You are here

Working with equations

Working with equations

Equations are the mathematical basis for simulating the behaviour of a model. All node-type elements with the exception of file parameters, and all flows and squirts, must have equations for the model to run.

Before its equation is entered, a model element is displayed in red. It is not possible to run the simulation whilst any model elements are still red. If you make a change to the model that causes a component's equation to become invalid, for instance deleting an influence going to that component, it will be displayed in red to indicate that its equation must be edited before the model can run. Simile has an equation language that allows great power and flexibility in specifying expressions, reading data from tables, or sketching semi-quantitative relationships by hand. 

How to enter equations

There are two ways to enter equations for calculating model element values. Either use:

In either case, a helpful error message will appear if you enter an equation that cannot be used by Simile.

How to write equations

The following topics provide detailed reference information on the parts that make up a complex expression, and on the mathematical functions available, both built-in and user-supplied. See:

When is the equation evaluated?

  • For compartments and population initializers (creation), the equation defines the initial value, and is applied when the model is first built, when it is reset, or when the submodel instance containing the compartment or population comes into existence (for instance, if it is itself in a population submodel).

  • For rule-based state variables, the 'On reset...' equation is evaluated whenever a compartment's would be. The other equations are evaluated when their corresponding events occur.

  • For events and squirts, the equation is only evaluated when they occur.

  • For other components, the equation defines their value at any time while the model is running.

Working with variables and data types

Further information on variables and data types useful in understanding Simile.

In: Contents