How can I control a simulation running on a machine remotely from another machine in MATLAB 7.7 (R2009a)?

5 views (last 30 days)
I have a use case where I would like to control simulation aspects (start, stop, pause, tuning block parameters) remotely through another machine(Monitor machine).Both the machines run on Windows, and the monitor machine does not have MATLAB or Simulink installed.
I also want to be able to access simulink library blocks remotely and create models.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 31 Jan 2017
This can be achieved using a MATLAB Automation server from a client application such as Microsoft Visual Basic.
For example the following sequence of steps shows how to run, pause and stop a Simulink application on a target machine which has MATLAB installed, from a client machine (such as a monitor machine) through a Visual Basic application:
1. On the machine that has MATLAB installed (say, the target machine), make these setup changes:
a. Start the DCOM Configuration utility by selecting "Start->Control Panels->Administrative
Tools->Component Services".
b. Select "Component Services->Computers->My Computer->DCOM Config".
c. Right-click the appropriate "Matlab.Application" line and select "Properties". For MATLAB 7.0 (R14) to MATLAB 7.3 (R2006b), select "Matlab.Application (Version 7.0)". In your case, if you are using MATLAB 7.8 (R2009a), choose the application with version 7.3
d. Click the "Identity" tab and select "Interactive User". Click "OK".
2. Now open a VB editor. For example, you can open the VB editor that is available with excel by opening excel and typing (Alt + F11).
Within the editor, use the CREATEOBJECT command to create an instance of MATLAB in the target machine using the code snippet below:
 
Sub test()
Dim MatLab As Object
Dim Result As String
Set MatLab = CreateObject("Matlab.Application", <ipaddress of target machine>")
MatLab.Execute ("open_system('vdp')")
Result = MatLab.Execute("set_param('vdp', 'SimulationCommand', 'start')")
MatLab.Execute ("set_param('vdp', 'SimulationCommand', 'stop')")
End Sub
Here, "ipaddress of target machine" is the ipaddress of the machine where MATLAB is to be remotely opened. To obtain this address, type IPCONFIG in the DOS prompt of the target machine.
The above code sample opens MATLAB on a remote machine, opens the model VDP, and starts and stops it. Note that you have to use the MatLab.Execute command to execute MATLAB commands
For more information about running simulations programatically, visit the link below:
<http://www.mathworks.com/help/releases/R2009a/toolbox/simulink/index.html?/help/releases/R2009a/toolbox/simulink/ug/f11-61832.html>
You can perform most of the GUI operations of Simulink(such as tuning parameters, etc) from the command line using the SET_PARAM command. More information can be obtained in the MATLAB Help documentation at the link below:
<http://www.mathworks.com/help/releases/R2009a/toolbox/simulink/index.html?/help//releases/R2009a/toolbox/simulink/slref/set_param.html>
To add blocks and create libraries use the commands ADD_BLOCK, and ADD_LINE. For more information about these commands, follow the links below:
<http://www.mathworks.com/help/releases/R2009a/toolbox/simulink/index.html?/help/releases/R2009a/toolbox/simulink/slref/add_block.html>
<http://www.mathworks.com/help/releases/R2009a/toolbox/simulink/index.html?/help/releases/R2009a/toolbox/simulink/slref/add_line.html>

More Answers (0)

Categories

Find more on Schedule Model Components in Help Center and File Exchange

Products


Release

R2009a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!