Hopsan
Running a simulation

How simulations work

Hopsan uses fixed time step simulations with distributed solvers. This means that the number of iterations is stop time minus start time divided by the time step. If the start time is negative, the negative time will be simulated but not logged for plotting. This can be used to avoid initial transients in the simulation, which are normally caused by incorrect start values.

Simulations always begin with an initialization phase. Here all start values are set, and all equations initialized (in case they require initialization). During the simulation phase, each time step will begin with simulating all C-components, then it will simulate all signal components and finally the Q-components. When everything in a time step is simulated, the data will be logged for plotting. This is only performed a certain amount of times, depending on how many log samples the user has selected in the Model Preferences dialog.

After the simulation there is a finalize phase, where components has the opportunity to clean up things. This is not used by most components, and nothing the user needs to bother about. When the simulation is finished, data will be loaded from the core to the graphical interface so that it can be plotted by the user.

Setting up simulation parameters

Start value, time step and stop time can be changed directly in the toolbar at the top of the main window. Choosing the time step is always a trade-off; smaller time steps will give more accurate results, but will also slow down the simulation. Apart from these settings, it is also possible to change how many data samples that will be logged for plotting. This is done in the Model Preferences dialog, which is accessed from the monkey wrench icon in the simulation toolbar. This is also a trade-off; too few data samples will result in less good looking plots, while too much logging will slow down the simulation.

Model Properties

When all setup is finished, the simulation is executed by clicking on the green "play" button in the simulation toolbar. If the progress bar is enabled (can be disabled from Options Dialog for performance reasons), it is possible to abort the simulation by clicking "Abort".

Simulate