auto-js.sim.activity
Simulate a jobshop with a simulation by activity.
add-iteration
(add-iteration model new-bucket)Adds an iteration event
add-iteration-past-event
(add-iteration-past-event model)add-snapshot
(add-snapshot model)Adds an event with a resource snapshot
create-new-entity
(create-new-entity model entity-source-id)Creates a new entity from entity-source-id
A source should have * create-fn optional a function * nb-entity * next-event * nb-max * waiting-time
:errors new-entity-exception, create-unkown-entity-id :past-events create-new-entity :stats entities-in how many new entities have been created and entities-nb how many are in the system
destroy-entity
(destroy-entity model entity)Destroys an entity from entity-source-id
:errors : none :stats : entities throughputs store the list of duration of the entity in the system entities-out and entities-nb :past-events destroy-entity
end-route
(end-route model entity)The entity ends its route, the entity is destroyed
:errors : route-ends-was-not-started :stats : routes route-id throughputs :past-events end-route
ends-production
(ends-production model entity)Production of entity is ended, if exists one waiting-product is picked and its production started.
:errors : :no-current-operation :past-events : :ends-production :stats :resources m :nb-in-stock, :resources m :occupation
enter-input-stock
(enter-input-stock model entity)Product enters the input-stock and directly the production slot if available, or waits in stock instead.
:errors no-current-operation :past-events enter-input-stock-wait-in-stock :stats :resources m :nb-in-stock
enter-production
(enter-production model entity)Product starts its production on machine.
:errors : current-operation-missing, machine-is-busy-already :past-events : enter-production :stats :resources m :occupation
Otherwise machine is updated with starts ends and next-event. And entities is set to in-production.
errors
(errors {:keys [entity-sources], :as model})Check model consistency
first-entity-out
(first-entity-out model)Return the date when the first entity get out the system
get-entity
(get-entity model entity-id during-kw)Returns a pair of * entity found ( nil if not) * model updated with an error if not
:errors unkown-entity-id :past-events none :stats none
last-entity-in
(last-entity-in model)Return the date when the last entity get in the system
next-event-bucket
(next-event-bucket model)Bucket of the next entity to create, nil otherwise
next-op
(next-op model entity)Entity is moving to its next operation, if there is no next operation, the route is ended.
Next operation is resolved and set to current-operation.
:stats : When route is ended: :routes route-id :throughputs :errors : route-ends-was-not-started :past-events : :next-op and end-route
on-new-product
(on-new-product model)For entity-source that should appear now (next-event=bucket), the product is created, the route is started and its first operation executed
- :errors
:next-event-missedif an event should have been done in the past:source-emptyif the source exists but has never something to create - :past-events: none
- :stats: none
on-production-end
(on-production-end model)For all resources with a next-event at current bucket, ends the production of entities occupying the machine.
print-error
(print-error {:keys [error-id _bucket _entity entity-source-id], :as error})print-errors
(print-errors {:keys [errors], :as _model})print-event
(print-event event)Print the event if it is matching one of this events.
print-output
(print-output model)print-status
(print-status {:keys [sim-status], :as _model})resource-next-event
(resource-next-event model)show-past
(show-past model)start
(start {:keys [resources entity-sources bucket], :or {bucket 0}, :as model} prng)Starts the simulation.
Can be used after a previous run has been stopped.
start-route
(start-route model entity route-id)The entity starts the route route-id, that should be found in route.
:errors : :route-not-existing and route-is-empty and when route is ended: :routes route-id :throughputs route-ends-was-not-started :past-events : :start-route :stats : :routes route-id :route-nb