BPMN-OS
BPMN for optimization and simulation
Loading...
Searching...
No Matches
Execution engine

The execution engine is responsible for running a BPMN model instance. It requires a data provider, several event dispatchers to provide execution relevant information during runtime, and a controller making decisions during execution. Below is an example using a static data provider to obtain a scenario, a ready handler, to provide activity-related information, a deterministic completion handler, to trigger task completion, and a time warp handler, to trigger the advancement of the simulation time, and a greedy controller using a guided evaluator.

#include <bpmnos-model.h>
#include <bpmnos-execution.h>
int main() {
// load model and instances
BPMNOS::Model::StaticDataProvider dataProvider("diagram.bpmn","scenario.csv");
auto scenario = dataProvider.createScenario();
// initialize execution engine
// initialize and connect BPMNOS::Execution::EventDispatcher for BPMNOS::Execution::ReadyEvent
readyHandler.connect(&engine);
// initialize and connect BPMNOS::Execution::EventDispatcher for BPMNOS::Execution::CompletionEvent
completionHandler.connect(&engine);
// initialize and connect BPMNOS::Execution::EventDispatcher for BPMNOS::Execution::ClockTickEvent
timeHandler.connect(&engine);
// initialize and connect BPMNOS::Execution::Controller for BPMNOS::Execution::Decision
BPMNOS::Execution::GreedyController controller(&evaluator);
controller.connect(&engine);
// run engine on scenario
engine.run(scenario.get());
}
Class creating a completion event for a token awaiting the completion of a task (except DecisionTask)...
BPMNOS::number run(const BPMNOS::Model::Scenario *scenario, BPMNOS::number timeout=std::numeric_limits< BPMNOS::number >::max())
Runs a scenario as long as there is a token or new instantiations. Terminates when the time if the sy...
Definition Engine.cpp:39
virtual void connect(Mediator *mediator)
A controller dispatching the best evaluated decisions.
Class representing an evaluator that uses the guidance that may be provided.
Class dispatching a ready event when the required data is available a token at an activity.
Class creating a clock tick event each time fetchEvent() is called.
Definition TimeWarp.h:12
Class representing a data provider for static BPMN instance data.