InventoryCostCalculator

class InventoryCostCalculator @JvmOverloads constructor(parent: ModelElement, inv: Inventory, params: CostParams, name: String? = null) : ModelElement, CostCalculator(source)

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:

CostLineFormula
CostLine.HoldingavgOnHand × unitCost × carryingRate
CostLine.InTransitavgOnOrder × unitCost × carryingRate
CostLine.OrderingorderCount × orderingCost
CostLine.StockoutstockoutCount × stockoutCost
CostLine.LostSalelostSaleCount × lostSaleCost
CostLine.UnitShortagetotalUnitsShort × 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

parent

the ModelElement parent (typically the owning CostFormulation)

inv

the Inventory this calculator observes — the calculator reads inv.itemType directly; no separate item constructor argument is needed

params

cost-rate parameters

Constructors

Link copied to clipboard
constructor(parent: ModelElement, inv: Inventory, params: CostParams, name: String? = null)

Properties

Link copied to clipboard
open override val lineResponses: Map<CostLine, ResponseCIfc>

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.

Link copied to clipboard
open override val source: ModelElement

The single source ModelElement this calculator observes.

Link copied to clipboard
open override val tier: NodeTier

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.