File Exchange

image thumbnail

EnergyPlus Co-simulation Toolbox

version 1.2.3.1 (73.6 MB) by Jiri Dostal
Co-simulation of EnergyPlus models in Matlab/Simulink.

32 Downloads

Updated 20 Feb 2020

GitHub view license on GitHub

Description
---------------
The toolbox facilitates simultaneous simulation of EnergyPlus and Matlab (co-simulation). The main component is the mlep class containing all the necessary tools to configure and run EnergyPlus co-simulation within the Matlab environment.

System Requirements
-----------------------------
* Windows. The toolbox has only been tested for Windows, but considerable preparations for other OS has already been done.
* EnergyPlus installed. You can obtain the software here https://energyplus.net/. If you install the EnergyPlus to the default location ('C:\EnergyPlusVx-x-x') then it might be detected automatically by the toolbox.

Installation
--------
Obtain a copy of the toolbox from
* Matlab Add-on Manager
* or Mathworks File Exchange https://uk.mathworks.com/matlabcentral/fileexchange/69074-energyplus-co-simulation-toolbox
* or a GitHub repository https://github.com/dostaji4/EnergyPlus-co-simulation-toolbox/releases
and install.

Features
-----------
The toolbox contains:

* Parsing of the IDF file to determine co-simulation inputs/outputs.
* Automatic socket communication configuration (on localhost).
* Background start of the EnergyPlus process with an output to the Matlab command line.
* System Object implementation usable in Matlab & Simulink.
* Bus input/output integration for easy Simulink model setup.

Examples
-------------
See the GettingStarted.mlx guide delivered with the Matlab toolbox or the documentation residing under Help -> Supplemental Software -> EnergyPlus co-simulation toolbox

Troubleshooting
---------------------
* Always be sure that EnergyPlus itself is working. To check run "EP-Launch.exe" from the EnergyPlus installation folder and try running one of its examples (located at <EP folder>/ExampleFiles/).
* If you have issues with "EnergyPlus not found." run "setupMlep.m".
* If you have an issue with a "Vector to Bus" block not having its bus types correctly specified, run the model again. Bus objects should now be in the workspace and it should work.

Copyright (C) 2019, Jiri Dostal (jiri.dostal@cvut.cz)
All rights reserved.

This software builds on the free software by Truong Nghiem(truong@seas.upenn.edu), Willy Bernal (Willy.BernalHeredia@nrel.gov) and several other third-party open-source tools.

Cite As

Dostal, Jiri, and Tomas Baumelt. “Model Predictive Control for Buildings with Active One-Pipe Hydronic Heating.” E3S Web of Conferences, edited by S.I Tanabe et al., vol. 111, EDP Sciences, 2019, p. 04050, doi:10.1051/e3sconf/201911104050.

View more styles

Comments and Ratings (12)

Chenjie

Sun Ho Kim

Hi, I have not been able to run the MATLAB example file, mlepMatlab_example.m, without having Simulink installed.

When I installed a free trial of Simulink on 2019b, the MATLAB example file worked fine. However, my 2018b license that does not have Simulink will not run mlepMatlab_example.m.

It looks like the toolbox makes several function calls that require Simulink to be installed. Examples that I have seen are get_param and bdroot.

Is it possible to use this toolbox without Simulink installed? How might I get it working on my 2018b license?

Thank you

By the way, I am still confused with communication part, especially the usage of Socket.cfg... I would be grateful if you explain it a bit for me. Thanks!

Rui Guo

Jiri Dostal

@PaulaVanDenBrom I haven't found myself in such a need so far. Do you need to co-simulate multiple buildings simultaneously? With my only limited knowledge of parallelization, I don't find an extension for parfor trivial. What about having multiple buildings side-by-side in Simulink? I haven't tested this yet, to be honest, but that is one feature I'd like to work! So, be sure to let me know. EnergyPlus simulation is running in a separate OS process. Simulation of several buildings would result in several EnergyPlus processes. And the OS is responsible for loading multiple computation cores (how it does that? I don't have the slightest idea).

Is it possible to convert this code into a parfor loop?

Jiri Rehor

Updates

1.2.3.1

added short Troubleshooting section in this description.

1.2.3

Updated IDF files to EnergyPlus 9.2 version.
Followed Upgrade advisor to remove "not recommended" Matlab commands.
Fixed some documentation bugs.
Fixed a bug for ExternalInterface:Actuator.

1.2.2.2

CITE THE SOURCE WHEN USING THE TOOLBOX, please.

1.2.2.1

* minor bug in ExternalInterface:Actuator & ExternalInterface:Variable. Working now as intended.

1.2.2

* updated examples to EnergyPlus version 9.1.0
* disabled IDF simulation with mismatching EnergyPlus version.
* updated simulink models to Matlab r18b. It can still be simulated by older Matlab (enable this in Simulink preferences).
* minor fixes

1.2.1.1

* corrected a bug in the setup routine. Made first time use through Simulink end in a neverending loop.
* extended communication timeouts to accommodate for larger EP simulations

1.2.1

Added better documentation

1.2

### Added
* Load and Save routines.

### Changed
* Bus objects are now loading in the Init function callback. It should solve
the '_Missing Bus objects_' issues.
* Optimized IDF file parsing speed.
* Initialization no longer triggered fro

1.1.1.2

* compatibility issues in r18b

1.1.1.1

forgot to add the update binary

1.1.1

* using Matlab's internal JRE instead of searching for external one.

1.1

Added
* Bus objects now support signal names longer than 63 characters.
* Simulation and initialization are now considerably faster.
* A Vector to Bus block added.
* Browse buttons in the Simulink block mask.

1.0.3

Adding the binary to the repository code. Hopefully, the Matlab Add-on Explorer will detect it now.

1.0.2

Adding further info. Mainly for manual toolbox installation (The binary is obtainable at GitHub)

MATLAB Release Compatibility
Created with R2019b
Compatible with R2017a to any release
Platform Compatibility
Windows macOS Linux

examples/legacy_example

library