# 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
name = 'Minimize Energy Consumption' } {  nodeType := 'logger';  topic :='metrics';  database := 'influxdb';  metric := 'cpu_usage';  interval := '30s';  }

The QVT operational rules form the backbone of the model-to-model transformation process within the GORA framework. These rules are applied to translate high-level i* models, representing stakeholder goals, tasks, and dependencies, into a structured platform-independent model (PIM) that serves as the intermediate representation for subsequent code generation. Each QVT rule operates on defined metamodel elements of the i* framework. For example, a rule may transform a SoftGoal into a monitoring condition or map a Task to a specific logic block or function. Dependencies between actorsand tasks are resolved into publish/subscribe relations, which later become MQTT topics and handlers in the generated code. Transformation rules ensure semantic consistency by preserving intentional elements from the requirements phase and by embedding traceability links across the generated model. The QVT transformations include mapping rules, such as converting actors into system components, mapping tasks and SoftGoals into conditional logic, translating resources into input/output streams (e.g., sensor/actuator channels) and representing dependencies as message exchange patterns. These transformation rules are implemented in a way that is both deterministic and traceable, ensuring that any changes in the i* model will result in predictable and verifiable changes in the generated PIM. Critically, the encoding of soft sustainability-related goals--such as energy efficiency, reduced latency, and resource optimization--into QVT mappings aligns the transformation process with sustainable IoT system design. This allows developers to systematically incorporate sustainability constraints and objectives early in the development process and maintain them throughout the software lifecycle. QVT transformation guarantees that the design intent captured at the goal level is preserved and enforced throughout the development pipeline, enabling automatic, verifiable generation of source code that reflects the high-level objectives of sustainability, efficiency, and responsiveness in IoT environments. #### 4.2.6 Acceleo for Model-to-Text Transformations

Acceleo is a model-to-text transformation language that can generate code from a UML class diagram (or any other model). The Acceleo template reads the UML classes and generates Python classes, methods, and attributes, focusing on the sustainability goals of the IoT system (energy efficiency, real-time processing, and scalability). For this proposal, it is necessary to define the Acceleo template (these templates are written in OCL (Object Constraint Language) and are used to generate the output). In this step, it is needed to define an Acceleo template that reads the UML model class diagram and generates corresponding Python classes. Next, we detail the fragment of the Acceleo template defined. This transformation loops over each UML class from the class diagram and generates a Python class. For each class, we generate the attributes (as Python class variables) and operations (as Python methods). After defining the Acceleo template, it is necessary to run the transformation to generate Python code. This will generate Python classes corresponding to the UML class diagram generated earlier. The template generates Python classes for each UML class, where attributes are mapped to Python variables and operations are transformed into corresponding Python methods. The generated code adheres to key sustainability principles to enhance system efficiency and performance. First, energy efficiency is delivered through asynchronous processing or event-driven mechanisms for real-time data collection. Second, real-time data processing is ensured by implementing methods like get_sensor_data(), which are designed to minimize latency and improve responsiveness.