@kruschdev/pascal-plugin-plumbing 0.0.0-stage → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +123 -2
- package/docs/AGENT-TOOLS.md +12 -0
- package/docs/ARCHITECTURE.md +15 -0
- package/docs/CAD-CATALOG.md +10 -0
- package/docs/IPC-REFERENCE.md +17 -0
- package/package.json +89 -4
- package/src/agent-operations.ts +854 -0
- package/src/agent-tools.ts +258 -0
- package/src/cad/catalog.ts +151 -0
- package/src/cad/equipment.ts +172 -0
- package/src/cad/fittings.ts +322 -0
- package/src/cad/fixtures.ts +255 -0
- package/src/cad/index.ts +6 -0
- package/src/cad/manifold-interior.ts +248 -0
- package/src/cad/materials.ts +122 -0
- package/src/index.ts +156 -0
- package/src/ipc/audit.ts +927 -0
- package/src/ipc/autopopulate.ts +5071 -0
- package/src/ipc/framing-interop.ts +843 -0
- package/src/ipc/index.ts +9 -0
- package/src/ipc/pricing.ts +571 -0
- package/src/ipc/routing.ts +2410 -0
- package/src/ipc/rules.ts +271 -0
- package/src/ipc/schedule.ts +653 -0
- package/src/ipc/sizing.ts +663 -0
- package/src/ipc/tables.ts +780 -0
- package/src/nodes/equipment.ts +330 -0
- package/src/nodes/fixture.ts +245 -0
- package/src/nodes/manifold.ts +194 -0
- package/src/nodes/parametrics.ts +170 -0
- package/src/nodes/pipe-run.ts +393 -0
- package/src/render.ts +64 -0
- package/src/ui/chat-card.tsx +209 -0
- package/src/ui/inspector-card.tsx +243 -0
- package/src/ui/manifold-cutaway-view.tsx +297 -0
- package/src/ui/plumbing-panel.tsx +812 -0
- package/src/ui/schedule-view.tsx +523 -0
- package/src/ui/store.ts +98 -0
|
@@ -0,0 +1,780 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure TypeScript IPC 2021 / UPC 2021 / IFGC 2021 / IRC 2021 plumbing tables and constants.
|
|
3
|
+
* Framework-free: zero Three.js, React, or `@pascal-app/*` imports.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export const FEET_TO_METERS = 0.3048
|
|
7
|
+
export const METERS_TO_FEET = 1 / FEET_TO_METERS
|
|
8
|
+
export const INCHES_TO_METERS = 0.0254
|
|
9
|
+
export const METERS_TO_INCHES = 1 / INCHES_TO_METERS
|
|
10
|
+
|
|
11
|
+
export type CodeEdition = 'IPC-2021' | 'UPC-2021'
|
|
12
|
+
export type OccupancyType = 'residential' | 'commercial'
|
|
13
|
+
export type SupplyTopology = 'manifold' | 'trunk-and-branch'
|
|
14
|
+
export type FoundationType = 'slab' | 'crawlspace' | 'basement'
|
|
15
|
+
|
|
16
|
+
export type PlumbingSystem =
|
|
17
|
+
| 'cold-water'
|
|
18
|
+
| 'hot-water'
|
|
19
|
+
| 'hot-recirc'
|
|
20
|
+
| 'dwv-drain'
|
|
21
|
+
| 'dwv-vent'
|
|
22
|
+
| 'fuel-gas'
|
|
23
|
+
| 'condensate'
|
|
24
|
+
| 'dryer-vent'
|
|
25
|
+
|
|
26
|
+
export type PipeMaterial =
|
|
27
|
+
| 'pex-a'
|
|
28
|
+
| 'pex-b'
|
|
29
|
+
| 'copper-l'
|
|
30
|
+
| 'copper-m'
|
|
31
|
+
| 'cpvc'
|
|
32
|
+
| 'pvc-dwv'
|
|
33
|
+
| 'abs-dwv'
|
|
34
|
+
| 'cast-iron'
|
|
35
|
+
| 'csst'
|
|
36
|
+
| 'black-iron'
|
|
37
|
+
| 'rigid-aluminum'
|
|
38
|
+
|
|
39
|
+
export type PipeNominalSize =
|
|
40
|
+
| '3/8"'
|
|
41
|
+
| '1/2"'
|
|
42
|
+
| '3/4"'
|
|
43
|
+
| '1"'
|
|
44
|
+
| '1-1/4"'
|
|
45
|
+
| '1-1/2"'
|
|
46
|
+
| '2"'
|
|
47
|
+
| '2-1/2"'
|
|
48
|
+
| '3"'
|
|
49
|
+
| '4"'
|
|
50
|
+
| '6"'
|
|
51
|
+
|
|
52
|
+
export const PIPE_SIZE_ORDER: readonly PipeNominalSize[] = [
|
|
53
|
+
'3/8"',
|
|
54
|
+
'1/2"',
|
|
55
|
+
'3/4"',
|
|
56
|
+
'1"',
|
|
57
|
+
'1-1/4"',
|
|
58
|
+
'1-1/2"',
|
|
59
|
+
'2"',
|
|
60
|
+
'2-1/2"',
|
|
61
|
+
'3"',
|
|
62
|
+
'4"',
|
|
63
|
+
'6"',
|
|
64
|
+
] as const
|
|
65
|
+
|
|
66
|
+
export const PIPE_NOMINAL_INCHES: Readonly<Record<PipeNominalSize, number>> = {
|
|
67
|
+
'3/8"': 0.375,
|
|
68
|
+
'1/2"': 0.5,
|
|
69
|
+
'3/4"': 0.75,
|
|
70
|
+
'1"': 1.0,
|
|
71
|
+
'1-1/4"': 1.25,
|
|
72
|
+
'1-1/2"': 1.5,
|
|
73
|
+
'2"': 2.0,
|
|
74
|
+
'2-1/2"': 2.5,
|
|
75
|
+
'3"': 3.0,
|
|
76
|
+
'4"': 4.0,
|
|
77
|
+
'6"': 6.0,
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Actual outer diameter (inches) for stud-boring and 3D CAD rendering.
|
|
82
|
+
* Copper/PEX CTS vs IPS Sch-40 PVC/ABS/Black-Iron.
|
|
83
|
+
*/
|
|
84
|
+
export const PIPE_OD_INCHES: Readonly<Record<PipeNominalSize, { cts: number; ips: number }>> = {
|
|
85
|
+
'3/8"': { cts: 0.5, ips: 0.675 },
|
|
86
|
+
'1/2"': { cts: 0.625, ips: 0.84 },
|
|
87
|
+
'3/4"': { cts: 0.875, ips: 1.05 },
|
|
88
|
+
'1"': { cts: 1.125, ips: 1.315 },
|
|
89
|
+
'1-1/4"': { cts: 1.375, ips: 1.66 },
|
|
90
|
+
'1-1/2"': { cts: 1.625, ips: 1.9 },
|
|
91
|
+
'2"': { cts: 2.125, ips: 2.375 },
|
|
92
|
+
'2-1/2"': { cts: 2.625, ips: 2.875 },
|
|
93
|
+
'3"': { cts: 3.125, ips: 3.5 },
|
|
94
|
+
'4"': { cts: 4.125, ips: 4.5 },
|
|
95
|
+
'6"': { cts: 6.125, ips: 6.625 },
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Actual inner diameter (inches) by material family for velocity & Hazen-Williams head loss.
|
|
100
|
+
*/
|
|
101
|
+
export const SUPPLY_ID_INCHES: Readonly<
|
|
102
|
+
Record<'pex-a' | 'pex-b' | 'copper-l' | 'copper-m' | 'cpvc', Readonly<Record<string, number>>>
|
|
103
|
+
> = {
|
|
104
|
+
'pex-a': {
|
|
105
|
+
'3/8"': 0.35,
|
|
106
|
+
'1/2"': 0.475,
|
|
107
|
+
'3/4"': 0.671,
|
|
108
|
+
'1"': 0.862,
|
|
109
|
+
'1-1/4"': 1.054,
|
|
110
|
+
'1-1/2"': 1.244,
|
|
111
|
+
'2"': 1.629,
|
|
112
|
+
'2-1/2"': 2.011,
|
|
113
|
+
'3"': 2.398,
|
|
114
|
+
'4"': 3.172,
|
|
115
|
+
'6"': 4.716,
|
|
116
|
+
},
|
|
117
|
+
'pex-b': {
|
|
118
|
+
'3/8"': 0.35,
|
|
119
|
+
'1/2"': 0.475,
|
|
120
|
+
'3/4"': 0.671,
|
|
121
|
+
'1"': 0.862,
|
|
122
|
+
'1-1/4"': 1.054,
|
|
123
|
+
'1-1/2"': 1.244,
|
|
124
|
+
'2"': 1.629,
|
|
125
|
+
'2-1/2"': 2.011,
|
|
126
|
+
'3"': 2.398,
|
|
127
|
+
'4"': 3.172,
|
|
128
|
+
'6"': 4.716,
|
|
129
|
+
},
|
|
130
|
+
'copper-l': {
|
|
131
|
+
'3/8"': 0.43,
|
|
132
|
+
'1/2"': 0.545,
|
|
133
|
+
'3/4"': 0.785,
|
|
134
|
+
'1"': 1.025,
|
|
135
|
+
'1-1/4"': 1.265,
|
|
136
|
+
'1-1/2"': 1.505,
|
|
137
|
+
'2"': 1.985,
|
|
138
|
+
'2-1/2"': 2.465,
|
|
139
|
+
'3"': 2.945,
|
|
140
|
+
'4"': 3.905,
|
|
141
|
+
'6"': 5.845,
|
|
142
|
+
},
|
|
143
|
+
'copper-m': {
|
|
144
|
+
'3/8"': 0.45,
|
|
145
|
+
'1/2"': 0.569,
|
|
146
|
+
'3/4"': 0.811,
|
|
147
|
+
'1"': 1.055,
|
|
148
|
+
'1-1/4"': 1.291,
|
|
149
|
+
'1-1/2"': 1.527,
|
|
150
|
+
'2"': 2.009,
|
|
151
|
+
'2-1/2"': 2.495,
|
|
152
|
+
'3"': 2.981,
|
|
153
|
+
'4"': 3.935,
|
|
154
|
+
'6"': 5.881,
|
|
155
|
+
},
|
|
156
|
+
cpvc: {
|
|
157
|
+
'3/8"': 0.36,
|
|
158
|
+
'1/2"': 0.469,
|
|
159
|
+
'3/4"': 0.695,
|
|
160
|
+
'1"': 0.901,
|
|
161
|
+
'1-1/4"': 1.105,
|
|
162
|
+
'1-1/2"': 1.309,
|
|
163
|
+
'2"': 1.716,
|
|
164
|
+
'2-1/2"': 2.469,
|
|
165
|
+
'3"': 3.068,
|
|
166
|
+
'4"': 4.026,
|
|
167
|
+
'6"': 6.065,
|
|
168
|
+
},
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/** Hazen-Williams C roughness factors and maximum allowable water velocity (ft/s). */
|
|
172
|
+
export const SUPPLY_MATERIAL_HYDRAULICS: Readonly<
|
|
173
|
+
Record<
|
|
174
|
+
'pex-a' | 'pex-b' | 'copper-l' | 'copper-m' | 'cpvc',
|
|
175
|
+
{ cFactor: number; maxVelocityColdFps: number; maxVelocityHotFps: number; stickOrRollFt: number; unitLabel: string }
|
|
176
|
+
>
|
|
177
|
+
> = {
|
|
178
|
+
'pex-a': { cFactor: 150, maxVelocityColdFps: 8, maxVelocityHotFps: 8, stickOrRollFt: 100, unitLabel: '100 ft roll' },
|
|
179
|
+
'pex-b': { cFactor: 150, maxVelocityColdFps: 8, maxVelocityHotFps: 8, stickOrRollFt: 100, unitLabel: '100 ft roll' },
|
|
180
|
+
'copper-l': { cFactor: 130, maxVelocityColdFps: 8, maxVelocityHotFps: 5, stickOrRollFt: 20, unitLabel: '20 ft stick' },
|
|
181
|
+
'copper-m': { cFactor: 130, maxVelocityColdFps: 8, maxVelocityHotFps: 5, stickOrRollFt: 20, unitLabel: '20 ft stick' },
|
|
182
|
+
cpvc: { cFactor: 150, maxVelocityColdFps: 8, maxVelocityHotFps: 8, stickOrRollFt: 10, unitLabel: '10 ft stick' },
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
export type FixtureKind =
|
|
186
|
+
| 'water-closet'
|
|
187
|
+
| 'lavatory'
|
|
188
|
+
| 'kitchen-sink'
|
|
189
|
+
| 'bathtub'
|
|
190
|
+
| 'shower'
|
|
191
|
+
| 'tub-shower-combo'
|
|
192
|
+
| 'dishwasher'
|
|
193
|
+
| 'clothes-washer'
|
|
194
|
+
| 'laundry-sink'
|
|
195
|
+
| 'bar-sink'
|
|
196
|
+
| 'floor-drain'
|
|
197
|
+
| 'hose-bibb'
|
|
198
|
+
| 'bidet'
|
|
199
|
+
| 'garbage-disposal'
|
|
200
|
+
| 'urinal'
|
|
201
|
+
| 'mop-sink'
|
|
202
|
+
| 'drinking-fountain'
|
|
203
|
+
| 'grease-interceptor'
|
|
204
|
+
|
|
205
|
+
export type EquipmentKind =
|
|
206
|
+
| 'water-heater-tank-gas'
|
|
207
|
+
| 'water-heater-tank-electric'
|
|
208
|
+
| 'water-heater-tankless-gas'
|
|
209
|
+
| 'water-heater-hpwh'
|
|
210
|
+
| 'expansion-tank'
|
|
211
|
+
| 'main-shutoff-prv'
|
|
212
|
+
| 'water-softener'
|
|
213
|
+
| 'sump-pump'
|
|
214
|
+
| 'sewage-ejector'
|
|
215
|
+
| 'recirc-pump'
|
|
216
|
+
| 'gas-meter'
|
|
217
|
+
| 'backwater-valve'
|
|
218
|
+
|
|
219
|
+
export type ManifoldKind = 'pex-homerun' | 'copper-header' | 'gas-csst'
|
|
220
|
+
|
|
221
|
+
export type FixtureSpec = {
|
|
222
|
+
kind: FixtureKind
|
|
223
|
+
label: string
|
|
224
|
+
dfuIpc: number
|
|
225
|
+
dfuUpc: number
|
|
226
|
+
wsfuCold: number
|
|
227
|
+
wsfuHot: number
|
|
228
|
+
wsfuTotal: number
|
|
229
|
+
minTrapIn: PipeNominalSize | null
|
|
230
|
+
minDrainIn: PipeNominalSize | null
|
|
231
|
+
minVentIn: PipeNominalSize | null
|
|
232
|
+
supplySizeIn: PipeNominalSize | null
|
|
233
|
+
needsHotWater: boolean
|
|
234
|
+
needsPTrap: boolean
|
|
235
|
+
/** Standard rough-in drain/supply centerline height above finished floor (meters). */
|
|
236
|
+
roughInHeightM: number
|
|
237
|
+
/** Flood-level rim height above finished floor (meters) for IPC 905.5 vent checks. */
|
|
238
|
+
floodRimHeightM: number
|
|
239
|
+
/** Nominal fixture footprint [widthM, heightM, depthM]. */
|
|
240
|
+
dimensionsM: readonly [number, number, number]
|
|
241
|
+
commercialOnly?: boolean
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* IPC Table 709.1 (DFU), UPC Table 702.1 (DFU), and IPC Table E103.3(2) (WSFU).
|
|
246
|
+
*/
|
|
247
|
+
export const FIXTURE_SPECS: Readonly<Record<FixtureKind, FixtureSpec>> = {
|
|
248
|
+
'water-closet': {
|
|
249
|
+
kind: 'water-closet',
|
|
250
|
+
label: 'Water Closet (1.28/1.6 GPF)',
|
|
251
|
+
dfuIpc: 3,
|
|
252
|
+
dfuUpc: 3,
|
|
253
|
+
wsfuCold: 2.2,
|
|
254
|
+
wsfuHot: 0,
|
|
255
|
+
wsfuTotal: 2.2,
|
|
256
|
+
minTrapIn: '3"',
|
|
257
|
+
minDrainIn: '3"',
|
|
258
|
+
minVentIn: '2"',
|
|
259
|
+
supplySizeIn: '1/2"',
|
|
260
|
+
needsHotWater: false,
|
|
261
|
+
needsPTrap: false, // Integral trap inside porcelain bowl
|
|
262
|
+
roughInHeightM: 0.15,
|
|
263
|
+
floodRimHeightM: 0.42,
|
|
264
|
+
dimensionsM: [0.42, 0.78, 0.70],
|
|
265
|
+
},
|
|
266
|
+
lavatory: {
|
|
267
|
+
kind: 'lavatory',
|
|
268
|
+
label: 'Lavatory / Vanity Sink',
|
|
269
|
+
dfuIpc: 1,
|
|
270
|
+
dfuUpc: 1,
|
|
271
|
+
wsfuCold: 0.5,
|
|
272
|
+
wsfuHot: 0.5,
|
|
273
|
+
wsfuTotal: 0.7,
|
|
274
|
+
minTrapIn: '1-1/4"',
|
|
275
|
+
minDrainIn: '1-1/2"',
|
|
276
|
+
minVentIn: '1-1/2"',
|
|
277
|
+
supplySizeIn: '1/2"',
|
|
278
|
+
needsHotWater: true,
|
|
279
|
+
needsPTrap: true,
|
|
280
|
+
roughInHeightM: 0.53, // ~21" AFF drain rough-in
|
|
281
|
+
floodRimHeightM: 0.84,
|
|
282
|
+
dimensionsM: [0.60, 0.84, 0.50],
|
|
283
|
+
},
|
|
284
|
+
'kitchen-sink': {
|
|
285
|
+
kind: 'kitchen-sink',
|
|
286
|
+
label: 'Kitchen Sink',
|
|
287
|
+
dfuIpc: 2,
|
|
288
|
+
dfuUpc: 2,
|
|
289
|
+
wsfuCold: 1.0,
|
|
290
|
+
wsfuHot: 1.0,
|
|
291
|
+
wsfuTotal: 1.4,
|
|
292
|
+
minTrapIn: '1-1/2"',
|
|
293
|
+
minDrainIn: '2"',
|
|
294
|
+
minVentIn: '1-1/2"',
|
|
295
|
+
supplySizeIn: '1/2"',
|
|
296
|
+
needsHotWater: true,
|
|
297
|
+
needsPTrap: true,
|
|
298
|
+
roughInHeightM: 0.46, // ~18" AFF drain rough-in
|
|
299
|
+
floodRimHeightM: 0.91,
|
|
300
|
+
dimensionsM: [0.84, 0.91, 0.56],
|
|
301
|
+
},
|
|
302
|
+
bathtub: {
|
|
303
|
+
kind: 'bathtub',
|
|
304
|
+
label: 'Alcove Bathtub',
|
|
305
|
+
dfuIpc: 2,
|
|
306
|
+
dfuUpc: 2,
|
|
307
|
+
wsfuCold: 1.0,
|
|
308
|
+
wsfuHot: 1.0,
|
|
309
|
+
wsfuTotal: 1.4,
|
|
310
|
+
minTrapIn: '1-1/2"',
|
|
311
|
+
minDrainIn: '1-1/2"',
|
|
312
|
+
minVentIn: '1-1/2"',
|
|
313
|
+
supplySizeIn: '1/2"',
|
|
314
|
+
needsHotWater: true,
|
|
315
|
+
needsPTrap: true,
|
|
316
|
+
roughInHeightM: 0.15,
|
|
317
|
+
floodRimHeightM: 0.46,
|
|
318
|
+
dimensionsM: [1.52, 0.50, 0.76],
|
|
319
|
+
},
|
|
320
|
+
shower: {
|
|
321
|
+
kind: 'shower',
|
|
322
|
+
label: 'Walk-In Shower',
|
|
323
|
+
dfuIpc: 2,
|
|
324
|
+
dfuUpc: 2,
|
|
325
|
+
wsfuCold: 1.0,
|
|
326
|
+
wsfuHot: 1.0,
|
|
327
|
+
wsfuTotal: 1.4,
|
|
328
|
+
minTrapIn: '2"',
|
|
329
|
+
minDrainIn: '2"',
|
|
330
|
+
minVentIn: '1-1/2"',
|
|
331
|
+
supplySizeIn: '1/2"',
|
|
332
|
+
needsHotWater: true,
|
|
333
|
+
needsPTrap: true,
|
|
334
|
+
roughInHeightM: 0.05,
|
|
335
|
+
floodRimHeightM: 0.18,
|
|
336
|
+
dimensionsM: [0.96, 2.05, 0.96],
|
|
337
|
+
},
|
|
338
|
+
'tub-shower-combo': {
|
|
339
|
+
kind: 'tub-shower-combo',
|
|
340
|
+
label: 'Tub / Shower Combo',
|
|
341
|
+
dfuIpc: 2,
|
|
342
|
+
dfuUpc: 2,
|
|
343
|
+
wsfuCold: 1.0,
|
|
344
|
+
wsfuHot: 1.0,
|
|
345
|
+
wsfuTotal: 1.4,
|
|
346
|
+
minTrapIn: '1-1/2"',
|
|
347
|
+
minDrainIn: '2"',
|
|
348
|
+
minVentIn: '1-1/2"',
|
|
349
|
+
supplySizeIn: '1/2"',
|
|
350
|
+
needsHotWater: true,
|
|
351
|
+
needsPTrap: true,
|
|
352
|
+
roughInHeightM: 0.15,
|
|
353
|
+
floodRimHeightM: 0.46,
|
|
354
|
+
dimensionsM: [1.52, 2.05, 0.80],
|
|
355
|
+
},
|
|
356
|
+
dishwasher: {
|
|
357
|
+
kind: 'dishwasher',
|
|
358
|
+
label: 'Dishwasher Hookup',
|
|
359
|
+
dfuIpc: 2,
|
|
360
|
+
dfuUpc: 2,
|
|
361
|
+
wsfuCold: 0,
|
|
362
|
+
wsfuHot: 1.4,
|
|
363
|
+
wsfuTotal: 1.4,
|
|
364
|
+
minTrapIn: '1-1/2"',
|
|
365
|
+
minDrainIn: '2"',
|
|
366
|
+
minVentIn: '1-1/2"',
|
|
367
|
+
supplySizeIn: '1/2"',
|
|
368
|
+
needsHotWater: true,
|
|
369
|
+
needsPTrap: false, // Indirect drain via kitchen sink trap / disposal
|
|
370
|
+
roughInHeightM: 0.40,
|
|
371
|
+
floodRimHeightM: 0.86,
|
|
372
|
+
dimensionsM: [0.60, 0.86, 0.60],
|
|
373
|
+
},
|
|
374
|
+
'clothes-washer': {
|
|
375
|
+
kind: 'clothes-washer',
|
|
376
|
+
label: 'Washer Outlet Box (2" Standpipe)',
|
|
377
|
+
dfuIpc: 2,
|
|
378
|
+
dfuUpc: 3,
|
|
379
|
+
wsfuCold: 1.0,
|
|
380
|
+
wsfuHot: 1.0,
|
|
381
|
+
wsfuTotal: 1.4,
|
|
382
|
+
minTrapIn: '2"',
|
|
383
|
+
minDrainIn: '2"',
|
|
384
|
+
minVentIn: '1-1/2"',
|
|
385
|
+
supplySizeIn: '1/2"',
|
|
386
|
+
needsHotWater: true,
|
|
387
|
+
needsPTrap: true,
|
|
388
|
+
roughInHeightM: 1.07, // ~42" AFF recessed washer box
|
|
389
|
+
floodRimHeightM: 1.07,
|
|
390
|
+
dimensionsM: [0.24, 0.22, 0.11],
|
|
391
|
+
},
|
|
392
|
+
'laundry-sink': {
|
|
393
|
+
kind: 'laundry-sink',
|
|
394
|
+
label: 'Laundry / Utility Sink',
|
|
395
|
+
dfuIpc: 2,
|
|
396
|
+
dfuUpc: 2,
|
|
397
|
+
wsfuCold: 1.0,
|
|
398
|
+
wsfuHot: 1.0,
|
|
399
|
+
wsfuTotal: 1.4,
|
|
400
|
+
minTrapIn: '1-1/2"',
|
|
401
|
+
minDrainIn: '2"',
|
|
402
|
+
minVentIn: '1-1/2"',
|
|
403
|
+
supplySizeIn: '1/2"',
|
|
404
|
+
needsHotWater: true,
|
|
405
|
+
needsPTrap: true,
|
|
406
|
+
roughInHeightM: 0.46,
|
|
407
|
+
floodRimHeightM: 0.89,
|
|
408
|
+
dimensionsM: [0.62, 0.89, 0.56],
|
|
409
|
+
},
|
|
410
|
+
'bar-sink': {
|
|
411
|
+
kind: 'bar-sink',
|
|
412
|
+
label: 'Wet-Bar Sink',
|
|
413
|
+
dfuIpc: 1,
|
|
414
|
+
dfuUpc: 1,
|
|
415
|
+
wsfuCold: 0.5,
|
|
416
|
+
wsfuHot: 0.5,
|
|
417
|
+
wsfuTotal: 0.7,
|
|
418
|
+
minTrapIn: '1-1/2"',
|
|
419
|
+
minDrainIn: '1-1/2"',
|
|
420
|
+
minVentIn: '1-1/2"',
|
|
421
|
+
supplySizeIn: '1/2"',
|
|
422
|
+
needsHotWater: true,
|
|
423
|
+
needsPTrap: true,
|
|
424
|
+
roughInHeightM: 0.46,
|
|
425
|
+
floodRimHeightM: 0.91,
|
|
426
|
+
dimensionsM: [0.46, 0.91, 0.46],
|
|
427
|
+
},
|
|
428
|
+
'floor-drain': {
|
|
429
|
+
kind: 'floor-drain',
|
|
430
|
+
label: 'Floor Drain (2" Trap)',
|
|
431
|
+
dfuIpc: 2,
|
|
432
|
+
dfuUpc: 2,
|
|
433
|
+
wsfuCold: 0,
|
|
434
|
+
wsfuHot: 0,
|
|
435
|
+
wsfuTotal: 0,
|
|
436
|
+
minTrapIn: '2"',
|
|
437
|
+
minDrainIn: '2"',
|
|
438
|
+
minVentIn: '1-1/2"',
|
|
439
|
+
supplySizeIn: null,
|
|
440
|
+
needsHotWater: false,
|
|
441
|
+
needsPTrap: true,
|
|
442
|
+
roughInHeightM: 0.0,
|
|
443
|
+
floodRimHeightM: 0.0,
|
|
444
|
+
dimensionsM: [0.16, 0.04, 0.16],
|
|
445
|
+
},
|
|
446
|
+
'hose-bibb': {
|
|
447
|
+
kind: 'hose-bibb',
|
|
448
|
+
label: 'Frost-Proof Hose Bibb (Vacuum Breaker)',
|
|
449
|
+
dfuIpc: 0,
|
|
450
|
+
dfuUpc: 0,
|
|
451
|
+
wsfuCold: 2.5,
|
|
452
|
+
wsfuHot: 0,
|
|
453
|
+
wsfuTotal: 2.5,
|
|
454
|
+
minTrapIn: null,
|
|
455
|
+
minDrainIn: null,
|
|
456
|
+
minVentIn: null,
|
|
457
|
+
supplySizeIn: '1/2"',
|
|
458
|
+
needsHotWater: false,
|
|
459
|
+
needsPTrap: false,
|
|
460
|
+
roughInHeightM: 0.46, // ~18" AFF exterior wall
|
|
461
|
+
floodRimHeightM: 0.46,
|
|
462
|
+
dimensionsM: [0.12, 0.14, 0.22],
|
|
463
|
+
},
|
|
464
|
+
bidet: {
|
|
465
|
+
kind: 'bidet',
|
|
466
|
+
label: 'Bidet',
|
|
467
|
+
dfuIpc: 1,
|
|
468
|
+
dfuUpc: 1,
|
|
469
|
+
wsfuCold: 0.5,
|
|
470
|
+
wsfuHot: 0.5,
|
|
471
|
+
wsfuTotal: 0.7,
|
|
472
|
+
minTrapIn: '1-1/4"',
|
|
473
|
+
minDrainIn: '1-1/2"',
|
|
474
|
+
minVentIn: '1-1/2"',
|
|
475
|
+
supplySizeIn: '1/2"',
|
|
476
|
+
needsHotWater: true,
|
|
477
|
+
needsPTrap: true,
|
|
478
|
+
roughInHeightM: 0.20,
|
|
479
|
+
floodRimHeightM: 0.40,
|
|
480
|
+
dimensionsM: [0.38, 0.42, 0.58],
|
|
481
|
+
},
|
|
482
|
+
'garbage-disposal': {
|
|
483
|
+
kind: 'garbage-disposal',
|
|
484
|
+
label: 'Garbage Disposal (3/4 HP)',
|
|
485
|
+
dfuIpc: 2,
|
|
486
|
+
dfuUpc: 2,
|
|
487
|
+
wsfuCold: 0,
|
|
488
|
+
wsfuHot: 0,
|
|
489
|
+
wsfuTotal: 0,
|
|
490
|
+
minTrapIn: '1-1/2"',
|
|
491
|
+
minDrainIn: '2"',
|
|
492
|
+
minVentIn: '1-1/2"',
|
|
493
|
+
supplySizeIn: null,
|
|
494
|
+
needsHotWater: false,
|
|
495
|
+
needsPTrap: true,
|
|
496
|
+
roughInHeightM: 0.42,
|
|
497
|
+
floodRimHeightM: 0.91,
|
|
498
|
+
dimensionsM: [0.22, 0.34, 0.22],
|
|
499
|
+
},
|
|
500
|
+
urinal: {
|
|
501
|
+
kind: 'urinal',
|
|
502
|
+
label: 'Commercial Wall-Hung Urinal',
|
|
503
|
+
dfuIpc: 4,
|
|
504
|
+
dfuUpc: 2,
|
|
505
|
+
wsfuCold: 5.0,
|
|
506
|
+
wsfuHot: 0,
|
|
507
|
+
wsfuTotal: 5.0,
|
|
508
|
+
minTrapIn: '2"',
|
|
509
|
+
minDrainIn: '2"',
|
|
510
|
+
minVentIn: '1-1/2"',
|
|
511
|
+
supplySizeIn: '3/4"',
|
|
512
|
+
needsHotWater: false,
|
|
513
|
+
needsPTrap: false,
|
|
514
|
+
roughInHeightM: 0.46,
|
|
515
|
+
floodRimHeightM: 0.61,
|
|
516
|
+
dimensionsM: [0.36, 0.66, 0.36],
|
|
517
|
+
commercialOnly: true,
|
|
518
|
+
},
|
|
519
|
+
'mop-sink': {
|
|
520
|
+
kind: 'mop-sink',
|
|
521
|
+
label: 'Commercial Mop / Service Basin',
|
|
522
|
+
dfuIpc: 3,
|
|
523
|
+
dfuUpc: 3,
|
|
524
|
+
wsfuCold: 1.5,
|
|
525
|
+
wsfuHot: 1.5,
|
|
526
|
+
wsfuTotal: 2.0,
|
|
527
|
+
minTrapIn: '3"',
|
|
528
|
+
minDrainIn: '3"',
|
|
529
|
+
minVentIn: '2"',
|
|
530
|
+
supplySizeIn: '1/2"',
|
|
531
|
+
needsHotWater: true,
|
|
532
|
+
needsPTrap: true,
|
|
533
|
+
roughInHeightM: 0.05,
|
|
534
|
+
floodRimHeightM: 0.30,
|
|
535
|
+
dimensionsM: [0.61, 0.32, 0.61],
|
|
536
|
+
commercialOnly: true,
|
|
537
|
+
},
|
|
538
|
+
'drinking-fountain': {
|
|
539
|
+
kind: 'drinking-fountain',
|
|
540
|
+
label: 'Commercial Drinking Fountain',
|
|
541
|
+
dfuIpc: 0.5,
|
|
542
|
+
dfuUpc: 0.5,
|
|
543
|
+
wsfuCold: 0.25,
|
|
544
|
+
wsfuHot: 0,
|
|
545
|
+
wsfuTotal: 0.25,
|
|
546
|
+
minTrapIn: '1-1/4"',
|
|
547
|
+
minDrainIn: '1-1/2"',
|
|
548
|
+
minVentIn: '1-1/4"',
|
|
549
|
+
supplySizeIn: '1/2"',
|
|
550
|
+
needsHotWater: false,
|
|
551
|
+
needsPTrap: true,
|
|
552
|
+
roughInHeightM: 0.68,
|
|
553
|
+
floodRimHeightM: 0.91,
|
|
554
|
+
dimensionsM: [0.46, 0.55, 0.46],
|
|
555
|
+
commercialOnly: true,
|
|
556
|
+
},
|
|
557
|
+
'grease-interceptor': {
|
|
558
|
+
kind: 'grease-interceptor',
|
|
559
|
+
label: 'Commercial Grease Interceptor (50 GPM)',
|
|
560
|
+
dfuIpc: 4,
|
|
561
|
+
dfuUpc: 4,
|
|
562
|
+
wsfuCold: 0,
|
|
563
|
+
wsfuHot: 0,
|
|
564
|
+
wsfuTotal: 0,
|
|
565
|
+
minTrapIn: '3"',
|
|
566
|
+
minDrainIn: '3"',
|
|
567
|
+
minVentIn: '2"',
|
|
568
|
+
supplySizeIn: null,
|
|
569
|
+
needsHotWater: false,
|
|
570
|
+
needsPTrap: false,
|
|
571
|
+
roughInHeightM: 0.15,
|
|
572
|
+
floodRimHeightM: 0.48,
|
|
573
|
+
dimensionsM: [0.85, 0.50, 0.60],
|
|
574
|
+
commercialOnly: true,
|
|
575
|
+
},
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
/**
|
|
579
|
+
* IPC Table 710.1(1) — Building Drains & Sewers maximum DFU by nominal size and slope (in/ft).
|
|
580
|
+
*/
|
|
581
|
+
export const IPC_BUILDING_DRAIN_MAX_DFU: ReadonlyArray<{
|
|
582
|
+
size: PipeNominalSize
|
|
583
|
+
slopeEighth: number | null // 1/8" per foot (1.04%) — allowed only for >= 3"
|
|
584
|
+
slopeQuarter: number // 1/4" per foot (2.08%)
|
|
585
|
+
slopeHalf: number // 1/2" per foot (4.17%)
|
|
586
|
+
}> = [
|
|
587
|
+
{ size: '1-1/2"', slopeEighth: null, slopeQuarter: 3, slopeHalf: 3 },
|
|
588
|
+
{ size: '2"', slopeEighth: null, slopeQuarter: 21, slopeHalf: 26 },
|
|
589
|
+
{ size: '2-1/2"', slopeEighth: null, slopeQuarter: 24, slopeHalf: 31 },
|
|
590
|
+
{ size: '3"', slopeEighth: 36, slopeQuarter: 42, slopeHalf: 50 },
|
|
591
|
+
{ size: '4"', slopeEighth: 180, slopeQuarter: 216, slopeHalf: 250 },
|
|
592
|
+
{ size: '6"', slopeEighth: 700, slopeQuarter: 840, slopeHalf: 1000 },
|
|
593
|
+
]
|
|
594
|
+
|
|
595
|
+
/**
|
|
596
|
+
* IPC Table 710.1(2) — Horizontal Fixture Branches & Vertical Stacks max DFU.
|
|
597
|
+
*/
|
|
598
|
+
export const IPC_HORIZONTAL_BRANCH_MAX_DFU: ReadonlyArray<{
|
|
599
|
+
size: PipeNominalSize
|
|
600
|
+
maxBranchDfu: number
|
|
601
|
+
maxStackDfu: number
|
|
602
|
+
}> = [
|
|
603
|
+
{ size: '1-1/2"', maxBranchDfu: 3, maxStackDfu: 4 },
|
|
604
|
+
{ size: '2"', maxBranchDfu: 6, maxStackDfu: 10 },
|
|
605
|
+
{ size: '2-1/2"', maxBranchDfu: 12, maxStackDfu: 20 },
|
|
606
|
+
{ size: '3"', maxBranchDfu: 20, maxStackDfu: 48 },
|
|
607
|
+
{ size: '4"', maxBranchDfu: 160, maxStackDfu: 240 },
|
|
608
|
+
{ size: '6"', maxBranchDfu: 620, maxStackDfu: 960 },
|
|
609
|
+
]
|
|
610
|
+
|
|
611
|
+
/**
|
|
612
|
+
* IPC Table 909.1 — Maximum distance from trap to vent (feet) at 1/4"/ft slope (1/8"/ft for 3"-4").
|
|
613
|
+
*/
|
|
614
|
+
export const IPC_MAX_TRAP_ARM_FT: Readonly<Record<string, number>> = {
|
|
615
|
+
'1-1/4"': 5,
|
|
616
|
+
'1-1/2"': 6,
|
|
617
|
+
'2"': 8,
|
|
618
|
+
'3"': 12,
|
|
619
|
+
'4"': 16,
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
/**
|
|
623
|
+
* IPC Table 906.1 — Minimum vent stack / branch vent diameter by connected DFU (simplified up to 100 ft developed length).
|
|
624
|
+
*/
|
|
625
|
+
export const IPC_VENT_SIZING_TABLE: ReadonlyArray<{
|
|
626
|
+
maxDfu: number
|
|
627
|
+
minVentIn: PipeNominalSize
|
|
628
|
+
maxDevelopedFt: number
|
|
629
|
+
}> = [
|
|
630
|
+
{ maxDfu: 8, minVentIn: '1-1/2"', maxDevelopedFt: 50 },
|
|
631
|
+
{ maxDfu: 24, minVentIn: '2"', maxDevelopedFt: 120 },
|
|
632
|
+
{ maxDfu: 48, minVentIn: '2"', maxDevelopedFt: 75 },
|
|
633
|
+
{ maxDfu: 212, minVentIn: '3"', maxDevelopedFt: 200 },
|
|
634
|
+
{ maxDfu: 500, minVentIn: '4"', maxDevelopedFt: 300 },
|
|
635
|
+
]
|
|
636
|
+
|
|
637
|
+
/**
|
|
638
|
+
* IPC Table E103.3(3) — Modified Hunter's Curve: WSFU -> Peak Demand GPM (Flush-Tank & Flushometer).
|
|
639
|
+
*/
|
|
640
|
+
export const HUNTERS_CURVE_WSFU_TO_GPM: ReadonlyArray<{
|
|
641
|
+
wsfu: number
|
|
642
|
+
gpmTank: number
|
|
643
|
+
gpmFlushometer: number
|
|
644
|
+
}> = [
|
|
645
|
+
{ wsfu: 1, gpmTank: 3.0, gpmFlushometer: 3.0 },
|
|
646
|
+
{ wsfu: 2, gpmTank: 5.0, gpmFlushometer: 5.0 },
|
|
647
|
+
{ wsfu: 4, gpmTank: 8.0, gpmFlushometer: 12.0 },
|
|
648
|
+
{ wsfu: 6, gpmTank: 10.7, gpmFlushometer: 18.0 },
|
|
649
|
+
{ wsfu: 10, gpmTank: 14.6, gpmFlushometer: 27.0 },
|
|
650
|
+
{ wsfu: 15, gpmTank: 17.0, gpmFlushometer: 31.0 },
|
|
651
|
+
{ wsfu: 20, gpmTank: 19.6, gpmFlushometer: 35.0 },
|
|
652
|
+
{ wsfu: 25, gpmTank: 22.0, gpmFlushometer: 38.0 },
|
|
653
|
+
{ wsfu: 30, gpmTank: 24.3, gpmFlushometer: 41.0 },
|
|
654
|
+
{ wsfu: 40, gpmTank: 28.5, gpmFlushometer: 46.5 },
|
|
655
|
+
{ wsfu: 50, gpmTank: 32.5, gpmFlushometer: 51.5 },
|
|
656
|
+
{ wsfu: 75, gpmTank: 41.5, gpmFlushometer: 61.0 },
|
|
657
|
+
{ wsfu: 100, gpmTank: 49.0, gpmFlushometer: 68.0 },
|
|
658
|
+
{ wsfu: 150, gpmTank: 62.5, gpmFlushometer: 80.0 },
|
|
659
|
+
{ wsfu: 200, gpmTank: 74.0, gpmFlushometer: 90.0 },
|
|
660
|
+
]
|
|
661
|
+
|
|
662
|
+
/**
|
|
663
|
+
* IFGC Table 402.4(2) — Schedule 40 Black Iron Natural Gas capacity (kBTU/hr at 0.5" WC drop, 0.60 SG).
|
|
664
|
+
* Keyed by longest equivalent length (ft).
|
|
665
|
+
*/
|
|
666
|
+
export const IFGC_GAS_BLACK_IRON_KBTUH: ReadonlyArray<{
|
|
667
|
+
maxLengthFt: number
|
|
668
|
+
capacityBySize: Readonly<Record<'1/2"' | '3/4"' | '1"' | '1-1/4"' | '1-1/2"' | '2"', number>>
|
|
669
|
+
}> = [
|
|
670
|
+
{ maxLengthFt: 20, capacityBySize: { '1/2"': 118, '3/4"': 247, '1"': 466, '1-1/4"': 957, '1-1/2"': 1430, '2"': 2760 } },
|
|
671
|
+
{ maxLengthFt: 40, capacityBySize: { '1/2"': 81, '3/4"': 170, '1"': 320, '1-1/4"': 657, '1-1/2"': 985, '2"': 1900 } },
|
|
672
|
+
{ maxLengthFt: 60, capacityBySize: { '1/2"': 65, '3/4"': 137, '1"': 257, '1-1/4"': 528, '1-1/2"': 791, '2"': 1520 } },
|
|
673
|
+
{ maxLengthFt: 80, capacityBySize: { '1/2"': 56, '3/4"': 117, '1"': 220, '1-1/4"': 452, '1-1/2"': 677, '2"': 1300 } },
|
|
674
|
+
{ maxLengthFt: 100, capacityBySize: { '1/2"': 50, '3/4"': 104, '1"': 195, '1-1/4"': 400, '1-1/2"': 600, '2"': 1160 } },
|
|
675
|
+
{ maxLengthFt: 150, capacityBySize: { '1/2"': 40, '3/4"': 83, '1"': 157, '1-1/4"': 322, '1-1/2"': 482, '2"': 928 } },
|
|
676
|
+
{ maxLengthFt: 200, capacityBySize: { '1/2"': 34, '3/4"': 71, '1"': 134, '1-1/4"': 275, '1-1/2"': 412, '2"': 794 } },
|
|
677
|
+
]
|
|
678
|
+
|
|
679
|
+
/**
|
|
680
|
+
* IFGC Table 402.4(15) — CSST Natural Gas capacity (kBTU/hr at 0.5" WC drop), mapped to nominal trade sizes.
|
|
681
|
+
*/
|
|
682
|
+
export const IFGC_GAS_CSST_KBTUH: ReadonlyArray<{
|
|
683
|
+
maxLengthFt: number
|
|
684
|
+
capacityBySize: Readonly<Record<'1/2"' | '3/4"' | '1"' | '1-1/4"', number>>
|
|
685
|
+
}> = [
|
|
686
|
+
{ maxLengthFt: 20, capacityBySize: { '1/2"': 92, '3/4"': 234, '1"': 544, '1-1/4"': 1080 } },
|
|
687
|
+
{ maxLengthFt: 40, capacityBySize: { '1/2"': 63, '3/4"': 161, '1"': 375, '1-1/4"': 745 } },
|
|
688
|
+
{ maxLengthFt: 60, capacityBySize: { '1/2"': 51, '3/4"': 129, '1"': 302, '1-1/4"': 600 } },
|
|
689
|
+
{ maxLengthFt: 80, capacityBySize: { '1/2"': 43, '3/4"': 111, '1"': 259, '1-1/4"': 515 } },
|
|
690
|
+
{ maxLengthFt: 100, capacityBySize: { '1/2"': 38, '3/4"': 98, '1"': 230, '1-1/4"': 458 } },
|
|
691
|
+
{ maxLengthFt: 150, capacityBySize: { '1/2"': 31, '3/4"': 79, '1"': 185, '1-1/4"': 368 } },
|
|
692
|
+
{ maxLengthFt: 200, capacityBySize: { '1/2"': 26, '3/4"': 67, '1"': 158, '1-1/4"': 315 } },
|
|
693
|
+
]
|
|
694
|
+
|
|
695
|
+
/** Color coding across 3D view, 2D floorplan, and left-rail System Legend. */
|
|
696
|
+
export const PLUMBING_SYSTEM_COLORS: Readonly<
|
|
697
|
+
Record<PlumbingSystem, { label: string; hex: string; num: number; dash2d: boolean }>
|
|
698
|
+
> = {
|
|
699
|
+
'cold-water': { label: 'Cold Supply', hex: '#2563eb', num: 0x2563eb, dash2d: false },
|
|
700
|
+
'hot-water': { label: 'Hot Supply', hex: '#dc2626', num: 0xdc2626, dash2d: true },
|
|
701
|
+
'hot-recirc': { label: 'Hot Recirc', hex: '#f97316', num: 0xf97316, dash2d: true },
|
|
702
|
+
'dwv-drain': { label: 'DWV Drain / Waste', hex: '#64748b', num: 0x64748b, dash2d: false },
|
|
703
|
+
'dwv-vent': { label: 'DWV Vent Stack', hex: '#16a34a', num: 0x16a34a, dash2d: true },
|
|
704
|
+
'fuel-gas': { label: 'Fuel Gas (IFGC)', hex: '#eab308', num: 0xeab308, dash2d: true },
|
|
705
|
+
condensate: { label: 'Condensate Drain', hex: '#06b6d4', num: 0x06b6d4, dash2d: false },
|
|
706
|
+
'dryer-vent': { label: 'Dryer Vent (4" Rigid)', hex: '#94a3b8', num: 0x94a3b8, dash2d: true },
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
export function round2(n: number): number {
|
|
710
|
+
return Math.round(n * 100) / 100
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
export function comparePipeSizes(a: PipeNominalSize, b: PipeNominalSize): number {
|
|
714
|
+
return PIPE_SIZE_ORDER.indexOf(a) - PIPE_SIZE_ORDER.indexOf(b)
|
|
715
|
+
}
|
|
716
|
+
|
|
717
|
+
export function largerPipeSize(a: PipeNominalSize, b: PipeNominalSize): PipeNominalSize {
|
|
718
|
+
return comparePipeSizes(a, b) >= 0 ? a : b
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
export function getFixtureDfu(kind: FixtureKind, codeEdition: CodeEdition = 'IPC-2021'): number {
|
|
722
|
+
const spec = FIXTURE_SPECS[kind]
|
|
723
|
+
return codeEdition === 'UPC-2021' ? spec.dfuUpc : spec.dfuIpc
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
/**
|
|
727
|
+
* IPC 2021 Table E103.3(2) Water Supply Fixture Units (WSFU) by fixture kind and occupancy.
|
|
728
|
+
* Commercial / public occupancies use flushometer water closets (10.0 WSFU) and public fixture ratings.
|
|
729
|
+
*/
|
|
730
|
+
const COMMERCIAL_WSFU_OVERRIDES: Readonly<
|
|
731
|
+
Partial<Record<FixtureKind, { cold: number; hot: number; total: number }>>
|
|
732
|
+
> = {
|
|
733
|
+
'water-closet': { cold: 10.0, hot: 0, total: 10.0 },
|
|
734
|
+
lavatory: { cold: 1.5, hot: 1.5, total: 2.0 },
|
|
735
|
+
'kitchen-sink': { cold: 3.0, hot: 3.0, total: 4.0 },
|
|
736
|
+
'mop-sink': { cold: 2.25, hot: 2.25, total: 3.0 },
|
|
737
|
+
bathtub: { cold: 3.0, hot: 3.0, total: 4.0 },
|
|
738
|
+
shower: { cold: 1.5, hot: 1.5, total: 2.0 },
|
|
739
|
+
'tub-shower-combo': { cold: 3.0, hot: 3.0, total: 4.0 },
|
|
740
|
+
urinal: { cold: 5.0, hot: 0, total: 5.0 },
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
export function getFixtureWsfu(
|
|
744
|
+
kind: FixtureKind,
|
|
745
|
+
occupancy: OccupancyType = 'residential',
|
|
746
|
+
): { cold: number; hot: number; total: number } {
|
|
747
|
+
if (occupancy === 'commercial') {
|
|
748
|
+
const pub = COMMERCIAL_WSFU_OVERRIDES[kind]
|
|
749
|
+
if (pub) return pub
|
|
750
|
+
}
|
|
751
|
+
const spec = FIXTURE_SPECS[kind]
|
|
752
|
+
return { cold: spec.wsfuCold, hot: spec.wsfuHot, total: spec.wsfuTotal }
|
|
753
|
+
}
|
|
754
|
+
|
|
755
|
+
export function isCtsMaterial(material: PipeMaterial): boolean {
|
|
756
|
+
return (
|
|
757
|
+
material === 'pex-a' ||
|
|
758
|
+
material === 'pex-b' ||
|
|
759
|
+
material === 'copper-l' ||
|
|
760
|
+
material === 'copper-m' ||
|
|
761
|
+
material === 'cpvc'
|
|
762
|
+
)
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
export function getPipeOuterDiameterM(size: PipeNominalSize, material: PipeMaterial): number {
|
|
766
|
+
const entry = PIPE_OD_INCHES[size] ?? PIPE_OD_INCHES['1/2"']
|
|
767
|
+
const odIn = isCtsMaterial(material) ? entry.cts : entry.ips
|
|
768
|
+
return odIn * INCHES_TO_METERS
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
/**
|
|
772
|
+
* RFC 4180 CSV field escaping with spreadsheet formula-injection neutralization.
|
|
773
|
+
*/
|
|
774
|
+
export function csvEscape(v: string | number): string {
|
|
775
|
+
let s = String(v)
|
|
776
|
+
if (typeof v === 'string' && v !== '-' && /^(?:[=+\-@\t]|\s+[=+\-@])/.test(s)) {
|
|
777
|
+
s = `'${s}`
|
|
778
|
+
}
|
|
779
|
+
return /[",\r\n]/.test(s) ? `"${s.replace(/"/g, '""')}"` : s
|
|
780
|
+
}
|