Python-based command line tool for converting IFC files to Openstudio models
Project description
ifc2osmod
Introduction
- actively being developed, still very unstable
- Commandline tools written in Python to convert IFC models to Openstudio Models
- ifcarch2osmod.py: input a IFC file and it will extract all the relevant information from the model and convert it to Openstudio format (.osm).
- idf2osmod.py: input a EP+ idf file and it will extract all the relevant information from the model and convert it to Openstudio format (.osm).
- osmod2ifc.py: input an Openstudio format (.osm) and it will extract all the relevant information from the model and convert it to IFC.
- utility tools:
- idf_transition.py: for linux OS, update version of .idf, written to convert PNNL prototype buildings (https://www.energycodes.gov/prototype-building-models) catalogue to EP+ 23.2
Getting started
- This tutorial uses Ubuntu 24.04 OS
- install openstudio application 1.8.0 here (https://github.com/openstudiocoalition/OpenStudioApplication/releases/tag/v1.8.0)
- Create a virtual environment called ifc2osmod
python3 -m venv venv/ifc2osmod - Activate the virtual environment.
source venv/ifc2osmod/bin/activate - Install the gendgn python library.
pip install ifc2osmod - Download the example file from this url https://github.com/chenkianwee/ifc2osmod_gendgn_egs/archive/refs/heads/main.zip
- Go to the directory where you have downloaded and unzip the example files for this tutorial.
cd ifc2osmod_gendgn_egs - Execute the following command to run an example file. In this command, we first convert an IFC file to OSM file using ifc2osmod.py. Then pipe in the generated OSM file path into the execute_osmod.py program.
ifcarch2osmod -i ifc/small_office.ifc -o res/osmod/small_office.osm | add_sch2osmod -p -b "Small Office" -c 1A | execute_osmod -p -e epw/miami/USA_FL_Miami.Intl.AP.722020_TMY3.epw -d epw/miami/USA_FL_Miami.Intl.AP.722020_TMY3.ddy -m json/measure_sel.json -out res/osmod/small_office_radiant_pnls
Convert idf buildings to osmodel example
- These instructions are only for Ubuntu 24.04.
Update the idf to the right version
-
Go to (https://www.energycodes.gov/prototype-building-models) and download Small Office 90.1-2022 zip file
-
Once you unzip the file. Look for the file 'ASHRAE901_OfficeSmall_STD2022_NewYork.idf'. Lets conver this idf file to osmodel.
-
We want to open the osmodel in Openstudio Application 1.8. So we need to update the idf file version to 24.1.0. Open the 'ASHRAE901_OfficeSmall_STD2022_NewYork.idf'. It is a text file. Search for the word 'version' using ctrl+f. The version of the idf file should be version 22.1.
-
Download energyplus 24.1.0 from here. Unzip the file. The IDFVersionUpdater folder is located in the PreProcess folder.
-
Run the following command to transit the file to the target version.
idf_transition -u '/EnergyPlus-24.1.0-9d7789a3ac-Linux-Ubuntu22.04-x86_64/PreProcess/IDFVersionUpdater/' -i '/Downloads/ASHRAE901_OfficeSmall_STD2022/ASHRAE901_OfficeSmall_STD2022_NewYork.idf' -c 22.1 -t 24.1 -o 'idf/ASHRAE901_OfficeSmall_STD2022_NewYork_24_1.idf'
Convert the idf to osm
- Convert the idf to osm using this command.
idf2osmod -i '/idf/ASHRAE901_OfficeSmall_STD2022_NewYork_24_1.idf' -o '/osmod/idf2osmod_ASHRAE901_OfficeSmall_STD2022_NewYork.osm'
Create construction json database to facilitate ifc2osmod conversion
- This is done by extracting the construction information, either opaque constructions or glazing contruction, from osmodel files in a directory. So put the osmodel files in the same directory.
- To extract the opaque construction, run the following command.
extract_osmod_opq_constr -o '/osmod/' -r '/json/osmod_opq_constr_info.json'
- To extract glazing construction, run the following command:
extract_osmod_smpl_glz_constr -o '/osmod/' -r '/json/osmod_smpl_glz_constr_info.json'
Development
-
Download the example files from this url https://github.com/chenkianwee/ifc2osmod_gendgn_egs/archive/refs/heads/main.zip
-
go to the ifc2osmod directory
cd ifc2osmod/src
ifcarch2osmod.py + add_sch2osmod.py + execute_osmod.py example
-
execute the following command to run an example file. In this command, we first convert an IFC file to OSM file using ifc2osmod.py. Then pipe in the generated OSM file path into the execute_osmod.py program.
python -m ifc2osmod.ifcarch2osmod -i path_to/ifc2osmod_gendgn_egs/ifc/small_office.ifc -o path_to/ifc2osmod_gendgn_egs/res/osmod/small_office.osm | python -m ifc2osmod.add_sch2osmod -p -b "Small Office" -c 1A | python -m ifc2osmod.execute_osmod -p -e path_to/ifc2osmod_gendgn_egs/epw/miami/USA_FL_Miami.Intl.AP.722020_TMY3.epw -d path_to/ifc2osmod_gendgn_egs/epw/miami/USA_FL_Miami.Intl.AP.722020_TMY3.ddy -m path_to/ifc2osmod_gendgn_egs/json/measure_sel.json -out path_to/ifc2osmod_gendgn_egs/res/osmod/small_office_radiant_pnls -
The results are stored in the 'ifc2osmod/results' folder. You can examine the files using the OpenStudio Application (https://github.com/openstudiocoalition/OpenStudioApplication/releases). Download version >= 1.7.0 to view the OSM generated from this workflow.
ifcarch2osmod.py + add_sch2osmod.py example
- execute the following command to run an example file. In this command, we first convert an IFC file to OSM file using ifc2osmod.py. Then pipe in the generated OSM file path into the add_sch2osmod.py program.
python -m ifc2osmod.ifcarch2osmod -i path_to/ifc2osmod_gendgn_egs/ifc/small_office.ifc -o path_to/ifc2osmod_gendgn_egs/res/osmod/small_office.osm | python -m add_sch2osmod -p -b "Small Office" -c 1A - The results are stored in the 'path_to/ifc2osmod_gendgn_egs/res' folder. You can examine the files using the OpenStudio Application (https://github.com/openstudiocoalition/OpenStudioApplication/releases). Download version >= 1.7.0 to view the OSM generated from this workflow.
idf_transition.py example
- execute the following command to run an example file. In this command, we update an idf file from 22.1 -> 23.2
python -m ifc2osmod.idf_transition -u /EnergyPlus-23.2.0-7636e6b3e9-Linux-Ubuntu22.04-x86_64/PreProcess/IDFVersionUpdater -i path_to/ifc2osmod_gendgn_egs/idf/ASHRAE901_OfficeSmall_STD2022_Miami.idf -o path_to/ifc2osmod_gendgn_egs/idf/ASHRAE901_OfficeSmall_STD2022_Miami_23.2.idf -c 22.1 -t 23.2python -m ifc2osmod.idf_transition -u /EnergyPlus-23.2.0-7636e6b3e9-Linux-Ubuntu22.04-x86_64/PreProcess/IDFVersionUpdater -i path_to/ifc2osmod_gendgn_egs/idf/ASHRAE901_OfficeMedium_STD2007_Miami.idf -o path_to/ifc2osmod_gendgn_egs/idf/ASHRAE901_OfficeMedium_STD2007_Miami_23.2.idf -c 22.1 -t 23.2
idf2osmod.py example
- execute the following command to run an example file. In this command, we convert an idf file to openstudio format
python -m ifc2osmod.idf2osmod -i path_to/ifc2osmod_gendgn_egs/idf/ASHRAE901_OfficeSmall_STD2022_Miami_23.2.idf -o path_to/ifc2osmod_gendgn_egs/osmod/idf2osmod_ASHRAE901_OfficeSmall_STD2022_Miami.osmpython -m ifc2osmod.idf2osmod -i path_to/ifc2osmod_gendgn_egs/idf/ASHRAE901_OfficeMedium_STD2007_Miami_23.2.idf -o path_to/ifc2osmod_gendgn_egs/osmod/idf2osmod_ASHRAE901_OfficeMedium_STD2007_Miami.osm
osmod2ifcarch.py example
- execute the following command to run an example file. In this command, we convert an .osm file to IFC
python -m ifc2osmod.osmod2ifcarch -o path_to/ifc2osmod_gendgn_egs/osmod/idf2osmod_ASHRAE901_OfficeSmall_STD2022_Miami.osm -i path_to/ifc2osmod_gendgn_egs/ifc/idf2osmod_ASHRAE901_OfficeSmall_STD2022_Miami.ifcpython -m ifc2osmod.osmod2ifcarch -o path_to/ifc2osmod_gendgn_egs/osmod/idf2osmod_ASHRAE901_OfficeMedium_STD2007_Miami.osm -i path_to/ifc2osmod_gendgn_egs/ifc/idf2osmod_ASHRAE901_OfficeMedium_STD2007_Miami.ifc
idf2osmod.py + osmod2ifcarch.py example
- you can pipe the result of idf2osmod.py into the osmod2ifcarch.py program.
python -m ifc2osmod.idf2osmod -i path_to/ifc2osmod_gendgn_egs/idf/ASHRAE901_OfficeSmall_STD2022_Miami_23.2.idf -o path_to/ifc2osmod_gendgn_egs/osmod/idf2osmod_ASHRAE901_OfficeSmall_STD2022_Miami.osm | python -m ifc2osmod.osmod2ifcarch -p -i path_to/ifc2osmod_gendgn_egs/ifc/idf2osmod_ASHRAE901_OfficeSmall_STD2022_Miami.ifc
freecad_custom_pset.py example
python -m ifc2osmod.freecad_custom_pset -j ifc2osmod/data/json/ifc_psets/ -c path_to/ifc2osmod_gendgn_egs/csv/CustomPsets.csv
read_ifc_mat_pset.py example
- generate json file
python -m ifc2osmod.read_ifc_mat_pset -i path_to/ifc2osmod_gendgn_egs/ifc/idf2osmod_ASHRAE901_OfficeSmall_STD2022_Miami.ifc -r path_to/ifc2osmod_gendgn_egs/json/mat_pset.json - generate csv file
python -m ifc2osmod.read_ifc_mat_pset -i path_to/ifc2osmod_gendgn_egs/ifc/idf2osmod_ASHRAE901_OfficeSmall_STD2022_Miami.ifc -r path_to/ifc2osmod_gendgn_egs/csv/mat_pset.csv -c
read_ifc_envlp_mat_pset.py example
- generate json file
python -m ifc2osmod.read_ifc_envlp_mat_pset -i path_to/ifc2osmod_gendgn_egs/ifc/idf2osmod_ASHRAE901_OfficeSmall_STD2022_Miami.ifc -r path_to/ifc2osmod_gendgn_egs/json/ifc_env_info.json - generate csv file
python -m ifc2osmod.read_ifc_envlp_mat_pset -i path_to/ifc2osmod_gendgn_egs/ifc/idf2osmod_ASHRAE901_OfficeSmall_STD2022_Miami.ifc -r path_to/ifc2osmod_gendgn_egs/csv/ifc_env_info.csv -c
calc_massless_mat.py example
- generate json file
python -m ifc2osmod.calc_massless_mat -i path_to/ifc2osmod_gendgn_egs/ifc/idf2osmod_ASHRAE901_OfficeSmall_STD2022_Miami.ifc -r path_to/ifc2osmod_gendgn_egs/json/massless_mat_info.json - generate csv file
python -m ifc2osmod.calc_massless_mat -i path_to/ifc2osmod_gendgn_egs/ifc/idf2osmod_ASHRAE901_OfficeSmall_STD2022_Miami.ifc -r path_to/ifc2osmod_gendgn_egs/csv/massless_mat_info.csv -c
extract_osmod_opq_constr.py example
python -m ifc2osmod.extract_osmod_opq_constr -o path_to/ifc2osmod_gendgn_egs/osmod -r path_to/ifc2osmod_gendgn_egs/json/osmod_opq_constr_info.json
extract_osmod_glz_constr.py example
python -m ifc2osmod.extract_osmod_smpl_glz_constr -o path_to/ifc2osmod_gendgn_egs/osmod -r path_to/ifc2osmod_gendgn_egs/json/osmod_smpl_glz_constr_info.json
eplus_sql2csv.py example
python -m ifc2osmod.epsql2csv -s path_to/osmod/small_office_wrkflw/run/eplusout.sql -r ../results/csv/
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ifc2osmod-0.0.7.tar.gz.
File metadata
- Download URL: ifc2osmod-0.0.7.tar.gz
- Upload date:
- Size: 253.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2cb1ebe9ce8d18a7f2710da44510da17d5eead4454b9aea0ce8450f6c1f8a560
|
|
| MD5 |
2dca3e94bbd14ea2d53790304fe49d39
|
|
| BLAKE2b-256 |
d70cc169f926589d35c0d5774914591572f936de41723f61d8b4673a5732f9c2
|
File details
Details for the file ifc2osmod-0.0.7-py3-none-any.whl.
File metadata
- Download URL: ifc2osmod-0.0.7-py3-none-any.whl
- Upload date:
- Size: 280.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
72d958a5379da17ec0be2c69c9182d3a6f25c1be4e3cf29b104c0931d0b9b89e
|
|
| MD5 |
7443010675c34d30e2bc2eb200e07867
|
|
| BLAKE2b-256 |
6251a333a289f2bf076bfee79bf3e6d515315d963d2ef6523e1a658a1f8ac4e9
|