From GridLAB-D Wiki
Jump to: navigation, search

 Approval item:  --Dchassin 16:50, 9 October 2011 (UTC)

The instance directive is used to define and link a slave instance of GridLAB-D to a master instance.


instance hostname {
  model slave.glm;
  cacheid id;
  mode connection-mode;
  execdir dir;
  return_port port-num;
  local-object:property -> remote-object:property;
  // ... other master->slave links
  local-object:property <- remote-object:property;

where hostname is the machine on which the instance should be run, slave is the GLM model to which this master will link, local-object:property are the data elements to be sent to (->) or received from (<-) the slave instance each sync, and remote-object:property is the target of that linkage.

Instance Block Keywords


The model keyword specifies the path and the name of the model file for the slave instance to run, relative to the directory that either the directory the master instance was called from, or the directory the slavenode was called from.


For debugging purposes. Specifies the 64-bit integer that should be used as the cache id, rather than a random int64. ID collisions will cause undefined behavior.


Defines the connection mode. Currently supported modes are "mmap", "shmem", and "socket".

Windows-specific. Uses memory-mapped file objects to exchange data for this instance, using Windows events to signal the local instance. This the default mode for Windows systems.
Linux/BSD-specific. Uses shared memory routines to exchange data for this instance. shmem is the default mode for Linux/BSD systems. Still in development.
Uses sockets to connect to a remote host at hostname, where another instance of GridLAB-D has been started with the "--slavenode" arguement. A randomly selected port is used when the slave instance connects back to the master, unless return_port is specified.


Only used with socket mode, defines which port shall be used by a specific slave instance. Port reuse may result in race conditions and undefined behavior. By default the return port number is randomly chosen in the range 32768-65535.

To do

If hostname is a machine other than localhost the slave will be started on the remote machine. Permission must be granted to GridLAB-D to access the IANA port number 6267 and the remote machine must be running the gldremoted service to accept incoming requests to start the slave instance.


   model "one/IEEE_13_house_1.glm";
   mode socket;
   return_port 16267;
   trans_node_5:voltage_A -> network_node:voltage_A;
   trans_node_5:voltage_B -> network_node:voltage_B;
   trans_node_5:voltage_C -> network_node:voltage_C;
   trans_node_5:constant_power_A <- network_node:measured_power_A;
   trans_node_5:constant_power_B <- network_node:measured_power_B;
   trans_node_5:constant_power_C <- network_node:measured_power_C;

See also