# A Model Based Framework for IoT-Aware Business Process Management
## 4 IoT-Aware BPM Framework
### Methodology for IoT-Aware BPM  
The proposed methodology, which is shown in Figure 8, consists of the following steps:  
1. Initially, an IoT-BPMN model that provides the _operational view_ of the sensors system is specified. The proposed BPMN extension allows systems developers to characterize the process model with information that describe the sensors networks, e.g., service endpoints for Service Task interacting with the underlying IoT platforms, datatype structure for the expected measures, etc. ;
2. A SysML model annotated with the IoT4 SysML profile is specified for providing the _structural view_ of the sensors network;
3. In order to allow the simulation-based analysis of the IoT system, the IoT-BPMN model and the XML-based description of the static simulation parameters characterizing the scenario under study are given as input to the IoTBPMN-to-eBPMN _model-to-text_  
Figure 7: IoT-aware BP Analysis Architecture. transformation. In this respect, as explained in Section 4.4, the IoT-BPMN extension includes the metaclasses provided by the PyBPMN metamodel. As such, the IoT-BPMN also describes the performance and reliability properties that characterize the BP (e.g., the activity service demand, the IoT devices MTTF, etc.). The eBPMN code implementing the _digital twin_ of the actual IoT-aware BP is thus generated. The eBPMN code execution allows analysts to evaluate the behavior of the IoT system and assess whether or not all the functional and non-functional requirements are satisfied;
4. The SySML-to-Sensors _model-to-text_ transformation is executed for generating: * The sensors driver used for making the PoT Broker component able to actually interact with concrete IoT devices; * The required classes that implement the Data Model storing measures collected by sensors. 5. In order to allow the actual execution of the business process, the IoTBPMN-to-Engine _model-to-model_ transformation is executed for generating a process model compliant with the adopted execution engine. It should be underlined that even though such a transformation is strictly tied to the adopted BP execution engine, the adoption of an MDA-based approach allows keeping the methodology valid regardless the engine adopted in the concrete case: any BP execution environment will be virtually supported by introducing an appropriate model transformation able to generate the required input model;
6. Finally, the IoT-aware BP is executed. The information included in the IoT-BPMN model (e.g., the sensor service end-points), allows the execution engine to interact with the PoT Broker for inquiring the underlying sensors network and collecting the measured data;
7. At execution time, the actual configuration of the sensors system (i.e., the physical twin) may change. In order to keep the digital twin aligned with its physical counterpart, the Data Retrieval Layer is responsible of collecting the parameters which describe the actual system configuration and updating the eBPMN implementation accordingly. It should be underlined that the methodology does not make any assumption about the availability of an IoT-BPMN modeling tool. Indeed, as shown in Figure 9, the IoT-BPMN model can be obtained throughout the following steps: first, a BPMN model is specified according to the IoT System functional requirements. Then, performance and reliability properties, as well as the description of the IoT devices, are used for enriching the BPMN model with relevant text annotations. Finally, a model-to-model transformation is executed to generate the corresponding PyBPMN and IoT-BPMN models. In this respect, in order to be automatically processed by a _model-to-text_ transformation, text annotations should follow the EBNF [40] formal syntax illustrated in [41] and conform to the PyBPM and the IoT metamodels. In order to show how the proposed methodology can be used in practice, a prototype of the framework has been developed and used in a scenario dealing with a Water Alert System.