Simscape Fix-step simulaiton with two different time steps
16 次查看(过去 30 天)
显示 更早的评论
Hi folks,
I would like to conduct a simulation with Symscape electronics with two different time steps. The idea is to use for the beginning of simulation bigger time steps in for the period of time when the system is oscillation and after reaching of a stable state change the sampling time to more fine. For example the complete simulation time could be 0.5s and the system became stable after 0.46s. In this case I would like to simulate with sampling time Ts = 2e-5s during a time frame 0 - 0.46s and than beginning from 0.46s switch to Ts = 5e-8s and complete simulation between 0.46s and 0.5s with the fine time step. Basically I need it for obtaining of the spectrum for output voltage and current up to the relatively high frequency.
I have tried to manage it with the option Data Import/Export. The data from the simulation with Ts = 2e-5s was save into an intermediate storage. Than the time step was changed but a have got an error "Simulink cannot load the initial SimState because the model, 'EMI_model_motor_2017_09_06', was changed after the SimState was saved. Run the simulation again and resave the SimState. Ideally would be simply change the parameter Ts but seems like it is impossible to do.
Thank you in advance Illia
0 个评论
回答(1 个)
Abhi Sundararaman
2017-9-20
编辑:Abhi Sundararaman
2017-9-20
According to the following doc page: https://www.mathworks.com/help/simulink/ug/saving-and-restoring-the-simulation-state-as-the-simstate.html#br_facs Changing the model's configuration parameters will prevent the SimState from being used. Therefore, it seems that changing the sample time between runs while trying to maintain SimState isn't possible unfortunately.
One workaround for this could be to start the simulation at your smallest sample time, and wherever you wish to have a higher sample time, you could set up logic (i.e a MATLAB function block) to only execute certain calculations every x time steps.
For example, if your lowest sample time was Ts1, but the start of your model from t = 0 to n should run at Ts2 (and Ts1 < Ts2), then you could have a MATLAB function block with an "if" statement that only ran calculations every Ts2/Ts1 timesteps for the first n seconds, and then afterwards it would run every Ts1 seconds.
Another, perhaps more straightforward workaround would be to package the higher-sample time section of the simulation into an Atomic Subsystem. The atomic subsystem can have blocks whose sample time is an integer multiple of the outer-model's sample time.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Switches and Breakers 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!