How to get the instantaneous step size value in variable step solver at a simulink model?

조회 수: 2 (최근 30일)
I got a problem to get the value of instantaneous step size value in variable step solver. In my simscape model there is also a runge kutta solver function that I wrote and I need a h value which is a h=step_value/10. I dont want to use fixed step solver. That is why I need to know step value for each time step.

답변 (1개)

Yifeng Tang
Yifeng Tang 2021년 5월 6일
If you turn on data logging for Simscape, you can access the time marks in the states data for each block. Any block will give you the same time array. More details here: https://www.mathworks.com/help/physmod/simscape/ug/log-and-plot-simulation-data.html
The time information should also be available in Simulink tout variable, depending on your model settings.
One example:
ssc_mass_spring_damper_sl; % open a simple Simscape example
Run the model. Then in the results:
time = simlog_ssc_mass_spring_damper_sl.Spring.x.series.time; % time
X = simlog_ssc_mass_spring_damper_sl.Spring.x.series.values('cm'); % displacement in specified unit
time2 = tout; % same time info
If you want to see which block is limiting the time steps, try the Solver Profiler: https://www.mathworks.com/help/simulink/ug/examine-solver-behavior-using-solver-profiler.html

카테고리

Help CenterFile Exchange에서 Troubleshooting에 대해 자세히 알아보기

제품


릴리스

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by