## 5 Case Study: Experimental Validation in a Representative Smart Building Scenario
### Implementation of the JFML-IoT-Based Energy Management System
#### 5.4.1 Sensor and Actuator Object Instantiation
The node periodically collects sensor data and executes the inference process (Listing 6):

FMLReader reader = **new** FMLReader(); FuzzyInferenceSystem fis = reader.parseFML( \"./energy_fuzzy_controller.fml\"); JFMLIoTNode centralNode = **new** JFMLIoTNode(\"CentralNode\"); centralNode.setFuzzyInferenceSystem(fis); centralNode.setMQTT(mqtt); centralNode.startInferenceLoop(10000); EmbeddedSystem nodeJFML = **new** EmbeddedSystemRPi(\"node_JFML\") ; nodeJFML.add)FMLIoTNode(centralNode);

This configuration provides a modular, interoperable, and interpretable fuzzy logic-based energy management solution fully compliant with the IEEE Std 1855-2016. The modular design of JFML-IoT enables seamless scalability and extension with additional devices or rules tailored to the requirements of smart building environments. Although a detailed benchmarking analysis is beyond the scope of this work, the proposed system was tested on two common embedded platforms--ESP32 and Raspberry Pi 3B+--with positive results. These platforms are widely adopted in IoT applications due to their low power consumption and sufficient processing capabilities. During our experiments, the system demonstrated average inference times under 20 milliseconds, with fuzzy rule bases of up to 30 rules, and consistently low resource usage (CPU below 10%, RAM below 50%). These results support the system's suitability for real-time energy management tasks and pave the way for future work focused on exhaustive performance analysis. ### Scenario-Based Evaluation and System Behavior Analysis

To validate the effectiveness, interpretability, and adaptability of the proposed fuzzy-based energy management system, we conducted a structured set of simulations using the final FML-based controller and the complete implementation of the JFML-IoT framework introduced in the previous sections. The goal of this evaluation is to explore the system's response to diverse environmental conditions and occupancy patterns commonly found in indoor spaces such as offices, classrooms, or laboratories. Four representative scenarios were defined to reflect distinct combinations of input variables, including temperature, humidity, illuminance, occupancy, and CO\({}_{2}\) concentration across two spatial zones. These scenarios were carefully selected to capture typical conditions under which building energy systems must operate. Table 5 presents the sensor input values corresponding to each scenario. In the following subsections, each scenario is analyzed in detail, highlighting the fuzzy rules activated, the system outputs inferred, and the rationale behind them. Readers can refer to Section 5.5.1 for Scenario S1 (High Temperature and Occupancy), Section 5.5.2 for Scenario S2 (Low Temperature and Unoccupied), Section 5.5.3 for Scenario S3 (Medium CO\({}_{2}\) and Occupancy), Section 5.5.4 for Scenario S4 (Low Light and Occupancy), and Section 5.5.5 for Scenario S5 (Low/High Light, Un/Occupancy, and High Humidity). #### 5.5.1 Scenario S1: High Temperature and Occupancy

To validate the updated fuzzy controller, this scenario evaluates a condition of elevated temperature and full occupancy across both monitored zones, with moderate levels of illuminance and CO\({}_{2}\). Table 6 details the input values. The inferred output values are listed in Table 8. Since both zones of the room are occupied, the system activates rule R24 as a baseline for achieving occupant comfort. This initial control state is then refined by rules R01 and R04, which respond to elevated temperatures detected in both areas, thereby increasing the activation level of the HVAC and ventilation systems to accelerate the cooling effect. Concurrently, the lighting sensors detect medium illuminance levels in both zones, triggering rules R08 and R11 to set the lighting systems to a Dim level. Additionally, a moderately elevated CO\({}_{2}\) concentration activates rule R16, which adjusts both the ventilation and HVAC systems accordingly.