Hi,
I am using python xml-rpc to run simulation and use plecs.simulate() to start simulation.

Once simulation start, until it ends, I am unable to send get&set parameter command.
However if in model window, if I change the value of a component, say resistor, it changes during simulation and works well. How can I achieve this via script.
If someone have found a solution like a framework which we can make in model itself so that it applies desired changes to parameters at the right time we need, it would be really helpful.
Hi @vishweshgm
It is not possible to change parameters during runtime using a script.
If you know in advance when a parameter needs to be modified, you should implement the corresponding logic directly in your model. However, in some cases this is not feasible and the decision must be made “on the fly.”
When using scripting, the required workflow is to stop the simulation, save the states, modify the desired parameter, and then restart the simulation using the stored states.
An example of this approach can be found in the following forum post:
Co-Simulation with Scripting for Changing Thermal Parameters During Simulation
Although the example focuses on thermal simulations, the same workflow can be applied to any parameter that needs to be changed during simulation.
Hope this helps.
Thanks @RetoChristen
I tried the method proposed here. What I see is during second simulation run, plecs scope starts again from t=0.0 with new trace. Is this expected behavior? Is there a way we can continue from last tarce file or merge the new trace file with old?
When stored states are loaded for a new simulation, PLECS starts from the final state of the previously stored system, not from time 0. Since the traces are generated as new results, you need to keep the traces from the first simulation if you want to see the complete run.
As this behavior is demonstrated in all three models in the post, could you clarify which one did not work for you? Also, are you running the script in Octave or Python? And which PLECS version are you using?