You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Define and implement a framework for component quantity unit handling #13
Mismatched units between CMP_QNT and downstream expectations can distort damage and repair metrics. Pelicun allows a wide range of units and outputs damage quantities in whatever the user specifies. ATC 138 code cannot handle arbitrary units and might be based on the blocks defined in FEMA P-58 acting as units (e.g., 100LF).
Proposed solution
Discuss the requirements for ATC 138 simulation. Document these explicitly and include Unit checks in the Pelicun output converter that warn users if they do not have the right units. Additionally, consider including more flexibility by converting units in the main code; or enhancing the pelicun conversion method to support multiple units at least from Pelicun.
Root cause: The convert_pelicun function in input_builder.py stripped Pelicun's unit metadata and passed raw physical quantities (SF, LF, EA) directly as qnt_damaged, num_comps, and comp_population. The ATC-138 engine expects these as P-58 component unit counts (physical quantity ÷ unit_qty), so the area calculations in the functionality assessment were inflated by unit_qty (often 30–1000×).
Fix — unit conversion:
Added a _UNIT_TO_SI conversion table and a _pelicun_to_p58_factor helper that computes the combined conversion factor for each component using its Pelicun unit (from CMP_QNT.csv) and its P-58 block size (unit_qty from component_attributes.csv).
The conversion handles imperial↔metric automatically (e.g., m² → sf) and correctly skips components with specialized units (EA → amp/ton/cfm) where the Pelicun value already represents a P-58 unit count.
The factor is applied to qnt_damaged, qnt_damaged_dir_*, num_comps, and comp_population — all quantities that are multiplied by unit_qty downstream.
Additional fix — replacement time: Pelicun's repair_time-parallel (worker-days) was also being used directly as calendar days for replacement time. Added a conversion that divides by a realistic crew size, consistent with the REDi-based formula used by the repair scheduler.
Repair times in worker-days and repair costs are left unconverted as they are decision variables not scaled by unit_qty downstream.
Activity
zsarnoczay commentedon Mar 24, 2026
This has been addressed in PR #20 .
What was done
Root cause: The
convert_pelicunfunction ininput_builder.pystripped Pelicun's unit metadata and passed raw physical quantities (SF, LF, EA) directly asqnt_damaged,num_comps, andcomp_population. The ATC-138 engine expects these as P-58 component unit counts (physical quantity ÷unit_qty), so the area calculations in the functionality assessment were inflated byunit_qty(often 30–1000×).Fix — unit conversion:
_UNIT_TO_SIconversion table and a_pelicun_to_p58_factorhelper that computes the combined conversion factor for each component using its Pelicun unit (fromCMP_QNT.csv) and its P-58 block size (unit_qtyfromcomponent_attributes.csv).qnt_damaged,qnt_damaged_dir_*,num_comps, andcomp_population— all quantities that are multiplied byunit_qtydownstream.Additional fix — replacement time: Pelicun's
repair_time-parallel(worker-days) was also being used directly as calendar days for replacement time. Added a conversion that divides by a realistic crew size, consistent with the REDi-based formula used by the repair scheduler.Repair times in worker-days and repair costs are left unconverted as they are decision variables not scaled by
unit_qtydownstream.