User defined types for networks and populations

This example shows how the standard component type structures can be used to declare components for simple networks. The following three definitions allow networks to be constructed containing fixed size populations of a particular component type.

The harder part is to provide elements in the Dynamics blocks to express what should be done with components based on these types. The Network element doesn't pose any problems because the default behavior on instantiation will do the right thing: it will instantiate each of the child populations and EventConnectivity elements.

But the population element needs to say that its instantiation involves making 'size' instances of the component referred to by the 'component' reference, where 'size' is the value supplied for the size parameter in a component specification. This can be done by including a Build element inside the Dynamics block:

The MultiInstantiate specification says that there should be 'size' instances of the component referred to in the 'component' parameter created when the model is built. This overrides the default behavior. [TODO: what is the Build element content corresponding to the default behavior?].

This serves to create some rather simple populations. More complex specifications, such as putting one instance at each point of a grid satisfying a particular constraint could be handled via first declaring elements to form the grid, and then using selectors that pick the points in the population element to actually put the cells at [its not clear to me how much more would be required to make this work, other than implementing proper xpath-like selectors].

The following three types define a general connectivity structure with an abstract ConnectionPattern type, and a specific instance for All-All connectivity.

The Build element in the AllAll pattern uses a new ForEach construct and the EventConnectin element from before. The ForEach element operates selects each instance matching its 'instances' attribute, and applies the enclosing directives, much in the same way as for-each in XSL. The proof of concept interpreter also has Choose, When and Otherwise elements that operate much like their XSL equivalents, although these are not used in this example.

With these definitions in place, a network simulation can be defined with the following:

The output when the model is run is shown below, followed by the full listing.