Using runEp() to directly run simulations with EnergyPlus
This script has been created by eppy’s development team (https://eppy.readthedocs.io/en/latest/runningeplus.html, specifically from section ‘Running in parallel processes using Generators’), however I did some changes. Anyway, you probably should check out eppy package, since it’s absolutely awesome.
This script will take all EPWs and IDFs located in the folder where the script is being executed as input files, and will run simulations based on these, naming the output files with the following naming convention: “IDFname[EPWname”
First of all, let’s see what files we do have in the folder:
[1]:
import os
original_files = [i for i in os.listdir()]
print(*original_files, sep='\n')
.ipynb_checkpoints
TestModel_V2510[CS_AUS DeDear[CA_80[CM_3[HM_2[VC_0[VO_0.0[MT_50.0[MW_50.0[AT_0.1[NS_X.idf
United-Kingdom_Aberdeen_Present.epw
using_runEp.ipynb
__init__.py
As you can see, the EPW file or files we have is or are:
[2]:
print([i for i in original_files if i.endswith('.epw')])
['United-Kingdom_Aberdeen_Present.epw']
And the IDF file or files we have is or are:
[3]:
print([i for i in original_files if i.endswith('.idf')])
['TestModel_V2510[CS_AUS DeDear[CA_80[CM_3[HM_2[VC_0[VO_0.0[MT_50.0[MW_50.0[AT_0.1[NS_X.idf']
Based on that, let’s use runEp():
[4]:
from accim.run import run
run.runEp(
runOnlyAccim=True, #only runs output IDFs, that is, IDFs with "[" in its name
confirmRun=True, #to skip confirmation
num_CPUs=2, #to specify the number of CPUs to be used
EnergyPlus_version='25.1', #to specify the EnergyPlus version of the IDF, and the version of EnergyPlus you are going to run
)
The IDFs we are going to run are:
TestModel_V2510[CS_AUS DeDear[CA_80[CM_3[HM_2[VC_0[VO_0.0[MT_50.0[MW_50.0[AT_0.1[NS_X.idf
and the No. of IDFs is going to be 1
The sample_EPWs we are going to run are:
United-Kingdom_Aberdeen_Present.epw
and the No. of sample_EPWs is going to be 1
Therefore, the simulations are going to be:
TestModel_V2510[CS_AUS DeDear[CA_80[CM_3[HM_2[VC_0[VO_0.0[MT_50.0[MW_50.0[AT_0.1[NS_X[United-Kingdom_Aberdeen_Present
and the No. of simulations is going to be 1
runEp() just informed us about the input files, and the number of simulation runs and name of each one. So now, let’s see what are the outputs:
[5]:
new_files = [i for i in os.listdir() if not(any(i in j for j in original_files))]
print(*new_files, sep='\n')
TestModel_V2510[CS_AUS DeDear[CA_80[CM_3[HM_2[VC_0[VO_0.0[MT_50.0[MW_50.0[AT_0.1[NS_X[United-Kingdom_Aberdeen_Present.audit
TestModel_V2510[CS_AUS DeDear[CA_80[CM_3[HM_2[VC_0[VO_0.0[MT_50.0[MW_50.0[AT_0.1[NS_X[United-Kingdom_Aberdeen_Present.bnd
TestModel_V2510[CS_AUS DeDear[CA_80[CM_3[HM_2[VC_0[VO_0.0[MT_50.0[MW_50.0[AT_0.1[NS_X[United-Kingdom_Aberdeen_Present.csv
TestModel_V2510[CS_AUS DeDear[CA_80[CM_3[HM_2[VC_0[VO_0.0[MT_50.0[MW_50.0[AT_0.1[NS_X[United-Kingdom_Aberdeen_Present.dxf
TestModel_V2510[CS_AUS DeDear[CA_80[CM_3[HM_2[VC_0[VO_0.0[MT_50.0[MW_50.0[AT_0.1[NS_X[United-Kingdom_Aberdeen_Present.eio
TestModel_V2510[CS_AUS DeDear[CA_80[CM_3[HM_2[VC_0[VO_0.0[MT_50.0[MW_50.0[AT_0.1[NS_X[United-Kingdom_Aberdeen_Present.end
TestModel_V2510[CS_AUS DeDear[CA_80[CM_3[HM_2[VC_0[VO_0.0[MT_50.0[MW_50.0[AT_0.1[NS_X[United-Kingdom_Aberdeen_Present.err
TestModel_V2510[CS_AUS DeDear[CA_80[CM_3[HM_2[VC_0[VO_0.0[MT_50.0[MW_50.0[AT_0.1[NS_X[United-Kingdom_Aberdeen_Present.eso
TestModel_V2510[CS_AUS DeDear[CA_80[CM_3[HM_2[VC_0[VO_0.0[MT_50.0[MW_50.0[AT_0.1[NS_X[United-Kingdom_Aberdeen_Present.mdd
TestModel_V2510[CS_AUS DeDear[CA_80[CM_3[HM_2[VC_0[VO_0.0[MT_50.0[MW_50.0[AT_0.1[NS_X[United-Kingdom_Aberdeen_Present.mtd
TestModel_V2510[CS_AUS DeDear[CA_80[CM_3[HM_2[VC_0[VO_0.0[MT_50.0[MW_50.0[AT_0.1[NS_X[United-Kingdom_Aberdeen_Present.rdd
TestModel_V2510[CS_AUS DeDear[CA_80[CM_3[HM_2[VC_0[VO_0.0[MT_50.0[MW_50.0[AT_0.1[NS_X[United-Kingdom_Aberdeen_Present.rvaudit
TestModel_V2510[CS_AUS DeDear[CA_80[CM_3[HM_2[VC_0[VO_0.0[MT_50.0[MW_50.0[AT_0.1[NS_X[United-Kingdom_Aberdeen_Present.shd
TestModel_V2510[CS_AUS DeDear[CA_80[CM_3[HM_2[VC_0[VO_0.0[MT_50.0[MW_50.0[AT_0.1[NS_X[United-Kingdom_Aberdeen_PresentTable.csv
TestModel_V2510[CS_AUS DeDear[CA_80[CM_3[HM_2[VC_0[VO_0.0[MT_50.0[MW_50.0[AT_0.1[NS_X[United-Kingdom_Aberdeen_PresentTable.htm
TestModel_V2510[CS_AUS DeDear[CA_80[CM_3[HM_2[VC_0[VO_0.0[MT_50.0[MW_50.0[AT_0.1[NS_X[United-Kingdom_Aberdeen_PresentZsz.csv
The CSV files we have generated follow the naming convention ‘IDF[EPW’ and therefore, are suitable to be used with the class Table, within the accim.data.datawrangling module.
[6]:
print(*[i for i in os.listdir() if i.endswith('.csv') and not(i.endswith('Table.csv')) and not (i.endswith('Zsz.csv'))], sep='\n')
TestModel_V2510[CS_AUS DeDear[CA_80[CM_3[HM_2[VC_0[VO_0.0[MT_50.0[MW_50.0[AT_0.1[NS_X[United-Kingdom_Aberdeen_Present.csv
Now, let’s remove all output files of the simulation run:
[7]:
for i in new_files:
os.remove(i)