About
Introduction
Elements
Download
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)
ComponentType   (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 ComponentType and Component elements

ComponentType

Root element for defining component types. Note that ComponentClass is used for this element in the NeuroML Component definitions. LEMS will handle ComponentClass elements in the same way as ComponentType elements.
name()
The name of the component type. This can be uses as an XML element name in the shorthand form whendefining components.  
eXtends()
The component type that this type inherits field definitions for, if any  
abouts()
Metadata about a component type can be included anywhere by wrapping it in an About element, though this is not necessary: LEMS does not use the body text of XML elements itself, so this is free for the modeler to include descriptive text or other markup of thier own.  
metas()
Structured metadata can be put in Meta elements. The content is read into a generic xml data structure. Other tools can then do their own thing with it. Each Meta element should set the context attribute, so tools can use the getMeta(context) method to retrieve elements that match a particular context.  
Can contain:
Parameter
DerivedParameter
PathParameter
Requirement
Exposure
Child
Children
ComponentRef
ComponentTypeRef
Link
Property
DefaultBehavior
Behavior
Fixed
Constant
Attachments
EventPort
Path
Text
Collection
PairCollection
AnalogPort
About
Meta

Parameter

Sets the name an dimensionality of a parameter that must be supplied when a component is defined curresponding to the enclosing ComponentType
name()
The name of the parameter. This isthe attibute name when the parameter is supplied in a component definition  
dimension()
The dimension, or 'none'. This should be the ID of a deminsion element defined elsewhere  
Child of:
ComponentType

DerivedParameter

A parameter that comes from other parameter values in the model rather than being set explicitly. Its value can be supplied either with the 'value' attribute that evaluates within the scope of the definition, or with the 'select' attribute which gives a path to 'primary' version of the parameter. For example, setting select='//MembranePotential[species=channel/species]/reversal' within the appropriate context allows a channel's reversal potential to taken from a single global setting according to its permeant ion, rather than explicitly supplied locally.
select()
Path to the parameter that supplies the value. Exactly one of 'select' and 'value' is required.  
value()
Expression that supplies the value. Exactly one of 'select' and 'value' is required.  
Child of:
ComponentType

PathParameter

A parameter of which the value is a path expression. When a ComponentType declares a PathParameter, a corresponding Component definition should have an attibute with that name whose value is a path expression that evaluates within the instance tree of the built model. This is used, for example, in the definition of a group component class, where the coresponding component specifies a path over the instance tree which selectesthe items that should go in the group.
name()
Name of the parameter  
Child of:
ComponentType

Requirement

A Requirement gives the name and dimension of a quantity (parameter or variable) that should be accessible within the scope of a model component. This is only applicable for elements that can be included as children of other elements, where the scope comprises its own parameters and those in the scope of its enclosing element. Once a requirement has been declared, then the quantity can be used within the Behavior definition of the component. It is the responsibility of an implementation to check that the component is only used in a context in which the requirement is met. A typical example is in defining membrand bound components which require access to the membrane potential but where the variable that holds the potential itself is defined in the top level component.
name()
name  
dimension()
reference to a dimension  
Child of:
ComponentType

Exposure

A quantity that is made available to other component in the simulation. All variables in a Behavior definition are private. If other components need access to them then the definition has to explicitly link them to an exposure defined in the component class
name()
name  
dimension()
Reference to a dimension  
Child of:
ComponentType

Child

Specifies that a component can have a child of a particular type. The name supplied here can be used in path expressions to access the component. This is useful, for example, where a component can have multiple children of the same type but with different roles, such as the forward and reverse transition rates in a channel.
name()
 
type()
Reference to a component class, the value should be the name of the target class.  
Child of:
ComponentType

Children

Specifies that a component can have children of a particular class. The class may refer to an extendedtype, in which case components of any class that extends the specified target class should be valid as child components
name()
 
type()
The class of component allowed as children.  
Child of:
ComponentType

ComponentRef

A reference to another component. The target component can be accessed with path expressions in the same way as a child component, but can be defined independently
name()
 
type()
Target type  
Child of:
ComponentType

ComponentTypeRef

This is used in conjunction with PathParameter elements to specify the target class of selections defined within components operating over the instance tree.
name()
 
Child of:
ComponentType

Link

Like a ComponentRef, but resolved relative to the enclosing object so the target must already be in the model. One or the other should be deprecated. The Link element has the same properties as ComponentRef. 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.
name()
 
type()
Target type  
Child of:
ComponentType

Property

An property on an instance of a component. Unlike a Parameter, a Property can very from instance to instance. It should be set with an Assign element within the build specification.
name()
 
dimension()
 
Child of:
ComponentType

DefaultBehavior

If more than one Behavior definition is supplied, a DefaultBehavior element can be added to point to the one that should be used by default in the absence of other criteria.
behavior()
The id of the Behavior element to be used as the default. The target element should be a child of the enclosing component class.  
Child of:
ComponentType

Behavior

Contains the description of the dynamical behavior of the ComponentType. Can also contain instructions on other elements to create when a component of this type is created. Note that Dynamics is used for this element in the NeuroML Component definitions. LEMS will handle Dynamics elements in the same way as Behavior elements.
Can contain:
DerivedVariable
StateVariable
TimeDerivative
KineticScheme
OnStart
OnEvent
OnCondition
Show
Record
Run
Build
Regime
Child of:
ComponentType

DerivedVariable

A quantity that depends algebraically on other quantities in the model. The 'value' field can be set to a mathematical expression, or the select field to a path expression. If the path expression produces multiple matches, then the 'reduce' field says how these are reduced to a single value by taking the sum or product.
name()
 
valueCondition()
An optional boolean condition. If true, variable is set to "value", otherwise "valueIfFalse"  
valueIfFalse()
A fallback value for the variable if "valueCondition" is false, otherwise "value"  
select()
 
onAbsent()
A value to be used if the path at select is not found  
dimension()
 
reduce()
Either 'add' or 'multiply'  
exposure()
 
Child of:
BehaviorRegime

StateVariable

name()
 
dimension()
 
exposure()
If this variable is to be accessed from outside, it should be linked to an Exposure that is defined in the ComponentType.  
Child of:
BehaviorRegime

TimeDerivative

Has a variable and a value. The value is the rate of change of the variable.
Child of:
BehaviorRegime

KineticScheme

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.
name()
 
nodes()
 
edges()
 
Can contain:
Nodes
Edges
Child of:
Behavior

Nodes

The children attribute should point to a children declaration in the parent element. The variable field specifies the variable in the state elements that is governed by the scheme.
children()
 
variable()
 
Child of:
KineticScheme

Edges

children()
The element that provides the transitions for the scheme  
sourceNodeName()
The name of the attribute in the rate element that defines the source of the transition  
targetNodeName()
 
forwardRate()
 
reverseRate()
 
Child of:
KineticScheme

OnStart

Can contain:
StateAssignment
EventOut
Transition
Child of:
BehaviorRegime

StateAssignment

Has 'variable' and 'value' fields
Child of:
OnStartOnEventOnConditionOnEntry

EventOut

Child of:
OnStartOnEventOnConditionOnEntry

Transition

Child of:
OnStartOnEventOnConditionOnEntry

OnEvent

Event handler block
port()
the port to lesten on  
Can contain:
StateAssignment
EventOut
Transition
Child of:
BehaviorRegime

OnCondition

Can contain:
StateAssignment
EventOut
Transition
Child of:
BehaviorRegime

Show

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.
scale()
path to the parameter that sets the scale for rendering times non-dimensional  
src()
path to the element that defines what should be shown  
Child of:
Behavior

Record

quantity()
path to the parameter that will contain the path to the quantity to be recorded  
scale()
path to the element that defines the scale for rendering the quantity dimensionless  
color()
hex format color suggestion for how the data should be displayed  
save()
Optional name of file to save recorded data in  
Child of:
Behavior

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.
component()
name of the component reference that will set the component to be run  
variable()
 
increment()
path to the parameter that sets the step size  
total()
path to the parameter that sets the total span of the independent variable to be run  
Child of:
Behavior

Build

Can contain:
BuildElement
Child of:
Behavior

BuildElement

Can contain:
BuildElement
Child of:
BuildElementBuild

Regime

Can contain:
DerivedVariable
StateVariable
TimeDerivative
OnStart
OnEntry
OnEvent
OnCondition
RequiredVar
Child of:
Behavior

OnEntry

Can contain:
StateAssignment
EventOut
Transition
Child of:
Regime

RequiredVar

Child of:
Regime

Fixed

Fixes the value of a parameter in the parent class, so that it does not have to be supplied separately in component definitions.
parameter()
 
value()
 
Child of:
ComponentType

Constant

A constant quantity: like a parameter for which the value is supplied in the class definition itself rather than when a component is defined.
name()
 
value()
 
dimension()
 
Child of:
ComponentType

Attachments

Specifies that a component can accept attached components of a particular class. Attached components can be added at build time dependent on other events. For scoping and access purposes they are like child components. The cannonical use of attachments is in adding synapses to a cell when a network connection is made.
name()
 
type()
 
Child of:
ComponentType

EventPort

A port on a component that can send or receive events, depending on the direction speicfied.
name()
 
direction()
'IN' or 'OUT'  
Child of:
ComponentType

Path

Duplicates some functionality of PathParameter - the two should be merged.
name()
 
Child of:
ComponentType

Text

Holds textual information that does not change the model but is needed for other purposes such as labelling graphs.
name()
 
Child of:
ComponentType

Collection

Specifies that instances of components based on this class can containe a named collection of other instances. This provides for containers for oprating on groups of instances with path and filter expressions defined in components to operate over the instance tree.
name()
 
Child of:
ComponentType

PairCollection

Defines a named collection of paris of instances, similar to the Collection element.
name()
 
Child of:
ComponentType

AnalogPort

Child of:
ComponentType

About

Child of:
ComponentType

Meta

Child of:
ComponentType

Component