Models resource consumers interaction.
Resource definition:
Consumer definition:
Note:
Models resource consumers interaction. Resource definition: * A limited quantity of items that are used (e.g. seized and disposed) by entities as they proceed through the system. A resource has a capacity that governs the total quantity of items that may be available. All the items in the resource are homogeneous, meaning that they are indistinguishable. If an entity attempts to seize a resource that does not have any units available it must wait in a queue. It is often representing real world items that availability is limited (e.g. machine, wrench). Consumer definition: * A consumer is responsible for seizing and disposing the resource. Note: * All namespaced keywords of the rc bounded context are from this namespace, so rc users need only to refer this one.
(dispose event-return
resource-name
{:automaton-simulation-de.rc/keys [resource]
:automaton-simulation-de.simulation-engine/keys [date]
:as _current-event})
Returns the event-return
with the resource disposed, so it is available again.
A consumer is unblocked, the capacity of resource-name
is freed.
Returns the `event-return` with the resource disposed, so it is available again. A consumer is unblocked, the capacity of `resource-name` is freed.
(preemption-policy-registry)
Returns the default registry for event preemption-policy
.
Note that you can enrich it with your own policies.
Returns the default registry for event `preemption-policy`. Note that you can enrich it with your own policies.
(resource-update {:automaton-simulation-de.simulation-engine/keys [state]
:as event-return}
resource-name
new-capacity)
Update the resource capacity.
Update the resource capacity.
(seize {:automaton-simulation-de.simulation-engine/keys [state]
:as event-return}
resource-name
consumed-quantity
seizing-date
postponed-event)
Seize a resource,
Depending on the capacity found in the state for that resource-name
,
postponed-event
execution.postponed-event
is executed now, (i.e. added at the current date in the scheduler)Returns an event-return.
Seize a resource, Depending on the capacity found in the state for that `resource-name`, * If capacity is not defined for that resource, the whole consumption is skipped, including the `postponed-event` execution. * If some resource are available, the `postponed-event` is executed now, (i.e. added at the current date in the scheduler) * Otherwise block that consumer and store it in the queue * Blocked consumer: A blocked consumer is a consumer waiting for a resource being available. * Queue: Stores blocked consumers. Returns an event-return.
(unblocking-policy-registry)
Returns the default registry for event unblocking-policy
.
Note that you can enrich it with your own policies.
Returns the default registry for event `unblocking-policy`. Note that you can enrich it with your own policies.
(wrap-model {{:automaton-simulation-de.rc/keys [rc]}
:automaton-simulation-de.simulation-engine/model-data
:as model}
unblocking-policy-registry
preemption-policy-registry)
Wraps a model to add necessary behavior to model a resource/consumer.
Resource/Consumer modeling is a way to model state and events for simulation, by using concepts of resource being used by consumer
The resources
is a map defining the resource available:
* policy
In a queue, the policy selects the next consumer that will be unblocked. (Each queue has its own policy)
* renewable?
When disposed, a renewable resource model is available again. Typically the toolings like wrenches, hammers, machines are most often renewable resources.
Wraps a model to add necessary behavior to model a resource/consumer. Resource/Consumer modeling is a way to model state and events for simulation, by using concepts of resource being used by consumer The `resources` is a map defining the resource available: * `policy` In a queue, the policy selects the next consumer that will be unblocked. (Each queue has its own policy) * `renewable?` When disposed, a renewable resource model is available again. Typically the toolings like wrenches, hammers, machines are most often renewable resources.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close