Mleplustutorial
Mleplustutorial
Contents
1 Introduction 2
2 System Requirements 3
3 Installation 4
3.1 WINDOWS . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
3.2 MAC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
3.3 MAnual Installation . . . . . . . . . . . . . . . . . . . . . . . 4
5 Other Examples 12
5.1 Legacy Example . . . . . . . . . . . . . . . . . . . . . . . . . 12
5.2 Green Scheduling vs. Uncoordinated Control . . . . . . . . . 13
1
5.3 MPC vs. Proportional Control . . . . . . . . . . . . . . . . . 13
1 Introduction
MLE+ is an open-source Matlab/Simulink toolbox for building energy sim-
ulation, analysis, optimization and control design. At the core of MLE+ are
co-simulation interfaces with multiple building energy simulation programs
such as EnergyPlus and Radiance. MLE+ also provides easy-to-use graphi-
cal frontends and standard workflows for common tasks, for instance model
identification and controller design. In addition, a BACnet interface is in-
cluded which allows for a straightforware and transparent implementation of
building controllers designed in Matlab/Simulink to real building systems.
Figure 1 illustrates the overall structure of MLE+.
MLE+ is designed for engineers and researchers who are familiar with
Matlab and Simulink and want to use these software tools in building energy
research. MLE+ is particularly useful for:
2
for buildings, in which the building simulation is carried out by ded-
icated simulation software, such as EnergyPlus, while the controllers
are implemented in Matlab or Simulink.
2 System Requirements
• Windows Operating System. Currently, MLE+ is only supported in
Windows. However, we are working in making MLE+ compatible in
the Linux and Mac OS platforms.
• EnergyPlus version 8.0.0 (latest). MLE+ should work well with pre-
vious versions of EnergyPlus: versions 7.0.0 and 6.0.0. However, it
has not been tested thoroughly. We strongly recommend to download
EnergyPlus 8.0.0 as the example files correspond to this version.
1
The GUI Layout Toolbox requires 2010a or future version of Matlab. If you find any
problems, please contact the authors for further assistance
3
3 Installation
1. Download the latest version from https://github.com/mlab/mlep_v1.1/zipball/master
or clone the repository https://github.com/mlab/mlep_v1.1
2. Extract all files to a directory in your computer. Call this folder /mlep.
3.1 WINDOWS
1. This will install the GUI Layout Toolbox and add the necessary paths
to the Matlab environment automatically. After that, the installation
screen in Figure 2 will appear. Here you need to specify the paths to
EnergyPlus main Directory and the path to the folder with Java bina-
ries. Also, this will replace your RunEPlus.batch file (in Windows).
3.2 MAC
1. This will install the GUI Layout Toolbox and add the necessary paths
to the Matlab environment automatically. After that, the installation
screen in Figure 3 will appear. Here you need to specify the paths to
EnergyPlus main Directory.
tool required to open the MLE+ front-end. If you run into some problems
installing try using the manual installation. You would need to follow this
instructions .
4
Figure 2: Windows MLE+ Installation Screen.
5
Figure 3: MAC OS MLE+ Installation Screen.
or not;
We will design a controller in MLE+ which monitors the angle and inten-
sity of the solar radiation incident on the West zone window. If the incident
solar radiation exceeds a certain threshold, the blinds will be deployed and
the shade angle will be set to reduce the possibility of glare.
6
4.2 The MLE+ Control Design Workflow
The control design workflow of MLE+ defines a sequence of steps for design-
ing a controller in Matlab for a building model simulated by EnergyPlus.
A graphical front-end is provided to support this workflow. To start the
front-end, execute the command mlep in Matlab. This will open a graphical
interface as shown in Figure 5.
• Click the button Select IDF file and select the file EMSWindowShadeControl.idf
located in the folder /ShadingProject.
• Click the button Select weather file and select the weather file
USA_IL_Chicago-OHare.Intl.AP.725300_TMY3.epw. We will use the
weather profile of Chicago for our simulation.
7
4.4 Configure Input and Output Variables Between Energy-
Plus and Matlab
We will set up the input and output variables to be exchanged between En-
ergyPlus and Matlab for co-simulation. An input variable serves as an input
to EnergyPlus at each step of the co-simulation, while output variables are
those which can be repeatedly read from EnergyPlus to monitor its internal
state.
8
inputs to EnergyPlus as these are the variables that we will control
through MLE+. Make sure your configuration is exactly the same as
the one shown in (Figure 8) and (Figure 9).
5. Once the input and output variables had been set, push the green
button Write Variables.cfg. This file will create a file with the com-
munication configuration between Matlab and EnergyPlus. It should
be printed in the Matlab command line.
9
Figure 8: Configuration of input variables to EnergyPlus.
1. Push the button Load Control File and select the file control_file_blind_angle.m.
This file contains the Matlab code for the shading controller.
2. View and edit this file by clicking the button Edit Control File. You
can also create a template file for your own feedback loop by clicking
on Create Control File. This creates the file controlFile.m.
The input and output variables specified by the user are referred to by
their aliases throughout the control file as shown in Figure 11. In the code
snippet shown in Figure 11 the value of the incident solar radiation is com-
pared against the threshold (100 W m−2 ) to determine if the shades will be
deployed.
10
Figure 10: MLE+ control design tab.
2. A Windows command window will open and will show the progress of
the simulation.
3. After the co-simulation has finished, MLE+ extracts and parses all
output variables generated by EnergyPlus, then lists them in a listbox
(see Figure 12). Select one or multiple variables, then click the button
Plot to display them on the screen.
4. You can also save the data to the Matlab workspace by clicking the
buttons Save all or Save Selected
Note that MLE+ decouples the simulation engine and the controller im-
plementation. This way we can tune the control scheme in Matlab, then
assess its performance by running multiple simulations without the need of
modifying the EnergyPlus file.
11
mcode.sty Demo
Figure 11: Matlab code snippet of the shading controller (notice alias vari-
ables).
For your convenience, a project file for the tutorial example is included
in the distribution. You can load the project file ShadingProject.prj and
switch directly to the tab Simulate to run a simulation of the control design.
5 Other Examples
5.1 Legacy Example
This folder contains the original example distributed with MLE+ Legacy.
This example does not make use of the MLE+ front end. You can run
12
Figure 12: Plot and analyze simulation results of EnergyPlus.
13