B2B Import ERP ships a pure, AI-free engineering calculation engine used across three surfaces: the public wizard form, the CRM diagnostic report, and the internal quoting tool. All functions are deterministic — given the same inputs they always return the same outputs — and carry zero side-effects. They do not call external APIs, touch the database, or require authentication. This makes them trivially testable with standard Jest unit tests. The engine consists of two primary modules:Documentation Index
Fetch the complete documentation index at: https://mintlify.com/ency07/B2B-import/llms.txt
Use this file to discover all available pages before exploring further.
src/utils/engineering.ts— airflow, volume, power, and noise calculations following ASHRAE standards.src/utils/pricing.ts— COP/USD price estimation with urgency multipliers and volume-based scaling.
src/utils/tenant.ts, provides CSS colour helpers used by the branding subsystem.
calculateRequiredCfm
Calculates the required airflow (in CFM — Cubic Feet per Minute) from the physical dimensions of a space and its operating environment, using ASHRAE Air Changes per Hour (ACH) norms.
Parameters
Room dimensions in metres:
Operating environment key. Determines the ACH rate applied:
| Key | ACH | Criticality | Notes |
|---|---|---|---|
heavy_plant | 45 | ALTA | Heavy manufacturing / smelting |
fundicion | 45 | ALTA | Foundry (alias for heavy_plant) |
mecanico | 20 | MEDIA | Mechanical workshop |
alimentos | 15 | BAJA | Food processing |
data_center / datacenter | 30 | ALTA | Server rooms |
mining | — | — | Not in the ACH map; defaults to 10 ACH. Use heavy_plant for mining environments requiring 45 ACH. |
warehouse / almacen | 8 | BAJA | Warehouse / storage |
default | 10 | BAJA | General purpose |
Algorithm
Returns
Example
getAchForEnvironment
Returns the Air Changes per Hour (ACH) rate for a given environment key, falling back to 10 (the default value) for unrecognised keys.
An environment key from
ACH_BY_ENVIRONMENT (see table in calculateRequiredCfm). Unknown keys return 10.number — the ACH rate for the environment.
calculateAirDensity
Calculates corrected air density (kg/m³) for a given altitude and temperature using the standard pneumatic formula.
Altitude in metres above sea level.
0 = sea level (standard density 1.204 kg/m³ at 20 °C).Ambient temperature in °C.
Formula
generateEngineeringReport
Full pre-engineering calculation engine. Extends the CFM calculation with altitude/temperature corrections, motor power sizing, noise estimation, equipment count, and investment range.
estimatePrice
Generates a budgetary price range in COP and USD based on service type, urgency, and the physical volume of the installation.
Parameters
Service category. Determines the base price in COP:
| Key | Base Price (COP) |
|---|---|
fabricacion | $1,200,000 |
venta | $800,000 |
reparacion | $500,000 |
mantenimiento | $300,000 |
default / otro | $500,000 |
Urgency multiplier applied after the volume modifier:
| Key | Multiplier |
|---|---|
alta | ×1.35 (+35%) |
media | ×1.10 (+10%) |
baja | ×1.00 (no increment) |
Volume of the installation in m³. Every 100 m³ adds 5% to the base price:
volumeModifier = 1 + max(0, volume / 100) × 0.05.Algorithm
Returns
Example
parseToHslChannels
Converts any standard CSS colour (hex #RRGGBB, hsl(), hsla(), or already-formatted space-separated channels) into Tailwind CSS v4’s space-separated HSL channel format "H S% L%".
Input colour in any of these formats:
#0284c7— 6-digit hex#abc— 3-digit hex (expanded internally)hsl(199, 89%, 48%)— CSS hsl()hsla(199, 89%, 48%, 1)— CSS hsla()"199 89% 48%"— already in channel format (returned as-is)
"H S% L%" e.g. "199 89% 48%". Falls back to "240 5.9% 10%" for unrecognised formats.
Example
formatColorForDb
Converts space-separated HSL channel format back into a valid hsl() CSS string for storing in tenant_settings.config_value, which enforces a format constraint.
Space-separated HSL channels:
"H S% L%"."hsl(H, S%, L%)" — e.g. "hsl(199, 89%, 48%)". If the input doesn’t match the channel pattern it is returned unchanged.