-
Notifications
You must be signed in to change notification settings - Fork 31
Coding guide
The coding guide is intended for GridLAB-D developers of makefiles, maintenance scripts, modules, classes, and infrastructure code.
The makefiles are built by autotools using the files Makefile.am, aminclude.mk, configure.ac, custom.mk, and modules.mk. In addition, auxiliary support files are located in build-aux/.
The shell script install.sh is used to setup the host system to build GridLAB-D. It also uses auxiliary support files located in build-aux/. Some systems also require scripts and tools available in the third_party/ and utilitie/s folders.
Modules are defined in folders using the module name. Depending on their age, modules use different core APIs, as shown in Table 1.
Table 1 - Module core API versions
| Module name | API Version | Remarks |
|---|---|---|
| assert | 3 | Older classes use APIv2 |
| climate | 2 | |
| commercial | 2 | |
| generators | 2 | |
| industrial | 3 | |
| influxdb | 3 | |
| market | 2 | |
| mysql | 3 | |
| optimize | 2 | |
| powerflow | 2 | |
| powernet | 3 | |
| reliability | 2 | |
| revenue | 3 | |
| tape | 1 | |
| transactive | 3 |
APIv3 is used for all new modules as of GridLAB-D 4.0. This API supports a C++ class library wrapped around APIv2 callback functions for module implementation.
Table 2: Module Implementation Template for APIv3
| File | Purpose | Remarks |
|---|---|---|
| Makefile.mk | Module makefile | Specifies how module is built |
| main.cpp | Module main | Includes main, initialization, and termination code |
| .h | Module header | Includes all module headers and core linkage headers |
| .h | Class header | Includes declaration of class and supporting data types |
| .cpp | Class implementation | Includes implementation of class |
APIv2 is used by modules developed between GridLAB-D 2.0 and GridLAB-D 3.2. This API supports C and C++ style callback functions for module implementation. APIv2 is obsolete. Please refer for GridLAB-D 3.2 documentation for details.
APIv1 is used by modules developed before GridLAB-D 2.0. This API supports C-style callback functions only for module implementation. APIv1 is obsolete. Please refer to GridLAB-D 1.3 documentation for details.
Copyright © 2020-2022, Regents of the Leland Stanford Junior University
This site is maintained by SLAC GISMo at SLAC National Accelerator National Laboratory, which is operated by Stanford University for the US Department of Energy under Contract DE-AC02-76RL00515.