MATLAB: Simulink Error “Derivative input -47 …” with integrator block

derivative inputerror massageinput -47integrator blocksimulink

Hello Everybody,
I hope somebody can help me, because I cannot find a solution to my Problem. In a rather big Simulink Model I am using an Integrator Block. The Integrator Input Signal is give from a Merge Block – I have been plotting this Signal via a scope: the Input Signal is continually Zero!
Additionally I have an external Initial Condition Port – this Port is continually 100.
So the Integrator should normally do nothing – integrate 0 the the Initial value of 100. When I copy this Subsystem to a new file and put the vales manually, it works as it should – and the result is continually 100.
When I try running the model, I get the very confusion error message: Derivative input -47 of 'NameOfBlock' at time 0.08 is Inf or NaN. Stopping simulation. 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)
I have already tried to put a Saturation to the Input port – with no results. Also I have tried in the Configuration Parameters – Data Import/Export – Save to Workspace – to plot the States. There I get 56 States and 2 of These becom 1e+16 , is this already Inf? But I cannot define, which state this is.
Why is it, that I get an error message with Input Port Nr. -47 ?!?!
Can anybody give my a tipp, how to locate the error?
I would be very gratefull …

Best Answer

The port "-47" is a bug. I would recommend recommend trying in R2013b (I think it is fixed in this latest release). Also, you can contact technical support to get more information on this bug.
A few things you can try to debug your NaN error:
- Log the states in structure format, that way you will have a block name associated with the values.
- As recommend by Kaustubha, use the debugger. You have the possibility to put a breakpoint ofn Nan, which should help identifiy where this all starts.
- You might want to try this central submission to see what happens between two steps of the simulink solver: