## 2 Functional Specification Model and Synthesis of Real-Time Systems
### IoT Application System Model  
The first stage of design is to create a system model of the application. The system model represents the application function at the highest abstraction level, where tasks (processes) and interactions between tasks are distinguished. At this level, what a task does is not as important as when it is activated, what the synchronization between tasks is, and how the tasks communicate with each other. Typically, system models are graph models. Existing methods use various system models. We can distinguish, for example:  
* Task Graph (TG): one of the simplest and most popular methods of representing functions at the system level. It is a directed acyclic graph in which nodes represent tasks and edges represent the order in which tasks are performed (usually representing transmissions). The task is activated when all preceding ones are completed. In this way, sequential dependencies between tasks are presented. Transmission volumes are represented by edge weights. A sample task graph is shown in Figure 1. The graph describes a six-task system. Tasks on the same path in the graph are sequentially executed, while tasks from parallel paths can be executed in parallel. Extended versions of task graphs can also be found in the literature, e.g., conditional task graphs and multimodal task graphs [50; 51]. Such models allow for the specification of special cases, such as the conditional or alternative performance of certain tasks.
* SDF (Synchronous Data Flow) or SSDF (Statically Schedulable Data Flow): models representing data flow (often used in modeling telecommunications applications). Like the TG, SDF is a directed graph. Unlike the TG, cycles can occur in SDF. The synchronization mechanism is described by determining the number of tags generated by the execution of a given task (for each output edge). The number of tags taken from each input is also specified for each task. The task is activated if the required number of tags is available on all inputs.
* STATECHARTS: a model based on a FSM (Finite State Machine), models based on a description in the form of various forms of automation enable the specification of control flow. Unlike a classic FSM, state charts enable parallel descriptions and task specifications. Tasks are related to transitions between states.  
There are also a number of other methods that often target specific classes of applications. The system model should not impose any constraints on the target system architecture if this is not directly implied by the design assumptions. The architecture should be the result of system optimization. Therefore, the first step in the methodology should be to propose a method for specifying the application at the system level. This model will be the starting point for further design (scheduling, mapping into architecture, and optimization). Therefore, it should contain all the information so that the above tasks can be performed. Each method has limitations (e.g., the task graph offers no way of describing the control functionality). In the case of RTIoT, the model should allow for the specification of both computational and transmission tasks (communication tasks). The model should also target so-called reactive systems, i.e., systems in which particular sequences of actions/tasks are activated as a result of reactions to specific events.