supplyChain

fun supplyChain(name: String, autoStreamBase: Int = 1, block: SupplyChainScope.() -> Unit): NetworkSpec(source)

Author a NetworkSpec with a Kotlin DSL. The DSL is pure sugar over the data layer: it builds and returns a NetworkSpec and never touches runtime framework types. Visual nesting (holdingPoint { holdingPoint { } }) lowers to the flat node list, with each node's parent inferred from the enclosing scope.

val spec = supplyChain("Net") {
transportStrategy = perIHPTimeBased
val widget = item("Widget", exponential(1.0, stream = 1), unitCost = 12.5)
holdingPoint("W") {
attachedToExternalSupplier(constant(3.0))
inventory(widget) { sQ(s = 4, Q = 20, initialOnHand = 20) }
tier(count = 3, namePrefix = "R", transportTime = constant(1.0)) {
inventory(widget) { sS(s = 2, S = 5, initialOnHand = 10) }
demand(widget, exponential(1.5, stream = autoStream()))
}
}
defaultCost()
}

Return

the authored NetworkSpec

Parameters

name

the network name

autoStreamBase

the first number handed out by SupplyChainScope.autoStream

block

the DSL body

See also