www.delorie.com/gnu/docs/mcsim/mcsim_24.html   search  
 
Buy GNU books!


MCSim User' Manual

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

5.2.9 Note about models

MCSim can easily deal with algebraic models. You do not need to define state variables or a Dynamics section for such models. Simply use input and output variables and paramaters. The model can be specified in the CalcOutputs section. You can use the time t if that is natural for your model. If you do not use t in your model, you will still need to specify "output times" in Print() or PrintStep() statements to obtain outputs: you can use an arbitrary time, such as 1. If you do not use t you will also need do define an Experiment (see section 6.4.1 Experiment definition) for each combination of values for the "independent" variables of your model. This may be clumsy if many values are to be used. In that case, you may want to use the variable t to represent something else than time.

Ordinary differential models, with algebraic components, can be setup easily with MCSim. Use state variables and specify a Dynamics section. Time, t is the integration variable, but here again, t can be used to represent anything you want. We are not aware of cases in which MCSim has been used for partial differential equations. Some problems might be solved by implementing rudimentary line methods...

You can use MCSim for discrete-time dynamic models (or difference models). It's a bit tricky. Assignments in CalcOutput are volatile (not memorized), so the model equations have to be in Dynamics. But the model variables should still be declared as outputs, because they should not be updated by integration. However, you need at least a true state in the Dynamics section, so you should declare a dummy one (and give it a constant derivative of value zero). You also want the calls to Dynamics to be precisely scheduled, so it is best to use the Euler integration routine (see section 6.3.2 Integrate() specification) which uses a constant step. Since Euler may call repeatedly Dynamics at any given time, you want to guard against untimely updating... Altogether, we recommend that you examine the sample files `discrete.model' and `discrete.in' provided with the source code for MCSim.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

  webmaster     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003