Please take a minute to review and accept our Terms of Use.
Welcome to the PLECS User Forum, where you can ask questions and receive answers from other members of the community.

Many technical questions regarding PLECS are answered on the Technical Solutions page of our website. Tutorial videos, specific application examples, and pre-recorded webinars are available on our YouTube page. Please follow us on LinkedIn for the latest Plexim news.

plecs('simulate') command doesn't work in MATLAB

0 votes
59 views
Hi

I am trying to automate a series of simulation with variable components. I have MATLAB R1029b and Plecs 4.3.6. I am trying to run the example shown in

https://www.plexim.com/support/videos/simulation-scripting-standalone

When the script runs to plecs('simulate', varStructure); i get the following error:

 USAGE: PLECS('CMD','PARAMETER1','PARAMETER2',...)
     Known commands are: get, set, version, hostid, export, thermal, scope, checkout

Is this an issue with my Plecs version? Other commands such as 'get' 'set' and 'scope' all work.
asked Oct 2 by flin036 (15 points)
Can you post the model or the full script code here?
Hi Kris

The block of code I use is:

 

 mdl = plecs('get','','CurrentCircuit');
 %plecs('simulate');
 sim(['MATT_PADS_TEST'],30e-3);
 plecs('scope',[mdl '/Scope1'] ,'HoldTrace', ['kmin']);
 data_kmin = plecs('scope',[mdl '/Scope1'] ,'GetCursorData', [0.018952941176470374 0.018964705882352727],'rms');

 

Note here since I am running plecs blockset I can use simulink to run the simulation, but I cannot use the plecs('simulate') command (hence it is commented out).

All the other plecs commands involving scope and getting and setting component values in plecs works.

I would like to use the plecs('simulate') command as it provides a better way of performing a component sweep without having to write a for loop.

 

Thank you for your help

1 Answer

+1 vote
 
Best answer

Since you're using PLECS Blockset, Simulink handles the actual execution of the model, not PLECS.  You would use the sim('model') call, as you have pointed out already. 

The video you are referencing is for PLECS Standalone, where PLECS handles the execution of the model, and therefore has a different command to run the model.

You can still access the PLECS model, manipulate parameters, save scope captures, and so on through the PLECS API, and intermix these calls with MATLAB calls as needed.

Refer to the "Buck Converter with Parameter Sweep" demo model. It highlights the code used to run a parameter sweep for PLECS Blockset and Standalone.

answered Oct 5 by Bryan Lieblick (326 points)
selected Oct 6 by flin036
...