Unit Converter (unit-converter)
Purpose
Convert numeric values between engineering unit systems across PhyCalcPro dimensions — length, force, pressure, stress, energy, power, and related quantities. Ensures consistent SI base-unit handoff to all module solvers.
Physics & theory
Physical quantities are expressed as value × unit within a dimension (e.g., length in m, mm, in, ft). Conversion normalizes to SI base via toBase, then scales to target unit via fromBase. Dimensionality is enforced — force cannot convert to length.
Multi-system support (US customary, SI, mixed engineering units) aligns with useDesignCodeUnits and ModuleUnitSelect profiles across product modules. Temperature conversions may use offset scales (°C, °F, K) per dimension registry.
Governing equations
For affine temperature: , .
Numerical method
Registry-based conversion (unit-converter/engine + units/conversions.ts): toBase(value, dimension, fromUnit) then fromBase(base, dimension, toUnit). Physics dimensions validated against allowed unit keys per dimension type.
Supported dimensions include length, mass, force, pressure, stress, energy, power, torque, angle, temperature, and velocity — each mapped in src/lib/physics/units.ts. Invalid unit keys for a dimension return an error at conversion time rather than silently scaling by an incorrect factor.
Inputs
| Parameter | Description |
|---|---|
value | Numeric magnitude |
dimension | Physics dimension key |
fromUnit, toUnit | Source and target unit strings |
Outputs
convertedValue— numeric result in the target unitfromUnit,toUnit— echo of selected unit keys for audit trailsdimension— physics dimension identifier used for the conversion
Design codes & checks
- Indicative: Unit conversion (utility tool)
Assumptions & limitations
- Conversions within single dimension only.
- Precision follows IEEE double — display rounding handled in UI.
- Non-SI industry units included per module profiles; not every obscure unit.
- Currency and dimensionless ratios not supported unless defined.
- Compound units (e.g., lbf·ft as derived entries) must use the predefined dimension registry.
Verification
- CI:
unit-converter-indicative-01.json - Engineer sign-off: validation-master-checklist.md
References
- NIST SP 811. Guide for the Use of the International System of Units (SI).
- ISO 80000 quantities and units series.
- IEEE/ASTM SI 10. American National Standard for Metric Practice.
- BIPM. The International System of Units (SI), 9th ed.
- Beer, F. P., et al. Mechanics of Materials, 8th ed. McGraw-Hill — foundational stress and deformation theory.