Coupling GenOpt, Energyplus and Daysim

10 posts / 0 new
Last post

Greetings all!
I am attempting to optimize the passive design of a building using GenOpt as the optimizer, EnergyPlus as the primary energy model platform, and daylight reports from Daysim (an identical model to the Eplus model) which feed into the Eplus model.Each iteration dictated by GenOpt would need to simulate in Daysim and finish before simulating in Eplus.I am using a 'Master' batch file, referenced by GenOpt, to call Daysim and then Eplus.This process works when run straight from the batch file, but when run through GenOpt it does not create the temporary working directory correctly (.expidf and .err files missing), and so it crashes during the first iteration, saying ".err file does not exist".Simplifying the task to just optimize Eplus, but through a batch file, has the same result.The command line I've been working with consists of 3 parts: Call I've tried countless different variations of this command line but cant figure it out!
Has anyone optimized an EnergyPlus model through GenOpt using a batch file before? Or know what the command line might look like to do that?
Any ideas welcome!
Thanks,Tavis.

Tavis Wells's picture
Offline
Joined: 2014-03-15
Reputation: 0

Hello Tavis,

Khaled Nassar presented in 2012 at the Radiance Workshop a process for
optimization of a Radiance model using GenOpt that references a batch
file. It might be useful to you.

Presentation (starts on p. 24):
http://radiance-online.org/community/workshops/2012-copenhagen/Day1/Nassar/Presentation3.pdf
Recording:
http://radiance-online.org/community/workshops/2012-copenhagen/Day1/Nassar/KNassarGenOpt.mp3

Alstan

On Fri, 14 Mar 2014 06:48:45 -0400, Tavis Wells
wrote:

J. Alstan Jakubiec's picture
Joined: 2014-03-15
Reputation: 0

Look at RunDirMulti.bat that comes with EnergyPlus (in the main
EnergyPlus folder). It loops through a list of files and creates
separate temp directories for a series of parallel runs. You should be
able to borrow from this or adapt it to your purposes.
Mike

Michael J. Witte's picture
Joined: 2011-10-01
Reputation: 0

Hi Tavis,

The lines below are from the "EnergyPlusWinXP.cfg" file that comes with GenOpt. Apparently GenOpt does use a batch file (customized RunEPlus.bat) to run E+. I think your best approach would be to modify the RunEPlus.bat file (or the RunEPlusParallel.bat file in GenOpt), and insert the part that runs DaySim in the same way that the other E+ preparatory steps are done...

**
/* Specifying how to start the simulation program.
In "Command", only those words in %xx% are
replaced (possibly with empty Strings).
*/
SimulationStart
{
// The command line below calls a custom version of RunEPlus.bat.
// This is needed to run multiple EnergyPlus simulations in parallel,
// because the standard version writes files to the EnergyPlus program
// directory, and hence multiple simulations would access the same files.
Command = "cmd /x /c \"start /D\"%Simulation.Files.Input.Path1%\" /WAIT /MIN call \".\\RunEPlusParallel.bat\" %Simulation.Files.Input.File1% %Simulation.CallParameter.Suffix%\"";
WriteInputFileExtension = false;
}
**

Cheers,

Yi

Yi Zhang's picture
Offline
Joined: 2011-10-02
Reputation: 0

Hi, Thank you for your replies!

Alstan,
Yes, Khaled's tutorial for GenOpt + Radiance has been very helpful. I think the same input file structure could be used, plus the Daysim Header file.

Mike,
This RunDirMulti.bat looks like it would be used to simulate a batch of pre-made EnergyPlus models in parallel, is this right? Or does it enable 1 model to run subsequent iterations? I need one iteration to finish before the next starts, so GenOpt can make its systematic changes to the model.

Yi,
I've tried copy pasting the Daysim batch file command lines in at the start of the RunEplus.bat so that it runs and completes before the Eplus model. This appears to work when run from the command shell, but, again, not when attempted through GenOpt. I think it comes back to Eplus and GenOpt- not creating temporary directories properly when called through a batch file (even following the command lines from GenOpts example files)?

Best regards,
Tavis.

Tavis Wells's picture
Offline
Joined: 2014-03-15
Reputation: 0

Hi Tavis,

Hmm, that's mysterious. Do you share your batch file(s) with the group? I cannot see any problems from Java's (GenOpt's language) point of view...

Cheers,

Yi

Yi Zhang's picture
Offline
Joined: 2011-10-02
Reputation: 0

Hi Yi,

Very mysterious! Yip I've attached the two .cfg file I've tried (one based on the Eplus.cfg example file; the other based on the batchSimulation.cfg file), and the Master.bat file with the various command lines I've tried (as a word doc- email wouldn't allow to send .bat).
And the .ini and command.txt if that helps.

Thank you for your interest and help!

Best regards,
Tavis.

Tavis Wells's picture
Offline
Joined: 2014-03-15
Reputation: 0

The problem is from wrapping the EPlusRun.bat in another batch file. Try use the third command-line in "IntegrateDaysim_EnergyPlus-7-2-0-Win7.cfg", i.e.

Command = "cmd /C \"\"D:\\MBSc500\\GenOpt\\IntegrateDaysim\\IntegrateDaysim_Master.bat\" \"%Simulation.Files.Input.File1%\" \"%Simulation.CallParameter.Suffix%\"\"";

And then change the call line in IntegrateDaysim_Master.bat to:

call "D:\MBSc500\GenOpt\IntegrateDaysim\RunEPlus.bat" %1 %2

And see if it works.

Cheers,

Yi

Yi Zhang's picture
Offline
Joined: 2011-10-02
Reputation: 0

Yi,

No luck, the same error came up.
I'm pretty new at this scripting business but as I understand it, the %1 and %2 are variables that the 'IntegrateDaysim_Master.bat' will substitute- the %1 for the model specified in the .cfg file (ChMod3.idf), and the %2 for the weather file specified in the .cfg. Is this correct?

Regards,
Tavis.

Tavis Wells's picture
Offline
Joined: 2014-03-15
Reputation: 0

%1 and %2 represents the two arguments passed to IntegrateDaysim_Master.bat. For E+ simulation they are the idf the epw file names. I've tried a wrapper batch file by modifying one of GenOpt's examples; and it worked fine. Here are my modifications:

== wraprun.bat in C:\GenOptV3-1-0\example\energyplus\7_2_0\GPSHookeJeeves\ ==
call C:/EnergyPlusV7-2-0-64/RunEPlus.bat %1 %2

== EnergyPlus-7-2-0-Win7.cfg in C:\GenOptV3-1-0\cfg\ ==
...
SimulationStart
{
// The command line below calls RunEPlus.bat.
Command = "cmd /C \"C:/GenOptV3-1-0/example/energyplus/7_2_0/GPSHookeJeeves/wraprun.bat %Simulation.Files.Input.File1% %Simulation.CallParameter.Suffix%\"";
WriteInputFileExtension = false;
}

== optWin7.ini in C:\GenOptV3-1-0\example\energyplus\7_2_0\GPSHookeJeeves\ ==
...
Configuration {
File1 = "..\\..\\..\\..\\cfg\\EnergyPlus-7-2-0-Win7.cfg";
}
...

Your problem may now come from moving RunEPlus.bat out of the E+ folder...

Yi

Yi Zhang's picture
Offline
Joined: 2011-10-02
Reputation: 0