Programmable logic controllers (plc)
[Runtime modules]


Detailed Description

The PLC module can load any DLL that has the following exports.

The data structure must conform to the following structure:

    struct {
     char *name;
     enum {DT_INTEGER=6, DT_DOUBLE=1} type;
     void *addr;
    } data[];
with the last entry having a NULL name (this is very important).

The compiler will automatically create a conforming DLL from a .plc file having the following typical structure

See Machine Implementation for an example of PLC code


Modules

 Communication networks (comm)
 Messages are sent from one PLC object to another using PLC code.
 Machine implementation
 The machine object implements the PLC code.

Functions

int plc::create ()
 Create a new object.
EXPORT int create_plc (OBJECT **obj, OBJECT *parent)
int plc::init (OBJECT *parent)
 Initialize the new object.
EXPORT int init_plc (OBJECT *obj)
 plc::plc (MODULE *mod)
 Register the new object class and construct the default object properties.
TIMESTAMP plc::sync (TIMESTAMP t0, TIMESTAMP t1)
 Synchronize the object.
EXPORT TIMESTAMP sync_plc (OBJECT *obj, TIMESTAMP t0)

Variables

static plcplc::defaults = NULL
 a pointer to the default values for new objects
static CLASSplc::oclass = NULL
 a pointer to the registered object class definition


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