Calculation Engine
Purpose
The calculation engine (backend/src/services/calculator.ts) is the core of the application. It takes building block quantities from the PPS Space Calculator, looks up equipment mappings, applies regional pricing, and produces a 15-row cost summary table with Equipment, Installation, CAPEX, OPEX, and BAU columns.
Calculation Chain
- Space Aggregation — Sum building block quantities across all floors
- Data Points — Calculate total data points from low + high per block
- Tech Breakdown — Multiply block qty x equipment multiplier from building_block_equipment_map
- Network Design — Add site-size-specific network equipment from network_designs table
- Derived Items — Calculate Access Switches, cabling, cabinets from data point counts
- Security Items — Add CCTV from site size if scope includes it
- Equipment Overrides — Apply manual qty/cost overrides and add new items (2026-02-23)
- Category Totals — Sum equipment costs by category x regional unit prices
- Cost Summary — Build the 15-row table with formulas below
- Cost Overrides — Apply manual cell-level overrides to cost summary (2026-02-23)
Formulas (All Verified)
| Line | Formula | Status |
|---|---|---|
| Installation | 25% of Equipment | Verified across 3 projects |
| CAPEX | Equipment + Installation | Verified |
| BAU | 60% of CAPEX (10%/year x 6 years) | Verified (fixed 2026-02-22) |
| ITO | 10% of (Equipment + Installation) | Verified |
| PMS | Fee from site_sizes.pms_fee (varies by tier) | Fixed 2026-02-22 — Craig provided 5-tier schedule |
| Design (AV/SCS) | scs_design_cost from site_sizes, modified by Design Scope toggle | Verified |
| WiFi Heatmap | wifi_heatmap_cost if scope includes it | Verified |
| PPS | 2% of (Equipment + Installation) if over 5,000 | Verified |
| Contingency | MAX(5% of (Equipment + Installation), ,000) | Under review — may be simpler flat K |
| LCR Year 6 | 90% of (Equipment + Installation) | Implemented, not yet verified |
| Decommissioning | Sum of (qty x multiplier x rate) per activity | Implemented 2026-02-22 — verified 50 for Church Lane |
PMS Fee Schedule (from Craig)
| Project Size Tier | PMS Fee |
|---|---|
| Mini | 5,000 |
| Small | 5,876 |
| Medium | 11,752 |
| Large | 23,400 |
| Extra Large | 97,000 |
Craig can arbitrarily assign any tier to any project. The default is looked up by site_size_id.
Decommissioning Activities (9 types)
| Activity | Multiplier | Rate/hr | Cost per unit |
|---|---|---|---|
| Desk Decommissioning | 1x | 0 | 0/desk |
| AV/VC Decommissioning | 8hrs | 0 | 60/config |
| Removal of Wireless APs | 1hr | 0 | 0/AP |
| SER-Switch Unpatching | 4hrs | 0 | 80/switch |
| MTR Decommissioning | 8hrs | 0 | 60/rack |
| Vertical Fiber Primary | 16hrs | 0 | ,120/route |
| Vertical Fiber Secondary | 32hrs | 0 | ,240/route |
| Network Delivery Team | 24hrs | 25 | ,000/team |
| End-user Services | 24hrs | 25 | ,000/team |
Only applies to Refurbishment, Relocation, Restack, and Decommissioning project scopes. Not applicable to New Build, ATM, or Design-only.
Scope Considerations (9 toggles)
| Toggle | Affects |
|---|---|
| Wireless AP | WAP equipment inclusion |
| Security | CCTV points |
| Structured Cabling | All cabling items |
| Design Scope | SCS and AV / SCS Only / AV Only / WiFi Only / All |
| Wi-Fi Heatmap | WiFi heatmap design fee |
| Networks | Network equipment (full or access switch only) |
| Voice Allowance | Network Services OPEX |
| Servers | Server cost from site size |
| Cabinets and Racks | Cabinet equipment |
Equipment Override System (2026-02-23)
Six retail/branch banking building blocks have zero auto-mappings. Rather than wait for Craig’s mapping data, a manual override system allows users to:
- Override quantities — Change auto-calculated equipment qty for any item
- Override unit costs — Change regional unit price for any item
- Add new items — Insert equipment not in the reference data
Overrides are stored in project_equipment_overrides table and applied at step 7 in the chain. Items with overrides are flagged (is_overridden) in the tech breakdown output. See the Equipment & Cost Overrides page for full details.