DemandGenerator

open class DemandGenerator @JvmOverloads constructor(val supplyChainModel: SupplyChainModel, val itemType: ItemType, timeUntilFirstRV: RVariableIfc, timeBtwEventsRV: RVariableIfc, maxNumberOfEvents: Long = Long.MAX_VALUE, timeOfTheLastEvent: Double = Double.POSITIVE_INFINITY, name: String? = null) : EventGenerator, DemandSenderIfc, ExternalDemandConsumer(source)

Generates demands at scheduled intervals and routes them to a demand filler. The demand's item type is fixed at construction; the amount is sampled from a configurable distribution (defaults to 1). When unitDemandOnly is true and the sampled amount is d, the generator sends d separate unit-quantity demands.

Parameters

supplyChainModel

the supply-chain model whose createDemand factory is used

itemType

the item type of every demand this generator emits

timeUntilFirstRV

time until the first generation event

timeBtwEventsRV

time between subsequent generation events

maxNumberOfEvents

maximum number of events to generate

timeOfTheLastEvent

simulation time at which to stop generating

name

optional model-element name

See sc.inventorylayer.DemandGenerator

Constructors

Link copied to clipboard
constructor(supplyChainModel: SupplyChainModel, itemType: ItemType, timeUntilFirstRV: RVariableIfc, timeBtwEventsRV: RVariableIfc, maxNumberOfEvents: Long = Long.MAX_VALUE, timeOfTheLastEvent: Double = Double.POSITIVE_INFINITY, name: String? = null)

Properties

Link copied to clipboard
open override var demandFiller: DemandFillerIfc?

Direct filler override; if set, used instead of demandFillerFinder.

Link copied to clipboard

Finder used to locate a filler for each generated demand.

Link copied to clipboard
Link copied to clipboard

Whether emitted demands allow backlogging.

Link copied to clipboard

Whether emitted demands allow partial filling.

Link copied to clipboard
Link copied to clipboard

If true, a sampled amount of d > 1 produces d separate unit-quantity demands instead of one demand of amount d. Default false.

Functions

Link copied to clipboard

Build a demand with this generator's permission flags and sender.

Link copied to clipboard
protected open fun demandDelivered(demand: SupplyChainModel.Demand)

Default: no-op. Subclasses may override.

Link copied to clipboard
protected open fun demandReceived(demand: SupplyChainModel.Demand)

Called when a generated standalone demand reaches RECEIVED. Defaults to asking the filler to fill the demand.

Link copied to clipboard
protected open fun demandRejected(demand: SupplyChainModel.Demand)

Default: throws. Subclasses may override.

Link copied to clipboard
protected override fun generate()
Link copied to clipboard
protected open fun generateAmount(): Int

Sample the amount distribution. Defaults to 1 when no dist is set.

Link copied to clipboard
open override fun mightRequest(type: ItemType): Boolean

Returns true when type equals this generator's itemType. (Java had this inverted — != — and that bug is corrected here.)

Link copied to clipboard
protected open fun sendDemand(demand: SupplyChainModel.Demand)

Send demand to its filler.

Link copied to clipboard

Set the distribution governing the amount of each demand. If never set, every demand is for 1 unit.

Link copied to clipboard
protected open fun setFillerOnDemand(demand: SupplyChainModel.Demand)

Resolve the demand's filler. Direct override wins over the finder.