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


MCSim User' Manual

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

5.2.2 Global parameter declarations

Commands not specified within the delimiting braces of another section are considered to be global declarations. In the global section, you first declare the states, inputs, and outputs variables. There should be at least one state or output variable in your model.

The format for declaring each of these variables is the same, and consists of the keyword States, Inputs or Outputs followed by a list of the variable names enclosed in curly braces as shown here:

 
States =   {Qb_fat,  # Benzene in the fat
            Qb_bm,   # ...     in the bone marrow
            Qb_liv}; # ...     in the liver and others

Inputs =   {Q_gav,   # Gavage dose
            C_inh};  # Inhalation concentration

Outputs =  {Cb_exp,  # Concentration in expired air
            Cb_ven}; # ...           in venous blood

After being defined, states, inputs and outputs can then be given initial values (constants or expressions). Note that inputs can also be assigned input functions, described below. Some examples of initialization are shown here:

 
Qb_fat = 0.1; # Default initial value for state variable Qb_fat

# Gavage input assigned a periodic exponential input function
Q_gav = PerExp(1, 60, 0, 1); # Magnitude of 1.0,
                             # period of 60 time units,
                             # T0 in period is 0,
                             # Rate constant is 1.0

If a global state, input, or output variable is not given an initial value, it will default to zero. Initial values are reset to their specified value by the simulation program at the start of each simulation of an Experiment (see section 6.4.1 Experiment definition).

All the model parameters you want to be able to change through simulation files should be declared global. Parameters must be given nominal values, following the assignment rules given above. For example:

 
BodyWt = 0.38 + sqrt(0.01); # (kg) Weight of the rat

All parameters and variables are computed in double precision floating-point numbers. Initialization values should not be such as to cause computation errors in the model equations; this is likely to cause program crashes (so, for example, do not assign a default value of zero to a parameter appearing alone in a denominator). Note that the order of global declarations matters within the global section itself (i.e., parameters and variables should be defined and initialized before being used in assignments of others), but not with respect to other blocks. A parameter defined at the end of the description file can be used in the dynamics section which may appear at the beginning of the file. Still, such an inverse order should be avoided. For this reason, the format above, where global declarations come first, is strongly suggested to avoid confusing results. Note again that the name IFN, in capital letters, is reserved by the program and should not be used as parameter or variable name. Finally, if a parameter is defined several times, only the first definition is taken into account.


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

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