home >> Low level routines for simulation >> PSEUDO-CODE/CODE
last update: may 2006

The pseudo-code/code (hopefully) works as is, but for sake of clarity or because I am lazy
-only the Low-pass version of filters are given.
-not all possible combinations are given. In particular, the focus is on dynsysts applying to angles ; to get the (simpler) general case, just get rid of lines of code where "wrapPrd" or "wrapHalfPrd" show.
-it is most probably not the fastest implementation. The code is actually meant to provide the interested coder with something that works to start with.
(My own actual implementation is based on C++ classes).

Sets of tuning parameters:
You can set the value of the equation(s) parameter(s) directly, but I defined the tuning parameters of a numerical dynsyst so that
-the dynsyst behaves like its equivalent continuous dynsyst,
-they implicitely prevent the dynsyst from producing diverging ouputs,
-you have a better feeling and control about the dynsyst behavior.

Some numerical dynsysts ( of order greater than 0) offer the possibility to take as an input the current value of the Input variable or the one from the previous computation step.
This depends on your requirements, and in your code this is decided at the time the function implementing the dynsyst is called, as Input is one of its arguments.

Some bot routines have to deal with angles ( view angles, move angles).
Most dynsysts have been designed to handle wrapping variables, which are supposed to wrap in the [0 included, PERIOD excluded[ range.
Obviously PERIOD= 360 for angles in degrees, and PERIOD=2*PI for angles in radians.
HALFPERIOD is defined as 0.5* PERIOD.
wrapPrd( float x) is your function that returns x wrapped in [0 included, PERIOD excluded[ and wrapHalfPrd( float x) returns wrapPrd( x+ HALFPERIOD)- HALFPERIOD.

As regards the figures, a numerical dynsyst response curve should be represented as a "staircase" ( piece-wise constant) function to faithfully reflect sampling-holding. But doing so resulted in confusing multi-curve plots, so for a given curve, I joined its points with segments for better readability. One should not forget that this tends to show numerical dynsysts as better approximation of their continuous counterpart than they actually are.