Self-managed Workflows for Cyber-physical Systems Ronny Seiger Software Technology Group, Technische Universität Dresden, Germany ronny.seiger@tu-dresden.de Abstract. The application of Business Process Management (BPM) technologies to automate processes in Cyber-physical Systems (CPS) promises various advantages including a higher flexibility and simpli- fied programming, a more efficient resource usage, and an easier integra- tion of devices. However, these new areas also introduce novel challenges for Workflow Management Systems (WfMSes) especially related to the physical world interactions, constraint resources, complex devices and unpredictable actors that make up CPS. WfMSes used in classical BPM domains are able to address these new challenges only partially. We pro- pose a new modelling language and WfMS designed to extend classical processes into CPS Workflows. We put a special focus on the process- based interactions with the physical world via sensors, actuators, things and humans. An autonomic manager based on the MAPE-K control loop adds self-management to WfMSes to deal with unanticipated situations and cyber-physical state inconsistencies. A smart home case study shows the feasibility and high coverage of new CPS-related requirements. Keywords: Workflow Management Systems · Self-management · Cyber- physical Systems · Internet of Things. 1 Motivation and Challenges: Workflows in CPS Workflows are a well-established concept for describing business logics and pro- cesses in web-based applications and enterprise application integration. Applying BPM technologies to increase autonomy and automate sequences of activities in CPS and Internet of Things (IoT) promises various advantages including a higher flexibility and simplified programming, a more efficient resource usage, and an easier integration of CPS devices. However, traditional BPM notations and engines have not been designed to be used in the context of CPS, which raises new research questions occurring with the coupling of the virtual and physical worlds [4,5,1]. Among these challenges are the process-based interac- tions with complex compounds of heterogeneous sensors, actuators, things and humans. Novel factors related to physical world interactions may jeopardize the successful execution of workflows in CPS and lead to unanticipated situations. The main goal of this thesis is to apply and extend workflow technologies to realize defined objectives and goals in CPS by automating repetitive tasks and 2 Ronny Seiger processes involving physical and virtual participants. The key actors in these CPS workflows are physical actuators, sensors, smart objects and humans, and virtual software components that interact with each other. CPS introduce the new dimension of interaction with the physical world and new properties a WfMS for CPS has to cope with: cyber-physical interactions; hierarchical devices of varying complexity and availability; limited physical resources; new physi- cal error sources; and context-dependant and safety-critical behaviour–and with these the increased need for autonomy. Based on these new properties we inves- tigate research questions along the BPM lifecycle [10] regarding the Modelling, Implementation and Execution of autonomous and resilient CPS workflows [6]. Following a discussion of existing BPM systems and related research, we pro- pose new concepts to address novel requirements and bridge identified research gaps. First, we introduce a CPS workflow notation for modelling the interactions among all CPS entities as well as success and error criteria for the execution on the process-level. We then present an architecture of a WfMS called “PRO- tEUS” to execute the processes. Subsequently, the integration of a feedback loop to increase flexibility and resilience of the process execution is shown–also as a general framework for adding self-* capabilities to WfMSes. The evaluation of our concepts is conducted in a smart home case study and complemented by a discussion of the requirements coverage, advantages and limitations. 2 Solution: The PROtEUS Workflow Manament System The PROtEUS system [8] depicted in Fig. 1 is our proposal of a system architec- ture for a CPS WfMS that we developed following the design science approach. As high-level business process notations lack technical detail and expressive- ness to implement the interaction with actors of CPS, the process descriptions (models) follow an implementation-oriented meta-model for CPS workflows [9]. PROtEUS Feedback Service Process Execution Engine Monitor Process Goals Analyser Local Service Platform Planner Distribution Process Human Task Service CEP Engine Executor Manager Manager Handler Service Result Service Actuator Knowledge Base WebSocket Server Service Invoker CEP Adapter Remote Management Interactive Service Semantic Service Engine Client Client Client Sensor Access Actuator Sensor Sensor Actuator Layer Fig. 1. Architecture of the PROtEUS WfMS for CPS and Associated Components. – Process Execution Engine to execute process instances according to their underlying process models and communicate with all other components. Self-managed Workflows for CPS 3 – Process Manager to control and monitor the execution of processes. – CEP Engine to enable complex event processing (CEP) within sensor event streams for detecting explicitly defined event patterns. – Local Service Platform to enable the local deployment and discovery of web services based on OSGi and REST. – Service Invoker to call various types of web services invoking CPS device functionality based on standard or proprietary protocols. – Human Task Handler to distribute manual tasks that are part of a process requiring human interactions on an end-user device (e. g., a smartphone). – Distribution Manger to enable the distributed execution of subprocesses on remote peers in a hierarchical network managed by super-peers. – Web Socket Server to enable the bi-directional communication and inter- action with users and other instances of the WfMS via Pub/Sub and RPC. PROtEUS interacts with the Semantic Access Layer (SAL) to dynamically dis- cover and invoke IoT services based on required functionality and context con- straints of mobile and resource-constraint IoT devices at runtime [2]. One of the key concepts called Cyber-physical Consistency is shown in Fig. 2 a). Due to the dynamic nature of CPS unanticipated situations may appear at any time, which requires a level of self-adaptiveness of the WfMS. The example shows the process- based triggering of a light switch with the light assumed to be on after execution of an instance. However, a broken light bulb or other physical obstacles, which may not be detected by the WfMS or actuator can lead to the light still being off and thus to the virtual state SC,t being inconsistent with the physical state SP,t . As shown in Fig. 1 PROtEUS interacts with the Feedback Service, which implements a generic MAPE-K control loop [3] enabling self-adaptation [7]. Its application to manage process activities for Cyber-physical Synchronization is shown in Fig. 2 b). We add Goals to the process steps as attributes that ag- gregate Objectives defining success and error criteria for the execution based on external data. These specifications are not limited to physical context values but can also refer to other criteria (e. g., KPI or QoS levels). a) Cyber-physical Consistency b) Cyber-physical Synchronization Fig. 2. Synchronization to Maintain Cyber-physical Consistency during Execution. 4 Ronny Seiger – Knowledge: The Knowledge Base is a central database (ontology) storing all information regarding the CPS entities and process execution. – Monitor: Monitoring agents update sensor data in the Knowledge Base continuously and forward relevant changes (Symptoms) to the Analyser. – Analyse: The Analyser uses the criteria defined in the objectives to check the execution for success–terminating the MAPE-K loop if positive–or error– sending a Change Request to the Planner if positive. – Plan: The Planner uses the determined mismatch and an extensible Com- pensation Repository to find Compensation Actions and replacement re- sources based on their capabilities and context. – Execute: The change plan is enacted by the Executor instructing the re- spective CPS actuators and effectors. The MAPE-K loop is repeated. With the Feedback Service implemented as a standalone micro-service, we can use the MAPE-K loop as framework to retrofit existing WfMSes. We propose two ways of retrofitting: 1) Invasive–requiring extensions to the process meta- models to specify goals and objectives, and modifying the execution logic to call the Feedback Service in parallel to the managed process step; and 2) Non- invasive–requiring the existing process models to be extended with an explicit parallel call to the Feedback Service having the goal as input parameter. 3 Evaluation and Contributions To evaluate the new concepts and prototypes we conducted an extensive proof-of- concept case study in a smart home–modelling and executing two main scenario processes that assist residents with their morning routines and in emergency cases, and special processes based on these examples. In general, we link the ex- ecution of the individual process steps to the corresponding effects in the physical world via external sensor data–and vice versa. In case the Feedback Service is involved, we also link the executions of the MAPE loops with the process ex- ecution and physical effects. The PROtEUS system shows expected behaviour and fast execution times for virtual computations and synchronous invocations of services. The major contributors to the overall execution times are activities involving (asynchronous) actions and changes in the physical world, which are much slower by nature. A discussion of the coverage of new CPS-related require- ments shows advances of the PROtEUS system compared to related approaches– including the interaction with sensors, dynamic actuators, humans and other WfMSes as well as an increased level of runtime adaptivity. With this thesis, we present a comprehensive approach of introducing workflows to CPS and IoT [6]. Besides an extensive discussion of requirements related to BPM and CPS/IoT and an evaluation of related work, our main contributions comprise: – A domain-independent modelling notation for executable workflows in CPS that supports the specification of the process outcome; – An architecture of a CPS WfMS to execute workflows interacting with the physical world via sensors, actuators, things and humans (PROtEUS ); Self-managed Workflows for CPS 5 – A software component for adding multi-level feedback loops to WfMSes en- abling cyber-physical synchronization and self-* (Feedback Service); – A retrofitting framework for extending existing WfMSes with self-* capabil- ities in an invasive and non-invasive way by using MAPE-K feedback loops. The overall objective of this thesis is the development of a WfMS that can be used in the context of CPS [6]. We developed concepts and prototypes to model, implement and enact complex interactions among all CPS entities and with the physical environment on a business process-oriented level. The CPS WfMS is able to react to dynamic changes in the structure of the CPS and to increase fault-tolerance and resilience due to its autonomic capabilities. With our pro- totypes it is possible to establish links between the process executions and the cyber-physical environment, and vice versa. Our focus is on addressing new re- quirements with a holistic approach that integrates well-established technologies together with new components and engineering concepts into a WfMS for CPS. The evaluation shows the feasibility of the prototypes within a case study in the context of a smart home as an exemplary CPS. The results are also applicable and highly relevant for other CPS domains (e. g., smart hospitals and smart factories) that require flexible and adaptive processes. From the discussions, we were able to identify advantages, limitations and open issues, which can be used as starting points for future developments in the field of BPM for CPS and IoT. References 1. Chang, C., Srirama, S.N., Buyya, R.: Mobile cloud business process management system for the internet of things: a survey. ACM Computing Surveys (2016) 2. Huber, S., Seiger, R., Kühnert, A., Theodorou, V., Schlegel, T.: Goal-based seman- tic queries for dynamic processes in the internet of things. International Journal of Semantic Computing 10(02), 269–293 (2016) 3. IBM: An architectural blueprint for autonomic computing. Tech. rep. (2005) 4. Janiesch, C., Koschmider, A., Mecella, M., Weber, B., Burattin, A., Di Ciccio, C., Gal, A., Kannengiesser, U., Mannhardt, F., Mendling, J., et al.: The internet-of- things meets business process management: Mutual benefits and challenges. arXiv preprint arXiv:1709.03628 (2017) 5. Mendling, J., Baesens, B., Bernstein, A., Fellmann, M.: Challenges of smart busi- ness process management: An introduction to the special issue. Decision Support Systems (2017) 6. Seiger, R.: Self-managed Workflows for Cyber-physical Systems. phdthesis (2018), http://nbn-resolving.de/urn:nbn:de:bsz:14-qucosa2-323153 7. Seiger, R., Huber, S., Heisig, P., Aßmann, U.: Toward a framework for self-adaptive workflows in cyber-physical systems. Software & Systems Modeling (Nov 2017) 8. Seiger, R., Huber, S., Schlegel, T.: Toward an execution system for self-healing workflows in cyber-physical systems. Software & Systems Modeling pp. 1–22 (2016) 9. Seiger, R., Keller, C., Niebling, F., Schlegel, T.: Modelling complex and flexible processes for smart cyber-physical environments. Journal of Computational Science 10, 137 – 148 (2015) 10. Van Der Aalst, W.M.: Business process management: a comprehensive survey. ISRN Software Engineering 2013 (2013)