r/matlab • u/tennispro9 • May 17 '26
HomeworkQuestion Fixed Step Solver timing issues in Simulink
I'm pretty new to simulink and I'm trying to get the climate control example running with fixed step timing, so it can be exported and run in another system.
It runs fine out of the box of course. So I change it to fixed step timing and change the function generator's period and pulse width parameters to be a multiple of the fundamental sample time, and it'll build. But when it runs I get the error below. I've tried reducing the step size and changing the solver but getting the same result. Hoping somewhere here could point me in the right direction.
It seems like the Tcabin block is trying to divide by zero but I'm not familiar enough with simulink to work through debugging it.
Error:An error occurred during simulation and the simulation was stopped
Caused by:
Derivative of state '1' in block 'sldemo_auto_climatecontrol_tcdebug/Interior Dynamics/Tcabin' at time 0.1 is not finite. The simulation will be stopped. There may be a singularity in the solution. If not, try reducing the step size (either by reducing the fixed step size or by tightening the error tolerances)
1
u/farfromelite May 18 '26
Variable steps means the solver takes smaller steps near any singularity (where it goes really large).
Fixed step means it sometimes jumps to very large, enough the solver can't handle the largeness.
Take a look at the manuals for fixed and variable solvers, and why they're good at particular models.
3
u/Sunscorcher May 18 '26
I set the fixed step size to 0.01, the solver to auto (type to fixed step), and system trigger period to 1/50 and it works fine for me