Models can run slowly when their solutions are difficult to compute. The two most common reasons for this are:

  • The model is stiff, forcing the numerical solver to take very small steps. Try redesigning the model to make it more numerically tractable.
  • The model produces many events. You can simplify the model by removing events triggered by If statements in the Modelica code. The NoEvent operator tells the simulation to not create events when the value of an If statement changes. For example, to prevent an event from occurring when A becomes greater than B, change:
     if A > B then

    to:

     if noEvent(A > B) then