Thu Feb 25 11:32:09 CET 2010

Simulink S-functions

Discrete functions are split into two callbacks: 

  - mdlOutputs()   compute next outputs (predict)

  - mdlUpdate()    perform state update

From a control pov: use the predictor computed in previous step to
generate control outputs; this minimizes input -> output latency.
Then spend the rest of the cycle updating the predictor using input
measurements and generated outputs.

This rings a faint bell about simplectic forms: there is a ping/pong
discrete update method that conserves simplectic product between
position and state (i.e. Keppler's law): even if the integration isn't
exact, the conservation property is kept.

Anyways, the ping/pong update seems a good base model, as compared to
the direct update (unfactored) update.  How to write this as a monad
or AF?

I.e. could this be something like:

     s -> i -> o
     s -> o -> s

Probably it needs to be

     s -> i -> o
     s -> i -> o -> s