Simulation Environment for the JavaScript Agent Machine
Introduction
The SEJAM simulator is a built as a software layer on top of a generic JAM node. The simulation layer provides visualisation and an extended simulation API that can be accessed by agents.
There are logical and physical nodes. A SEJAM world consists of logical nodes handled by one physical nodes, which can be connected to remote physical nodes via IP links. The simulation world consists of agent processing nodes (logical/virtual JAM nodes) and some communication links (virtual channels) between nodes enabling migration of agents and propagation of signals between nodes. Nodes are placed in a two-dimensional spatial simulation world, and each node has a distinct position.
There are computational and physical agents. They differ in their operational behaviour, but both are modelled with AgentJS. Physical agents represent physical entities like, e.g., humans, ants, cars. Physical agents are bound to a node (the agent is only mobile through its node). The default agent type is computational and computational agents represent mobile software that can migrate between logical and physical ndoes.
A meshgrid network arranges nodes in a two-dimensional grid (that can be irregular and incomplete).
A patchgrid network is similar to NetLogo simulation worlds. A patch grid arranges nodes in a two-dimensional grid, too, but with an implicit global virtual communication link that enables migration of physical agents between any of the nodes in the grid. Migration of computational agents (default) and propagation of message signals still require explicit links between nodes.
Communication ports and links have either (static or dynamic) point-to-point or broad/multicast characteristics, i.e., nodes within a specific spatial range can communicate with each other (computational agents).
Nodes (except in mesh- and patch grid worlds) can be moved within the two-dimensional world carrying their agents.
NetLogo API
Simulation functions for physical (behavioural) agents derived from NetLogo simulation model is provided by the net extension related to a patch grid world. Furthermore, agent grouping is supported.
- net.ask
- net.create
- net.forward
- net.get
- net.turn
- net.group
- net.set
- net.setxy
Multi-domain Simulation
Combining physical world with MAS simulation is a challenge. Such a multi-domain simulation enables the direct derivation of sensor data from a physical model (sensing part) provision to a computational system, and the investigation of the action of this computational system on the physical system (actuating part). The goal of this multi-domain simulation is to investigate the behaviour of MAS on dynamic (or semi-static) changes of mechanical structures and vice versa.
The physical world consists of the mechanical structure given by a physical model (FEM or mass-spring multi-body), sensors, and external loading having impact on the static and dynamic reaction of the structure, including gravity. For the sake of simplicity, the mechanical structure under test is modelled with a mass-spring multi-body system. The multi-body physics simulation is well known from computer games and animations. It can be easily and efficiently integrated in computational systems like MAS simulators.
To this end, the SEJAM simulator (JAM platform + GUI + simulation control) was extended with a modified physics engine (based on Cannon.js and Three.js) enabling the direct coupling of the physical model with the computation of agents. The JAM platform and the SEJAM simulator are entirely implemented in JavaScript, executed with the Node Webkit (node.js+Chromium HTML browser).
A simulation model consists basically of three parts:
- The MAS behaviour models;
- The JAM virtual network world;
- The physical model.
All parts are specified in JavaScript.
In this environment, the physical model can be accessed by all agents. A distributed MAS simulation consists of node and worker agents executed on different virtual JAM nodes. There is commonly one artificial agent (world agent) representing the world and managing the simulation, i.e., generating and updating sensor data accessed by the node and worker agents by using the unified tuple-space interface. The world agent can read and modify physical simulation variables, i.e., reading strain, force parameters, and setting material/structure properties (e.g., stiffness).
SEJAM2 Architecture
Simulation Model
The simulation model is specified in JSON+ format (JSON + function code) and is used to provide definitions of agent classes, the simulations world, nodes, composition of networks with nodes, initialization and initial instantiation of agents, and optionally physical multi-body physics models.
Agent classes can be embedded in the simulation or can be imported from external files by using the open
statement. Each behavioural agent class is associated with a visual definition.
The following definitions give the basic structure of a simulation model and the semantic type interface.
Definition. SeJAM Simulation Model Template
simulation : model = {
// Physical MBP model
physics : { plate : {..}},
// Computation and Communication: Agent behaviour Classes
classes: {
node : { behaviour: function () {..}, visiual:{..} },
ac1 : { behaviour: function () {..}, visiual:{..} },
ac2 : { behaviour: function () {..}, visiual:{..} },
..
world : { behaviour: function () {..}, visiual:{..} },
},
// Global simulation parameters used by agent and physical simu.
parameter : {
p1 : v1,
p2 : v2,
..
},
// Simulation set-up and initialization
world: { ..
init : { agents: {..}, physics: {..}},
meshgrid : { node:{..}, port = {..},
link:{..} .. } } // Network model
}
Definition. Semantic Type Model
type model = {
name? : string,
agents : model.classes,
resources? : model.resource,
patches? : model.resource,
parameter? : model.parameter,
world : model.world,
physics? : physics,
}
type model.classes = model.agents = {
$ac: {
behaviour: agent constructor function | open(file),
visual : visual,
type? : 'computational'|'phyiscal'
on?: { $event : visual },
}
}
type model.world = {
init? : {
agents? : {
$ac : function (nodeid:string,position) ->
{level:number,args:[]|{}|null}
},
nodes? : function (node),
resources? : function (resource),
patches? : function (resource),
world? : {},
physics? : function (physics),
},
start?: function (env),
stop? : function (env),
data? : {},
nodes? : function () -> simobj [],
resources? : function () -> simobj [],
meshgrid? : meshgrid,
patchgrid? : patchgrid,
}
A simulation world consists of agent processing nodes (logical/virtual JAM nodes) and some communication links between nodes enabling migration of agents and propagation of signals between nodes. Nodes are placed in a two-dimensional spatial simulation world, and each node has a distinct position.
There are computational and physical agents. The latter represent physical entities (although virtual in the simulation) like, e.g., humans, ants, cars. The default agent type is computational and agents represent mobile software.
A meshgrid network arranges nodes in a two-dimensional grid (that can be irregular and incomplete).
A patchgrid network is similar to a NetLogo simulation world. There are two different patchgrid models: Fixed and floating. In the fixed model a patch grid arranges nodes in a two-dimensional grid, too, but with an implicit global virtual communication link that enables migration of phyiscal agents between any of the nodes in the grid. Migration of computational agents (default) and propagation of message signals still require explicit links between nodes. In the floating model a physical agent is associated with a mobile tuple (logical node,behavioural agent).
Communication ports and links have either (static or dynamic) point-to-point or broad/multicast characteristics, i.e., nodes within a specific spatial range can communicate with each other (computational agents).
Nodes (except in mesh- and fixed patch grid worlds) can be moved within the two-dimensional world carrying their agents.
Example
SEJAM2 Multi-window GUI
Download
- SEJAM2
- SeJAM application package (platform independent) not including required node webkit (nw.js), Version 1.7.2
At least nw-js versions 0.13.4 is required.
The simulator is started by changing in the sejam2 top-level directory and executing nw.js ./
.
SEJAM2 ZIP
Manuals
Manuals for JAM, JAM AIOS API, and SEJAM2
- JAM
- Manual PDF
- AIOS
- Manual PDF
- AIOS.API
- Manual PDF
- SEJAM2
- Manual PDF