Microgrid Optimization using OpenFMB

  • What this demonstrates: Simplified Microgrid operation using the RTI Databus and Open Field Messaging Bus (OpenFMB). It shows the interactions between solar, energy storage, recloser and load.
  • What this allows the user to do: Island and reconnect a Microgrid with battery and solar. It also allows the user to control the functionality of the storage system. It is a simulated environment with a web page showing the status of different components.


With the increase of local energy generation, there is an increased need for microgrids to shift control of the electricity system to the end user, making it more decentralized and democratic. These solutions are providing large electricity consumers with energy independence and delivers power that is more reliable and storm-resilient.

Microgrids, and integration of DER units in general, introduce a number of operational challenges that need to be addressed in the design of control and protection systems.  To ensure that the present levels of reliability are not significantly affected and the potential benefits of Distributed Generation units are fully harnessed, the development of the system architecture is critical. For microgrids to work, efficient, advanced communications, control and metering infrastructure at the edge is needed. Interconnectivity between the devices to stabilize the voltage and frequency, offer plug-and- play capability for DERs and properly share the current state among them is critical. This is where RTI Connext and OpenFMB have a critical role. This Case + Code provides a framework and reference architecture for grid edge interoperability and distributed intelligence. The framework consists of business-driven, top-down business case, use case, data modeling and implementation approaches.

The following diagram illustrates communication within and between the different components.

Open Field Message Bus diagram

The grid of the future will require treating data differently; leveraging metadata and performing analysis locally to process the mountain of new data available from new technologies. Traditional headend systems have relied on relatively few sources of field information. New asset classes on the grid (AMI, smart inverters, PMUs, etc.) have added large amounts of data that can quickly and accurately describe the state of the power system. Traditional headend systems were not designed to process this increased volume of information as quickly as is needed to react to current operational scenarios and fully realize the benefits of these new grid edge assets.

Information no longer needs to go to the central system to enable decision making. Federated local data can be made securely available between assets at the grid edge to complement and enhance operations. OpenFMB nodes host applications that analyze information to develop a higher resolution of situational awareness, and provide the ability to affect local control in coordination with other operational decision making. For more information about OpenFMB check out the OpenFMB website

What This Example Does

This Microgrid demonstration utilizes simulators instead of actual devices and single technology choices rather than multiple to illustrate operational interactions between field devices and OpenFMB nodes. The simulator demo consists of the following simulators and processes:

  • PV simulator (solarsim)
  • ESS simulator (batterysim)
  • Load simulator (loadsim)
  • Recloser (reclosersim)
  • Load Balancer (islandbalancer)
  • The Visualization of the system (HMI)

The demonstration shows the communication capabilities between peer resources and is not focused on a detailed power simulation. A possible scenario is islanding by user tripping recloser:

  1. Start with Maintain mode - only when grid connected
  2. User trips recloser
  3. Islanded -- fake mode to set voltage source sent by recloser when tripped
  4. The Island balancer app sends setpoint to the battery to balance the system
  5. User closes recloser
  6. Leaving Islanding -- sent by recloser when recloser closes
  7. Then app sets Maintain mode sent by the recloser

The different applications are connected through the RTI Connext Databus as shown in the following picture. In other words, each application uses Connext DDS to share data through a logicaldatabus.


The data model for OpenFMB is available in the OpenFMB Github Repository. This demo uses version 2 of the OpenFMB data model.

Each application has a configuration file (.properties file) which configures the update rate and any other application specific

Solar Simulation (PV)


The solar simulation publishes the solar reading (current PV output) and the solar status. The solar status is currently not subscribed to by any application. The solar reading values are read from a file (load.tsv). To see the values changing the configuration files has a jitter configuration. The actual value is calculated as follow:

(InputValue (from) file * scale + offset) + ((jitterRange * random.double) – (jitterRange/2))

The publish interval is configured in the configuration file. By default, it is 2 seconds.

Load Simulator


The Load Publisher class simulates a 24-hour commercial load. The scenario is one of a factory that runs 2 full shifts 7 AM until midnight and then a third maintenance shift from midnight until 7 AM. KW values are published at a defined rate as defined in the configuration file. The default publish rate is 5 seconds. The simulator uses wall-clock time to build and index into a 24-hour table. The current hour and the next hour KW values are obtained, linear interpolation is performed between the 2 values, and a random jitter is applied. The purpose is to provide a reasonable 150 kW peak load curve for a simulated factory.

Battery Simulator


This simulator simulates the battery. The battery simulator subscribes to the control event and based on the battery state it will either maintain standby, charge, or discharge. The battery capacity as well as the charge rate can be configured in the properties file. The battery will publish status events and current reading (state of charge).

Recloser Simulator


The recloser simulates the connection to the grid. It subscribes to all the readings (PV, ESS, and load) as well as the control event. Depending on the event the recloser will island or connect to the grid and publish status and event information.

Balance Simulator


The balance controls the battery in case of islanding.


The HMI provides a web server which displays the system status. The visualization consists of both a server and client components. The server component collects all the traffic from the message bus and produces a packet for the HMI client to consume. The following tabular shows the microgrid status and resource information.

The top two boxes contain summary information. The bottom boxes are dynamic, such that when a new device comes online a new box becomes visible with the appropriate information.

The URL for the status page is localhost:8080


Running the Example

Download the Example

The example has been configured and tested on Ubuntu 16.04 64 bit. The example can be downloaded from the RTI Community Github repository. To run the example, you need the following

components installed on your system:

  • Google Chrome
  • Java

The OpenFMB directory also contains a evaluation copy of RTI Connext DDS Secure. To run the example you need to set the following environment variables:

NDDSHOME = <repository_path>/rti_connext_dds-5.3.0



If you already have an installation of RTI Connext DDS Secure, make sure that the environment variables mentioned above are correctly set.

RTI Connext DDS Secure is commercial software provided for use with this demonstration under an Evaluation License. Use of the demonstration is limited to uses compatible with that license. You can find the license in the installation at <repository_path>/rti_connext_dds-5.3.0/RTI_License_Agreement.pdf. A temporary license key to enable the software is included at <repository_path>/rti_connext_dds-5.3.0/rti_license.dat.

Run the Example

To start the demo, go to the scripts directory and run: ./simgo.sh

The script will start the ESS, Solar, Recloser, Balancer, Load simulator, and HMI applications. The script will bring up a Chrome web browser with the information from each component.

In the scripts directory you will also find scripts to start each of the components individually as well as the configuration files.

Building the Example

See README in the RTI Community Github repository on how to build the example code.Under the Hood

QoS Considerations

The QoS file for the example is in the scripts directory. Events and Control use secure reliable. Reading uses secure best effort.

Secure DDS Configuration

The example is configured to use RTI Connext DDS Secure. The certificates are in the cert folder. Each application has its own permissions file. There is also a generic permissions file (RTI_OPENFMB_DEMO_PERMISSIONS.p7s) which can be used for the admin console to visualize the system. Normally the generic permissions file would not be part of the system configuration. Instructions on how to configure Admin Console for the OpenFMB demo can be found in the instructions in the RTI Community Github repository.

Next Steps

Join the Community

Post questions on the RTI Community Forum.

Contribute to our Case + Code examples on RTI Community GitHub using these instructions.