GLM file loader
[GridLAB-D CoreNetwork node (bus)]


Detailed Description

Load objects represent static loads and export both voltages and current.

Deprecated:
This file format will soon be abandoned in favor of XML.
This loader uses a simple parser. Someday it will be replaced by a more robust implementation that will be easier to fix, manage, improve, update, grow, etc.

Current syntax:

    <integer> : /[+-][0-9]+/.
    <real> : /[+-][0-9]+[\.[0-9]*][{eE}[+-][0-9]+]/.
    <real> : /[+-]\.[0-9]+[{eE}[+-][0-9]+]/.
    <datetime> : /'[0-9]+-[0-9]+-[0-9]+ [0-9]+:[0-9]+:[0-9]+'/
    <name> : /[A-Za-z_]+[A-Za-z_0-9]* /.
    <id> : /[A-Za-z_]+[A-Za-z_0-9]*:[0-9]+/.
     
    <file> : <blocks>.
    <blocks> : <blocks> <block>.
    <block> : <clock_block>
    <block> : <module_block>.
    <block> : <class_block>.
    <block> : <object_block>.
    <block>.
    <clock_block> : "clock" "{" <clock_properties> "}".
    <clock_properties> : <clock_properties> <clock_property>.
    <clock_property> : "tick" <real> ";".
    <clock_property> : "timestamp" <datetime>.
    <clock_property> : "timestamp" <integer>.
    <module_block> : "module" <name> ";".
    <module_block> : "module" <name> "{" <module_properties> "}".
        etc...
    <class_block> : "class" <name> ";".
    <class_block> : "class" <name> "{" <class_properties> "}".
        etc...
    <object_block> : "object" <id> "{" <object_properties> "}".
        etc...


Classes

struct  s_unresolved_object

Defines

#define ACCEPT   { _n+=_m; _p+=_m; _m=0; }
#define BEGIN_REPEAT   {char *__p=_p; int __mm=_mm, __m=_m, __n=_n, __l=_l; int __ln=linenum;
#define COPY(X)   {size--; (X)[_n++]=*_p++;}
#define DONE   return _n;
#define END_REPEAT   }
#define FSTAT   fstat
#define HERE   (_p+_m)
#define LITERAL(X)   (_mm=literal(HERE,(X)),_m+=_mm,_mm>0)
#define OR   {_m=0;}
#define PARSER   char *_p
#define QNAN   (sqrt(-1))
#define REJECT   { linenum=_l; return 0; }
#define REPEAT   _p=__p;_m=__m; _mm=__mm; _n=__n; _l=__l; linenum=__ln;
#define START   int _mm=0, _m=0, _n=0, _l=linenum;
#define TERM(X)   (_mm=(X),_m+=_mm,_mm>0)
#define UR_NONE   0x00
#define UR_RANKS   0x01
#define WHITE   (_m+=white(HERE))

Typedefs

typedef stat STAT

Functions

UNRESOLVEDadd_unresolved (OBJECT *by, OBJECT **ref, CLASS *oclass, char *id, unsigned int line, int flags)
int load::create (void)
EXPORT int create_load (OBJECT **obj, OBJECT *parent)
 REQUIRED: allocate and initialize an object.
EXPORT int init_load (OBJECT *obj)
 Object initialization is called once after all object have been created.
int load::isa (char *classname)
EXPORT int isa_load (OBJECT *obj, char *classname)
 load::load (MODULE *mod)
OBJECTload_get_index (OBJECTNUM id)
double load_latitude (char *buffer)
double load_longitude (char *buffer)
int load_resolve_all ()
STATUS load_set_index (OBJECT *obj, OBJECTNUM id)
STATUS loadall (char *file)
 Load a file.
STATUS loadall_glm (char *file)
TIMESTAMP load::postsync (TIMESTAMP t0)
int set_flags (OBJECT *obj, char1024 propval)
TIMESTAMP load::sync (TIMESTAMP t0)
EXPORT TIMESTAMP sync_load (OBJECT *obj, TIMESTAMP t0, PASSCONFIG pass)
 Sync is called when the clock needs to advance on the bottom-up pass (PC_BOTTOMUP).
int time_value (PARSER, TIMESTAMP *t)
int time_value_datetime (PARSER, TIMESTAMP *t)

Variables

static loadload::defaults = NULL
static CLASSload::oclass = NULL
static CLASSload::pclass = NULL


Function Documentation

EXPORT int create_load ( OBJECT **  obj,
OBJECT parent 
)

REQUIRED: allocate and initialize an object.

Parameters:
obj a pointer to a pointer of the last object in the list
parent a pointer to the parent of this object
Returns:
1 for a successfully created object, 0 for error

Definition at line 133 of file load.cpp.

References create(), gl_create_object, gl_error, gl_set_parent, OBJECTDATA, and oclass.

EXPORT int init_load ( OBJECT obj  ) 

Object initialization is called once after all object have been created.

Parameters:
parent a pointer to this object's parent
Returns:
1 on success, 0 on error

Definition at line 158 of file load.cpp.

References GL_THROW, s_object_list::id, powerflow_object::init(), s_class_list::name, and s_object_list::oclass.

STATUS loadall ( char *  file  ) 

Load a file.

Returns:
STATUS is SUCCESS if the load was ok, FAILED if there was a problem
Todo:
Rollback the model data if the load failed (ticket #32)
Todo:
Support nested loads and maintain context during subloads (ticket #33)

Definition at line 1604 of file load.c.

Referenced by cmdarg_load(), and cmex_load().

STATUS loadall_glm ( char *  file  ) 

Parameters:
file  a pointer to the first character in the file name string

Definition at line 1531 of file load.c.

EXPORT TIMESTAMP sync_load ( OBJECT obj,
TIMESTAMP  t0,
PASSCONFIG  pass 
)

Sync is called when the clock needs to advance on the bottom-up pass (PC_BOTTOMUP).

Parameters:
t0 this objects current timestamp
t1 the timestamp which the object should move forward to
Returns:
t2, where t2>t1 on success, t2=t1 for retry, t2<t1 on failure

Definition at line 180 of file load.cpp.

References s_object_list::clock, powerflow_object::get_id(), powerflow_object::get_name(), GL_THROW, OBJECTDATA, PC_BOTTOMUP, PC_POSTTOPDOWN, PC_PRETOPDOWN, postsync(), node::presync(), sync(), and TS_NEVER.


GridLAB-DTM Version 1.0
An open-source project initiated by the US Department of Energy