Runtime Class API


Detailed Description

The Runtime Class API is a programming library for inline C++ embedded within GLM files.


Classes

struct  s_namespace
 Full object name (including space name). More...

Defines

#define gl_error   (*callback->output_error)
 Send a printf-style message to the error stream.
#define gl_globalclock   (*(callback->global_clock))
 Get the current value of the global clock.
#define gl_output   (*callback->output_message)
 Send a printf-style message to the output stream.
#define gl_testmsg   (*callback->output_test)
 Send a printf-style message to the testmsg stream.
#define gl_verbose   (*callback->output_verbose)
 Send a printf-style message to the verbose stream.
#define gl_warning   (*callback->output_warning)
 Send a printf-style message to the warning stream.
#define PC_BOTTOMUP   0x02
 used when the class requires synchronization on the bottom-up pass
#define PC_FORCE_NAME   0x20
 used to indicate the this class must define names for all its objects
#define PC_NOSYNC   0x00
 used when the class requires no synchronization
#define PC_PARENT_OVERRIDE_OMIT   0x40
 used to ignore parent's use of PC_UNSAFE_OVERRIDE_OMIT
#define PC_POSTTOPDOWN   0x04
 used when the class requires synchronization on the second top-down pass
#define PC_PRETOPDOWN   0x01
 used when the class requires synchronization on the first top-down pass
#define PC_UNSAFE_OVERRIDE_OMIT   0x80
 used to flag that omitting overrides is unsafe
#define PF_CHARSET   0x0002
 set supports single character keywords (avoids use of |)
#define PF_RECALC   0x0001
 property has a recalc trigger (only works if recalc_<class> is exported)

Typedefs

typedef struct s_callbacks CALLBACKS
 core callback function table
typedef char char1024 [1025]
 strings up to 1024 characters
typedef char char256 [257]
 strings up to 256 characters
typedef char char32 [33]
 strings up to 32 characters
typedef char CLASSNAME [64]
 the name a GridLAB class
typedef struct s_datetime DATETIME
 A typedef for struct s_datetime.
typedef struct s_exception_handler EXCEPTIONHANDLER
 the exception handler structure
typedef char FUNCTIONNAME [64]
 Object name.
typedef short int16
 8-bit integers
typedef int int32
 16-bit integers
typedef char int8
 string up to 8 characters
typedef struct s_namespace NAMESPACE
 Namespaces are used to disambiguate class and object names.
typedef char * OBJECTNAME
 Object id number.
typedef unsigned int OBJECTNUM
 Object data size.
typedef unsigned int OBJECTRANK
 Object rank number.
typedef unsigned char PASSCONFIG
 the pass configuration
typedef void * PROPERTYADDR
 the offset of a property from the end of the OBJECT header
typedef char PROPERTYNAME [64]
 the name of a property
typedef struct s_unit UNIT
 the entry point of a module function

Enumerations

enum  MACHINEPULSETYPE { , MPT_TIME, MPT_POWER , MPT_TIME, MPT_POWER }
 type of machine More...
enum  MACHINETYPE { ,
  MT_ANALOG, MT_PULSED, MT_MODULATED, MT_QUEUED,
  MT_SCHEDULED , MT_ANALOG, MT_PULSED, MT_MODULATED,
  MT_QUEUED
}
enum  NOTIFYMODULE {
  NM_PREUPDATE = 0, NM_POSTUPDATE = 1, NM_RESET = 2, NM_PREUPDATE = 0,
  NM_POSTUPDATE = 1, NM_RESET = 2
}
enum  PROPERTYACCESS {
  PA_PUBLIC, PA_REFERENCE, PA_PROTECTED, PA_PRIVATE,
  PA_PUBLIC, PA_REFERENCE, PA_PROTECTED, PA_PRIVATE
}
enum  PROPERTYTYPE { ,
  PT_void, PT_double, PT_complex, PT_enumeration,
  PT_set, PT_int16, PT_int32, PT_int64,
  PT_char8, PT_char32, PT_char256, PT_char1024,
  PT_object, PT_delegated, PT_bool, PT_timestamp,
  PT_double_array, PT_complex_array, PT_float, PT_real,
  PT_loadshape, PT_enduse , PT_void, PT_double,
  PT_complex, PT_enumeration, PT_set, PT_int16,
  PT_int32, PT_int64, PT_char8, PT_char32,
  PT_char256, PT_char1024, PT_object, PT_delegated,
  PT_bool, PT_timestamp, PT_double_array, PT_complex_array,
  PT_float, PT_real, PT_loadshape, PT_enduse
}
enum  RANDOMTYPE {
  RT_INVALID = -1, RT_DEGENERATE, RT_UNIFORM, RT_NORMAL,
  RT_LOGNORMAL, RT_BERNOULLI, RT_PARETO, RT_EXPONENTIAL,
  RT_SAMPLED, RT_RAYLEIGH, RT_WEIBULL, RT_GAMMA,
  RT_BETA, RT_TRIANGLE, RT_INVALID = -1, RT_DEGENERATE,
  RT_UNIFORM, RT_NORMAL, RT_LOGNORMAL, RT_BERNOULLI,
  RT_PARETO, RT_EXPONENTIAL, RT_SAMPLED, RT_RAYLEIGH,
  RT_WEIBULL
}

Functions

OBJECTgl_create_object (CLASS *oclass)
 Create an object in the core.
void * gl_get_addr (OBJECT *obj, char *name)
 Get a pointer to the data of an object property (by name).
template<class T>
void gl_get_value (OBJECT *obj, char *propname, T &value)
 Get the typed value of a property.
char * gl_global_getvar (char *name)
 Get the string value of global variable.
char * gl_name (OBJECT *my)
 Get the name of an object.
int gl_set_parent (OBJECT *obj, OBJECT *parent)
 Set the parent of an object.
int gl_set_rank (OBJECT *obj, unsigned int rank)
 Promote an object to a higher rank.
template<class T>
void gl_set_value (OBJECT *obj, char *propname, T &value)
 Set the typed value of a property.
void gl_throw (char *msg,...)
 Throw an exception using printf-style arguments.


Typedef Documentation

typedef char FUNCTIONNAME[64]

Object name.

the name of a function (not used)

Definition at line 409 of file gridlabd.h.


Enumeration Type Documentation

type of machine

Enumerator:
MPT_TIME  pulses are of fixed time (either total period or on-time duration); power is energy/duration
MPT_POWER  pulses are of fixed power; duration is energy/power
MPT_TIME  pulses are of fixed time (either total period or on-time duration); power is energy/duration
MPT_POWER  pulses are of fixed power; duration is energy/power

Definition at line 638 of file gridlabd.h.

Enumerator:
MT_ANALOG  machine output an analog signal
MT_PULSED  machine outputs pulses of fixed area with varying frequency to match value
MT_MODULATED  machine outputs pulses of fixed frequency with varying area to match value
MT_QUEUED  machine accrues values and output pulses of fixed area with varying frequency
MT_SCHEDULED  machine output values on a schedule
MT_ANALOG  machine output an analog signal
MT_PULSED  machine outputs pulses of fixed area with varying frequency to match value
MT_MODULATED  machine outputs pulses of fixed frequency with varying area to match value
MT_QUEUED  machine accrues values and output pulses of fixed area with varying frequency

Definition at line 631 of file gridlabd.h.

Enumerator:
NM_PREUPDATE  notify module before property change
NM_POSTUPDATE  notify module after property change
NM_RESET  notify module of system reset event
NM_PREUPDATE  notify module before property change
NM_POSTUPDATE  notify module after property change
NM_RESET  notify module of system reset event

Definition at line 459 of file gridlabd.h.

Enumerator:
PA_PUBLIC  property is public (visible, saved, and loaded)
PA_REFERENCE  property is FYI (visible and saved, but not loaded
PA_PROTECTED  property is semipublic (visible, but not saved or loaded)
PA_PRIVATE  property is nonpublic (not-visible, saved or loaded)
PA_PUBLIC  property is public (visible, saved, and loaded)
PA_REFERENCE  property is FYI (visible and saved, but not loaded
PA_PROTECTED  property is semipublic (visible, but not saved or loaded)
PA_PRIVATE  property is nonpublic (not-visible, saved or loaded)

Definition at line 412 of file gridlabd.h.

Enumerator:
PT_void  the type has no data
PT_double  the data is a double-precision float
PT_complex  the data is a complex value
PT_enumeration  the data is an enumeration
PT_set  the data is a set
PT_int16  the data is a 16-bit integer
PT_int32  the data is a 32-bit integer
PT_int64  the data is a 64-bit integer
PT_char8  the data is NULL -terminated string up to 8 characters in length
PT_char32  the data is NULL -terminated string up to 32 characters in length
PT_char256  the data is NULL -terminated string up to 256 characters in length
PT_char1024  the data is NULL -terminated string up to 1024 characters in length
PT_object  the data is a pointer to a GridLAB object
PT_delegated  the data is delegated to a module for implementation
PT_bool  the data is a true/false value, implemented as a C++ bool
PT_timestamp  timestamp value
PT_double_array  the data is a fixed length double[]
PT_complex_array  the data is a fixed length complex[]
PT_float  the data is a fixed length array of object pointers

Single-precision float

PT_real  Single or double precision float ~ allows double values to be overriden.
PT_loadshape  Loadshapes are state machines driven by schedules.
PT_enduse  Enduse load data.
PT_void  the type has no data
PT_double  the data is a double-precision float
PT_complex  the data is a complex value
PT_enumeration  the data is an enumeration
PT_set  the data is a set
PT_int16  the data is a 16-bit integer
PT_int32  the data is a 32-bit integer
PT_int64  the data is a 64-bit integer
PT_char8  the data is NULL -terminated string up to 8 characters in length
PT_char32  the data is NULL -terminated string up to 32 characters in length
PT_char256  the data is NULL -terminated string up to 256 characters in length
PT_char1024  the data is NULL -terminated string up to 1024 characters in length
PT_object  the data is a pointer to a GridLAB object
PT_delegated  the data is delegated to a module for implementation
PT_bool  the data is a true/false value
PT_timestamp  timestamp value
PT_double_array  the data is a fixed length double[]
PT_complex_array  the data is a fixed length complex[]
PT_float  the data is a fixed length array of object pointers

Single-precision float

PT_real  Single or double precision float ~ allows double values to be overriden.
PT_loadshape  Loadshapes are state machines driven by schedules.
PT_enduse  Enduse load data.

Definition at line 363 of file gridlabd.h.

enum RANDOMTYPE

Enumerator:
RT_INVALID  used to flag bad random types
RT_DEGENERATE  degenerate distribution (Dirac delta function); double only_value
RT_UNIFORM  uniform distribution; double minimum_value, double maximum_value
RT_NORMAL  normal distribution; double arithmetic_mean, double arithmetic_stdev
RT_LOGNORMAL  log-normal distribution; double geometric_mean, double geometric_stdev
RT_BERNOULLI  Bernoulli distribution; double probability_of_observing_1.
RT_PARETO  Pareto distribution; double minimum_value, double gamma_scale.
RT_EXPONENTIAL  exponential distribution; double coefficient, double k_scale
RT_SAMPLED  sampled distribution; unsigned number_of_samples, double samples[n_samples]
RT_RAYLEIGH  Rayleigh distribution; double sigma.
RT_WEIBULL  Weibull distribution; double lambda, double k.
RT_GAMMA  Gamma distribution; double alpha, double beta.
RT_BETA  Beta distribution; double alpha, double beta.
RT_TRIANGLE  Triangle distribution; double a, double b.
RT_INVALID  used to flag bad random types
RT_DEGENERATE  degenerate distribution (Dirac delta function); double only_value
RT_UNIFORM  uniform distribution; double minimum_value, double maximum_value
RT_NORMAL  normal distribution; double arithmetic_mean, double arithmetic_stdev
RT_LOGNORMAL  log-normal distribution; double geometric_mean, double geometric_stdev
RT_BERNOULLI  Bernoulli distribution; double probability_of_observing_1.
RT_PARETO  Pareto distribution; double minimum_value, double gamma_scale.
RT_EXPONENTIAL  exponential distribution; double coefficient, double k_scale
RT_SAMPLED  sampled distribution; unsigned number_of_samples, double samples[n_samples]
RT_RAYLEIGH  Rayleigh distribution; double sigma.
RT_WEIBULL  Weibull distribution; double lambda, double k.

Definition at line 707 of file gridlabd.h.


Function Documentation

OBJECT* gl_create_object ( CLASS *  oclass  )  [inline]

Create an object in the core.

Returns:
A pointer to the object
Parameters:
oclass  a pointer to the class of the object to be created

Definition at line 923 of file gridlabd.h.

void* gl_get_addr ( OBJECT obj,
char *  name 
) [inline]

Get a pointer to the data of an object property (by name).

Returns:
a pointer to the data
Parameters:
obj  the object whose property is sought
name  the name of the property being sought

Definition at line 948 of file gridlabd.h.

template<class T>
void gl_get_value ( OBJECT obj,
char *  propname,
T &  value 
) [inline]

Get the typed value of a property.

Returns:
nothing
Parameters:
obj  the object whose property value is being obtained
propname  the name of the property being obtained
value  a reference to the local value where the property's value is being copied

Definition at line 956 of file gridlabd.h.

References gl_name(), and gl_throw().

char* gl_global_getvar ( char *  name  )  [inline]

Get the string value of global variable.

Returns:
A pointer to a static buffer containing the value
Parameters:
name  pointer to string containing the name of the global variable

Definition at line 916 of file gridlabd.h.

char* gl_name ( OBJECT my  )  [inline]

Get the name of an object.

Returns:
a pointer to a static buffer containing the object's name
Parameters:
my  pointer to the object

Definition at line 892 of file gridlabd.h.

Referenced by gl_get_value(), gl_set_value(), and house_e::sync_thermostat().

int gl_set_parent ( OBJECT obj,
OBJECT parent 
) [inline]

Set the parent of an object.

Returns:
the rank of the object after parent is set
Parameters:
obj  the object whose parent is being set
parent  the parent that is being set

Definition at line 932 of file gridlabd.h.

int gl_set_rank ( OBJECT obj,
unsigned int  rank 
) [inline]

Promote an object to a higher rank.

Returns:
the old rank of the object
Parameters:
obj  the object whose rank is being set
rank  the new rank of the object

Definition at line 940 of file gridlabd.h.

template<class T>
void gl_set_value ( OBJECT obj,
char *  propname,
T &  value 
) [inline]

Set the typed value of a property.

Returns:
nothing
Parameters:
obj  the object whose property value is being obtained
propname  the name of the property being obtained
value  a reference to the local value where the property's value is being copied

Definition at line 969 of file gridlabd.h.

References gl_name(), and gl_throw().

void gl_throw ( char *  msg,
  ... 
) [inline]

Throw an exception using printf-style arguments.

Returns:
Does not return

Definition at line 904 of file gridlabd.h.

Referenced by gl_get_value(), and gl_set_value().


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