4

Run EnergyPlus in Matlab

I'm trying to run EnergyPlus in Matlab. I found mle+ but I could only find guides for the GUI.

Since I have to run many simulations with data previously calculated in a Matlab script, it could be easier to run E+ directly inside a loop statement.

I found out how to do in python (https://unmethours.com/question/22157...) but I couldn't find it in Matlab.

Thank you!

Gio's avatar
1.1k
Gio
asked 2017-11-07 03:31:53 -0500
yongqingzhao's avatar
939
yongqingzhao
updated 2017-11-28 21:56:37 -0500
edit flag offensive 0 remove flag close merge delete

Comments

2

Do you want to run E+ and Matlab synchronous that mean at each timestep EnergyPlus exchange data with Matlab mutually? Or, you want to call E+ in Matlab?

TianZhichao's avatar TianZhichao (2017-11-07 05:33:25 -0500) edit
1

For now, I just need to call E+ in Matlab. Could you make an example typing the code?

What if I want to exchange data?

Gio's avatar Gio (2017-11-07 06:19:51 -0500) edit
add a comment see more comments

2 Answers

3

You can use system or dos function to call RunEPlus.bat located in EnergyPlus directory. There are two ways rnning energyplus:

1. Runging RunEPlus.bat batch file

For example:
dos('D:\Your_EnergyPlus_installation_folder\RunEPlus.bat in(idf file name without idf extension) in(weather file without epw extension)')

system('D:\Your_EnergyPlus_installation_folder\RunEPlus.bat in(idf file name without idf extension) in(weather file without epw extension)')

2. Runing energyplus.exe

For example:

 system('C:\YOUR_ENERGYPLUS_INSTALLATION_FOLDER\EnergyPlus.exe -w weather_file.epw idf_file.idf')

where -w represents the weather file option. Without "-w" you only get a sizing run. Here are more details (https://github.com/NREL/EnergyPlus/bl...)

yongqingzhao's avatar
939
yongqingzhao
answered 2017-11-07 19:02:27 -0500, updated 2017-11-23 22:40:36 -0500
edit flag offensive 0 remove flag delete link

Comments

Hi, thanks for your answer but it's not working. I was successful typing this: system('C:\YOUR_ENERGYPLUS_INSTALLATION_FOLDER\EnergyPlus.exe -w weather_file.epw idf_file.idf') In my case: system('C:\EnergyPlusV8-5-0\EnergyPlus.exe -w SanFrancisco.epw Building1.idf')

where -w represents the weather file option. Without "-w" you only get a sizing run. Here are more details (https://github.com/NREL/EnergyPlus/bl...) Please change your answer.

Gio's avatar Gio (2017-11-08 05:31:26 -0500) edit
2

Running RunEPlus.bat can also work,my previous answer can not work may be bcause the file path of RunEPlus.bat is error and weather file name includes file extension!

yongqingzhao's avatar yongqingzhao (2017-11-08 06:51:14 -0500) edit

Perfect, thank you very much!

Gio's avatar Gio (2017-11-09 03:35:35 -0500) edit

Hi, I have the same problem. The running enegyplus.exe in Matlab works for me. However, instead of pushing the simulate button, I need it to be done automatically. Could you please tell me if you know how to make that run automatically?

yasamandadras's avatar yasamandadras (2021-11-03 12:43:16 -0500) edit

Sorry I can't help, I solved using python

Gio's avatar Gio (2022-02-21 02:48:13 -0500) edit
add a comment see more comments
0

You can also use this Matlab toolbox https://uk.mathworks.com/matlabcentra...

Jiri Dostal's avatar
1
Jiri Dostal
answered 2019-12-26 13:45:38 -0500
edit flag offensive 0 remove flag delete link

Comments

add a comment see more comments