From GridLAB-D Wiki
Jump to: navigation, search

double_array - Double array property type

Synopsis

class class_name {
  double_array property_name;
}
object double_array {
  property_name "a11 a12 ... a1M ; a21 a22 ... A2M ; ... ; aN1 aN2 ... aNM";
}

Remarks

Double arrays are dense arrays of doubles or references to doubles. Each value may be one of the following:

  • a constant value that can be referenced and changed by other objects;
  • a reference to a double value in another object; or
  • a unassigned value (i.e., NAN).

To refer to a member of an array use the part syntax:

property_name.n.m

where n refers to the column number and m refers to the row number (base 0).

Examples

The following declares a class test with three doubles and a double array:

class test {
  double x;
  double y;
  double z;
  double_array w;
}

The following creates an object of class test, assigns the three values, links the first 3 members of the first row of the array to the three values, sets the second row to constants, and sets the third row to NANs:

object test {
  name my;
  x random.normal(0,1);
  y random.normal(0,1);
  x random.normal(0,1)
  w "my.x my.y my.z ; 1 2 3 ; NAN NAN NAN ";
}

As of Jojoba (Version 3.2) local property names are automatically recognized without required the object name, so the above example can also be written as

object test {
  x random.normal(0,1);
  y random.normal(0,1);
  x random.normal(0,1)
  w "x y z ; 1 2 3 ; NAN NAN NAN ";
}

Version

The double_array type was added as of Hassayampa (Version 3.0).

Bugs

Double arrays cannot resolve references to objects that don't already exist. This means that you cannot refer to objects that have not yet been loaded.

Recorder and player do not interpret double array parts correctly at this time. Assert does interpret them correctly using the assert part property.

Double array references should be able to resolve references to double parts in many types of properties, but this doesn't work yet.

See also