Implementation

We implemented a middleware based on Ptolemy II with extensions that allow coupling clients to Ptolemy II and exchange data during run-time. A client can be a simulation program such as EnergyPlus or MATLAB/Simulink. Future versions will include interfaces to Dymola and BACnet compatible Building Automation Systems (BAS).

Ptolemy II synchronizes the exchanged data. It can also be used to implement models directly in Ptolemy II using actor models from Ptolemy II's library and it can be used to visualize during run-time the system evolution. Using Ptolemy II allows us to reuse and extend tested software components for the synchronization and process visualization. Its modular extensible structure will allow future use of the BCVTB for other research applications, such as the interaction between wireless controls networks and building energy systems.

All communication between the clients is done through Ptolemy II. Each client is represented by an actor in Ptolemy II. The actors communicate with the simulation programs using BSD sockets. The communication with the BAS will be done using BACnet commands. A C library is distributed with the BCVTB that allows clients to receive the BSD socket address, and to exchange data with Ptolemy II using BSD sockets.

The figure below shows a system model in Ptolemy II that links EnergyPlus with MATLAB/Simulink. In this example, the building and HVAC system are simulated in EnergyPlus which is called by the actor with name EnergyPlus, and the controller is simulated in MATLAB/Simulink which is called by the actor with name Controller. The actor with name Plotter provides an online plot during the simulation. The SDF Director in the top-left corner controls the time stepping, the data synchronization and, optionally, synchronizes the simulation to real-time.

ptolemyEPlusSimuMac.png

The following sections describe the implementation in more detail

bcvtb: Implementation (last edited 2008-03-14 04:55:21 by MichaelWetter)