santoshphilip / eppy

scripting language for E+, Energyplus
MIT License
157 stars 67 forks source link

Fatal error running EnergyPlus in Linux using Eppy #389

Closed liuhz-github closed 1 year ago

liuhz-github commented 2 years ago

I am running EnergyPlus in Linux environment. All input files paths (.idd, .idf, .epw) have been properly defined. I am able to run EnergyPlus with the input files through the command lines.

However, when I try to run EnergyPlus through python script with eppy, the intermediate files (eplusout.expidf) are not generated and the program stops. It seems the ExapandObjects step is not successful. All folder permissions have been set to 0777.

Python scripts: from eppy.modeleditor import IDF iddfile = "/home/EnergyPlus-9.1.0-08d2e308bb-Linux-x86_64/Energy+.idd" IDF.setiddname(iddfile) epwfile = "USA_CA_San.Francisco.Intl.AP.724940_TMY3.epw" idfname = "/home/test.idf" idf = IDF(idfname, epwfile) idf.run(output_directory = '../', expandobjects=True)

Program Version,EnergyPlus, Version 9.1.0-08d2e308bb, YMD=2022.08.23 16:19, Fatal Input file path /home/eplus.expidf not found ...Summary of Errors that led to program termination: ..... Reference severe error count=0 ..... Last severe error= Warning: Node connection errors not checked - most system input has not been read (see previous warning). Fatal error -- final processing. Program exited before simulations began. See previous error messages. EnergyPlus Warmup Error Summary. During Warmup: 0 Warning; 0 Severe Errors. EnergyPlus Sizing Error Summary. During Sizing: 0 Warning; 0 Severe Errors. ***** EnergyPlus Terminated--Fatal Error Detected. 0 Warning; 0 Severe Errors; Elapsed Time=00hr 00min 0.14sec.

Please kindly advise! Thank you.

santoshphilip commented 2 years ago

I am not seeing the line

idf = IDF(idfname, epwfile)

in your script. Can you check ?

liuhz-github commented 2 years ago

Yes, I have this line, sorry for missing it out in my question. The problem is still there.

santoshphilip commented 2 years ago

Let us check if idf.run() works on your machine at all. Try this

Tell me if this runs

liuhz-github commented 2 years ago

It runs fine, after I substituted my idf file with Minimal.idf.

EnergyPlus Starting EnergyPlus, Version 9.1.0-08d2e308bb, YMD=2022.08.23 23:31 Adjusting Air System Sizing Adjusting Standard 62.1 Ventilation Sizing Initializing Simulation Reporting Surfaces Beginning Primary Simulation Initializing New Environment Parameters Warming up {1} Starting Simulation at 12/21 for DENVER_STAPLETON ANN HTG 99.6% CONDNS DB Initializing New Environment Parameters Warming up {1} Starting Simulation at 07/21 for DENVER_STAPLETON ANN CLG .4% CONDNS DB=>MWB Writing tabular output file results using HTML format. Writing final SQL reports EnergyPlus Run Time=00hr 00min 0.21sec EnergyPlus Completed Successfully.

santoshphilip commented 2 years ago

great ! So eppy runs the simulations. We need to find out why your simulation is not running.

try to run an file that uses the HVACTemplate from the example file, such as HVACTemplate-5ZoneBaseboardHeat.idf from ExampleFiles

again, just do idf.run() with no arguments (eppy will automatically set expandobjects=True )

Let us see if this runs

santoshphilip commented 2 years ago

If the steps from the previous comment work, then run your file with just idf.run() - no arguments

Let us see what happens

liuhz-github commented 2 years ago

I tried HVACTemplate-5ZoneBaseboardHeat.idf from ExampleFiles, but the same error occurred, that eplusout.expidf is not generated.

ExpandObjects Started. Begin reading Energy+.idd file. Done reading Energy+.idd file. ExpandObjects Finished. Time: 0.057 EnergyPlus Starting EnergyPlus, Version 9.1.0-08d2e308bb, YMD=2022.08.23 23:47 **FATAL:Input file path /home/eplusout.expidf not found EnergyPlus Run Time=00hr 00min 0.13sec Program terminated: EnergyPlus Terminated--Error(s) Detected.

santoshphilip commented 2 years ago

OK ... I'll do some testing here and let you know.

santoshphilip commented 2 years ago

I just tested it on a mac. It works for me The output looks like this:

(eppy3_pypi) Santoshs-MacBook-Pro:temp santosh$ python runidf.py 

/Applications/EnergyPlus-9-1-0/energyplus --weather /Users/santosh/Documents/coolshadow/temp/USA_CA_San.Francisco.Intl.AP.724940_TMY3.epw --output-directory /Users/santosh/Documents/coolshadow/temp --idd /Applications/EnergyPlus-9-1-0/Energy+.idd --expandobjects /Users/santosh/Documents/coolshadow/temp/in.idf

ExpandObjects Started.
 Begin reading Energy+.idd file.
 Done reading Energy+.idd file.
ExpandObjects Finished. Time:     0.045
EnergyPlus Starting
EnergyPlus, Version 9.1.0-08d2e308bb, YMD=2022.08.23 09:13
Initializing Response Factors
Calculating CTFs for "ROOF-1", Construction # 1
Calculating CTFs for "WALL-1", Construction # 2
Calculating CTFs for "FLOOR-SLAB-1", Construction # 4
Calculating CTFs for "INT-WALL-1", Construction # 5
Initializing Window Optical Properties
Initializing Solar Calculations
Allocate Solar Module Arrays
Initializing Zone Report Variables
Initializing Surface (Shading) Report Variables
Computing Interior Solar Absorption Factors
Determining Shadowing Combinations
Computing Window Shade Absorption Factors
Proceeding with Initializing Solar Calculations
Initializing Surfaces
Initializing Outdoor environment for Surfaces
Setting up Surface Reporting Variables
Initializing Temperature and Flux Histories
Initializing Window Shading
Computing Interior Absorption Factors
Computing Interior Diffuse Solar Absorption Factors
Computing Interior Diffuse Solar Exchange through Interzone Windows
Initializing Solar Heat Gains
Initializing Internal Heat Gains
Initializing Interior Solar Distribution
Initializing Interior Convection Coefficients
Gathering Information for Predefined Reporting
Completed Initializing Surface Heat Balance
Calculate Outside Surface Heat Balance
Calculate Inside Surface Heat Balance
Calculate Air Heat Balance
Initializing HVAC
Warming up
Warming up
Warming up
Warming up
Warming up
Warming up
Performing Zone Sizing Simulation
...for Sizing Period: #1 CHICAGO_IL_USA ANNUAL HEATING 99% DESIGN CONDITIONS DB
Warming up
Warming up
Warming up
Warming up
Warming up
Warming up
Performing Zone Sizing Simulation
...for Sizing Period: #2 CHICAGO_IL_USA ANNUAL COOLING 1% DESIGN CONDITIONS DB/MCWB
Adjusting Air System Sizing
Adjusting Standard 62.1 Ventilation Sizing
Initializing Simulation
Reporting Surfaces
Beginning Primary Simulation
Initializing New Environment Parameters
Warming up {1}
Warming up {2}
Warming up {3}
Warming up {4}
Warming up {5}
Warming up {6}
Starting Simulation at 01/14/2014 for RUNPERIOD 1
Initializing New Environment Parameters
Warming up {1}
Warming up {2}
Warming up {3}
Warming up {4}
Warming up {5}
Warming up {6}
Starting Simulation at 07/07/2015 for RUNPERIOD 2
Writing tabular output file results using HTML format.
Writing final SQL reports
EnergyPlus Run Time=00hr 00min  0.65sec
EnergyPlus Completed Successfully.
(eppy3_pypi) Santoshs-MacBook-Pro:temp santosh$ 
santoshphilip commented 2 years ago

The command line runs on the in.idf file Is eppy able to create the in.idf file at all. (eppy will also delete it at the end of the simulation) You might see the file appear if you do ls in.idf in a separate terminal as you run eppy in the first terminal

What kind of command line does eppy create - you will see it above your E+ messages when you run your script

santoshphilip commented 2 years ago

I am going to be offline for a couple of hours. Will check on any developments you have once I am back

liuhz-github commented 2 years ago

Actually, the eppy works perfect on my windows machine and one of my Linux Ubuntu machines, and the intermediate (in.idf and eplusout.expidf) files could be generated.

But it is not working, when I tested on some other Linux Ubuntu/intel machines, somehow the (in.idf and eplusout.expidf) file couldnot be generated.

The first few lines eppy create when I run my scripts are: /home/energyplus_installable/EnergyPlus-9.1.0-08d2e308bb-Linux-x86_64/energyplus --weather /home/energyplus_installable/EnergyPlus-9.1.0-08d2e308bb-Linux-x86_64/WeatherData/USA_CA_San.Francisco.Intl.AP.724940_TMY3.epw --output-directory /home/ --idd /home/energyplus_installable/EnergyPlus-9.1.0-08d2e308bb-Linux-x86_64/Energy+.idd --expandobjects /home/in.idf

Is eppy compatible with higher version of EnergyPlus, say latest version v9.6? I want to try if the problem goes away with version upgrade.

santoshphilip commented 2 years ago

I just noticed in your edited comment that you tried running in

/home and in /home/user

Can you try running in any folder that is not /home ideally run it in folder that it takes you to when you login to linux

Yes eppy is compatible with all versions of E+ As long as it get the right idd file, it will work

I don't think it is a E+ version issue. Something else is going on.

liuhz-github commented 2 years ago

I tried again, putting the EnergyPlus 9.1 installation folder, input files (epw, HVACTemplate-5ZoneBaseboardHeat.idf, pythonscript) into the folder when I login to linux Ubuntu, /home/myfolder, the situation remains unchanged.

Output: /home/myfolder/EnergyPlus-9.1.0-08d2e308bb-Linux-x86_64/energyplus --weather /home/myfolder/EnergyPlus-9.1.0-08d2e308bb-Linux-x86_64/WeatherData/USA_CA_San.Francisco.Intl.AP.724940_TMY3.epw --output-directory /home/myfolder --idd /home/myfolder/EnergyPlus-9.1.0-08d2e308bb-Linux-x86_64/Energy+.idd --expandobjects /home/myfolder/in.idf

ExpandObjects Started. Begin reading Energy+.idd file. Done reading Energy+.idd file. ExpandObjects Finished. Time: 0.058 EnergyPlus Starting EnergyPlus, Version 9.1.0-08d2e308bb, YMD=2022.08.24 00:56 **FATAL:Input file path /home/myfolder/eplusout.expidf not found EnergyPlus Run Time=00hr 00min 0.13sec Program terminated: EnergyPlus Terminated--Error(s) Detected. Traceback (most recent call last): File "/home/myfolder/.local/lib/python3.8/site-packages/eppy/runner/run_functions.py", line 374, in run check_call(cmd) File "/usr/lib/python3.8/subprocess.py", line 364, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['/home/myfolder/EnergyPlus-9.1.0-08d2e308bb-Linux-x86_64/energyplus', '--weather', '/home/myfolder/EnergyPlus-9.1.0-08d2e308bb-Linux-x86_64/WeatherData/USA_CA_San.Francisco.Intl.AP.724940_TMY3.epw', '--output-directory', '/home/myfolder', '--idd', '/home/myfolder/EnergyPlus-9.1.0-08d2e308bb-Linux-x86_64/Energy+.idd', '--expandobjects', '/home/myfolder/in.idf']' returned non-zero exit status 1.

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "runeplus_serial.py", line 40, in idf.run() File "/home/myfolder/.local/lib/python3.8/site-packages/eppy/modeleditor.py", line 1047, in run run(self, weather=epw, idd=idd, **kwargs) File "/home/myfolder/.local/lib/python3.8/site-packages/eppy/runner/run_functions.py", line 389, in run raise EnergyPlusRunError(message) eppy.runner.run_functions.EnergyPlusRunError:

Contents of EnergyPlus error file at /home/myfolder/eplusout.err Program Version,EnergyPlus, Version 9.1.0-08d2e308bb, YMD=2022.08.24 00:56, Fatal Input file path /home/myfolder/eplusout.expidf not found ...Summary of Errors that led to program termination: ..... Reference severe error count=0 ..... Last severe error= Warning: Node connection errors not checked - most system input has not been read (see previous warning). Fatal error -- final processing. Program exited before simulations began. See previous error messages. EnergyPlus Warmup Error Summary. During Warmup: 0 Warning; 0 Severe Errors. EnergyPlus Sizing Error Summary. During Sizing: 0 Warning; 0 Severe Errors. ***** EnergyPlus Terminated--Fatal Error Detected. 0 Warning; 0 Severe Errors; Elapsed Time=00hr 00min 0.13sec

santoshphilip commented 2 years ago

do

cp HVACTemplate-5ZoneBaseboardHeat.idf in.idf
# copy it into /home/myfolder

then do

 /home/myfolder/EnergyPlus-9.1.0-08d2e308bb-Linux-x86_64/energyplus --weather /home/myfolder/EnergyPlus-9.1.0-08d2e308bb-Linux-x86_64/WeatherData/USA_CA_San.Francisco.Intl.AP.724940_TMY3.epw --output-directory /home/myfolder --idd /home/myfolder/EnergyPlus-9.1.0-08d2e308bb-Linux-x86_64/Energy+.idd --expandobjects /home/myfolder/in.idf

This is the command line from your previous comment (that was generated by eppy)

liuhz-github commented 2 years ago

1) After copying HVACTemplate-5ZoneBaseboardHeat.idf to in.idf, energyplus runs on in.idf without any problem. 2) Also it works, if I call EnergyPlus directly to run HVACTemplate-5ZoneBaseboardHeat.idf /home/myfolder/EnergyPlus-9.1.0-08d2e308bb-Linux-x86_64/energyplus --weather /home/myfolder/EnergyPlus-9.1.0-08d2e308bb-Linux-x86_64/WeatherData/USA_CA_San.Francisco.Intl.AP.724940_TMY3.epw --output-directory /home/myfolder --idd /home/myfolder/EnergyPlus-9.1.0-08d2e308bb-Linux-x86_64/Energy+.idd --expandobjects /home/myfolder/HVACTemplate-5ZoneBaseboardHeat.idf

Output for first case: /home/myfolder/EnergyPlus-9.1.0-08d2e308bb-Linux-x86_64/energyplus --weather /home/myfolder/EnergyPlus-9.1.0-08d2e308bb-Linux-x86_64/WeatherData/USA_CA_San.Francisco.Intl.AP.724940_TMY3.epw --output-directory /home/myfolder --idd /home/myfolder/EnergyPlus-9.1.0-08d2e308bb-Linux-x86_64/Energy+.idd --expandobjects /home/myfolder/in.idf

ExpandObjects Started. Begin reading Energy+.idd file. Done reading Energy+.idd file. ExpandObjects Finished. Time: 0.053 EnergyPlus Starting EnergyPlus, Version 9.1.0-08d2e308bb, YMD=2022.08.24 01:21 Initializing Response Factors Calculating CTFs for "ROOF-1", Construction # 1 Calculating CTFs for "WALL-1", Construction # 2 Calculating CTFs for "FLOOR-SLAB-1", Construction # 4 Calculating CTFs for "INT-WALL-1", Construction # 5 Initializing Window Optical Properties Initializing Solar Calculations Allocate Solar Module Arrays Initializing Zone Report Variables Initializing Surface (Shading) Report Variables Computing Interior Solar Absorption Factors Determining Shadowing Combinations Computing Window Shade Absorption Factors Proceeding with Initializing Solar Calculations Initializing Surfaces Initializing Outdoor environment for Surfaces Setting up Surface Reporting Variables Initializing Temperature and Flux Histories Initializing Window Shading Computing Interior Absorption Factors Computing Interior Diffuse Solar Absorption Factors Computing Interior Diffuse Solar Exchange through Interzone Windows Initializing Solar Heat Gains Initializing Internal Heat Gains Initializing Interior Solar Distribution Initializing Interior Convection Coefficients Gathering Information for Predefined Reporting Completed Initializing Surface Heat Balance Calculate Outside Surface Heat Balance Calculate Inside Surface Heat Balance Calculate Air Heat Balance Initializing HVAC Warming up Warming up Warming up Warming up Warming up Warming up Performing Zone Sizing Simulation ...for Sizing Period: #1 CHICAGO_IL_USA ANNUAL HEATING 99% DESIGN CONDITIONS DB Warming up Warming up Warming up Warming up Warming up Warming up Performing Zone Sizing Simulation ...for Sizing Period: #2 CHICAGO_IL_USA ANNUAL COOLING 1% DESIGN CONDITIONS DB/MCWB Adjusting Air System Sizing Adjusting Standard 62.1 Ventilation Sizing Initializing Simulation Reporting Surfaces Beginning Primary Simulation Initializing New Environment Parameters Warming up {1} Warming up {2} Warming up {3} Warming up {4} Warming up {5} Warming up {6} Starting Simulation at 01/14/2014 for RUNPERIOD 1 Initializing New Environment Parameters Warming up {1} Warming up {2} Warming up {3} Warming up {4} Warming up {5} Warming up {6} Starting Simulation at 07/07/2015 for RUNPERIOD 2 Writing tabular output file results using HTML format. Writing final SQL reports EnergyPlus Run Time=00hr 00min 0.63sec EnergyPlus Completed Successfully.

santoshphilip commented 2 years ago

@liuhz-github , At this point I am at a loss as to why it is not working on your Linux.

I have to break away from this to work on another deadline. I'll try to get back to this over the weekend

liuhz-github commented 2 years ago

@santoshphilip Thank you very much for your support and time.

I realise that EnergyPlus can't be run under the /tmp folder. After I change the /tmp folder to a folder under "/home/myfolder", the problem is solved. This is done by modifying a line in the eppy code (run_functions.py, line 336):

original eppy code: https://github.com/santoshphilip/eppy/blob/2d10381bf0b8f4dbc8bee17ce10cd61f77365517/eppy/runner/run_functions.py#L336

modified: run_dir = os.path.abspath(tempfile.mkdtemp(dir=output_dir))

Do you have any idea why E+ can't execute under the /tmp folder (permission 777)? Thank you.

santoshphilip commented 2 years ago

Can you post your code snippet that helps me to recreate the problem.

liuhz-github commented 2 years ago

python

My code is the standard one modified from eppy tutorial. I run it on linux Ubuntu 20.04. I tried several machines, one works perfect and the rest requires modified working directory away from /tmp.

Thank you.

santoshphilip commented 1 year ago

closed as unable to recreate error