## 5 RTIoT System Design Methodology
### System Specifications  
The starting point for designing an RTIoT system is a system specification in the form of an attributed set of task graphs. Each task graph describes one function of the system. The following attributes are defined for each graph:  
* Maximum frequency of graph activation: This attribute specifies the maximum frequency of appearance of input events that cause the execution of functions represented by a given TG. * Maximum number of TG instances: This attribute specifies the maximum number of simultaneous instances of the task graph. This corresponds to the maximum number of simultaneous events that cause the activation of the functions described by the TG. * A set of time constraints: The time constraints are associated with the selected paths in the task graph and define the maximum time in which all tasks must be completed from the activation of the task that starts the path to the completion of the task that ends the path. * For each task, an attribute is specified that assigns the task to a specific layer of the architecture. This attribute is defined by the designer. Example task graphs are shown in Figures 3-6. These graphs describe nine basic functions of a smart city system for managing parking spaces. Figure 3 shows a user-activated task graph for the following system functionalities: searching for the parking space closest to the user's current location, the function of finding the user's car in the parking lot based on their license plate number, the function of reserving any free parking space based on the entered search criteria, the function of charging a parking fee for the used parking lot, and the function of retrieving information on weather conditions. Figure 3: Task graph of the parking space management system. Figure 4: Task graph for the problem of monitoring/managing parking spaces. Figure 5: Task graph of basic system functions triggered from the application. For all system functionality, the starting point, or trigger (T0_0), is the end-user activity in a dedicated application made by selecting the appropriate function at the UL layer level. Depending on the selected function, a further sequence of events follows. When the user selects the parking space search function (T0_1), the user's current location is retrieved using the GPS module (T0_4). If the car search function (T0_2) is selected, the user must enter the license plate number of the searched vehicle (T0_10) into the application. On the other hand, when the function of reserving a free parking space is selected from the user's application (T0_03), the end user enters data/criteria for the search function, such as city and street (T0_12). The user also has the ability to download information on weather conditions (T0_17). In the next step (T0_5), the central server (a dedicated cloud application running in the CL layer) receives queries from the UL layer and starts the processes necessary to perform the called functions. For example, databases can be searched to find free parking spaces while considering information from the GPS tracker. A search for license plate numbers can be run, along with the retrieval of the vehicle location data assigned to them (parking/parking space number). Taking the user's criteria into account, free parking spaces can be searched for, or the fee due can be calculated based on the time the parking space is occupied and the parking rate for the given parking space. The (T0_6) task runs in the user application responsible for receiving and processing data coming from the CL layer. In the next step, the user, based on the generated data, selects a parking space by activating the \"Reserve\" function (T0_7); in turn, for the process of searching for a car based on the entered license plate number (T0_10), the end result is the presentation of the results of the query processing in the end-user application (T0_11) or the start of the payment process using a debit/credit card or bank transfer (T0_14). It is also possible to visualize data on weather conditions (T0_18).