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.

Is possible to execute the Steady-State Analysis from simulation script?

+1 vote
2,797 views
I want to write a script that allow to execute the steady state analysis by varying one or more parameters for simulations.

Is possible to do this?

Best regards
asked Feb 3, 2018 by lrubino01 (17 points)
edited Feb 5, 2018 by lrubino01

2 Answers

+2 votes
 
Best answer

Hello Irubino01, 

There is a good example in the Documentation in the chapter Simulation Scripts:

mdlVars = struct('varL', 50e-6);  
opts = struct('ModelVars', mdlVars);  
 
plecs('scope', './Scope', 'ClearTraces');  
 
inductorValues = [50, 100, 200];  
for ix = 1:length(inductorValues)  
  opts.ModelVars.varL=inductorValues(ix) * 1e-6;  
  out = plecs('simulate', opts);  
  plecs('scope', './Scope', 'HoldTrace', ...  
        ['L=' mat2str(inductorValues(ix)) 'uH']);  
  [maxv, maxidx] = max(out.Values(1,:));  
  printf('Max current for L=%duH: %f at %fs\n', ...  
         inductorValues(ix), maxv, out.Time(maxidx));  
end
 

Adjust example according to your circuit and instead of

plecs('simulate', opts) 

use 

plecs('analyze', 'analysisName', opts)

where 'analysisName' is the Description string of your Analysis.

 
Best Regards, 
Falk
answered Feb 5, 2018 by Falk Kyburz (253 points)
selected Feb 6, 2018 by lrubino01

Thank you for your reply, but I need other informations to apply your method. Starting from your suggestion,

>use 

>plecs('analyze', 'analysisName', opts)

>where 'analysisName' is the Description string of your Analysis.

where can I found the syntax for the description string?

Best regards

Luigi

Hello Luigi,

Have a look at the attached minimum example. This should get you started.

Cheers

Falk
0 votes

Is it possible to start the Steady-State Analysis from simulation script in the Blockset version?

The command :

plecs('analyze', 'analysisName', opts)

will not work.

 

answered Nov 14, 2018 by MarkusK (15 points)
Hi Markus,

I don't use Blockset, so take my advice with a grain of salt.The calling syntax for blockset is described in the "Analysis Tools" -> "Usage in PLECS Blockset" chapter of the documentation. Also, see help of the Steady-State Analysis block.

Falk
...