Importing a parameter in Simulation script and using it as a variable.

Hello PLECS users/team,

I am fairly new to PLECS and struggling with calling a variable from my simulation into the simulation script. I am able to call the variable from initialization but not from the simulation. My aim is to call a parameter which is generated in PLECS and use it as a variable inside the simulation script. I have tried plecs(‘get’, …) command however I am not successful.

Kindly let me know how it can be done. Thanks in advance.

Some of the terminology you’re using is not clear to me.

Can you post a simple model showing what you are trying to do? It’s ok if you need to use dummy variables or include in a code comment “I would like to access variable ‘x’ here”.

Hello,

As Bryan pointed out it’s not very clear what you’re attempting to do. However, from what I understood I attached a simple example for you.

To retrieve the results from the PLECS simulation to your simulation script, you can either use a scope block or a signal outport block. In the attached example, we calculate the duty cycle “d” of a boost converter from the PLECS simulation, which we can then use in the script for post-processing, or use this value in a second PLECS simulation. Is this similar to what you’re intending to do?

Regards,
Manu

boost_converter_script.plecs (14.3 KB)