Recurring Error in Simulation
So, I have a fairly complicated Simulink Model which run again and again, to generate different outputs. This has worked fine for several weeks, and now suddenly I have this Error. I didn’t change anything in the model, only a random variable definition in the matlab script which initiates the simulation. The variable is not used in the model.
I was able to get the Model to run once by closing the window, reopening it and reloading some variables, but upon a second unaltered simulation it crashed again. The Error message I get is the following:
Error:An error occurred while running the simulation and the simulation was terminated
Caused by:
[‘My Model/Solver Configuration3’]: Transient initialization at time 3.116414621485137e-05, solving for consistent states and modes, failed to converge.
Nonlinear solver: failed to converge, residual norm too large.
Here is the set of components with unconverged equations:
‘My Model/Transmission Line3’ % an ideal transmission line
Equation location is:
‘C:Program FilesMATLABR2023btoolboxphysmodeleclibrarym+ee+passive+linesideal_transmission_line.sscp'(no line number info)
‘My Model/Simscape Component1’ % this is a component I made myself by copying the Capacitor component and allowing negative capacitances
Equation location is:
‘\My Path+NegativeCapacitorNegativeCapacitor.ssc’ (line 29)
Equation location is:
‘\My Path+NegativeCapacitorNegativeCapacitor.ssc’ (line 29)
‘My Model/Simscape Component’ % same negative Capacitor
Equation location is:
‘\My Path+NegativeCapacitorNegativeCapacitor.ssc’ (line 29)
Equation location is:
‘\My Path+NegativeCapacitorNegativeCapacitor.ssc’ (line 29)
‘My Model/Resistor3’ % random resistor 1 Ohm
Equation location is:
‘C:Program FilesMATLABR2023btoolboxphysmodsimscapelibrarym+foundation+electricalbranch.ssc’ (line 23)
‘My Model/Resistor5’ % random resistor ca 120 Ohm
Equation location is:
‘C:Program FilesMATLABR2023btoolboxphysmodsimscapelibrarym+foundation+electricalbranch.ssc’ (line 23)
I’ve encountered this error several times before, the last time several months ago, but could so far avoid it by reloading previous versions of the file, or closing and opening again. My usual strategies aren’t working this time and I’d like to know why this error occurs so I can fix it once and for all.
A similar question suggested checking for algebraic loops, but the Code
Simulink.BlockDiagram.getAlgebraicLoops(‘My Model’)
did not find any algebraic loops.
I’m using Automatic Solver Selection with Variable Step. My model is pretty idealized, so abrupt jumps occur, however this has not been an issue in the past and I don’t understand why it would be now, if this is why the error occurs (this has been suggested in another answer to a similar question). I have found that after a few microseconds the current in my circuit jumps to about 10^300, which is where the simulation stops, understandably. I just don’t understand why the current would suddenly jump so high and why at that moment.
If anyone has any ideas on what is causing this error and how to fix it, I would greatly appreciate the help.So, I have a fairly complicated Simulink Model which run again and again, to generate different outputs. This has worked fine for several weeks, and now suddenly I have this Error. I didn’t change anything in the model, only a random variable definition in the matlab script which initiates the simulation. The variable is not used in the model.
I was able to get the Model to run once by closing the window, reopening it and reloading some variables, but upon a second unaltered simulation it crashed again. The Error message I get is the following:
Error:An error occurred while running the simulation and the simulation was terminated
Caused by:
[‘My Model/Solver Configuration3’]: Transient initialization at time 3.116414621485137e-05, solving for consistent states and modes, failed to converge.
Nonlinear solver: failed to converge, residual norm too large.
Here is the set of components with unconverged equations:
‘My Model/Transmission Line3’ % an ideal transmission line
Equation location is:
‘C:Program FilesMATLABR2023btoolboxphysmodeleclibrarym+ee+passive+linesideal_transmission_line.sscp'(no line number info)
‘My Model/Simscape Component1’ % this is a component I made myself by copying the Capacitor component and allowing negative capacitances
Equation location is:
‘\My Path+NegativeCapacitorNegativeCapacitor.ssc’ (line 29)
Equation location is:
‘\My Path+NegativeCapacitorNegativeCapacitor.ssc’ (line 29)
‘My Model/Simscape Component’ % same negative Capacitor
Equation location is:
‘\My Path+NegativeCapacitorNegativeCapacitor.ssc’ (line 29)
Equation location is:
‘\My Path+NegativeCapacitorNegativeCapacitor.ssc’ (line 29)
‘My Model/Resistor3’ % random resistor 1 Ohm
Equation location is:
‘C:Program FilesMATLABR2023btoolboxphysmodsimscapelibrarym+foundation+electricalbranch.ssc’ (line 23)
‘My Model/Resistor5’ % random resistor ca 120 Ohm
Equation location is:
‘C:Program FilesMATLABR2023btoolboxphysmodsimscapelibrarym+foundation+electricalbranch.ssc’ (line 23)
I’ve encountered this error several times before, the last time several months ago, but could so far avoid it by reloading previous versions of the file, or closing and opening again. My usual strategies aren’t working this time and I’d like to know why this error occurs so I can fix it once and for all.
A similar question suggested checking for algebraic loops, but the Code
Simulink.BlockDiagram.getAlgebraicLoops(‘My Model’)
did not find any algebraic loops.
I’m using Automatic Solver Selection with Variable Step. My model is pretty idealized, so abrupt jumps occur, however this has not been an issue in the past and I don’t understand why it would be now, if this is why the error occurs (this has been suggested in another answer to a similar question). I have found that after a few microseconds the current in my circuit jumps to about 10^300, which is where the simulation stops, understandably. I just don’t understand why the current would suddenly jump so high and why at that moment.
If anyone has any ideas on what is causing this error and how to fix it, I would greatly appreciate the help. So, I have a fairly complicated Simulink Model which run again and again, to generate different outputs. This has worked fine for several weeks, and now suddenly I have this Error. I didn’t change anything in the model, only a random variable definition in the matlab script which initiates the simulation. The variable is not used in the model.
I was able to get the Model to run once by closing the window, reopening it and reloading some variables, but upon a second unaltered simulation it crashed again. The Error message I get is the following:
Error:An error occurred while running the simulation and the simulation was terminated
Caused by:
[‘My Model/Solver Configuration3’]: Transient initialization at time 3.116414621485137e-05, solving for consistent states and modes, failed to converge.
Nonlinear solver: failed to converge, residual norm too large.
Here is the set of components with unconverged equations:
‘My Model/Transmission Line3’ % an ideal transmission line
Equation location is:
‘C:Program FilesMATLABR2023btoolboxphysmodeleclibrarym+ee+passive+linesideal_transmission_line.sscp'(no line number info)
‘My Model/Simscape Component1’ % this is a component I made myself by copying the Capacitor component and allowing negative capacitances
Equation location is:
‘\My Path+NegativeCapacitorNegativeCapacitor.ssc’ (line 29)
Equation location is:
‘\My Path+NegativeCapacitorNegativeCapacitor.ssc’ (line 29)
‘My Model/Simscape Component’ % same negative Capacitor
Equation location is:
‘\My Path+NegativeCapacitorNegativeCapacitor.ssc’ (line 29)
Equation location is:
‘\My Path+NegativeCapacitorNegativeCapacitor.ssc’ (line 29)
‘My Model/Resistor3’ % random resistor 1 Ohm
Equation location is:
‘C:Program FilesMATLABR2023btoolboxphysmodsimscapelibrarym+foundation+electricalbranch.ssc’ (line 23)
‘My Model/Resistor5’ % random resistor ca 120 Ohm
Equation location is:
‘C:Program FilesMATLABR2023btoolboxphysmodsimscapelibrarym+foundation+electricalbranch.ssc’ (line 23)
I’ve encountered this error several times before, the last time several months ago, but could so far avoid it by reloading previous versions of the file, or closing and opening again. My usual strategies aren’t working this time and I’d like to know why this error occurs so I can fix it once and for all.
A similar question suggested checking for algebraic loops, but the Code
Simulink.BlockDiagram.getAlgebraicLoops(‘My Model’)
did not find any algebraic loops.
I’m using Automatic Solver Selection with Variable Step. My model is pretty idealized, so abrupt jumps occur, however this has not been an issue in the past and I don’t understand why it would be now, if this is why the error occurs (this has been suggested in another answer to a similar question). I have found that after a few microseconds the current in my circuit jumps to about 10^300, which is where the simulation stops, understandably. I just don’t understand why the current would suddenly jump so high and why at that moment.
If anyone has any ideas on what is causing this error and how to fix it, I would greatly appreciate the help. simulink, error, simulation MATLAB Answers — New Questions