About
Introduction
Elements
Interpreter
Example 1
Example 2
Example 3
Example 4
Example 5
Example 6
Example 7
Regimes example
Example n
Canonical form
Discussion

All elements

This page summarizes all the element types currently supported by the proof-of-concept interpreter. The explanations are somewhat cursory so it is probably better to look at the examples to work out what is going on.

There is one block for each element type. All element names are in fixed width bold. Attribute names are in normal fixed width. Each block shows the attributes supported by an element and then the types of children allowed.

Model structure

Models can be spread over multiple files. The root element in each file is Lems.

Lems

Include   (any)
Dimension   (any)
Unit   (any)
Type   (any)
Component   (any)
For the purposes of the early examples, a couple of other, deprecated elements are also allowed: XSimulation and XNetwork

Include

file   (string)
the name or relative path of a file to be included
Files are included where the Include declaration occurs. The enclosing Lems block is stripped off and the rest of the content included as is.

Units and dimensions

Dimension

name   (string)
the name of the dimension. Other items refer to it by this name.
m   (int)
exponent for Mass
l   (int)
exponent for Length
t   (int)
exponent for Time
i   (int)
exponent for Current
The name attribute is required. The others default to zero if not present.

Unit

symbol   (string)
the symbol is used in the value of a dimensional quantity
dimension
Reference to a component of type Dimension.
powTen   (int)
The power of ten that scales this unit from the SI unit of the same dimension
The symbol and dimension attributes are required. powTen defaults to zero if not present.

Defining types

Type

extends   (string)
the name of a type that this type extends. The extending type gets copies of all the child elements of the extended type.
name   (string)
Identifier for other components to refer to the type. The name can also be used as the element type for components of this type.
Parameter   (any)
SetParameter   (any)
Behavior   (0 or 1)
EventPort   (any)
Child   (any)
Children   (any)
Attachments   (any)
ComponentRef   (any)

Parameter

name   (string)
the name to be used in component definitions and expressions to set or access the parameter
dimension
Reference to a component of type Dimension. The dimension of the parameter.

EventPort

name   (string)
the name used when connecting to the port
direction   (choice)
possible values: 'in', 'out'

Child

name   (string)
identifier for the child within its parent
type
Reference to a component of type Type.
A Child element indicates that a type must contain exactly one component of the given type.

Children

name   (string)
a name for the set of components, used a part of a path to extract their values
type
Reference to a component of type Type.
min   (int)
minimum number of children of the given type
max   (int)
maximum number of children of the given type
The Children element is for use when a component may contain several components of the given type.

Attachments

name   (string)
as for children
type
Reference to a component of type Type.
The Attachments element works a little like the Children element, except it indicates that instances of components of the specified type may be added at model at instantiation time rather than model specification time (this is used, for example, where a connection between two cells causes a synapse component to be added to the target cell).

ComponentRef

name   (string)
...
type
Reference to a component of type Type.
ComponentRef is like Child, except that instead of the definition being enclosed within the parent component, it is only referred to. The target component should be defined at the top level.

Link

name   (string)
...
type
Reference to a component of type Type.
Similar to a ComponentRef in concept, except that it points to a local component which is already within the declared model. The Link element just establishes a connection with the target component, but leaves it in its existing place in the hierarchy. Variables in the target component can be accessed via the name of the link element.

Text

name   (string)
...
The Text element is used for anything that does not need to be understood by the interpreter itself such as labels provided for user convenience or display hints such as the colors of lines.

Path

name   (string)
...
A path to a quantity in the model or the instantiated state (?): the syntax and use of Path elements needs more work.

Behaviors, state variables, and equations

Behavior

GlobalVariable   (any)
IndependentVariable   (any)
ExternalVariable   (any)
DerivedVariable   (any)
ExternalQuantity   (any)
StateVariable   (any)
TimeDerivative   (any)
KineticScheme   (any)
OnStart   (any)
OnEvent   (any)
OnCondition   (any)
Build   (any)
Show   (any)
Record   (any)
Run   (any)

StateVariable

name   (string)
the variable name, as used in expressions
dimension
Reference to a component of type Dimension.

TimeDerivative

variable
Reference to a component of type StateVariable.
value   (expression)
the rate of change of the state varaible with respect to time

StateAssignment

variable
Reference to a component of type StateVariable.
value   (expression)
the value to be assigned to the variable.

OnEvent

port
Reference to a component of type EventPort. the port for which this block specifies what happens when an event arrives.
StateAssignment   (any)
EventOut   (any)

OnStart

StateAssignment   (any)
EventOut   (any)

OnCondition

test   (expression)
A boolean expression giving the trigger condition for the block to apply.
StateAssignment   (any)
EventOut   (any)
An OnCondition block must do something that causes the trigger condition no longer to apply immediately after it has been triggered. Otherwise the behavior is indeterminate.

EventOut

port
Reference to a component of type EventPort. the port to send the event on.
Only used within event blocks.

GlobalVariable

name   (string)
the variable name
dimension
Reference to a component of type Dimension.

IndependentVariable

name   (string)
variable name
dimension
Reference to a component of type Dimension.

DerivedVariable

name   (string)
variable name
dimension
Reference to a component of type Dimension.
value   (expression)
an expression on terms of local variables
The value should be an expression in terms of other variables available within the enclosing Behavior element.

ExternalVariable

name   (string)
variable name
dimension
Reference to a component of type Dimension.
select   (string)
an xpath-style expression for the quantity to be selected
This makes a variable from elsewhere in the model locally available. sum and product functions can be used if the path matches an array of variables.

ExternalQuantity

name   (string)
quantity name
dimension
Reference to a component of type Dimension.
path   (string)
an xpath-style expression for the quantity to be selected
This operates somewhat like an ExternalVariable except the path is the path to a parameter in the model, not a state variable in the running instance. Its value is therefore fixed within the model. It can be used, for example, when a channel refers to a component to specify its permeant ion, and the behavior needs to look up in a third component (eg the membrane properties) what the reversal potential of that ion is.

Kinetic Schemes

KineticScheme

name   (string)
variable name
dimension
Reference to a component of type Dimension.
Nodes   (1)
Edges   (1)
A kinetic scheme does not itself introduce any new elements or state variables. It is rather a way of connecting quantities in existing components by saying that quantities in the edge elements should be interpreted as transition rates among quantities in the node elements.

Nodes

children   (string)
The name of the Children element in the parent elements that provides the states for the scheme
variable   (string)
The variable in the state elements that is governed by the scheme.
The children attribute should point to a children declaration in the parent element.

Edges

children   (string)
the element that provides the transitions for the scheme
sourceNodeName   (string)
the name of the attribute in the rate element that defines the source of the transition
targetNodeName   (string)
attribute for the target
forwardRate   (string)
variable that provides the forward rate
reverseRate   (string)
variable that provides the reverse rate
The reverseRate attribute is optional. If it is left out then the reverse transitions should be present in the as separate elements in the selected transitions list in the parent element.

Recording and display

Show

src   (string)
path to the element that defines what should be shown
timeScale   (string)
path to the parameter that sets the scale for rendering times non-dimensional
These two attributes are paths to parameters. Values are only supplied for the parameters when a component is built using the containing type. The 'src' attribute should point to another element that contains Show or Record definitions. The 'timeScale' attribute is optional, and will be superseded if this element points to a Show element that sets a new time scale, but before pointing to a Record element at least one element in the display chain must have set the time scale.

Record

quantity   (string)
path to the parameter that will contain the path to the quantity to be recorded
scale   (string)
path to the element that defines the scale for rendering the quantity dimensionless
color   (string)
hex format color suggestion for how the data should be displayed

Defining simulations

Run

component   (string)
name of the component reference that will set the component to be run
path to the parameter that sets the independent variable
increment   (string)
path to the parameter that sets the step size
total   (string)
path to the parameter that sets the total span of the independent variable to be run
The run element provides a way to make a model runnable. It should point to the parameters that set the step size etc. The target parameters have to be dimensionally consistent.

Build time processing

Build

MultiInstantiate   (any)
ForEach   (any)
EventConnection   (any)

MultiInstantiate

component   (string)
name of the component reference that will set the component to be run
number   (string)
Number of instances to be made
The MultiInstantiate declaration overrides the default instantiation behavior for a component and instead produces an array of state instances of the specified component of size given by the value of the parameter pointed to by the 'number' attribute.

ForEach

instances   (string)
path to the parameter that will contains the path to the state instances to be iterated over
as   (string)
the name by which each instance will be known when passed to the enclosed build directives
The ForEach element specifies that the enclosing directives are applied to each state instance matched by the referent of the instances attribute. There is no ordering implied.

EventConnection

from   (string)
path to the parameter that will contain the path to the source state
to   (string)
as 'from' but for the target state
An EventConnection element specifies a connection between two state instances in the runnable instance of a model. It can be used inside other Build elements, such as the ForEach element to specify multiple connections.

Defining components

Component

id   (string)
an identifier for the component. Unique within the model for standalone components. Unique within its parent for child components.
type
Reference to a component of type Type. The type of the component.
Other attributes and children depend on the type of the component. Each parameter in the type definition gives an attribute in the component. Children elements in the type definition specify the allowed component types for child elements in the component.

Components may also be declared using the type name as a new XML element. That is, if a Type has been declared with name "MySynapse" then "MySynapse" can be used as a new XML element name, as in <MySynapse id="syn1" .../>.

Hard-coded networks (deprecated)

The following elements were defined as a simple way to build enough of a network to try out synapse models. They were subsequently superseded by user-defined types using the build-time processing elements shown above. The Receiver element has not yet been replaced this way.

XNetwork

id   (string)
identifier for the networ, unique within a model.
XPopulation   (any)
XEventConnectivity   (any)

XPopulation

id   (string)
identifier
component
Reference to a component of type Component.
size   (int)
the number of items in the population.

XEventConnectivity

XSource   (1)
XTarget   (1)
XConnectionPattern   (1)
XReceiver   (0 or 1)

XSource

population
Reference to a component of type XPopulation.

XTarget

population
Reference to a component of type XPopulation.

XConnectionPattern

base   (choice)
possible values: all-all

Receiver

component
Reference to a component of type Component.
port
Reference to a component of type EventPort.
destination   (path)
the name of an attachments element in the target component.
The Receiver element is used if the target component does not accept events directly, but accepts some intermediary object as declared via an Attachments declaration in its type definition. Each incoming event connection is then made to an instance of the specified component which is then given to the target component. The Behavior block of the target component can access any quantities in its attachments via the usual DerivedVariable mechanism.