<jupyter_start><jupyter_text>Running an EnergyPlus simulation on the 1ZoneUncontrolled file  1. IntroductionThis notebook shows how to use the [`eprun`] function within the [eprun package] to run an EnergyPlus simulation. It uses the **'1ZoneUncontrolled.idf'** file in the EnergyPlus example files.[`eprun`]: https://eprun.readthedocs.io/en/latest/eprun_function.html[eprun package]: https://eprun.readthedocs.io/en/latest/index.html  2. Setup 2.1 Module importsThis imports the [`eprun`] function from the eprun package, as well as the [os package](https://docs.python.org/3/library/os.html) for working with files.[`eprun`]: https://eprun.readthedocs.io/en/latest/eprun_function.html<jupyter_code>from eprun import eprun
import os<jupyter_output><empty_output><jupyter_text>2.2 Simulation input filesA directory named **'input_files'** has been created in the same directory as this notebook. An .idf and .epw file have been placed in the **input_files** directory. These are the input files for the EnergyPlus simulation.* The **'1ZoneUncontrolled.idf'** file is provided in the 'ExampleFiles' directory in the EnergyPlus install directory and represents the model inputs for a single zone, heated building.* The **'USA_CO_Golden-NREL.724666_TMY3.epw'** file is an EnergyPlus weather file and is provided in the 'WeatherData' folder in the EnergyPlus install directory.<jupyter_code>for file_name in os.listdir('input_files'):
    print(file_name)<jupyter_output>1ZoneUncontrolled.idf
USA_CO_Golden-NREL.724666_TMY3.epw<jupyter_text>2.3 Simulation directory for output filesA directory named **'simulation_files'** has been created in the same directory as this notebook. This will hold the simulation results.<jupyter_code>'simulation_files' in os.listdir()<jupyter_output><empty_output><jupyter_text>3. Simulation runThe [`eprun`] function is used to run the EnergyPlus simulation. The code below runs a simulation and returns an [`EPResult`] object.[`eprun`]: https://eprun.readthedocs.io/en/latest/eprun_function.html[`EPResult`]: https://eprun.readthedocs.io/en/latest/EPResult_class.html<jupyter_code>epresult=eprun(ep_dir='C:\EnergyPlusV9-4-0',
               input_filepath=r'input_files\1ZoneUncontrolled.idf',
               epw_filepath=r'input_files\USA_CO_Golden-NREL.724666_TMY3.epw',
               sim_dir='simulation_files')
print(type(epresult))<jupyter_output><class 'eprun.epresult.EPResult'><jupyter_text>4. Checking for run successThe simulation run was a success as the `returncode` property of the [`EPResult`] object is '0'. An unsuccessful run would have a `returncode` of '1'.[`EPResult`]: https://eprun.readthedocs.io/en/latest/EPResult_class.html<jupyter_code>epresult.returncode<jupyter_output><empty_output><jupyter_text>5. Viewing the simulation CommandPrompt textWhen an EnergyPlus simulation is run in the CommandPrompt it produces a stream of text as it runs through the stages of the simulation. This text can be viewed by using the `stdout` property of the [`EPResult`] object.[`EPResult`]: https://eprun.readthedocs.io/en/latest/EPResult_class.html<jupyter_code>print(epresult.stdout)<jupyter_output>EnergyPlus Starting
EnergyPlus, Version 9.4.0-998c4b761e, YMD=2021.01.01 04:54
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}
Warming up {7}
Warming up {8}
Warming up {9}
Warming up {10}
Warming up {11}
Warming up {12}
Warming up {13}
Warming up {14}
Warming up {15}
Warming up {16}
Warming up {17}
Warming up {18}
Warming up {19}
Warming up {20}
Warming up {21}
Warming up {22}
Starting Simulation at 12/21 for DENVER CENTENNIAL  GOLDEN   N ANN HTG 99% CONDNS DB
Initializing New Environment Parameters
Warming up {1}
Warming up {2}
Warming up {3}
Warming up {4}
Warming up {5}
Warming up {6}
Warming up {7}
Warming up {8}
Warming up {9}
Warming up {10}
Warming up {11}
Warming up {12}
Warming up {13}
Warming up {14}
Warming up {15}
Warming up {16}
Starting Simulation a[...]<jupyter_text>6. Checking the output filesThe output files of the simulation run are placed in the **simulation_files** directory.<jupyter_code>for file_name in os.listdir('simulation_files'):
    print(file_name)<jupyter_output>eplusout.audit
eplusout.bnd
eplusout.dxf
eplusout.eio
eplusout.end
eplusout.err
eplusout.eso
eplusout.mdd
eplusout.mtd
eplusout.mtr
eplusout.rdd
eplusout.shd
eplustbl.csv
eplustbl.htm
eplustbl.tab
eplustbl.txt
eplustbl.xml<jupyter_text>7. Viewing the resultsThe [`EPResult`] object contains methods to view, plot and export the results of the simulation.For example, the code below plots a graph of the **hourly zone mean air temperature** in the zone **'ZONE ONE'** over the 12 month simulation period:[`EPResult`]: https://eprun.readthedocs.io/en/latest/EPResult_class.html<jupyter_code>%matplotlib inline
import matplotlib.pyplot as plt
ax=epresult.get_eso().get_environment('RUN PERIOD 1').get_interval_variable(75).plot()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.09918160561184723, 'fraction_numerical': 0.027084957131722525, 'mean_word_length': 5.844, 'pattern_counts': {'":': 0, '<': 30, '<?xml version=': 0, '>': 30, 'https://': 9, 'lorem ipsum': 0, 'www.': 0, 'xml': 1}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '8', 'dir': 'jupyter-structured-clean-dedup', 'id': '225433', 'license': 'MIT', 'n_tokens_mistral': 1838, 'n_tokens_neox': 1722, 'n_words': 531, 'path': 'examples/Running an EnergyPlus simulation on the 1ZoneUncontrolled file/Running an EnergyPlus simulation on the 1ZoneUncontrolled file.ipynb', 'repo_name': 'stevenkfirth/eprun', 'size': '5132'}