Jump to content
Sign in to follow this  
VisSim Forum Archives

Interfacing with MATLAB

Recommended Posts

 

Submitted by shaabanyusuf on Fri, 07/20/2012 - 16:28 

Hi,

I have just installed VisSim. I have tried to run simulations with MATLAB interface but it keeps giving me the error 'Simulation aboted at 0 simulated seconds 21 real seconds'. I tried to run the examples in VisSim but without success.

Thank you

Share this post


Link to post
Share on other sites

Submitted by Ric on Tue, 01/27/2015 - 09:29.

You can use the VisSim "Matlab Expression" block located in "Blocks/Matlab Interface" to communicate data from VisSim to MATLAB, process the data in MATLAB, and return the processed data to VisSim. I'm attaching an example .vsm that calls an .m file, assuming you have a copy of MATLAB on your computer and you create the VisSimMatLabDemo.m file (shown below) and place the .m file in the same folder as the .vsm file is located, you should be able to run the .vsm file and see the correct results. I have seen the need to re-launch both VisSim and MATLAB in some situations where a change is made to the .m file in order for the change to take effect.

function yvec = VisSimMatLabDemo(xvec) %Called from "VisSimMatLabDemo.vsm"

% Input vector, xvec % xvec(1) = iFirstPass = 1/0 = first pass/ else % xvec(2) = input1 % xvec(3) = input2 % % Output vector, yvec % yvec(1) = output1 % yvec(2) = output2 % %unload Input vector into local variables iFirstPass = xvec(1); u1 = xvec(2); u2 = xvec(3);

k1 = 1.; k2 = 2.;

if iFirstPass == 1 % Include any initialization logic here... yvec(1) = 0; yvec(2) = 0; else yvec(1) = k1u1; yvec(2) = k2u2; end

VisSimMatLabDemo.vsm

Share this post


Link to post
Share on other sites

Submitted by Gwizz on Thu, 03/31/2016 - 00:43.

When I start VisSim 9.0 on my Windows 7 PC, I get an error message that reads "Matlab interface error 126. The specified module could not be found." I have Matlab 2016a and I would like to do some work in VisSim using Matlab expressions. VisSim doesn't communicate with my Matlab install. What should I do or re-install?

Gary Scott Schneider Electric

Share this post


Link to post
Share on other sites

Submitted by a_a on Wed, 04/13/2016 - 21:13.

Due to license limitations we cannot test the interface with the latest Matlab builds here at our office. VisSim is a 32 bit application, so if you have a 64 bit Windows then you need both 32 and 64 bit Matlabs. As I can recall, the directory structure of Matlab looks something like ..\bin\win32 and/or ..bin\win64 The folders may have different names but 32 and 64 are presented. VisSim Matlab interface dll is named vsmML.dll It must be placed in the same folder where Matlab dll-s (libmx.dll and libeng.dll) are and it needs to be a 32 bit folder. Then, in VisSim, the path for vsmML.dll in Edit > Preferences > Addons must match that directory.

If you send a message to support@vissol.com, then I'll read it there and get your e-mail.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
You are posting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...