TimeBasedLoadCarrier

open class TimeBasedLoadCarrier @JvmOverloads constructor(val supplyChainModel: SupplyChainModel, parent: ModelElement = supplyChainModel, name: String? = null) : TimeBasedDemandCarrier(source)

Demand carrier that buffers per-destination demands in DemandLoadBuilders and ships them as SupplyChainModel.DemandLoads. Inherits per-destination random transport times from TimeBasedDemandCarrier; load formation strategy is delegated to the builders.

When reactToLoadBuildersFlag is true, the carrier ships every load a builder forms automatically; otherwise loads sit in the builder's load queue and must be drained explicitly via shipLoads (or by scheduling a periodic shipping event).

Parameters

supplyChainModel

model that owns the created loads (passed through when building new DemandLoadBuilders)

parent

parent model element; defaults to supplyChainModel

name

optional model-element name

See sc.transportlayer.TimeBasedLoadCarrier

Constructors

Link copied to clipboard
constructor(supplyChainModel: SupplyChainModel, parent: ModelElement = supplyChainModel, name: String? = null)

Properties

Link copied to clipboard

If true, every load formed automatically by an attached DemandLoadBuilder is shipped immediately via loadFormed. Default false (loads sit in the builder's outgoing queue until drained).

Link copied to clipboard

Read-only view of the aggregate shipment counter.

Link copied to clipboard

Functions

Link copied to clipboard

Snapshot of all load builders attached to this carrier, in assignment order. Used by the network cost model to walk per-builder per-item on-hand statistics for the shipmentBuildingHoldingCost line.

Link copied to clipboard

Create and assign a default load builder for destination.

fun assignLoadBuilder(destination: DemandSenderIfc, loadBuilder: DemandLoadBuilder)

Attach a pre-built loadBuilder for destination. Wires up the built-in DemandLoadFormedListenerIfc so the carrier can react to formed loads, and creates the per-destination shipment counter.

fun assignLoadBuilder(destination: DemandSenderIfc, name: String?, itemTypes: Collection<ItemType> = emptyList()): DemandLoadBuilder

Create and assign a load builder for destination, with the supplied model-element name and (optional) per-item on-hand tracking.

Link copied to clipboard

True iff destination has an assigned load builder.

Link copied to clipboard
fun formLoadByCount(destination: DemandSenderIfc, numDemands: Int): Boolean
Link copied to clipboard
fun formLoadByCube(destination: DemandSenderIfc, minCube: Double, maxCube: Double): Boolean
Link copied to clipboard
fun formLoadByWeight(destination: DemandSenderIfc, minWeight: Double, maxWeight: Double): Boolean
Link copied to clipboard

Per-destination shipment counter for the cost model. A load carrier's shipment unit is a load, so this returns the count of loads dispatched to sender — the same counter as getShipmentCounter — overriding the parent's per-demand counter, which a load carrier never increments. This is what lets the per-edge ksl.modeling.supplychain.cost.EdgeOutboundCostCalculator / ksl.modeling.supplychain.cost.EdgeInboundCostCalculator see load formation (Loading / Shipping / Unloading per dispatched load), mirroring the totalLoadWeightAccumulator / totalLoadCubeAccumulator overrides.

Link copied to clipboard

Returns the load builder previously assigned to destination.

Link copied to clipboard

Per-destination count of loads dispatched to sender, or 0.

Link copied to clipboard

Per-destination shipment counter, or null if not assigned.

Link copied to clipboard
protected open fun loadFormed(builder: DemandLoadBuilder)

Default reaction to a load formation: ship all queued loads in builder. Subclasses may override.

Link copied to clipboard
fun setCountLimit(destination: DemandSenderIfc, countLimit: Int)
Link copied to clipboard
fun setCubeFormingLimits(destination: DemandSenderIfc, minCube: Double, maxCube: Double)
Link copied to clipboard
Link copied to clipboard
fun setWeightFormingLimits(destination: DemandSenderIfc, minWeight: Double, maxWeight: Double)
Link copied to clipboard
protected fun shipFromLoadBuilder(builder: DemandLoadBuilder)

Drain builder's load queue, scheduling per-destination delivery events from the inherited per-sender transport times. If immediateTransportFlag is true and no transport time has been set for the destination, the load ships and delivers in the current instant.

Link copied to clipboard
fun shipLoads()

Drain every builder's load queue and ship the loads to their destinations.

Link copied to clipboard

Per-destination cumulative cube of all LOADS shipped to sender in the current replication (post-warmup), or null if sender has no assigned load builder.

Link copied to clipboard

Per-destination cumulative weight of all LOADS shipped to sender in the current replication (post-warmup), or null if sender has no assigned load builder. Each dispatched load contributes load.weight (the sum of its constituent demand weights). Overrides the parent's per-demand accumulator — the load carrier's shipment unit is a load, not a demand.

Link copied to clipboard
open override fun transportDemand(demand: SupplyChainModel.Demand)

Buffer the demand by handing it to its destination's load builder. Throws if demand's sender has no builder.