# Enhancing Sustainable IoT Systems Through a Goal-Oriented Requirements Analysis Framework
## 4 Goal-Oriented Requirements Analysis Approach for IoT Software Systems
### Application Example: IoT System for Monitoring Air Quality
#### 4.2.5 QVT for Model-to-Model Transformations
Upon receiving a new message, the payload is parsed and key environmental indicators, such as temperature, humidity, or air quality index, are extracted. These values are then evaluated against threshold-based decision rules that originate from the soft goals and operational tasks defined in the i* model. For example, if a temperature value exceeds a defined comfort threshold, a fan actuation message is published to a specific topic. Additionally, the code includes precise time stamping and logging mechanisms for each decision event, enabling detailed tracking of system latency and behavior over time. The structure of the code adheres to best practices in software engineering, such as separation of concerns and high cohesion, which contributes to its reduced memory usage and enhanced maintainability. This efficiency, along with energy-conscious design patterns enforced through automated transformations, directly supports the goals of sustainable IoT systems. Specifically, energy consumption is reduced through optimized actuation logic, while system responsiveness ensures timely intervention, minimizing unnecessary resource usage. By enabling automatic translation of high-level sustainability goals into optimized executable code, the GORA framework demonstrates a concrete path toward environmentally responsible IoT solutions. To validate the model-driven approach, the generated Python code must undergo rigorous testing within the target IoT environment. This testing process involves (1) integration testing of Python classes within the complete system architecture; (2) verification of real-time data processing capabilities, energy-efficient operation, and scalability under increasing sensor loads; and (3) continuous monitoring of sustainability metrics, including power consumption profiles and response time characteristics under various operational scenarios. The proposed methodology, which combines QVT for model-to-model transformations with Acceleo for model-to-text transformations, establishes a robust framework that bridges GORE with MDD. This dual transformation approach systematically integrates sustainability concerns--particularly energy efficiency, real-time performance, and architectural scalability--into both the design models (through UML extensions) and their corresponding Python implementations. Consequently, the methodology ensures that sustainability objectives are maintained throughout the system's lifecycle, from initial requirements specification to operational deployment and evolution. The generated Python code represents the classes, attributes, and operations defined in the UML model, facilitating the implementation of the IoT system. Once the Python code is generated, it can be integrated and tested by connecting to sensors, collecting data, and monitoring air quality. The transformation process ensures that the IoT system remains sustainable by maintaining traceability between requirements (i * RA model), design (UML class diagram), and code (Python source code). Furthermore, this process can be extended for future iterations, ensuring that, as new requirements are identified, the system can be easily updated by transforming the updated models using QVT and generating new Python code with Acceleo. This iterative process guarantees an efficient, MDD-based approach to the development of IoT systems, making it adaptable and sustainable for future enhancements. It is crucial to emphasize that end users interacting with devices are confined to thinking about the various actions these devices offer (e.g., turning it on, obtaining the temperature, etc.). Different devices present diverse actions, and the same action may exhibit different behaviors on various devices due to a lack of semantic interoperability. In the current realm of IoT systems, when programming smart devices, users must select the device, specify certain parameters or conditions, and then execute a specific action on the device.