Skip to content

Datacenter Hall ​

Datacenter Hall, rendered in the brepjs playground
BIM · 283 lines▶ Run it in the playground

A data hall designed on the 600 mm tile grid: four rows of 42U racks on the metric 8-tile pitch with hot-aisle containment, a fully perforated cold-aisle floor over a raised-floor plenum, six CRAH units sized N+1, and A+B power down redundant 250 A overhead busway. Each element carries datacenter psets (with the IFC class that a native writer would use) and is in a zone or a system. The console runs the capacity checks of a design review, and the Files button saves the equipment schedule. The view lifts the floor at one end to show the plenum. The rack fronts, the supports, the cables and the pipes are a display model.

Code ​

This is the full program. The playground runs it in your browser without a change.

ts
import { BimModel, countBySeverity, placedSolids, toIfcValidated } from 'brepjs-bim';
import { box, compound, cylinder, extrude, polygon, translate, unwrap, validSolid } from 'brepjs/quick';
import { color, present } from 'brepjs/playground';

// A data hall laid out the way one is designed: on the tile grid. Hot-aisle containment, N+1 CRAH
// cooling, A+B power. The console runs the capacity checks of a design review. Files saves the schedule.
// Units are millimetres. The rows run along X, and z = 0 is the top of the structural slab.
interface HallParams {
  perRow?: number; // racks in each row. 12 takes the cooling past its N+1 capacity
  rackKW?: number; // design load of one rack
  cutaway?: boolean; // lift the floor field at the east end and leave the north wall off. The model keeps them
}

// ---- published figures. The metric 8-tile pitch closes exactly: 1200 cold aisle + 1200 rack + 1200 hot
// aisle + 1200 rack (the imperial 7-tile pitch needs 610 mm tiles). A cold aisle of 1.2 m is the front
// clearance that TIA-942 prefers.
const TILE = 600; // raised-floor module (24 in grid)
const RACK = { w: 600, d: 1200, h: 1991, u: 42 }; // 42U cabinet
const CRAH = { kW: 74.6, airM3h: 15000, w: 2050, d: 890, h: 1970 }; // chilled-water downflow class
const RPP_KVA = 150; // row-end panel: each feed alone carries its row
const BUS = { amps: 250, volts: 415, continuous: 0.8 }; // track busway, 3-phase, A + B runs for each row
const TILE_BAND = [680, 1020]; // m3/h that a 25%-open tile carries (400 to 600 CFM)
const CLEAR = 2600; // TIA-942 clear height over the floor: the trays start above it
const DT = 15; // K, the gain from containment: no bypass air, and the supply stays in the ASHRAE 18 to 27 C band

// ---- display model
const RF = 600; // raised-floor height: a full-depth supply plenum under the floor
const ROWS = 4;
const AISLE = 2 * TILE; // cold and hot aisles are two tiles each
const BAND = 2 * TILE; // a rack row: the 1200 mm rack fills its band exactly
const END = 3 * TILE; // service zone at each row end: CRAH + egress clearance
const HALL_Y = (2 * ROWS + 1) * BAND; // 10.8 m: 4 rack bands + 5 aisles
const WALL_H = 4400;
const TRAY = { width: 450, depth: 100, z: RF + CLEAR + 100 }, BUSWAY = { width: 160, depth: 150, z: RF + CLEAR + 600, off: 350 };

type P3 = [number, number, number];
type Body = ReturnType<typeof box>;
type Tones = Record<string, Body[]>;
const X: P3 = [1, 0, 0], Y: P3 = [0, 1, 0], Z: P3 = [0, 0, 1];
const seq = (n: number): number[] => Array.from({ length: n }, (_, i) => i);
// Y bands, 2 tiles each: cold | row | hot | row | cold | row | hot | row | cold. Rows alternate facing
// (TIA-942), so back-to-back pairs share a contained hot aisle and each front takes air from a cold aisle.
const bandY = (i: number): number => i * BAND;
const rowBand = (r: number): number => bandY(2 * r + 1);
const facesUp = (r: number): boolean => r % 2 === 1; // rows A, C front -y. Rows B, D front +y

// The model stays alive for the IFC file. Each temporary solid is freed, also when the build throws.
async function hall({ perRow = 10, rackKW = 8, cutaway = true }: HallParams = {}) {
  const model = new BimModel(), owned: Body[] = [];
  const own = <T extends Body>(s: T): T => { owned.push(s); return s; };
  try {
    model.init({ name: 'Data Hall 1', projectId: 'dc-hall-demo', crs: { name: 'EPSG:25832', eastings: 691000, northings: 5335000 } });
    const site = unwrap(model.addSite({ name: 'Campus' }));
    const building = unwrap(model.addBuilding({ name: 'DC1' }));
    const storey = unwrap(model.addStorey({ name: 'Data Hall Level', elevation: 0 }));
    const project = model.getProject();
    if (project) model.aggregate(project.localId, site);
    model.aggregate(site, building);
    model.aggregate(building, storey);
    const ROW_LEN = (perRow + 2) * TILE; // the racks + a remote power panel at each end
    const HALL_X = END + ROW_LEN + END; // 10.8 m for 10 racks: 18 tiles
    const rowMidX = END + ROW_LEN / 2, rackX = (j: number): number => END + TILE * (1 + j) + TILE / 2;
    const placed = <T,>(id: T): T => { model.placeIn(id as never, storey); return id; };

    // The structural slab goes 200 past the hall on the walled sides, so the walls stand on it. The access
    // floor is 600 above it, in four fields: one at each end of the rows and one under each pair of rows.
    // The perforated tiles of the cold aisles fill the space between them.
    placed(unwrap(model.addSlab({ length: HALL_X + 200, width: HALL_Y + 200, thickness: 250, origin: [-200, 0, -250], axisX: X, axisZ: Z, predefinedType: 'BASESLAB', materialName: 'Concrete' })));
    const COLD = [0, 4, 8];
    const field = (x0: number, y0: number, x1: number, y1: number) =>
      placed(unwrap(model.addSlab({ length: x1 - x0, width: y1 - y0, thickness: 35, origin: [x0, y0, RF - 35], axisX: X, axisZ: Z, predefinedType: 'FLOOR', materialName: 'Raised access floor' })));
    field(0, 0, END, HALL_Y);
    field(END, bandY(1), END + ROW_LEN, bandY(4));
    field(END, bandY(5), END + ROW_LEN, bandY(8));
    const lifted = field(END + ROW_LEN, 0, HALL_X, HALL_Y);
    // Two of the four hall walls. The thickness of a wall is on the left of its direction (+Y for the north
    // wall, -X for the west wall), so the two walls are outside the tile field.
    const north = placed(unwrap(model.addWall({ length: HALL_X, height: WALL_H, thickness: 200, origin: [0, HALL_Y, 0], axisX: X, axisZ: Z, materialName: 'Concrete' })));
    placed(unwrap(model.addWall({ length: HALL_Y + 200, height: WALL_H, thickness: 200, origin: [0, 0, 0], axisX: Y, axisZ: Z, materialName: 'Concrete' })));

    const addEquip = (name: string, solid: Body, material: string, psets: Record<string, Record<string, string | number | boolean>>) =>
      placed(unwrap(model.addProxy({ name, solid, materialName: material, customProperties: psets })));

    // Racks: row letter + position, with two cords to the A and B feeds of the row. The pset records the
    // IFC class that a native writer would use for each element.
    const racks = seq(ROWS).flatMap((r) => seq(perRow).map((j) => {
      const tag = 'ABCD'[r] + String(j + 1).padStart(2, '0');
      const id = addEquip('Rack ' + tag, box(RACK.w, RACK.d, RACK.h, { at: [rackX(j), rowBand(r) + BAND / 2, RF + RACK.h / 2] }), 'Steel, powder coated',
        { DC_Rack: { tag, ifcClass: 'IfcFurniture/TECHNICALCABINET', uHeight: RACK.u, designLoadKW: rackKW, feedA: 'RPP-0' + (r + 1) + 'A', feedB: 'RPP-0' + (r + 1) + 'B' } });
      return { tag, id };
    }));

    // Each cold aisle gets a fully perforated floor: at 8 kW for each rack, one tile for each rack is not
    // enough (a 25%-open tile carries 400 to 600 CFM, about 3 kW). The tiles fill the openings of the floor.
    const tileIds = COLD.flatMap((band) => seq(2 * (perRow + 2)).map((p) => placed(unwrap(model.addCovering({
      length: TILE, width: TILE, thickness: 35, origin: [END + TILE * (p % (perRow + 2)), bandY(band) + TILE * Math.floor(p / (perRow + 2)), RF - 35],
      axisX: X, axisZ: Z, predefinedType: 'FLOORING', materialName: 'Perforated tile, 25% open',
    })))));

    // Remote power panels close each row: one floor tile of footprint (ASHRAE TC9.9), A feed at the east
    // end and B at the west, so one feed carries the row when the other is down.
    const rpps = seq(ROWS).flatMap((r) => ([['B', END], ['A', END + ROW_LEN - TILE]] as const).map(([feed, x0]) => {
      const tag = 'RPP-0' + (r + 1) + feed, cy = rowBand(r) + (facesUp(r) ? BAND - TILE / 2 : TILE / 2);
      const id = addEquip(tag, box(TILE, TILE, 2000, { at: [x0 + TILE / 2, cy, RF + 1000] }), 'Steel, light grey',
        { DC_RPP: { tag, ifcClass: 'IfcElectricDistributionBoard', ratedKVA: RPP_KVA, feed, sourceUPS: 'UPS-' + feed } });
      return { tag, feed, id, x: x0 + TILE / 2, y: cy, front: facesUp(r) ? 1 : -1 };
    }));

    // Perimeter CRAHs at the two ends of the rows, with their discharge into the floor plenum.
    // N+1: five 74.6 kW units carry the 320 kW load, and the sixth is spare.
    const crahs = [CRAH.d / 2 + 50, HALL_X - CRAH.d / 2 - 50].flatMap((cx, side) => [bandY(2), bandY(4), bandY(6)].map((y0, k) => {
      const tag = 'CRAH-0' + (side * 3 + k + 1);
      const id = addEquip(tag, box(CRAH.d, CRAH.w, CRAH.h, { at: [cx, y0 + BAND / 2, RF + CRAH.h / 2] }), 'Galvanized steel',
        { DC_CRAH: { tag, ifcClass: 'IfcUnitaryEquipment/AIRHANDLER', sensibleCoolingKW: CRAH.kW, airflowM3h: CRAH.airM3h, coil: 'Chilled water' } });
      return { tag, id, x: cx, y: y0 + BAND / 2, east: side === 1 };
    }));

    // Overhead, above the clear height: a cable tray over each row, then the A and B busway runs.
    const trayIds = seq(ROWS).map((r) => {
      // The tray is a channel of 3 mm sheet: its section, pushed along the row.
      const y = rowBand(r) + BAND / 2, w = TRAY.width / 2, z = TRAY.z, t = 3;
      const section = own(unwrap(polygon([[END, y - w, z], [END, y + w, z], [END, y + w, z + TRAY.depth], [END, y + w - t, z + TRAY.depth], [END, y + w - t, z + t], [END, y - w + t, z + t], [END, y - w + t, z + TRAY.depth], [END, y - w, z + TRAY.depth]])));
      const channel = unwrap(validSolid(unwrap(extrude(section, [ROW_LEN, 0, 0]))));
      return addEquip('CT-' + 'ABCD'[r] + '-01', channel, 'Galvanized steel',
        { DC_Tray: { tag: 'CT-' + 'ABCD'[r] + '-01', ifcClass: 'IfcCableCarrierSegment/CABLETRAYSEGMENT', widthMm: TRAY.width, service: 'Structured cabling' } });
    });
    const buses = seq(ROWS).flatMap((r) => ([['A', BUSWAY.off], ['B', -BUSWAY.off]] as const).map(([feed, off]) => {
      const tag = 'BB-' + 'ABCD'[r] + '-' + feed, y = rowBand(r) + BAND / 2 + off;
      const id = addEquip(tag, box(ROW_LEN, BUSWAY.width, BUSWAY.depth, { at: [rowMidX, y, BUSWAY.z + BUSWAY.depth / 2] }), 'Aluminium busway',
        { DC_Busway: { tag, ifcClass: 'IfcCableSegment/BUSBARSEGMENT', ratedA: BUS.amps, voltageV: BUS.volts, feed } });
      return { tag, feed, id, r, y };
    }));

    // Hot-aisle containment: roof panels at the height of the rack tops, and a door at each end of the
    // aisle. The cold aisles stay open: the room is the cold plenum.
    const hacIds = [bandY(2), bandY(6)].flatMap((y0, k) => {
      const tag = 'HAC-' + (k + 1);
      const roof = addEquip(tag + ' roof', box(ROW_LEN, AISLE, 40, { at: [rowMidX, y0 + AISLE / 2, RF + RACK.h + 20] }), 'Polycarbonate panel',
        { DC_Containment: { tag, ifcClass: 'IfcPlate', scheme: 'Hot aisle' } });
      const doors = [20, ROW_LEN - 20].map((dx) => addEquip(tag + ' door', box(40, AISLE, RACK.h, { at: [END + dx, y0 + AISLE / 2, RF + RACK.h / 2] }), 'Polycarbonate panel',
        { DC_Containment: { tag, ifcClass: 'IfcDoor', scheme: 'Hot aisle', part: 'End door' } }));
      return [roof, ...doors];
    });

    // The aisles are IfcSpaces (not in the view), with the names of the rows on each side. Zones group the
    // spaces, and systems group the equipment that gives one service.
    const aisleSpace = (name: string, longName: string, y0: number, h: number) =>
      placed(unwrap(model.addSpace({ name, longName, length: ROW_LEN, width: AISLE, height: h, origin: [END, y0, RF], axisX: X, axisZ: Z, materialName: 'Air' })));
    const coldSpaces = [aisleSpace('CA-A', 'Cold aisle, row A front', bandY(0), WALL_H - RF), aisleSpace('CA-BC', 'Cold aisle between rows B and C', bandY(4), WALL_H - RF), aisleSpace('CA-D', 'Cold aisle, row D front', bandY(8), WALL_H - RF)];
    const hotSpaces = [aisleSpace('HA-AB', 'Contained hot aisle between rows A and B', bandY(2), RACK.h), aisleSpace('HA-CD', 'Contained hot aisle between rows C and D', bandY(6), RACK.h)];
    model.assignToGroup(unwrap(model.addZone({ name: 'Cold Aisles', longName: 'Supply air zone' })), coldSpaces);
    model.assignToGroup(unwrap(model.addZone({ name: 'Hot Aisles', longName: 'Return air zone' })), hotSpaces);
    const feedIds = (feed: string) => [...rpps, ...buses].filter((e) => e.feed === feed).map((e) => e.id);
    model.assignToGroup(unwrap(model.addSystem({ name: 'Critical Power A' })), feedIds('A'));
    model.assignToGroup(unwrap(model.addSystem({ name: 'Critical Power B' })), feedIds('B'));
    model.assignToGroup(unwrap(model.addSystem({ name: 'Air Cooling' })), [...crahs.map((c) => c.id), ...tileIds, ...hacIds]);
    model.assignToGroup(unwrap(model.addSystem({ name: 'Structured Cabling' })), trayIds);
    model.assignToGroup(unwrap(model.addSystem({ name: 'IT Equipment' })), racks.map((r) => r.id));

    // ---- the checks of a design review, from the model.
    const itKW = racks.length * rackKW, firmKW = (crahs.length - 1) * CRAH.kW;
    const reqAirM3h = (itKW * 3600) / (1.2 * 1.005 * DT); // Q = P / (rho cp dT)
    const firmAirM3h = (crahs.length - 1) * CRAH.airM3h, perTileM3h = reqAirM3h / tileIds.length;
    const rowAmps = (perRow * rackKW * 1000) / 0.9 / (BUS.volts * Math.sqrt(3)), busContA = BUS.continuous * BUS.amps;
    const verdict = (okQ: boolean): string => (okQ ? ': ok' : ': SHORT');
    console.log('IT load   ' + racks.length + ' racks x ' + rackKW + ' kW = ' + itKW + ' kW');
    console.log('cooling   N+1: ' + (crahs.length - 1) + ' of ' + crahs.length + ' CRAH x ' + CRAH.kW + ' kW = ' + Math.round(firmKW) + ' kW vs ' + itKW + ' kW' + verdict(firmKW >= itKW));
    console.log('airflow   N+1 ' + Math.round(firmAirM3h) + ' m3/h vs ' + Math.round(reqAirM3h) + ' m3/h at dT ' + DT + ' K' + verdict(firmAirM3h >= reqAirM3h));
    console.log('tiles     ' + tileIds.length + ' perforated, ' + Math.round(perTileM3h) + ' m3/h each vs ' + TILE_BAND[0] + '-' + TILE_BAND[1] + ' (400-600 CFM) band' + verdict(perTileM3h >= TILE_BAND[0]! && perTileM3h <= TILE_BAND[1]!));
    console.log('power     row ' + Math.round(rowAmps) + ' A at 0.9 pf vs ' + busContA + ' A continuous on each ' + BUS.amps + ' A feed' + verdict(rowAmps <= busContA));
    const exported = unwrap(await toIfcValidated(model, { applicationName: 'brepjs playground', applicationVersion: '1.0' }));
    const sev = countBySeverity(exported.report);
    console.log('IFC4      ' + sev.error + ' errors, ' + sev.warning + ' warnings, ' + sev.info + ' info');

    // The equipment schedule that the FM team gets on handover.
    const schedule = [['Tag', 'Type', 'Rating', 'Feed'].join(',')];
    for (const r of racks) schedule.push(r.tag + ',Rack 42U,' + rackKW + ' kW,A+B');
    for (const p of rpps) schedule.push(p.tag + ',Remote power panel,' + RPP_KVA + ' kVA,' + p.feed);
    for (const c of crahs) schedule.push(c.tag + ',CRAH,' + CRAH.kW + ' kW sensible,N+1');
    for (const b of buses) schedule.push(b.tag + ',Track busway,' + BUS.amps + ' A ' + BUS.volts + ' V,' + b.feed);

    // ---- the view: each element by its material, and the busway by its feed.
    const PALETTE: Record<string, string> = {
      Concrete: '#a8a294', 'Raised access floor': '#e3dfd3', 'Perforated tile, 25% open': '#5d7396', 'Steel, powder coated': '#3b414a',
      'Steel, light grey': '#9aa3ab', 'Galvanized steel': '#c3c9d1', 'Polycarbonate panel': '#e2a23a',
    };
    const FEED: Record<string, string> = { A: '#c9473d', B: '#3c66b5' };
    const busFeed = new Map(buses.map((b) => [b.id, b.feed]));
    const tones: Tones = {};
    const add = (tint: string, ...list: Body[]): void => { (tones[tint] ??= []).push(...list); };
    for (const el of model.getAllElements()) {
      if (el.category === 'SPACE' || (cutaway && (el.localId === north || el.localId === lifted))) continue; // the aisle volumes would hide the hall
      const feed = busFeed.get(el.localId), material = (el.spec as { materialName?: string }).materialName ?? '';
      for (const s of unwrap(placedSolids(el))) add(feed ? FEED[feed]! : (PALETTE[material] ?? '#8b8b8b'), own(s));
    }

    // ---- display only: the detail that the view needs and the model does not. The model stays one element
    // for each asset. A part is made one time, and then moved to each place.
    const b = (x0: number, y0: number, z0: number, x1: number, y1: number, z1: number): Body => own(box(x1 - x0, y1 - y0, z1 - z0, { at: [(x0 + x1) / 2, (y0 + y1) / 2, (z0 + z1) / 2] }));
    const at = (part: Body[], v: P3): Body[] => part.map((s) => own(translate(s, v)));
    // A rack front: a door frame, seven blocks of 6U behind it with a status light on each, and two brush strips on the top.
    const front = (f: number) => {
      const y = (a: number, c: number): [number, number] => (f > 0 ? [a, c] : [-c, -a]); // from the front face outward
      const [f0, f1] = y(0, 30), [u0, u1] = y(0, 14), [l0, l1] = y(14, 18), h = RACK.h;
      const frame = [b(-300, f0, 30, -275, f1, h - 30), b(275, f0, 30, 300, f1, h - 30), b(-275, f0, 30, 275, f1, 55), b(-275, f0, h - 55, 275, f1, h - 30)];
      const units = seq(7).map((i) => b(-270, u0, 62 + i * 267, 270, u1, 62 + i * 267 + 257));
      const lights = seq(7).map((i) => b(-240, l0, 160 + i * 267, -60, l1, 215 + i * 267));
      const y0 = f > 0 ? -RACK.d : 0;
      return { frame, light: units.filter((_, i) => i % 2 === 0), dark: units.filter((_, i) => i % 2 === 1), lights, top: [b(-200, y0 + 150, h, 200, y0 + 210, h + 6), b(-200, y0 + 990, h, 200, y0 + 1050, h + 6)] };
    };
    const fronts = { [-1]: front(-1), [1]: front(1) };
    for (const r of seq(ROWS)) for (const j of seq(perRow)) {
      const f = facesUp(r) ? 1 : -1, part = fronts[f as 1 | -1], v: P3 = [rackX(j), rowBand(r) + BAND / 2 + (f * RACK.d) / 2, RF];
      add('#c3c9d1', ...at(part.frame, v)); add('#8a93a0', ...at(part.light, v)); add('#59616d', ...at(part.dark, v)); add('#12b5b0', ...at(part.lights, v)); add('#15181c', ...at(part.top, v));
    }
    // A tap-off box under each busway run at each third rack, with its cable down to the rack top.
    const drop = BUSWAY.z - 110 - RF - RACK.h, tapOff = [b(-110, -80, BUSWAY.z - 110, 110, 80, BUSWAY.z), own(cylinder(18, drop, { at: [0, 0, RF + RACK.h] }))];
    // A goalpost of strut on the rack tops carries the tray and the two busway runs.
    const post = [b(-20, -580, RF + RACK.h, 20, -540, BUSWAY.z), b(-20, 540, RF + RACK.h, 20, 580, BUSWAY.z), b(-20, -540, BUSWAY.z - 41, 20, 540, BUSWAY.z), b(-20, -540, TRAY.z - 41, 20, 540, TRAY.z)];
    for (const bus of buses) for (let j = 0; j < perRow; j += 3) add(FEED[bus.feed]!, ...at(tapOff, [rackX(j), bus.y, 0]));
    const CABLE = ['#19b6c9', '#ff5a1f', '#e8c63c', '#3c66b5']; // fibre jackets: aqua, orange and yellow. Blue copper
    for (const r of seq(ROWS)) {
      const cy = rowBand(r) + BAND / 2;
      for (let j = 1; j < perRow; j += 2) add('#8b9199', ...at(post, [rackX(j) - TILE / 2, cy, 0]));
      CABLE.forEach((tint, i) => add(tint, own(cylinder(34, ROW_LEN - 100, { at: [END + 50, cy - 150 + i * 100, TRAY.z + 3 + 34], axis: X }))));
    }
    // The containment: a rib on the roof at each rack, and two leaves with a window on each end door.
    for (const y0 of [bandY(2), bandY(6)]) {
      const top = RF + RACK.h + 40;
      for (let x = END; x <= END + ROW_LEN; x += TILE) add('#454c56', b(Math.max(x - 20, END), y0, top, Math.min(x + 20, END + ROW_LEN), y0 + AISLE, top + 12));
      for (const [x, s] of [[END, -1], [END + ROW_LEN, 1]] as const) {
        const x0 = Math.min(x, x + s * 6), x1 = Math.max(x, x + s * 6), mid = y0 + AISLE / 2;
        add('#454c56', b(x0, mid - 10, RF, x1, mid + 10, RF + RACK.h), b(x0, mid - 90, RF + 950, x1, mid - 60, RF + 1150), b(x0, mid + 60, RF + 950, x1, mid + 90, RF + 1150));
        add('#cfe3ea', b(x0, y0 + 120, RF + 1000, x1, mid - 140, RF + 1750), b(x0, mid + 140, RF + 1000, x1, y0 + AISLE - 120, RF + 1750));
      }
    }
    // Each CRAH: a return grille on its top, three panels on each long side, and a display. Each RPP: a door and a label.
    for (const c of crahs) {
      const x0 = c.x - CRAH.d / 2, x1 = c.x + CRAH.d / 2, y0 = c.y - CRAH.w / 2, z1 = RF + CRAH.h, third = CRAH.w / 3, room = c.east ? -1 : 1;
      add('#2f343b', b(x0 + 80, y0 + 80, z1, x1 - 80, y0 + CRAH.w - 80, z1 + 8));
      for (const s of [-1, 1]) for (const k of seq(3)) {
        const p0 = s > 0 ? x1 : x0 - 8, q0 = y0 + k * third + 20;
        add('#e3e6ea', b(p0, q0, RF + 100, p0 + 8, q0 + third - 40, z1 - 100));
        add('#2f343b', b(s > 0 ? p0 + 8 : p0 - 10, q0 + third - 110, RF + 900, s > 0 ? p0 + 18 : p0, q0 + third - 80, RF + 1100));
        if (k === 1 && s === room) add('#12b5b0', b(s > 0 ? p0 + 8 : p0 - 4, q0 + 150, RF + 1450, s > 0 ? p0 + 12 : p0, q0 + 450, RF + 1650));
      }
    }
    for (const p of rpps) {
      const y0 = p.front > 0 ? p.y + TILE / 2 : p.y - TILE / 2 - 10;
      add('#e3e6ea', b(p.x - 260, y0, RF + 80, p.x + 260, y0 + 10, RF + 1920));
      add(FEED[p.feed]!, b(p.x - 150, p.front > 0 ? y0 + 10 : y0 - 4, RF + 1600, p.x + 150, p.front > 0 ? y0 + 14 : y0, RF + 1700));
    }
    if (cutaway) {
      // Where the floor is lifted: the pedestals, a stand under each CRAH, and the chilled water mains with a riser to each unit.
      const pedestal = [own(cylinder(16, RF - 35 - 16, { at: [0, 0, 8] })), b(-55, -55, 0, 55, 55, 8), b(-45, -45, RF - 43, 45, 45, RF - 35)];
      const under = (x: number, y: number): boolean => crahs.some((c) => c.east && Math.abs(x - c.x) < CRAH.d / 2 + 60 && Math.abs(y - c.y) < CRAH.w / 2 + 60);
      for (const x of [HALL_X - END - 60, HALL_X - 2 * TILE, HALL_X - TILE, HALL_X - 60]) for (let y = 60; y < HALL_Y; y += (HALL_Y - 120) / 18)
        if (!under(x, y)) add('#c3c9d1', ...at(pedestal, [x, y, 0]));
      for (const y of [60, HALL_Y - 60]) for (let x = 60; x < HALL_X - END - 300; x += TILE) add('#c3c9d1', ...at(pedestal, [x, y, 0]));
      const mains = [HALL_X - 400, HALL_X - 230], first = crahs.find((c) => c.east)!.y - 300, last = HALL_Y - 100;
      mains.forEach((x, i) => add(i === 0 ? '#12b5b0' : '#ff5a1f', own(cylinder(55, last - first, { at: [x, first, 120], axis: Y }))));
      for (const c of crahs.filter((u) => u.east)) {
        for (const sx of [-1, 1]) for (const sy of [-1, 1]) add('#8b9199', b(c.x + sx * (CRAH.d / 2 - 60) - 30, c.y + sy * (CRAH.w / 2 - 60) - 30, 0, c.x + sx * (CRAH.d / 2 - 60) + 30, c.y + sy * (CRAH.w / 2 - 60) + 30, RF));
        mains.forEach((x, i) => add(i === 0 ? '#12b5b0' : '#ff5a1f', own(cylinder(40, RF - 175, { at: [x, c.y - 200 + i * 400, 175] }))));
      }
    }
    const shown = Object.entries(tones).map(([tint, list]) => color(compound(list), tint));
    return { model, shown, bytes: exported.bytes, schedule };
  } catch (error) {
    model[Symbol.dispose]();
    throw error;
  } finally {
    owned.splice(0).forEach((s) => s.delete());
  }
}

// Show 4 rows of 10 racks at 8 kW. Try hall({ perRow: 12 }), hall({ rackKW: 10 }), or hall({ cutaway: false }).
const dc = await hall();
export default present(dc.shown, {
  bimTree: dc.model.toTreeSummary(),
  ifc: () => dc.bytes,
  files: () => [{ name: 'equipment-schedule.csv', data: dc.schedule.join(String.fromCharCode(10)), mime: 'text/csv' }],
});

Functions used ​

countBySeverity placedSolids toIfcValidated box compound cylinder extrude polygon translate unwrap validSolid color present

▶ Run Datacenter Hall in the playground

Released under the Apache 2.0 License.