A framework to couple Matlab with EnergyPlus and solve simulation-based optimization problems.
-
Create environment variables
- Set environment variable ENERGYPLUS and point it to the location of the E+ installed folder (e.g. C:\EnergyPlusV8-9-0\ ).
- Create IO folder in E+ installation with two subfolders "Input" and "Output".
- Copy building.idf in the Input folder.
-
Alter the batch file.
- Find RunEPlus batch file in E+ installation.
- Replace set program_path=%~dp0 with set program_path="%ENERGYPLUS%".
- Replace set input_path=ExampleFiles\ with set input_path=%program_path%IO\Input.
- Replace set output_path=ExampleFiles\Outputs\ with set output_path=%program_path%IO\Output\
idfread(filename) -- Reads and parses IDF file in a structure array.
idfwrite(filename) -- Write IDF file from structure array.
runep(filename, epwfilename) -- Runs E+ process directly in Matlab given .IDF and .EPW (weather) files.
Problem definition: We try to optimize HVAC heating and cooling set points in office spaces with respect to energy savings and occupants' thermal comfort.
-
HVAC_opt_multiobjective.m -- We formulate the objetive functions as the output of EnergyPlus simulation
-
ga_run.m -- We solve the problem using a genetic algorithm solver (i.e. NSGA-II)
The figure below is an illustration of the optimization process:
For detailed problem formulation and case study results see here.
The framework can be applied in a variety of single or multi-objective building energy optimization problems, such as retrofit optimization with respect to energy and first costs, or blind opening and visual comfort to name a few.