Coverage for bim2sim/plugins/PluginLCA/bim2sim_lca/examples/e1_export_quantities_for_lca.py: 0%
13 statements
« prev ^ index » next coverage.py v7.6.12, created at 2025-03-12 17:09 +0000
« prev ^ index » next coverage.py v7.6.12, created at 2025-03-12 17:09 +0000
1import tempfile
2from pathlib import Path
4import bim2sim
5from bim2sim import Project, run_project, ConsoleDecisionHandler
6from bim2sim.utilities.types import IFCDomain
9def run_example_complex_building_lca():
10 """Generate output for an LCA analysis.
12 This example generates output for an LCA analysis. Specifies project
13 directory and location of the IFC file. Then, it creates a bim2sim
14 project with the lca backend. The project is executed with the
15 previously specified settings.
17 After execution, go to the export folder and have a look at the two .csv
18 files. <Material_quantities_ERC_Mainbuilding_Arch.csv> will offer you
19 information about the amount (mass) of each material used in the building.
20 <Quantities_overview_ERC_Mainbuilding_Arch.csv> will give you an overview
21 about all elements separately and their materials.
22 """
23 # Create a temp directory for the project, feel free to use a "normal"
24 # directory
25 project_path = Path(tempfile.TemporaryDirectory(
26 prefix='bim2sim_example5').name)
28 # Get path of the IFC Building model that is used for this example
29 # In this case the mainbuilding of EBC at Aachen which has mostly correct
30 # implemented materials in IFC
31 ifc_paths = {
32 IFCDomain.arch:
33 Path(bim2sim.__file__).parent.parent /
34 'test/resources/arch/ifc/'
35 'ERC_Mainbuilding_Arch.ifc'
36 }
37 # Create a project including the folder structure for the project with
38 # LCA as backend and no specified workflow (default workflow is taken)
39 project = Project.create(project_path, ifc_paths, 'lca')
41 # set weather file data
42 project.sim_settings.weather_file_path = (
43 Path(bim2sim.__file__).parent.parent /
44 'test/resources/weather_files/DEU_NW_Aachen.105010_TMYx.mos')
46 # Run the project with the ConsoleDecisionHandler. No questions for this
47 # example will be prompted.
48 run_project(project, ConsoleDecisionHandler())
50 # Go to the export folder and have a look at the two .csv files.
51 # <Material_quantities_ERC_Mainbuilding_Arch.csv> will offer you information
52 # about the amount (mass) of each material used in the building
53 # Quantities_overview_ERC_Mainbuilding_Arch.csv will give you an overview
54 # about all elements separately and their materials
57if __name__ == '__main__':
58 run_example_complex_building_lca()