πSimulation Overview
How to get simulations running in Collimator
Hybrid Dynamical Systems Simulation
Collimator is a hybrid dynamical system simulator, which uses a canvas with blocks and lines to represent the system. The collection of blocks, lines, and parameters is called a model.
Continuous and Discrete Portions of the Model
The continuous and discrete portions of a hybrid system require different solvers to advance them in time, and produce the simulation results. Because these portions require different solvers, it is important that Collimator assign the blocks of a model into continuous and discrete sets.
At Collimator, the property of a block defining itβs association to continuous or discrete is called time_mode
.
Some blocks are continuous time_mode
by design, these are listed in Block Library/Continuous.
These blocks require a continuous solver.
Similarly, some blocks are discrete time_mode
by design, these are listed in Block Library/Discrete.
These can be isolated in the library browser by filtering with the keyword discrete
. These blocks require a discrete solver.
Most blocks in the library are neither continuous nor discrete by design, they can be either. These are gain, lookup table, saturation, etc. Before Collimator can run a simulation, each of these blocks in the model is assigned to either continuous or discrete sets, such that the appropriate solver is applied. Collimator creates the Continuous and Discrete sets by applying some simple steps to propagate the time_mode
from blocks which have time_mode
defined by design, to blocks which do not. The rules applied are:
For all unassigned blocks for which all upstream blocks are Discrete, the block is assigned Discrete. When a blockβs
time_mode
is changed, revisit all blocks downstream to see if they need to be changed. Once there are no more blocks to visit, this step is done.Any remaining unassigned blocks are assigned Continuous.
With the blocks of the model all assigned to either Continuous or Discrete time_mode
, the simulation may begin.
Simulation Loop Pseudo Code
The pseudo code below illustrates how Continuous and Discrete portions are advanced in time.
The outer loop iterations are referred to as major_steps
, this is when discrete solver is at work. The middle loop iterations are referred to as minor_steps
, this is where the continuous solver is at work. The inner loop iterations are referred to as continuous result interpolation, this is where, if needed, the continuous solver interpolant can be used to produce results that are higher resolution in time than just the steps taken by the solver.
That is how Collimator starts with your model of continuous, discrete, and other blocks, and produces the simulation results.
Discontinuities Modeled as Events
The continuous portion is a set of ordinary differential equations (ODE). Some systems that can be modeled with ODEs include some discontinuities, like contact between two objects. The discontinuities can be modeled using blocks with events
, e.g. the comparator block, so that numerical integration of the ODEs progresses correctly before and after the discontinuity. To configure Collimator to do this, set events
to normal
. If you know that your model does not need any events handling, then select none
, as this will be most efficient. More granular user controls of events handling may be available in the future.
Last updated