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

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

1 Like

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
', ...  
         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

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

ScriptAnalysis.plecs (7.28 KB)

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.

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