NREL / OpenStudio

OpenStudio is a cross-platform collection of software tools to support whole building energy modeling using EnergyPlus and advanced daylight analysis using Radiance.
https://www.openstudio.net/
Other
501 stars 191 forks source link

3.7 Docker Image Energy Plus command does not recognize arguments on Mac OSX #5057

Closed rh0dium closed 10 months ago

rh0dium commented 10 months ago

Updated Issue

I'm working with nrel/openstudio:3.7.0 image and we are seeing an error I can't seem to figure out.

Running a basic energyplus command on docker image when the host is a Apple machine will fail

> docker run -it --rm -v /Volumes/Development/OpenSudio-ERI:/var/simdata/openstudio nrel/openstudio:3.7.0 bash
>> /usr/local/openstudio-3.7.0/EnergyPlus/energyplus -w ../../weather/USA_CO_Denver.Intl.AP.725650_TMY3.epw in.idf
The following argument was not expected: in.idf
Run with --help for more information.

Original Issue overview

Hey there,

I'm working with nrel/openstudio:3.7.0 image and we are seeing an error I can't seem to figure out.

Running the following command for OS-ERI in accordance with the documentation openstudio workflow/energy_rating_index.rb -x workflow/sample_files/base.xml

Current Behavior

It errors out and looking at the stderr-energyplus.log I am simply seeing this.

The following argument was not expected: in.idf
Run with --help for more information.

Note running this locally without the container does not show this behavior.

Expected Behavior

It should run the simulation

Steps to Reproduce

  1. Pull down the OS-ERI Repo - git clone https://github.com/NREL/OpenStudio-ERI.git
  2. Verify this works as expected without the image. openstudio workflow/energy_rating_index.rb -x workflow/sample_files/base.xml
  3. Next fire off a container docker run -it --rm -v /Volumes/Development/OpenSudio-ERI:/var/simdata/openstudio nrel/openstudio:3.7.0 bash
  4. Run the same command openstudio workflow/energy_rating_index.rb -x workflow/sample_files/base.xml

Possible Solution

It should be noted I'm running this on a Mac and there are reports but nothing on how it manifests itself

Details

Environment

Some additional details about your environment for this issue (if relevant):

Context

BTW - You all rock this is awesome stuff.

wenyikuang commented 10 months ago

Could you try to type openstudio --version in the container?

rh0dium commented 10 months ago

You bet -> 3.7.0+d5269793f1. This is the same as outside the container.

More details - Under the hood the energy_rating_index.rb is running effectively (many)

/Applications/OpenStudio-3.7.0/EnergyPlus/energyplus" -w "/Volumes/Development/OpenSudio-ERI/weather/USA_CO_Denver.Intl.AP.725650_TMY3.epw" in.idf

So continuing with your thoughts - Both inside and outside the container /usr/local/openstudio-3.7.0/EnergyPlus/energyplus --version

EnergyPlus, Version 23.2.0-7636e6b3e9

So this is specifically in energyplus it's not recognizing in.idf Which is so weird..

rh0dium commented 10 months ago

This is a Mac Issue - Could this be related to #5050 or #5022

Running this same tests on a Linux machine works as expected

> cd /tmp
> git clone https://github.com/NREL/OpenStudio-ERI.git
> docker pull nrel/openstudio:3.7.0
> docker run -it --rm -v /tmp/OpenStudio-ERI/:/var/simdata/openstudio nrel/openstudio:3.7.0 bash
>> openstudio workflow/energy_rating_index.rb -x workflow/sample_files/base.xml
>> find . -type f -name stderr-energyplus.log | xargs -i cat {}
EnergyPlus Completed Successfully.
EnergyPlus Completed Successfully.
EnergyPlus Completed Successfully.
EnergyPlus Completed Successfully.
EnergyPlus Completed Successfully.
rh0dium commented 10 months ago

Also tagging https://github.com/NREL/EnergyPlus/issues/10306 - This may be related. Or this one https://github.com/NREL/EnergyPlus/issues/10308

jmarrec commented 10 months ago

Running on mac M1 the amd64 image.

docker pull nrel/openstudio:3.7.0
docker run -it --rm --platform linux/amd64 nrel/openstudio:3.7.0 bash

Inside, all of this works fine.

curl -sLO https://raw.githubusercontent.com/NREL/EnergyPlus/develop/weather/USA_CO_Golden-NREL.724666_TMY3.epw
curl -sLO https://raw.githubusercontent.com/NREL/EnergyPlus/develop/testfiles/1ZoneUncontrolled.idf
/usr/local/openstudio-3.7.0/EnergyPlus/energyplus -w USA_CO_Golden-NREL.724666_TMY3.epw 1ZoneUncontrolled.idf

cp 1ZoneUncontrolled.idf in.idf
/usr/local/openstudio-3.7.0/EnergyPlus/energyplus -w USA_CO_Golden-NREL.724666_TMY3.epw in.idf

mv USA_CO_Golden-NREL.724666_TMY3.epw ..
/usr/local/openstudio-3.7.0/EnergyPlus/energyplus -w ../USA_CO_Golden-NREL.724666_TMY3.epw in.idf
jmarrec commented 10 months ago

Ok, finally finished cloning OpenStudio-ERI (1 GB!): testing at https://github.com/NREL/OpenStudio-ERI/commit/15b138a30b6ddb9ebf7ddab6a72b11d9365ab883

docker run -it --rm --platform linux/amd64 -v $(pwd)/OpenStudio-ERI:/var/simdata/openstudio nrel/openstudio:3.7.0 bash

root@3949bb3f9e79:/var/simdata/openstudio# openstudio workflow/energy_rating_index.rb -x workflow/sample_files/base.xml
HPXML: /var/simdata/openstudio/workflow/sample_files/base.xml
ERICalculation/Version: 2019ABCD
CO2IndexCalculation/Version: 2019ABCD
EnergyStarCalculation/Version: SF_National_3.2
IECCERICalculation/Version: 2021
ZERHCalculation/Version: SF_2.0
Generating 26 HPXMLs...
Running 12 Simulations...
Calculating results...
ERI: 78.47
CO2e Index: 152.49
IECC ERI: 74.51
ENERGY STAR Certification: FAIL
Zero Energy Ready Home Certification: FAIL
Completed in 163.4s.
root@3949bb3f9e79:/var/simdata/openstudio# find . -type f -name stderr-energyplus.log | xargs -i cat {}
EnergyPlus Completed Successfully.
EnergyPlus Completed Successfully.
EnergyPlus Completed Successfully.
EnergyPlus Completed Successfully.
EnergyPlus Completed Successfully.
EnergyPlus Completed Successfully.
EnergyPlus Completed Successfully.
EnergyPlus Completed Successfully.
EnergyPlus Completed Successfully.
EnergyPlus Completed Successfully.
EnergyPlus Completed Successfully.
EnergyPlus Completed Successfully.
EnergyPlus Completed Successfully.
EnergyPlus Completed Successfully.
EnergyPlus Completed Successfully.
EnergyPlus Completed Successfully.
EnergyPlus Completed Successfully.
EnergyPlus Completed Successfully.
EnergyPlus Completed Successfully.
EnergyPlus Completed Successfully.
EnergyPlus Completed Successfully.
EnergyPlus Completed Successfully.
EnergyPlus Completed Successfully.
EnergyPlus Completed Successfully.
EnergyPlus Completed Successfully.
EnergyPlus Completed Successfully.

Going into any of the dirs:

$ cd ./workflow/ERIIndexAdjustmentDesign/
$ /usr/local/openstudio-3.7.0/EnergyPlus/energyplus -w ../../weather/USA_CO_Denver.Intl.AP.725650_TMY3.epw in.idf # Works
$ /usr/local/openstudio-3.7.0/EnergyPlus/energyplus -w ../../weather/USA_CO_Denver.Intl.AP.725650_TMY3.epw --debug-cli in.idf

state.dataGlobal->AnnualSimulation = false,
state.dataGlobal->DDOnlySimulation = false,
state.dataStrGlobals->outDirPath = '',
state.dataStrGlobals->inputIddFilePath= '/usr/local/openstudio-3.7.0/EnergyPlus/Energy+.idd',

runEPMacro = false,
prefixOutName = eplus,

state.dataGlobal->runReadVars=false,
state.dataGlobal->outputEpJSONConversion=false,
state.dataGlobal->outputEpJSONConversionOnly=false,

suffixType=L,

state.dataGlobal->numThread=1,
state.files.inputWeatherFilePath.filePath='../../weather/USA_CO_Denver.Intl.AP.725650_TMY3.epw',
state.dataStrGlobals->inputFilePath='in.idf',
jmarrec commented 10 months ago

This looks like an issue specific to your machine. Unfortunately, I can't fix what I can't reproduce.

Things you could try:

Happy to keep helping as much as I can though, if you have more info to chew on.

rh0dium commented 10 months ago

@jmarrec Damn! Thanks for confirming it's on me. I don't expect you to help me anymore but here is the updates. Can you confirm your OS / Platform?

FWIW - Apple M1 Max / Version 14.1.2 (23B92)

So weird. Thanks again for confirming.

jmarrec commented 10 months ago

I have the same machine as yours, M1 Max. I think same OS version too (don't have the mac handy).

Edit: confirmed.

$ sw_vers
ProductName:        macOS
ProductVersion:     14.1.2
BuildVersion:       23B92

Can you try the command above with the --debug-cli added ?

 /usr/local/openstudio-3.7.0/EnergyPlus/energyplus -w ../../weather/USA_CO_Denver.Intl.AP.725650_TMY3.epw --debug-cli in.idf

Try also omitting in.idf

shorowit commented 10 months ago

I don't think @rh0dium mentioned it above, but it's worth pointing out that he was successfully running OpenStudio-ERI with OpenStudio 3.6. (Right?)

jmarrec commented 10 months ago

E+ 23.2.0 is the first release that uses the revamped CLI based on the modern C++ lib CLI11, https://github.com/CLIUtils/CLI11, and no longer the legacy ezOptionParser stuff (that was a plain C library).

One thing to try out might be to just run a ubuntu:20.04 docker, install the E+ CLI there (23.2.0 first, then 23.1.0 for comparison if 23.2.0 fails) and try it out. This really looks like it has nothing to do with OpenStudio or the OpenStudio docker image.

rh0dium commented 10 months ago

I have the same machine as yours, M1 Max. I think same OS version too (don't have the mac handy).

Edit: confirmed.

$ sw_vers
ProductName:      macOS
ProductVersion:       14.1.2
BuildVersion:     23B92

Can you try the command above with the --debug-cli added ?

 /usr/local/openstudio-3.7.0/EnergyPlus/energyplus -w ../../weather/USA_CO_Denver.Intl.AP.725650_TMY3.epw --debug-cli in.idf

Try also omitting in.idf

So --debug-cli did nothing

> /usr/local/openstudio-3.7.0/EnergyPlus/energyplus -w ../../weather/USA_CO_Denver.Intl.AP.725650_TMY3.epw --debug-cli in.idf
The following argument was not expected: in.idf
Run with --help for more information.

But when I ran without in.idf I got something

>  /usr/local/openstudio-3.7.0/EnergyPlus/energyplus -w ../../weather/USA_CO_Denver.Intl.AP.725650_TMY3.epw --debug-cli       

state.dataGlobal->AnnualSimulation = false,
state.dataGlobal->DDOnlySimulation = false,
state.dataStrGlobals->outDirPath = '',
state.dataStrGlobals->inputIddFilePath= '/usr/local/openstudio-3.7.0/EnergyPlus/Energy+.idd',

runEPMacro = false,
prefixOutName = eplus,

state.dataGlobal->runReadVars=false,
state.dataGlobal->outputEpJSONConversion=false,
state.dataGlobal->outputEpJSONConversionOnly=false,

suffixType=L,

state.dataGlobal->numThread=1,
state.files.inputWeatherFilePath.filePath='../../weather/USA_CO_Denver.Intl.AP.725650_TMY3.epw',
state.dataStrGlobals->inputFilePath='/usr/local/openstudio-3.7.0/EnergyPlus/energyplus',
rh0dium commented 10 months ago

@shorowit @jmarrec - That is correct this was working fine in OpenStudio 3.6

rh0dium commented 10 months ago

E+ 23.2.0 is the first release that uses the revamped CLI based on the modern C++ lib CLI11, https://github.com/CLIUtils/CLI11, and no longer the legacy ezOptionParser stuff (that was a plain C library).

One thing to try out might be to just run a ubuntu:20.04 docker, install the E+ CLI there (23.2.0 first, then 23.1.0 for comparison if 23.2.0 fails) and try it out. This really looks like it has nothing to do with OpenStudio or the OpenStudio docker image.

So should I create a new issue in the Energy Plus app - that seems more appropriate?

rh0dium commented 10 months ago

Added new ticket over on energy plus side. I think we can close this as I was able to replicate it on strictly the energyplus:23.2.0 container.