A Python library for hydraulic system analysis of IFC (Industry Foundation Classes) building models. ifc-hydro provides tools for analyzing cold water supply systems in building information models, including topology creation, property extraction, and hydraulic calculations.
- Topology Analysis: Create graph representations of hydraulic system connections from IFC models
- Property Extraction: Extract geometric and type properties from pipes, fittings, and valves
- Hydraulic Calculations: Perform flow analysis, pressure drop calculations, and available pressure determination
- IFC Integration: Direct integration with IFC models using IfcOpenShell
- Logging: Built-in logging system for debugging and analysis tracking
- Python 3.6 or higher
- IfcOpenShell library
from ifc-hydro-main import TopologyCreator, PropCalculator, HydroCalculator import ifcopenshell as ifc
- Initialize topology creator:
topology = TopologyCreator()
- Create system topology graph:
graph = topology.graph_creator()
- Find all paths from terminals to tanks:
all_paths = topology.all_paths_finder()
- Initialize calculators:
prop_calc = PropCalculator() hydro_calc = HydroCalculator()
- Load IFC model:
model = ifc.open('your_model.ifc')
- Calculate available pressure at a terminal:
terminal = model.by_id(5423) # Replace with actual terminal ID available_pressure = hydro_calc.available_pressure(terminal, all_paths) print(f"Available pressure: {available_pressure:.2f} m")
- Extract pipe properties:
pipe = model.by_id(5399) # Replace with actual pipe ID
pipe_props = prop_calc.pipe_properties(pipe)
print(f"Pipe length: {pipe_props['len']} m")
print(f"Pipe diameter: {pipe_props['dim']} m")
- Extract fitting properties:
fitting = model.by_id(7020) # Replace with actual fitting ID
fitting_props = prop_calc.fitt_properties(fitting)
print(f"Fitting type: {fitting_props['type']}")
- Calculate flow rates throughout the system:
pipe_pressure_drop = hydro_calc.linear_pressure_drop(pipe, all_paths)
- Calculate local pressure drop in fittings/valves:
fitting_pressure_drop = hydro_calc.local_pressure_drop(fitting, all_paths)
Creates hydraulic system topology from IFC models.
graph_creator()
: Creates a graph representation of the systempath_finder(term_guid, tank_guid)
: Finds path between specific terminal and tankall_paths_finder()
: Finds all paths from terminals to tanks
Extracts properties from IFC components.
pipe_properties(pipe)
: Extracts length and diameter from pipe segmentsfitt_properties(fitt)
: Extracts dimensions, directions, and type from fittingsvalv_properties(valv)
: Extracts dimensions and type from valves
Performs hydraulic calculations.
flow(all_paths)
: Calculates design flow for all componentslinear_pressure_drop(pipe, all_paths)
: Calculates linear pressure drop in pipeslocal_pressure_drop(conn, all_paths)
: Calculates local pressure drop in connectionsavailable_pressure(term, all_paths)
: Calculates available pressure at terminals
Graph data structure for representing system topology.
add(node1, node2)
: Adds connection between nodesremove(node)
: Removes node from graphis_connected(node1, node2)
: Checks if nodes are connectedfind_path(node1, node2)
: Finds path between nodes
Uses standardized design flow rates:
- Shower: 0.2 L/s
- Wash basin: 0.15 L/s
- WC seat: 0.15 L/s
- Linear losses: Fair Whipple-Hsiao equation for PVC pipes
- Local losses: Equivalent length method with tabulated coefficients
- Available pressure: Gravity potential minus total pressure losses
ifc-hydro/
├── ifc-hydro-main.py # Main module with all classes
├── README.md # This file
├── ifc-hydro.log # Log file (generated during execution)
└── projeto-demonstracao.ifc # Sample IFC model
- Python 3.6+
- IfcOpenShell
- Standard library modules:
datetime
,collections
,sys
,os
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
This project is licensed under the MIT License.
- 1.0.0 - First version with Hazen-Williams formula implementation
- 2.0.0 - Current version with improved hydraulic calculations (Fair Whipple-Hsiao)
For questions and support, please open an issue on the GitHub repository or send an e-mail to andrebuchmannmuller@gmail.com
- Built for my Master's degree at the Polytechnic School of Universidade de São Paulo