Book a Demo
Prev Next

Solvers in Simulations

A Solver within a simulation helps you to include behavior from mathematical models, querying the state as necessary to adjust the behavior of the corresponding UML model.

Creating and Initializing a Solver

A Solver is best created once at the start of a simulation. This allows it to be used throughout the simulation without incurring the delay of repeated construction time. This is also a good time to load any required modules, define functions and define an initial state for the model.

In a StateMachine simulation, good places to perform this initialization are in the Effect for the Transition leading from the Initial State, or in the Entry for a State that is not re-entered during simulation.

In an Activity simulation, you will need to add the Solver to the Effect for an Action.

Updating a Solver Model

As a simulation progresses you can use any of the Effect fields to update parameters of the mathematical model. That might consist of updating rates or changing between algorithms. In a StateMachine simulation:

  • A Transition Effect can be used when the change is needed for a particular flow
  • A State Entry can be used to ensure the behavior is changed while the simulation is in a State, regardless of how it gets there; this includes any nested States
  • A State Exit can be used to ensure the behavior is changed any time the simulation leaves a State, regardless of how it leaves
  • A State Do Activity behaves similarly to an Entry action.

In an Activity simulation there are only Action Effects.

Querying a Solver Model

With a Transition guard, call solver.get(). You can also call solver.exec() to call a function with no side effects.

Learn more