# A Model Based Framework for IoT-Aware Business Process Management
## 6 Example Application  
This section provides an example that aims to demonstrate how the proposed IoT-aware BPM framework can be used in practice. The example application makes use of a framework prototype implementation that addresses the methodology steps 1 through 7. In order to assess the technically soundness of the proposed IoT-aware BPM framework and to assess the feasibility and effectiveness of the relevant methodology along with its limitations, this section discusses the application of a framework prototype to a concrete case. Specifically, the prototype implementation of the framework addresses steps 1 through 7 of the proposed methodology. Let us consider a _Water Monitoring System (WMS)_, which controls a sensors network for evaluating the flooding risk of a water basin. The system includes the following sensors:  
* The water level and its vertical acceleration are monitored by a _GPS_ and an _acceloremeter_, both mounted on a buoy which floats on the water surface;
* The weather conditions are monitored by a weather station equipped with a _pluviometer/anemometer_. The control flow executed by the WMS IoT system is summarized as follows:  
1. All sensors have to be initialized;
2. Iteratively, the available sensors have to be inquired in order to obtain actual measures for the observed parameters: the water level, its vertical speed, the rainfall and the wind speed and direction;
3. According to the collected data, the system shall evaluate the flooding risk and, if required, an alert shall be sent to a human operator in charge of enacting the required countermeasures and properly managing the emergency operations. As illustrated in Figures 8 and 9, the first step of the proposed methodology deals with the specification of an IoT-BPMN process model. In this respect, according to the functional requirements, a BPMN diagram is initially defined. Then, the non-functional requirements are used for extending the BP model with textual annotations compliant to the IoT-BPMN metamodel. Finally, a _model-to-text_ transformation is executed to generate the XML-based representation of the IoT-aware BP. Figure 10 illustrates the BPMN model for the Water Alert System. A fragment of the annotated model is shown in Figure 11.  
At the second step, the _structural view_ of the WMS is specified in terms of a SysML diagram extended with the _IoT4 SysML_ profile. The structural model consists of various diagrams. The package diagram describes the various domain entities, as shown in Figure 12, which shows how the WMS entity, which acts as a <<system>>, observes the Basin. The use of the _IoT4 SysML_ profile allows the identification of relevant concepts which are used by the model transformations for generating the corresponding output:  
* Blocks representing IoT devices, e.g., the GPS or the accelerometer stereotyped as <<Sensor>> (see Figure 13);
* The structure of the data collected by a sensor. As an example, the attributes _rainFall_ and _wind_ owned by the _Pluvio-Anemometer_ Block are stereotyped as <<SensorData>> and <<SensorDataRecord>>, respectively. While the former denotes a _basic_ (i.e., Integer) datatype, the latter is a record type, further specified by the _WindDataType_ element (see Figure 13);
* The relationship between a _sensor_ and the observed _features of interest_. As an example, the _GPS <<observes>>_ the _weather conditions_ (see Figure 13);
* The observable properties characterizing each feature of interest. As an example, the _Basin Water Condition_ block is stereotyped as a <<FeatureofInterest>> which in turn is specified by two attributes stereotyped as <<ObservableProperty>>: the _waterLevel_ and the _verticalAcceleration_ (see Figure 14). Figure 11: Annotation of the BPMN model with performance- and IoT-related properties (fragment). Figure 10: BPMN Model for the Water Alert System. The WMS package contains the Block Definition Diagram (BDD) specifying the WMS structure (see Figure 13).