From GridLAB-D Wiki
Expansion variables are used in GLM code to embed context-dependent values into property values and code. Expansion variables are always enclosed in single curly braces, e.g., {variable}.
To enable expansion variable syntax, property values must be embedded in back-quotes as shown in this example from the Getting Started Using GridLAB-D page:
// Examples:1g.glm clock { timezone EST+5EDT; starttime '2000-01-01 00:00:00'; stoptime '2001-01-01 00:00:00'; } module residential; module tape; object house:..5 { object recorder { property air_temperature; file `temperature{id}.csv`; in '2000-04-01 00:00:00'; out '2000-04-02 00:00:00'; }; }
The recognized expansion variables are
- {file} embeds the full GLM file name
- {filename} embeds the base file name (no path and no extension)
- {filepath} embeds the path to the file (no file name or extension)
- {fileext} embeds the file extension (no path or name)
- {namespace} embeds the namespace
- {class} embeds the class name
- {gridlabd} embeds the path to the gridlabd installation
- {hostname} embeds the host name of the machine running the code Template:NEW30
- {hostaddr} embeds the host IP address of the machine running the code Template:NEW30
- {port} embeds the port number of the server (if any) Template:NEW30
- {cpu} embeds the CPU id (see pstatus) that is running the code Template:NEW30
- {pid} embds the process id (see pstatus that is running the code Template:NEW30
- {mastername} embeds the master server simulation host name Template:NEW30
- {masteraddr} embeds the master server simulation host IP address Template:NEW30
- {masterport} embeds the master server port number Template:NEW30
- {id} embeds the object id number
- {property} embeds the property from the current object
- {global} embeds the value from a global variable Template:NEW30