Hi,
INTRODUCTION:
I’m using scripting to run my PLECS simulations. Using ‘Analysis’ instead of ‘Simulate’ with variable step size was not satisfying, as I’m using nonlinear passive component models and the variable step size did not give the expected results.
Using ‘Analysis’ with needed fine discrete time step size instead, was much slower then using ‘Simulate’ until reaching steady state.
To speed up everything, i would like to try a 2 step approach:
1st: rough and fast simulation until reaching steady state, either with variable step size or a coarse discrete time step size
2nd: run a short discrete step size simulation for precise results by loading the system state of the first simulation.
PROBLEM DESCRIPTION:
When the second simulation starts, I get the following errors:
“The number of input signals has been changed. The custom state can not be restored.”
“Error while executing restore custom state function code: Reading custom state failed.”
I found out, that the source of the error is in the (“Pulse Delay/C-Script”), because the internal state of the variable step size implementation seems not to be compatible with the internal state of the discrete step size implementation.
For better understanding, I exported the essence of my problem in a simple model, which by it’s own makes little sense, but it shows well the described problem.
Have a look at the scripting part and execute it to see the problem.
First I run 2 consecutive discrete time step simulations with the same step size. As it can be seen in the console output, the exported System State have quite a big amount of data content. The second discrete time step simulation runs then well with the imported system state.
with initialization bDiscrete = true;
Secondly I repeat the same simulation steps, but using a coarse step size for the first simulation and a fine step size for the second simulation. The error pops up.
with initialization bDiscrete = false;
Secondly I repeat the same simulation steps, but using a variable step size for the first simulation and a fine step size for the second simulation. The error pops again up.
QUESTION:
Is there a way to modify/manipulate/augment/translate the structure of the SystemState / Custom State struct exported from variable time step simulation in a manner, that it reflects the correct data to be imported in a discrete step size simulation system state?
Debug_Model.plecs (10.2 KB)