Plaid implementation overview
This page will provide an overview of how Plaid is implemented. The goal is for an engineering team to be able to get an idea of what it takes to implement Plaid in your system, before diving into the full technical documentation.
Platform operability
Plaid is implemented as a microservice and can run in either Windows or Linux operating systems. It runs as a standalone executable, and exposes interfaces to connect to external systems, in particular the utility VTN and the customer's device management systems.
Licensed users receive the source code to Plaid (written in C++), which they may build using the windows or linux build guides.
Key components
The important parts of Plaid are:
- OpenADR implementation: this is the majority of the code base and the part that does not need to be touched by users. It fully implements OpenADR "under the hood", taking care of XML translations, scheduling, message formatting, OpenADR logic, VTN communications, etc.
- Config file: this file contains configurations required for each VEN stood up by the customer, for example the IP address of the VTN to connect to, the VEN ID, etc.
- Plugin: the plugin can be thought of as the translation layer between OpenADR functions and the customer's systems. It exposes callback functions that execute when required by OpenADR, e.g.
onEventStart()
will trigger when an OpenADR event is starting. - Management API: allows for programmatic control and monitoring of Plaid, e.g. checking status, restarting, setting schedules, etc.
As part of each instance, the configuration is updated with the name and url of the VTN to try to connect to. When built and run, Plaid will automatically reach out and form that connection. For most programs, there is some out of band communication involved in the setup process. For example, the VTN owner will assign a VENID that needs to be added to Plaid. Reach out to each individual program owner to determine the model they use - it should be normalized for them and easy to follow.
Config file
The config file holds all the configurable aspects of Plaid, perhaps most importantly the details for connecting to a VTN - e.g. VTN ID, Url, certificates, etc. It also contains a number of useful switches and options for plaid operation and behavior, such as logging and polling. This file will be updated for each version of Plaid.
Plugin
Within the plugin, a number of functions are exposed to allow interaction with the OpenADR implementation as needed. Of the following list, only OnEventIntervalStart and OnEventComplete need to implemented in order for the product to gain OpenADR certification. Other functions should be implemented as required to comply with the needs of specific utility VTNs, which can vary between communicating simple events or requiring reporting.
Plugin functions
Events
- OnDistributeEventStart
- OnDistributeEventComplete
- OnEvent
- OnEventStart
- OnEventIntervalStart
- OnEventComplete
- OnEventCancel
- OnEventArchive
Read more on how to implement events in Plaid.
Reports
- OnRegisterReports
- OnPeriodicReportStart
- OnPeriodicReportComplete
- OnQueryIntervals
Read more on how to implement reports in Plaid.
Status related
- OnRegister
- OnError
- heartbeat callback
Plaid ships with a default plugin that uses the functions to pass JSON messages via HTTP POST to the customer's system. The default plugin exposes a number of the Event functions, and can be extended to include the Report functions. The HTTP endpoint is configured through the plugin config file. While most customers use the default HTTP implementation, the Plugin may be updated to use any messaging system the customer prefers.
VEN Management API
The VEN Management API exposes an API that allows programmatic management, updating and monitoring of the VEN. Functions exposed are:
VEN Management API functions
Registration
- Query Registration
- Create Party Registration
- Cancel Party Registration
- Clear Registration
- Set VenID
VEN Control
- Start Ven
- Stop Ven
- Status
Events
- Request Event
- Clear Events
- Opt Event
- Created Event
Opt Schedules
- Create Opt Schedule
- Cancel Opt Schedule