Zoning¶
Automatic thermal zoning for EnergyPlus models. Splits a 2-D building
footprint into thermal zones and creates all Zone,
BuildingSurface:Detailed, and (optionally) Construction:AirBoundary
objects needed for simulation.
Quick Start¶
from idfkit import new_document, create_block, ZoningScheme
from idfkit.zoning import footprint_rectangle
doc = new_document()
create_block(
doc,
name="Office",
footprint=footprint_rectangle(50, 30),
floor_to_floor=3.5,
num_stories=3,
zoning=ZoningScheme.CORE_PERIMETER,
)
# 3 stories × 5 zones (4 perimeter + 1 core) = 15 zones
print(len(doc["Zone"])) # 15
Zoning Schemes¶
create_block supports three zoning strategies via the zoning parameter:
| Scheme | Zones per floor | Description |
|---|---|---|
BY_STOREY |
1 | One zone per floor (default). |
CORE_PERIMETER |
5 | Four orientation-based perimeter zones plus an interior core zone. |
CUSTOM |
User-defined | Caller supplies named zone polygons via custom_zones. |
By Storey (default)¶
The simplest scheme — one thermal zone per floor:
from idfkit import new_document, create_block
doc = new_document()
create_block(
doc,
name="Warehouse",
footprint=[(0, 0), (40, 0), (40, 20), (0, 20)],
floor_to_floor=4.0,
num_stories=2,
)
print(len(doc["Zone"])) # 2
Core-Perimeter¶
Splits each floor into four perimeter zones (North, East, South, West) and one interior core zone. The perimeter depth defaults to 4.57 m (15 ft) per ASHRAE 90.1 Appendix G and the DOE prototype buildings.
from idfkit import new_document, create_block, ZoningScheme
from idfkit.zoning import footprint_rectangle
doc = new_document()
create_block(
doc,
name="Office",
footprint=footprint_rectangle(50, 30),
floor_to_floor=3.5,
num_stories=3,
zoning=ZoningScheme.CORE_PERIMETER,
)
# 3 stories × 5 zones = 15 zones
print(len(doc["Zone"])) # 15
You can override the perimeter depth:
from idfkit import new_document, create_block, ZoningScheme
from idfkit.zoning import footprint_rectangle
doc = new_document()
create_block(
doc,
name="Office",
footprint=footprint_rectangle(50, 30),
floor_to_floor=3.5,
num_stories=1,
zoning=ZoningScheme.CORE_PERIMETER,
perimeter_depth=3.0, # 3 m instead of the default 4.57 m
)
Note
When the footprint is too small for the requested perimeter depth (i.e. the inradius is less than 0.5 m after insetting), zoning automatically falls back to a single zone per floor.
Custom Zoning¶
Supply your own named zone polygons per floor using custom_zones.
Each entry is a (name, polygon) tuple:
from idfkit import ZoneFootprint, ZoningScheme, create_block, new_document
doc = new_document()
create_block(
doc,
name="Lab",
footprint=[(0, 0), (30, 0), (30, 20), (0, 20)],
floor_to_floor=3.5,
num_stories=1,
zoning=ZoningScheme.CUSTOM,
custom_zones=[
ZoneFootprint("Wet Lab", [(0, 0), (15, 0), (15, 20), (0, 20)]),
ZoneFootprint("Dry Lab", [(15, 0), (30, 0), (30, 20), (15, 20)]),
],
)
print(len(doc["Zone"])) # 2
Air Boundaries¶
Set air_boundary=True to apply Construction:AirBoundary to all
inter-zone walls. This is useful for open-plan spaces where zone
boundaries are notional rather than physical:
from idfkit import new_document, create_block, ZoningScheme
from idfkit.zoning import footprint_rectangle
doc = new_document()
create_block(
doc,
name="Open Office",
footprint=footprint_rectangle(50, 30),
floor_to_floor=3.5,
num_stories=1,
zoning=ZoningScheme.CORE_PERIMETER,
air_boundary=True,
)
# A Construction:AirBoundary object is created automatically
print(len(doc["Construction:AirBoundary"])) # 1
Multi-Story Boundary Conditions¶
For multi-story buildings, inter-story floors and ceilings are
automatically linked with Surface boundary conditions:
| Story | Floor BC | Ceiling BC |
|---|---|---|
Ground floor (base_elevation=0) |
Ground |
Surface (story above) |
Elevated ground floor (base_elevation>0) |
Outdoors |
Surface (story above) |
| Mid floors | Surface (story below) |
Surface (story above) |
| Top floor | Surface (story below) |
Outdoors (Roof) |
Stacked Blocks (Setbacks)¶
Buildings with setbacks — where upper floors have a smaller footprint —
are modelled as separate blocks stacked with base_elevation, then
connected with link_blocks:
from idfkit import new_document, create_block, link_blocks
from idfkit.zoning import footprint_rectangle
doc = new_document()
# 5-story base
create_block(
doc,
name="Base",
footprint=footprint_rectangle(50, 30),
floor_to_floor=3.5,
num_stories=5,
)
# 3-story tower with a setback, stacked on top of the base
create_block(
doc,
name="Tower",
footprint=footprint_rectangle(40, 24),
floor_to_floor=3.5,
num_stories=3,
base_elevation=17.5, # 5 × 3.5 m
)
# Auto-detect and link roof/floor pairs at z=17.5
linked = link_blocks(doc)
link_blocks finds all roof and floor surfaces at shared elevations,
splits roofs that partially overlap a floor, and sets mutual Surface
boundary conditions between the new ceiling and floor. The original
roof is shrunk to cover only the remaining exposed area.
To link only specific blocks by name, pass lower and upper:
For finer control, use the lower-level adjacency API directly.
Footprint Helpers¶
Pre-built footprint generators for common commercial building shapes.
All return a list of (x, y) tuples in counter-clockwise order.
footprint_rectangle¶
from idfkit.zoning import footprint_rectangle
fp = footprint_rectangle(50, 30)
# [(0, 0), (50, 0), (50, 30), (0, 30)]
footprint_l_shape¶
from idfkit.zoning import footprint_l_shape
fp = footprint_l_shape(width=40, depth=10, wing_width=15, wing_depth=20)
footprint_u_shape¶
from idfkit.zoning import footprint_u_shape
fp = footprint_u_shape(width=40, depth=30, courtyard_width=20, courtyard_depth=15)
footprint_t_shape¶
from idfkit.zoning import footprint_t_shape
fp = footprint_t_shape(base_width=20, base_depth=15, top_width=40, top_depth=10)
footprint_h_shape¶
from idfkit.zoning import footprint_h_shape
fp = footprint_h_shape(width=40, depth=30, courtyard_width=20, courtyard_depth=10)
footprint_courtyard¶
from idfkit.zoning import footprint_courtyard
fp = footprint_courtyard(outer_width=50, outer_depth=40, inner_width=30, inner_depth=20)
Using Footprint Helpers with create_block¶
All footprint helpers plug directly into create_block:
from idfkit import new_document, create_block, ZoningScheme
from idfkit.zoning import footprint_l_shape
doc = new_document()
create_block(
doc,
name="L-Wing",
footprint=footprint_l_shape(40, 10, 15, 20),
floor_to_floor=3.5,
num_stories=2,
zoning=ZoningScheme.CORE_PERIMETER,
)
ZonedBlock (Describe-then-Apply)¶
ZonedBlock is a frozen dataclass alternative that validates all
parameters up front. Call build() to realise the geometry.
This describe-then-apply pattern lets you inspect computed properties
before committing to a document.
from idfkit import new_document, ZonedBlock, ZoningScheme
from idfkit.zoning import footprint_rectangle
block = ZonedBlock(
name="Office",
footprint=footprint_rectangle(50, 30),
floor_to_floor=3.5,
num_stories=3,
zoning=ZoningScheme.CORE_PERIMETER,
)
print(f"Building height: {block.height} m") # 10.5
print(f"Floor area: {block.floor_area} m²") # 1500.0
print(f"Total floor area: {block.total_floor_area} m²") # 4500.0
doc = new_document()
objects = block.build(doc)
print(len(objects)) # all created Zone + BuildingSurface:Detailed objects
API Reference¶
Automatic thermal zoning for EnergyPlus models.
Splits a 2-D building footprint into thermal zones using one of several
standard schemes and creates all Zone, BuildingSurface:Detailed,
and (optionally) Construction:AirBoundary objects needed for
simulation.
Three zoning schemes are provided:
- by_storey - one zone per floor.
- core_perimeter - four orientation-based perimeter zones plus an interior core zone per floor. Perimeter depth defaults to 4.57 m (15 ft) per ASHRAE 90.1 Appendix G and the DOE prototype buildings.
- custom - the caller supplies named polygons for each floor.
Footprint helpers for common commercial shapes (rectangle, L, U, T, H, courtyard) are included so users never have to compute vertices by hand.
Examples:
from idfkit import new_document
from idfkit.zoning import (
ZoningScheme,
create_block,
footprint_rectangle,
)
doc = new_document()
zones = create_block(
doc,
name="Office",
footprint=footprint_rectangle(50, 30),
floor_to_floor=3.5,
num_stories=3,
zoning=ZoningScheme.CORE_PERIMETER,
perimeter_depth=4.57,
)
ZoneFootprint
dataclass
¶
Named 2-D polygon for one thermal zone on one floor.
Source code in src/idfkit/zoning.py
ZonedBlock
dataclass
¶
Describes a building block with a zoning strategy.
This is a pure data object. Call build() to realise the
geometry in an IDFDocument.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
str
|
Base name for zones and surfaces. |
footprint |
Sequence[tuple[float, float]]
|
2-D footprint as |
floor_to_floor |
float
|
Floor-to-floor height in metres. |
num_stories |
int
|
Number of above-ground stories. |
zoning |
ZoningScheme
|
Zoning strategy. |
perimeter_depth |
float
|
Perimeter zone depth (metres), used only
when |
custom_zones |
list[ZoneFootprint] | None
|
Per-floor named zone polygons, used only when
|
air_boundary |
bool
|
Whether to use |
base_elevation |
float
|
Elevation of the ground floor in metres. Use this to stack blocks at different heights for setbacks. |
Source code in src/idfkit/zoning.py
875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 | |
floor_area
property
¶
Single-floor footprint area in square metres.
height
property
¶
Total building height in metres.
total_floor_area
property
¶
Total floor area across all stories in square metres.
build(doc)
¶
Realise the zoned geometry in the document.
Returns:
| Type | Description |
|---|---|
list[IDFObject]
|
All created IDFObject instances. |
Source code in src/idfkit/zoning.py
ZoningScheme
¶
Bases: Enum
Thermal zoning strategy.
Attributes:
| Name | Type | Description |
|---|---|---|
BY_STOREY |
One zone per floor. |
|
CORE_PERIMETER |
Core + 4 perimeter zones per floor. |
|
CUSTOM |
User-supplied zone polygons per floor. |
Source code in src/idfkit/zoning.py
create_block(doc, name, footprint, floor_to_floor, num_stories=1, *, zoning=ZoningScheme.BY_STOREY, perimeter_depth=ASHRAE_PERIMETER_DEPTH, custom_zones=None, air_boundary=False, base_elevation=0.0)
¶
Create a fully-zoned building block in one call.
This is the primary entry point for the zoning module. It combines footprint definition, zoning strategy, and multi-story extrusion into a single function call.
For setback buildings, create multiple blocks at different elevations
and link them with :func:link_blocks.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
doc
|
IDFDocument
|
The document to add objects to. |
required |
name
|
str
|
Base name for zones and surfaces (e.g. |
required |
footprint
|
Sequence[tuple[float, float]]
|
2-D footprint as |
required |
floor_to_floor
|
float
|
Floor-to-floor height in metres. |
required |
num_stories
|
int
|
Number of above-ground stories. |
1
|
zoning
|
ZoningScheme
|
Zoning strategy (default: one zone per floor). |
BY_STOREY
|
perimeter_depth
|
float
|
Depth of perimeter zones in metres.
Only used when |
ASHRAE_PERIMETER_DEPTH
|
custom_zones
|
list[ZoneFootprint] | None
|
Named zone polygons, required when |
None
|
air_boundary
|
bool
|
If |
False
|
base_elevation
|
float
|
Elevation of the ground floor in metres.
Defaults to 0. When > 0, the ground-floor boundary
condition is |
0.0
|
Returns:
| Type | Description |
|---|---|
list[IDFObject]
|
All created IDFObject instances. |
Examples:
Core-perimeter zoning for a 3-story office:
```python
from idfkit import new_document
from idfkit.zoning import (
ZoningScheme,
create_block,
footprint_rectangle,
)
doc = new_document()
create_block(
doc,
name="Office",
footprint=footprint_rectangle(50, 30),
floor_to_floor=3.5,
num_stories=3,
zoning=ZoningScheme.CORE_PERIMETER,
)
```
Source code in src/idfkit/zoning.py
987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 | |
footprint_courtyard(outer_width, outer_depth, inner_width, inner_depth, origin=(0.0, 0.0))
¶
Return a courtyard (donut) footprint as a single slit polygon.
The polygon traces the outer boundary counter-clockwise, steps into the inner courtyard through a slit at the bottom-right corner, traces the courtyard clockwise, and returns. This is a valid simple polygon that EnergyPlus can handle.
```text
┌──────────────────┐
│ ┌────────────┐ │
│ │ courtyard │ │
│ └────────────┘ │
└──────────────────┘
```
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
outer_width
|
float
|
Outer bounding box width (X). |
required |
outer_depth
|
float
|
Outer bounding box depth (Y). |
required |
inner_width
|
float
|
Courtyard width (X), must be < outer_width. |
required |
inner_depth
|
float
|
Courtyard depth (Y), must be < outer_depth. |
required |
origin
|
tuple[float, float]
|
|
(0.0, 0.0)
|
Source code in src/idfkit/zoning.py
footprint_h_shape(width, depth, courtyard_width, courtyard_depth, origin=(0.0, 0.0))
¶
Return an H-shaped footprint (counter-clockwise).
Two symmetrical courtyards are cut from the left and right sides of the bounding rectangle.
```text
┌──────┐ ┌──────┐
│ └────┘ │
│ connector │
│ ┌────┐ │
└──────┘ └──────┘
```
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
width
|
float
|
Overall width (X). |
required |
depth
|
float
|
Overall depth (Y). |
required |
courtyard_width
|
float
|
Width of each courtyard notch (X). |
required |
courtyard_depth
|
float
|
Depth of each courtyard notch (Y). |
required |
origin
|
tuple[float, float]
|
|
(0.0, 0.0)
|
Source code in src/idfkit/zoning.py
footprint_l_shape(width, depth, wing_width, wing_depth, origin=(0.0, 0.0))
¶
Return an L-shaped footprint (counter-clockwise).
The base rectangle runs from the origin along width (X) and
depth (Y). A shorter wing extends upward from the left side
with dimensions wing_width x wing_depth.
```text
┌────────┐
│ wing │
│ │
├────────┴──────────┐
│ base │
└───────────────────┘
```
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
width
|
float
|
Base width (X). |
required |
depth
|
float
|
Base depth (Y). |
required |
wing_width
|
float
|
Wing width (X), must be <= width. |
required |
wing_depth
|
float
|
Wing depth (Y), added above the base. |
required |
origin
|
tuple[float, float]
|
|
(0.0, 0.0)
|
Source code in src/idfkit/zoning.py
footprint_rectangle(width, depth, origin=(0.0, 0.0))
¶
Return a rectangular footprint (counter-clockwise).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
width
|
float
|
Dimension along the X axis (metres). |
required |
depth
|
float
|
Dimension along the Y axis (metres). |
required |
origin
|
tuple[float, float]
|
|
(0.0, 0.0)
|
Source code in src/idfkit/zoning.py
footprint_t_shape(base_width, base_depth, top_width, top_depth, origin=(0.0, 0.0))
¶
Return a T-shaped footprint (counter-clockwise).
A narrower base rectangle is centred below a wider top bar.
```text
┌──────────────────────┐
│ top bar │
└───┐ ┌───┘
│ base │
└──────────────┘
```
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
base_width
|
float
|
Width of the stem (X). |
required |
base_depth
|
float
|
Depth of the stem (Y). |
required |
top_width
|
float
|
Width of the top bar (X), must be >= base_width. |
required |
top_depth
|
float
|
Depth of the top bar (Y). |
required |
origin
|
tuple[float, float]
|
|
(0.0, 0.0)
|
Source code in src/idfkit/zoning.py
footprint_u_shape(width, depth, courtyard_width, courtyard_depth, origin=(0.0, 0.0))
¶
Return a U-shaped footprint (counter-clockwise).
The overall bounding box is width x depth. A rectangular
courtyard is cut from the top centre of the footprint.
```text
┌──────┐ ┌──────┐
│ │ │ │
│ └────┘ │
│ │
└──────────────────┘
```
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
width
|
float
|
Overall width (X). |
required |
depth
|
float
|
Overall depth (Y). |
required |
courtyard_width
|
float
|
Width of the courtyard opening (X). |
required |
courtyard_depth
|
float
|
Depth of the courtyard from the top edge (Y). |
required |
origin
|
tuple[float, float]
|
|
(0.0, 0.0)
|
Source code in src/idfkit/zoning.py
link_blocks(doc, lower=None, upper=None)
¶
Link stacked building blocks at shared elevations.
Detects roof and floor surfaces at matching elevations, splits
surfaces where the footprints differ, and sets Surface boundary
conditions between the resulting ceiling/floor pairs.
Can be called in two ways:
link_blocks(doc)— auto-detect all stacked blocks.link_blocks(doc, "Base", "Tower")— link only the named blocks (surfaces whose zone name starts with the given prefix).
Uses the lower-level :func:~idfkit.geometry_builders.detect_horizontal_adjacencies,
:func:~idfkit.geometry_builders.split_horizontal_surface, and
:func:~idfkit.geometry_builders.link_horizontal_surfaces functions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
doc
|
IDFDocument
|
The document containing the blocks. |
required |
lower
|
str | None
|
Optional name prefix for the lower block. |
None
|
upper
|
str | None
|
Optional name prefix for the upper block. |
None
|
Returns:
| Type | Description |
|---|---|
list[IDFObject]
|
All created or modified surface objects. |
Examples:
Setback building with a podium and tower:
```python
from idfkit import new_document
from idfkit.zoning import create_block, link_blocks, footprint_rectangle
doc = new_document()
create_block(doc, "Base", footprint_rectangle(50, 30), 3.5, num_stories=5)
create_block(doc, "Tower", footprint_rectangle(40, 24), 3.5, num_stories=3, base_elevation=17.5)
linked = link_blocks(doc)
```
Source code in src/idfkit/zoning.py
1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 | |
See Also¶
- Geometry Builders -- Shading blocks, horizontal adjacency detection, surface splitting, and utility functions
- Geometry -- Lower-level 3D primitives, coordinate transforms, and surface intersection
- Visualization -- 3D rendering of building geometry