From GridLAB-D Wiki
Jump to: navigation, search

 Proposed for review 

Forecasting is become a growing concern is the modeling of Smart Grid systems, and GridLAB-D must address the ability of agents to produce forecasts of their own behavior, or forecasts on behalf of other agents. This document is intended to open the discussion on just what capability is required and how it might be implemented at a conceptual level.

There are many problems for which the solutions require at least some forecasting capabilities. Optimization problems frequently require a forecast of the future expectations of load and resource availability given the current conditions. GridLAB-D currently does not implement such a capability, but could rather easily be extended to include it. This page describes the requirements and an approach to implementing forecasting in GridLAB-D.

General requirements

Forecast properties

The simplest forecast applies to a single property of a target object, such as the real power demand at an hourly interval for the next week. The forecasting data shall allow an object to generate or update a forecast as a part of the synchronization processes. The parameters required for a forecast shall include

a reference to the property to which the forecast applies
Number of values 
the count of the number of values in the forecast
Start time 
the time at which the forecast begins
Time step 
the time step between forecast values
an array of values the constitute the forecast

When a valid forecast is present for an object, the object flag OF_FORECAST shall be set. This shall be used by other objects to know that the object in question does have a forecast and that the forecast data is available.

Forecast implementation

Forecasting implementation shall be permitted either in the target object itself, or by an ancillary object that is associated with the target object. The forecasting implementation shall be model agnostic, i.e., it shall not presume any particular forecasting model or method.

Core design


A forecast data entity list pointer shall be added to the object header as

struct s_object_list {
  // ...
  FORECAST forecast;
  // ...

The forecast data entity shall be

typedef struct s_forecast {
  char1024 specification; // specification for the forecasting method
  PROPERTY *propref;
  int n_values; // number of forecast values
  TIMESTAMP starttime; // start of forecast data
  int32 timestep; // timestep in seconds
  double *data; // forecast values (n_values)
  struct s_forecast *next;

Forecasting API

FORECAST *forecast_create(OBJECT *obj, char* specs) 
creates a forecast using the specifications specs and appends it to the object obj.
FORECAST *forecast_find(OBJECT *obj, char *name) 
finds a forecast object.
double forecast_read(FORECAST *fc, TIMESTAMP *ts) 
reads the forecast fc for the time ts. If the forecast does not include a value for that time, the value returned in NaN.
void forecast_save(FORECAST *fc, TIMESTAMP *ts, int32 tstep, int n_values, double *data) 
save a new forecast to the forecast entity.