From GridLAB-D Wiki
Jump to: navigation, search

GUID - Global variable to get a globally unique identifier

Synopsis

${GUID}

Description

The GUID global variable dynamically generates a unique 128-bit identifier each time it is referenced. This can be used to generate object names, file names, and database entities that are practically guaranteed to be unique.

Example

The following code defines a class test with a random variable x. The name of the object is unique.

class test {
  random x;
}
object test {
  name test-${GUID};
  x "type:normal(0,1); refresh:1min";
}

Bugs

Prior to Hassayampa (Version 3.0) 
The random number generated is seeded using the current system time with a resolution of 1 second. Consequently, if two runs are started within the same second they are very likely to generate the same sequence of unique ids.

Version

The unique id variable was introduced in Hassayampa (Version 3.0).


See also