Menu

Instances section Log in to Edit

Marco Wolf
Attachments
staticinstances.jpg (30739 bytes)

Instances Section

In the instances part you tell the system which basic models you need for your calculation, instanciate them and name your elements. This is also the place to set the individual parameters of an instance of a basic model.

<instances>
  <instance model="Volume" name="v1">
    <parameters>
      <parameter id = "#mu1">25.0</parameter>
    </parameters>
  </instance>
  <instance ...> ... </instance>
  ...
</instances>

In this fragment of an instancessection (formerly initialization or init section) an instance named v1 of the basic model Volume should be used. The system looks up in the bibpath directory, if a file called Volume.xml exists, that contains a valid basic model. If that is ok it loads the file and sets parameter #mu1 in this volume influence by the value of 25.0. Of course you can also use arbitraty formulas using variables, processes or other instances for the definition of parameters.
To check partial results of a model each instance can be logged.

== Static instances ==
As the instances of basic models are initialized in the init section they can be used afterwards in different parts of your calculation, say subformulas. In the following figure you can see two possible constellations of shared instances.

foobar

In part b) of the figure the values of the instances of the models scale are recalculated everytime you ask for them for the Monte Carlo simulation. In part a) you expect a different behaviour, where instance scale just generates values once and passes equivalent data to the referencing subformulas in the processes. To model this behaviour you can use the keyword static, which tells the simulation system, that you want the instance scale to be calculated just once.

_Attention:__ If you use static instances, they are evaluated before any processes are calculated! This means that they can only depend on variables defined in the calculation section.

See the following code for an example of behaviour a):

<instances>
  <instance model="..." name="scale1"/>
  <instance model="..." name="scale2" mode="static"/>
  ...
<instances>
<processes>
  <process name="step1">
    <formula> ... scale1...scale2</formula>
  </process>
  <process name="step2">
    ...
    <formula> ... scale1...scale2</formula>
  </process>
  ...
</processes>
...

This means scale1 will generate different values for process step1 and step2. But scale2 will generate its values before the evaluation of the formulas and therefore deliver the same values for both processes.

It is also possible to choose a part of a basic model, an influence of a basic model as static.


MongoDB Logo MongoDB