Skip to main content

Module glm

Module glm 

Source
Expand description

GridLAB-D source syntax, bounded offline preprocessing and static import.

The source layer preserves statements and source spans without executing GLM scripts or certifying electrical meaning. Raw syntax keeps directives inert; preprocessing resolves only the supported local profile. parse separately imports phase-to-earth and phase-pair P/I/Z loads, including traditional delta flags and scalar setters, and the explicit line-matrix and overhead conductor/spacing profiles, rejecting unmodeled physics. Distribution and facade dispatch select PNNL 5.3 for .glm/gridlabd, or Arras 4.3 for gridlabd-arras. Same-profile emission replays acquired project files; emit_canonical generates a single file from current typed values.

Structs§

ExpansionOrigin
A contiguous expansion segment and the source bytes responsible for it.
GlmCoordinates
Source-declared object coordinates in decimal degrees. An absent axis is distinct from zero. These common GLM fields do not declare a datum or CRS. Powerflow initialization may subsequently replace a link’s location.
GlmObject
One explicit declaration. Unknown classes/properties remain visible and are not thereby certified as electrically supported. Properties are not cloned.
GlmProject
Source project and expanded syntax, without electrical interpretation. Syntax spans address the expansion; Self::original_spans locates the corresponding original bytes, including substitutions and included files.
GlmProperty
GlmQuantity
A constant in the property’s declared native unit. Diagnostics must be forwarded when projecting into a network, particularly for ignored suffixes.
ObjectIndex
Borrowed explicit-object index. Building it resolves parents, rejects cycles and ambiguous identities, and distinguishes nested from inline objects. Equipment references are resolved on demand; no class schema or defaults are inferred here. Dynamic objects, namespace blocks and relative/wildcard references require further interpretation and are not silently approximated.
ObjectKey
Index-local object identity. It is neither a native runtime ID nor the explicit numeric key written after a class name in a GLM declaration.
PreparedGlm
Preprocessed text, distinct from the retained original project. This is not an electrically interpreted network and must never replace source retention.
PreprocessOptions
Explicit preprocessing inputs. No process environment or simulator globals are consulted. Callers must supply the globals required by their profile.
RawGlm
Parsed syntax with its source owner. Source bytes, comments and whitespace remain available exactly as supplied; the tree does not replace those bytes.
Token
A token borrows its bytes through a shared source-buffer owner.

Enums§

GlmDialect
Loader conventions qualified against the pinned engine versions.
GlmPropertyValue
A property retains ordered source tokens or an explicit inline object link.
GlmQuantityKind
Native property storage kind. Quoted constants use a different native conversion path from unquoted GLM expressions.
Statement
Source syntax retains duplicate properties and unknown declarations in order.
TokenKind
Lexical category. Words keep punctuation used in units and complex literals.

Functions§

emit_canonical
Emit fresh GLM from the current typed network, without retained-source echo.
parse
Read the initial static GLM electrical profile. Unknown physical classes, properties and globals fail explicitly; they are not silently omitted from an apparently usable network. The source project is retained.
parse_project
Preprocess the supported explicit profile and parse its complete syntax. Failures retain the original project and point into original buffers rather than presenting expanded byte offsets as if they belonged to an input file.
parse_raw_source
Parse one primary GLM buffer without preprocessing or electrical projection. Includes and conditionals remain directive statements in this syntax API. Input is bounded to 64 MiB, one million tokens, 1 MiB per token and 64 nested blocks. All spans address the original bytes, including a UTF-8 BOM.
preprocess_source
Expand local quoted includes containing complete declarations, #define NAME=value, #ifdef, #ifndef, string-comparison #if, #else, #endif, and explicit ${NAME} variables.