Method for controlling operation of a medicament dispensing system, wherein the system comprises one or more distinct modules, wherein the method comprises the steps of:
- determining an execution plan comprising one or more tasks to be executed by the one or more distinct modules by means of a non-real-time controller;
- at the non-real-time controller, for each of the determined tasks of the execution plan, sending a task parameter command to one of the distinct modules, which has to execute the task, wherein the task parameter command comprises parameters needed to execute the task, and sending an associated task trigger command to a real-time controller, wherein the task trigger command is configured to instruct the real-time controller to trigger the respective module to execute the task with which the task trigger command is associated;
- upon receipt of the task trigger commands at the real-time controller, queueing the task trigger commands at the real-time controller;
- and
- at the real-time controller, executing the queued task trigger commands to trigger the respective modules to execute the task as indicated in the associated task parameter command;
- wherein each of the task parameter commands and the trig r commands sent in relation to the tasks of the execution plan is provided with a synchronization identifier;
- and
- at the real-time controller, the step of aligning the one or more tasks executed by and/or to e executed the one or more distinct modules by use of the synchronization identifiers;
- and
- wherein the step of aligning the one or more tasks comprises, at the real-time controller, after triggering a module to execute a task by executing the associated ask trigger command at the real-time controller, checking whether the following task depends on the task currently being executed by means of the synchronization identifiers included in the task parameter commands and the task er commands.