Solvers

To create more complex simulations involving transfer functions or state-space models, you first have to define a solver. Solvers have the same general attributes as simulations themselves, including asynchronousperiod, and onUpdate. The period of a solver is the same as the simulation parent by default, though other periods can be specified as long as they are a multiple of the simulation rate. Multiple solvers can even be added to a single simulation with different periods to create parallel multi-rate simulations. Solvers include a general attribute which simulations do not have which is type. By changing the type of solver you are changing the numerical approach that your simulation will take to solve your model. Currently you can select between three solvers, which include:

  1. ode1 - Euler method
  2. ode2 - Heun's method
  3. ode4 - Runge-Kutta method    

The below examples demonstrate how to alter the simulation solver.

Example 1

<simulation period="0.01" duration="10">
  <!--Declaring type of solver-->
  <solver type="ode1">
    <series>
      <sine amplitude="0.1" frequency="3.57" />
      <transferFunction num="1" den="0.001867 0.000060498 1" />
      <probe ref="myPlot.mySeries" />
    </series>
  </solver>
</simulation>
ode1-sim.png

Example 2

<simulation period="0.01" duration="10">
  <!--Declaring type of solver-->
  <solver type="ode4">
    <series>
      <sine amplitude="0.1" frequency="3.57" />
      <transferFunction num="1" den="0.001867 0.000060498 1" />
      <probe ref="myPlot.mySeries" />
    </series>
  </solver>
</simulation>
ode4-sim.png