Skip to content
This repository was archived by the owner on Sep 27, 2023. It is now read-only.

Coding guide

David P. Chassin edited this page May 26, 2020 · 3 revisions

The coding guide is intended for GridLAB-D developers of makefiles, maintenance scripts, modules, classes, and infrastructure code.

Makefiles

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/.

Maintenance Scripts

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.

GridLAB-D Modules

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

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

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

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.

GridLAB-D Classes

Infrastructure

Containers

Continuous Integration

Utilities

File Converters

Subcommands

Clone this wiki locally