From GridLAB-D Wiki
Jump to: navigation, search

Complex values are represented using the complex property type.

GLM

To declare a complex number in a class use the syntax

class my_class {
  complex my_complex;
}

Accepted complex number notations are i, j, and r. Complex notation d is used to designate polar coordinates.

You may include a unit with the declaration using the syntax

class my_class {
  complex my_complex[unit];
}

where unit is one of the supported units.

To define a complex number in an object use the syntax

object my_class {
  my_complex value;
}

You may include units in the definition using the syntax

object my_class {
  my_complex value unit;
}

provided the unit defined is compatible with the unit declared.

ASCII formatting

Complex number are formatted in one of four ways depending on the internal settings and last update to the variable (- indicates sign is optional, + indicates sign is mandatory, and none indicates number cannot have a sign).

Math rectangular format
#.######e-###+#.######e-###i
Engineering rectangular format
-#.######e-###-#.######e-###j
Polar radians format
#.######e-###+#.######e-###r
Polar degrees format
#.######e-###+#.######e-###d

Units, if specified by the class will be appended following a space, i.e.,

-#.######e-###-#.######e-###j units

where units is one of the units in unitfile.txt (or one derived from them).

The format of complex numbers is controlled by the complex_format global variable.

See also