Integration with a Postgres Database
Historically, the primary means of taking data outside of GridLAB-D™ and using it to define a parameter value was through the use of a "player" file (TODO - API docs - Add link to appropriate documentation when complete). This file was specially CSV-formatted with a timestamp in the first column and a value to play at that time in the second. GridLAB-D™ would read in this file and, where referenced in the model, apply the values to the specified parameter. Similarly, through the use of recorders (TODO - API docs - Add link to appropriate documentation when complete), it is possible to write parameter values out to a specially-formatted CSV.
Though GridLAB-D™ has had a modest database integration in the past, with the current Python API it is much easier to create a custom integration for any number of databases. Depending on the need of the application, the database could be used both to play in data as well as collect data. Databases are intended to be used for data management and their use in GridLAB-D™ provides all of the expected benefits of a centralized resource: everybody on the analysis team can access the data to ensure consistent inputs and an easily sharable set of outputs.
This example uses the popular Postgres database to store a set of thermostat inputs that are to be applied to a select number of houses in the model while also collecting the indoor air temperature for all houses in the model. At the conclusion of the script, a graph is made of the collected indoor air temperature. In this example, the thermostat setpoint values are generated within the script but in the more general case, some external analysis process would likely generate these values and pre-load them into the database.