Inventory Cost Calculator
Per-(IHP, item) cost calculator: observes one Inventory and populates six line-item Responses at the inventory's REPLICATION_ENDED notification. Source-owned data drives every line; the calculator performs pure multiplication on stable within-replication statistics with no framework-side time-unit conversion (see docs/supply-chain-cost-redesign.md §2 "Note on warmup handling").
Line items produced:
| CostLine | Formula |
|---|---|
| CostLine.Holding | avgOnHand × unitCost × carryingRate |
| CostLine.InTransit | avgOnOrder × unitCost × carryingRate |
| CostLine.Ordering | orderCount × orderingCost |
| CostLine.Stockout | stockoutCount × stockoutCost |
| CostLine.LostSale | lostSaleCount × lostSaleCost |
| CostLine.UnitShortage | totalUnitsShort × unitShortageCost |
avgOnHand and avgOnOrder are sourced from the inventory's withinReplicationStatistic.weightedAverage; all four counter fields are read directly. KSL's Counter/Response/TWResponse warmup hooks reset these accumulators at the warmup event, so the values reflect the post-warmup observation window automatically.
Parameters
the ModelElement parent (typically the owning CostFormulation)
the Inventory this calculator observes — the calculator reads inv.itemType directly; no separate item constructor argument is needed
cost-rate parameters
Constructors
Properties
The line-item Responses this calculator produces, keyed by CostLine. A calculator may produce a Response for every line its source can express; values for unproduced lines are absent from the map rather than zero.
The single source ModelElement this calculator observes.
Tier this calculator's source belongs to. Used by CostFormulation.byTierResponse to partition rollups across IHP / CD / ES. A calculator that attributes to multiple tiers (rare) returns null and is excluded from per-tier rollups.