Hello Lina,
I understand that you want to pause your simulation 900 seconds, change one parameter and keep on simulating while using a variable step solver.
In Simulink , general approach to achieve this is
- Create a "Clock" block or a source of time information that outputs the simulation time.
- Use a "Relational Operator" block to check if the current time is a multiple of 900 seconds.
- Use a "Triggered Subsystem" block to pause the simulation when the time condition is met. The Triggered Subsystem block can be set up to run the subsystem when the condition is true.
- Inside the "Triggered Subsystem" you can make the parameter changes or any other operations you need to perform.
- Use a "Assertion" or "Stop" block to pause the simulation, or you can create a custom pause mechanism within the Triggered Subsystem.
You can try the above approach ,one thing to note here is ,when using a variable step solver, the solver adapts the time step dynamically to ensure the simulation's accuracy and stability. This adaptive behavior may lead to the simulation stopping slightly before or after the exact time condition (e.g., multiples of 900 seconds) you intend to pause.
To mitigate this issue and ensure that the simulation stops at or very close to the desired time intervals, I think you can use methods like tightening solver tolerances.
Please refer to this MathWorks documentation which might help you
- 'Simulate a Model Interactively'- https://in.mathworks.com/help/simulink/ug/controlling-execution-of-a-simulation.html
- https://in.mathworks.com/help/simulink/ug/solver-exception-events.html
Hope that helps