Next Article in Journal
Reactive Power Optimization of a Distribution Network Based on Graph Security Reinforcement Learning
Previous Article in Journal
Refining Text2Cypher on Small Language Model with Reinforcement Learning Leveraging Semantic Information
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Interpretable Fuzzy Control for Energy Management in Smart Buildings Using JFML-IoT and IEEE Std 1855-2016

by
María Martínez-Rojas
1,
Carlos Cano
2,
Jesús Alcalá-Fdez
3,4,† and
José Manuel Soto-Hidalgo
3,5,*,†
1
Department of Building Construction, University of Granada, 18011 Granada, Spain
2
Department of Computer Science and Artificial Intelligence, University of Granada, 18011 Granada, Spain
3
Instituto de Investigación Biosanitaria ibs.Granada, 18011 Granada, Spain
4
Department of Computer Science and Artificial Intelligence, Andalusian Research Institute in Data Science and Computational Intelligence (DaSCI), University of Granada, 18011 Granada, Spain
5
Department of Computer Engineering, Automation and Robotics, University of Granada, 18011 Granada, Spain
*
Author to whom correspondence should be addressed.
These authors contributed equally to this work.
Appl. Sci. 2025, 15(15), 8208; https://doi.org/10.3390/app15158208
Submission received: 2 June 2025 / Revised: 17 July 2025 / Accepted: 17 July 2025 / Published: 23 July 2025
(This article belongs to the Section Computing and Artificial Intelligence)

Abstract

This paper presents an interpretable and modular framework for energy management in smart buildings based on fuzzy logic and the IEEE Std 1855-2016. The proposed system builds upon the JFML-IoT library, enabling the integration and execution of fuzzy rule-based systems on resource-constrained IoT devices using a lightweight and extensible architecture. Unlike conventional data-driven controllers, this approach emphasizes semantic transparency, expert-driven control logic, and compliance with fuzzy markup standards. The system is designed to enhance both operational efficiency and user comfort through transparent and explainable decision-making. A four-layer architecture structures the system into Perception, Communication, Processing, and Application layers, supporting real-time decisions based on environmental data. The fuzzy logic rules are defined collaboratively with domain experts and encoded in Fuzzy Markup Language to ensure interoperability and formalization of expert knowledge. While adherence to IEEE Std 1855-2016 facilitates system integration and standardization, the scientific contribution lies in the deployment of an interpretable, IoT-based control system validated in real conditions. A case study is conducted in a realistic indoor environment, using temperature, humidity, illuminance, occupancy, and CO2 sensors, along with HVAC and lighting actuators. The results demonstrate that the fuzzy inference engine generates context-aware control actions aligned with expert expectations. The proposed framework also opens possibilities for incorporating user-specific preferences and adaptive comfort strategies in future developments.

1. Introduction

Energy efficiency in buildings represents a critical component of modern infrastructure, driven by the need to reduce operating costs, minimize environmental impact, and adhere to increasingly stringent energy regulations. Since buildings account for a substantial portion of global energy consumption, optimizing their energy use is essential for achieving sustainability goals [1,2]. For instance, approximately 85% of buildings in the European Union (EU) were constructed before 2000, and among these, 75% exhibit low energy performance, so enhancing the energy efficiency of these buildings is essential for conserving energy, reducing costs for both citizens and small businesses, and advancing toward a zero-emission and fully decarbonized building stock by 2050. In response, on 28 May 2024, the EU revised the Energy Performance of Buildings Directive (EU/2024/1275) entered into force in all EU countries to foster an accelerated rate of renovation, particularly among the worst-performing buildings (https://energy.ec.europa.eu/topics/energy-efficiency/energy-efficient-buildings/energy-performance-buildings-directive_en, accessed on 16 July 2025).
Traditional techniques for energy efficiency in buildings include advanced lighting control systems that use dimmable LED lighting combined with daylight harvesting strategies to minimize electricity consumption [3]. Ventilation systems employ demand-controlled ventilation (DCV) using CO2 sensors to adjust airflow based on occupancy [4], while noise reduction techniques incorporate sound-absorbing materials and active noise cancellation strategies to enhance indoor comfort [5]. Occupancy detection technologies, such as passive infrared (PIR) sensors, ultrasonic sensors, and computer vision-based systems, help dynamically adjust heating, ventilation, and air conditioning (HVAC) settings to optimize energy usage [6]. These approaches, while effective, often rely on rigid rule-based automation that lacks adaptability to real-time environmental fluctuations and varying occupancy patterns.
The Internet of Things (IoT) has emerged as a transformative paradigm for real-time data acquisition, processing, and automation in smart environments, including building energy management [7,8,9]. IoT enables interconnected sensors, actuators, and controllers to collect and analyze environmental and operational data, allowing for more efficient and adaptive energy usage strategies. In the context of energy-efficient buildings, IoT applications include smart thermostats that optimize HVAC performance based on occupancy patterns [10], intelligent lighting systems that adjust brightness levels according to daylight availability [11], and energy monitoring systems that provide real-time feedback on consumption trends [12]. Furthermore, IoT facilitates predictive maintenance by continuously monitoring equipment performance, reducing energy waste caused by faulty systems [13]. Despite these advancements, many IoT-based solutions for energy management lack standardization, security, interoperability, and the ability to process uncertain or incomplete or missing data, limiting their effectiveness in complex and dynamic building environments [14,15,16]. Addressing these limitations requires a more intelligent decision-making framework capable of handling uncertainty and optimizing energy consumption dynamically.
Artificial intelligence (AI) and fuzzy logic-based systems provide an effective approach for dealing with the inherent uncertainty in complex environments such as smart buildings [17,18]. Unlike conventional control mechanisms that rely on precise mathematical models and deterministic decision-making, fuzzy inference systems (FISs) allow for nuanced, human-like reasoning that can adapt to real-world variability and approximate solutions in uncertain conditions [19]. By leveraging linguistic variables and membership functions, FISs enable energy management strategies that incorporate factors such as occupant behavior, external environmental conditions, and device performance with greater flexibility. This adaptability makes fuzzy logic particularly suited for optimizing energy efficiency in buildings, where diverse factors interact in non-linear and unpredictable ways [20].
Recognizing the potential of fuzzy systems for intelligent decision-making, the norm IEEE std 1855-2016 was introduced to formalize the development of interoperable fuzzy systems [21]. This standard defines a structured methodology for designing, implementing, and integrating fuzzy logic-based models, ensuring consistency across different hardware and software platforms. A key advancement stemming from this standard is the development of the Java Fuzzy Markup Language (JFML) library, an open-source framework that facilitates the implementation and deployment of fuzzy systems across various domains, including industrial automation, healthcare, and IoT applications [22]. Recent research has extended JFML to IoT environments, enabling its application in distributed sensor networks [23]. The integration of FISs with IoT allows for the real-time adaptation of energy management strategies by processing large volumes of sensor data with minimal computational overhead. However, the current version of JFML-IoT remains limited in its support for low-power devices and diverse sensor–actuator configurations, restricting its applicability in resource-constrained environments such as energy management systems in smart buildings.
Building upon these foundations, the present work aims to validate how an interpretable and expert-informed fuzzy control system—compliant with IEEE Std 1855-2016—can be effectively deployed to optimize energy usage in smart buildings. The scientific contribution lies in demonstrating the applicability of a modular framework capable of real-time control of HVAC, lighting, and ventilation systems using transparent and adaptable logic. While the fuzzy rules have been collaboratively designed with domain experts, they were conceived to reflect occupant needs and common usage scenarios, thus supporting both energy efficiency and indoor comfort. Furthermore, this framework establishes a basis for future extensions that incorporate user-specific preferences and direct feedback, strengthening the connection between interpretability and occupant-centered control.
The remainder of this paper is structured as follows. Section 2 presents an overview of related work, including existing research on IoT-based energy management, AI and fuzzy logic applications in smart buildings, and relevant control strategies for lighting, ventilation, and occupancy-based energy optimization. Section 3 introduces key preliminary concepts, providing a foundation for understanding fuzzy logic, Fuzzy Rule-Based Systems (FRBSs), the IEEE Std 1855-2016, and the main features of the JFML library. Section 4 details the architecture of the proposed system, describing the integration of sensors, actuators, and the fuzzy inference model for energy optimization. Section 5 presents a case study evaluating the framework in a real-world environment, demonstrating its effectiveness in adaptive energy management. Finally, Section 6 concludes the paper, summarizing key findings and outlining future research directions.

2. State of the Art

The increasing demand for energy efficiency in buildings has led to extensive research on IoT-based energy management and fuzzy logic applications in smart buildings, mainly focusing on advanced control strategies for lighting, ventilation, and occupancy-based energy optimization, among others. This section provides an overview of existing approaches, their limitations, and the research gaps that motivate this work.

2.1. IoT-Based Energy Management in Smart Buildings

IoT-based energy management systems in buildings rely on a network of distributed sensors to monitor environmental parameters such as temperature, humidity, air quality, occupancy, and energy usage. These sensors provide real-time data that is processed through edge computing or cloud-based platforms to optimize the operation of HVAC systems, lighting, and other energy-consuming devices [24]. For instance, smart HVAC systems utilize IoT-enabled CO2 and humidity sensors to implement DCV, dynamically adjusting airflow based on occupancy and indoor air quality metrics, which leads to significant reductions in energy consumption [10,25]. Similarly, intelligent lighting systems integrate dimmable LED fixtures with occupancy sensors and daylight harvesting strategies, achieving energy savings of 38% to 47% compared to traditional lighting solutions [11]. Moreover, IoT supports hybrid occupancy detection models that combine PIR sensors, ultrasonic sensors, and computer vision techniques to enhance the accuracy of occupancy detection, thereby enabling more effective energy control strategies [26]. Predictive maintenance, another major application, helps reduce operational costs and extend equipment lifespan by identifying inefficiencies and failures before they occur [13].
Despite these advancements, IoT-based solutions for energy management face several challenges [15]. A key issue is the lack of standardization and interoperability among heterogeneous IoT platforms, which complicates integration with existing building automation systems [14]. In addition, security and privacy concerns associated with IoT data transmission pose significant risks, requiring the implementation of robust encryption and authentication mechanisms [27,28]. Another critical challenge is the need for efficient processing of the large volumes of data generated by IoT sensors in real time, which demands advanced computational paradigms such as edge/fog computing and federated learning [29,30]. Furthermore, ensuring that sensors and embedded systems operate with low power consumption remains essential for sustainable and long-term deployment in smart building environments.

2.2. AI and Fuzzy Logic Applications in Smart Buildings

Artificial intelligence (AI) has emerged as a transformative paradigm in the design and deployment of intelligent building systems, enabling context-aware, data-driven energy optimization strategies. Numerous studies have applied machine learning (ML) and deep learning (DL) techniques for occupancy prediction, HVAC optimization, and fault detection. For instance, reinforcement learning has been widely explored to dynamically manage HVAC operations while maintaining thermal comfort and minimizing energy use [31]. Similarly, convolutional, recurrent neural networks and Large Language Models (LLMs) have been used to forecast indoor environmental conditions and user behavior, contributing to anticipatory control strategies in smart buildings [32,33]. AI-based anomaly detection has also proven effective in identifying irregular consumption patterns, system faults, and sensor failures [34].
Despite the remarkable advances of AI in smart buildings, these models often operate as opaque black boxes, raising concerns about transparency, interpretability, and user trust [35]. In this context, explainable AI (XAI) techniques and hybrid approaches are being investigated to improve the traceability of control decisions. Fuzzy logic offers a compelling alternative or complement to purely data-driven methods by embedding expert knowledge into interpretable rule-based systems. The integration of fuzzy inference systems (FISs) with AI techniques is gaining attention as a powerful framework for handling uncertainty in decision-making processes, making it a suitable approach for optimizing energy efficiency in smart buildings [17,19,20].
One of the primary applications of fuzzy logic in smart buildings is HVAC control, where fuzzy controllers adjust HVAC settings based on factors such as occupancy levels, indoor temperature, and external weather conditions. These systems have demonstrated energy savings of up to 30% while maintaining occupant comfort [36,37]. Similarly, fuzzy logic-based lighting systems dynamically adjust brightness based on occupancy detection and daylight availability, leading to savings of approximately 38–47% [38].
Fuzzy logic has also been integrated into adaptive ventilation control, where fuzzy controllers analyze indoor air quality parameters such as CO2, humidity, and volatile organic compounds (VOCs) to optimize airflow dynamically [39]. This approach enhances DCV by ensuring fresh air supply while minimizing HVAC energy consumption. Additionally, hybrid fuzzy–ML models are being developed to improve occupancy detection and predictive control, combining fuzzy rule-based reasoning with machine learning algorithms [40].
Another emerging area is the integration of fuzzy logic into security and fire monitoring systems. Fuzzy-based fire detection models analyze temperature, smoke, and gas concentration levels to improve response times and reduce false alarms [41]. Additionally, fuzzy logic has been employed in noise management strategies, enhancing soundproofing and active noise control in buildings [42].
Despite its advantages, fuzzy logic applications in smart buildings face limitations [43,44,45]. Many implementations require extensive manual rule definition, making scalability challenging. Moreover, the computational complexity of large-scale FISs limits real-time processing on low-power IoT devices. To address these challenges, ongoing research focuses on hybrid approaches combining fuzzy logic with machine learning and edge computing to enhance adaptability and computational efficiency [46,47].

2.3. Research Gaps and Motivation for This Work

While significant progress has been made in IoT-based energy management, fuzzy logic applications, and advanced control strategies, several challenges remain unaddressed. Existing IoT solutions often suffer from a lack of interoperability and standardization, which limits their scalability and integration with heterogeneous building management infrastructures [14]. Moreover, although fuzzy logic controllers provide adaptive and robust responses in dynamic environments, their deployment is frequently constrained by the computational complexity associated with large rule bases and the need for efficient execution on resource-constrained devices [45].
Another major challenge is the difficulty in constructing fuzzy rule-based systems (FRBSs) that are both effective and interpretable. Current implementations frequently lack transparency, making it difficult for domain experts or building managers to understand, validate, or adapt the underlying reasoning processes. To address this, the IEEE Std 1855-2016 proposes a standardized and interoperable framework for representing fuzzy logic systems using the Fuzzy Markup Language (FML), enhancing both system transparency and long-term maintainability.
In addition, there is a noticeable absence of lightweight, interpretable control strategies that can be deployed directly on embedded devices. Many existing approaches prioritize centralized, data-intensive models that require cloud processing or complex infrastructure, overlooking the need for fast, explainable, and edge-deployable systems that can support comfort-centric decisions in real time.
This work proposes a human-centered approach to the development of interpretable fuzzy controllers for energy management in smart buildings. Specifically, we leverage the capabilities of the JFML-IoT library—which provides native support for IEEE Std 1855-compliant FML—to implement a modular control system for lighting, ventilation, and HVAC subsystems. The fuzzy rules are defined in collaboration with a panel of domain experts, ensuring that the embedded knowledge reflects real-world reasoning about comfort, air quality, and energy efficiency. This process results in a transparent and extensible FRBS that can be maintained, audited, and adapted as requirements evolve.
By focusing on interpretability, interoperability, and embedded deployment, the proposed approach bridges the gap between expert reasoning and autonomous control, supporting real-time energy management that is both efficient and understandable.

3. Preliminaries

To facilitate the understanding of this work, this section provides an overview of key concepts related to fuzzy logic-based control systems. Specifically, we describe the IEEE std 1855-2016 and the FML, the structure and main features of the JFML library, and the design principles of JFML-IoT. These elements form the foundation for the proposed framework of JFML-IoT to support embedded devices and enable interpretable fuzzy control in constrained IoT environments.

3.1. IEEE Std 1855-2016 and Fuzzy Markup Language

The IEEE std 1855-2016 defines a common framework for the development and deployment of fuzzy systems [21]. It was introduced to provide interoperability, scalability, and standardization in fuzzy logic applications across different domains, ensuring consistency in their implementation. The core element of this standard is the FML, an XML-based representation designed to describe FISs independently of the underlying hardware or software.
FML enables the structured definition of fuzzy logic components, including the following:
  • Linguistic variables and terms: Representations of imprecise concepts such as “low temperature” or “high humidity”.
  • Fuzzy rules: Causal relations between linguistic variables and terms inspired by human reasoning.
  • Inference mechanisms: Methods for aggregating fuzzy rules to derive conclusions.
  • Defuzzification methods: Techniques to transform fuzzy outputs into crisp values for real-world applications.
This standard provides a structured methodology to ensure interoperability across different fuzzy logic implementations. However, it does not define specific software implementations, leading to the development of libraries such as JFML to support its adoption.

3.2. JFML: Java Fuzzy Markup Language Library

JFML is an open-source Java library that provides a reference implementation of the IEEE std 1855-2016 [22] (https://www.jfml.es/, accessed on 16 July 2025). It offers a robust framework for defining, managing, and executing fuzzy logic-based systems using FML. The modular design of JFML consists of several core components:
  • FML Core Module: Implements the fundamental functionalities of FML, enabling the parsing and generation of XML-based fuzzy systems.
  • Inference Engine: Provides mechanisms for executing fuzzy inference, supporting different inference methods such as Mamdani, Tsukamoto, Takagi-Sugeno-Kang (TSK), and AnYa.
  • Interoperability Layer: Facilitates integration with other fuzzy logic tools and formats such as PMML and Matlab Fuzzy Logic Toolbox v2.9.
  • Optimization Tools: Supports machine learning techniques and evolutionary algorithms for optimizing fuzzy models.
JFML has been widely adopted in diverse applications, including industrial automation, healthcare, and intelligent control systems. However, its application in IoT environments remains constrained due to its computational complexity and lack of native support for resource-limited embedded devices.

3.3. JFML-IoT: Design and Features

JFML-IoT is a lightweight extension of the JFML library, specifically developed to enable the execution of fuzzy inference processes in constrained IoT environments [23]   (https://github.com/JfMRes/JFML_IoT, accessed on 16 July 2025). It provides a modular and scalable architecture that supports the implementation of FRBSs compliant with the IEEE Std 1855-2016, making it particularly suitable for real-time control tasks in smart building applications.
The design philosophy of JFML-IoT focuses on bridging the gap between high-level fuzzy modeling and the low-level execution requirements of embedded systems. Its main features include
  • Optimized execution for edge computing: The library is adapted for microcontrollers and embedded platforms, offering reduced memory usage and execution time without sacrificing inference accuracy.
  • Modular and extensible architecture: It provides abstract classes for modeling sensors, actuators, communication modules, and embedded devices, facilitating the rapid development of custom hardware/software configurations.
  • Native support for IEEE 1855-compliant FML: FRBSs can be loaded, parsed, and executed from XML files using the FML, ensuring both interoperability and human interpretability.
  • Integration with standard communication protocols: JFML-IoT supports lightweight messaging protocols such as MQTT, allowing sensors and actuators to communicate through publish–subscribe patterns commonly used in building automation. It also supports data integrity through MQTT’s built-in QoS levels and timestamped message delivery, ensuring reliable and ordered transmission in constrained environments.
  • Separation of concerns: The architecture cleanly decouples the fuzzy logic engine from the data acquisition and actuation layers, improving system modularity and maintainability.
JFML-IoT serves as the computational backbone for the fuzzy inference framework proposed in this work. By leveraging its existing capabilities, we demonstrate how an interpretable, adaptable, and efficient fuzzy controller can be implemented and validated in a smart building scenario, without requiring further extensions to the library.

4. JFML-IoT-Based Energy Management System

This section presents the proposed energy management system based on the JFML-IoT framework, designed to enable intelligent control of building subsystems such as lighting, ventilation, and HVAC through fuzzy inference mechanisms. The system builds on the modular and interoperable features of JFML-IoT to create a robust, scalable, and interpretable control architecture that operates efficiently in resource-constrained environments.
To provide a comprehensive view of the system design and functionality, the section is structured into three key subsections. First, Section 4.1 outlines the general architecture of the solution, organized into four layers (Perception, Communication, Processing, and Application) to ensure modularity and extensibility. Second, Section 4.2 describes the dynamic behavior of the system by illustrating the sequence of actions performed during a typical control cycle. Finally, Section 4.3 highlights representative hardware devices supported by the current version of JFML-IoT and relevant to the energy management use case addressed in this work.

4.1. Layered System Architecture

The proposed energy management system follows a modular, multi-layered architecture that promotes scalability, interoperability, and adaptability to a wide range of smart building scenarios. The system leverages the capabilities of the JFML-IoT library to implement fuzzy inference in embedded devices, integrating heterogeneous sensor data and control logic efficiently.
  • Perception Layer: This layer comprises environmental sensing and actuation components. It includes Arduino-compatible sensors for temperature, humidity, luminance, CO2, and occupancy detection (e.g., DHT22, BH1750, MH-Z19, PIR modules), as well as actuators for HVAC and lighting control. These components capture real-time physical data and implement local actions as dictated by the FIS.
  • Communication Layer: Responsible for transmitting sensed data and control commands using the MQTT protocol, which ensures lightweight and reliable communication between devices. Each sensor node acts as an MQTT publisher, while actuator nodes and the processing unit act as subscribers, enabling real-time data flow. To ensure accurate and robust communication, this layer employs MQTT with Quality of Service (QoS) levels 1 or 2 depending on the criticality of the data. Additionally, data packets are protected using cyclic redundancy checks (CRCs) or checksums at the device level, and each message is timestamped and logged for traceability and fault detection.
  • Processing Layer: This layer hosts the JFML-IoT inference engine, capable of executing fuzzy logic rules in compliance with the IEEE Std 1855-2016. It processes incoming sensor data, evaluates the fuzzy rule base, and determines the appropriate control actions. The processing unit can be deployed on embedded microcontrollers with WiFi support (e.g., ESP32) or on a Raspberry Pi running a lightweight Java Virtual Machine.
  • Application Layer: Provides interfaces for system configuration, data visualization, and interaction with building management systems (BMSs). This layer may include dashboards, alert systems, or integration with external analytics tools to monitor energy consumption and comfort metrics in real-time.
To facilitate a clearer understanding of the system’s modular structure, Figure 1 provides a visual overview of the layered architecture proposed in this work. Each layer is decoupled in terms of functionality and responsibility, ensuring scalability and reusability across different deployment scenarios. The perception layer encompasses all sensing and actuation hardware, while the communication layer ensures reliable data exchange via MQTT using a publish/subscribe model. The processing layer hosts the fuzzy inference engine, and the application layer interfaces with users and external systems through REST APIs or WebSockets.
This architecture promotes a clear separation of concerns—between sensing, communication, processing, and user interaction—which is fundamental to the flexibility and extensibility of the JFML-IoT framework. Recent studies have emphasized the importance of modular communication layers and standardized protocols in smart building infrastructures, particularly within Digital Twin and integrated control paradigms [48,49]. These insights reinforce our architectural design and highlight the role of lightweight communication mechanisms in building scalable, interoperable, and energy-aware systems. While the current implementation relies exclusively on Wi-Fi for communication, the architecture is protocol-agnostic and can be extended to other wireless or wired technologies—such as ZigBee, LoRa, or Ethernet—depending on deployment constraints and energy efficiency requirements. Furthermore, although advanced security features are not yet included, the communication layer supports secure protocols such as MQTT over TLS, providing a solid foundation for future improvements in encryption, authentication, and GDPR-compliant data protection.

4.2. System Operation

The proposed JFML-IoT-Based Energy Management System operates through a sequence of coordinated steps that involve data acquisition, communication, inference, and actuation. The system is designed to respond dynamically to varying environmental conditions using a fuzzy logic controller executed on embedded devices. The operational workflow is as follows:
  • Data Acquisition: Arduino-compatible sensors (e.g., DHT22 for temperature and humidity, BH1750 for luminance, MH-Z19 for CO2, and PIR sensors for occupancy) periodically collect environmental data. These devices are configured to sample data at intervals optimized for energy management, typically ranging from 30 s to 5 min, depending on the variable being measured. For instance, occupancy and lighting conditions are sampled every 30 s, while temperature, humidity, and CO2 levels are sampled every 2 min, balancing responsiveness and resource efficiency.
  • Data Transmission: Each sensor node publishes its readings to dedicated MQTT topics, using lightweight JSON messages. These topics follow a structured naming convention (e.g., building/room1/temperature, building/room2/occupancy) to ensure scalability and integration with external platforms.
  • Fuzzy Inference Execution: The MQTT broker forwards incoming sensor data to the processing unit, which parses the values and updates the input variables of the fuzzy rule-based system (FRBS). The inference engine, implemented using the JFML-IoT library, evaluates the current rule base—defined in FML format according to IEEE Std 1855-2016—and calculates output control values for lighting, ventilation, and HVAC systems.
  • Actuation: The resulting output values are published to MQTT control topics (e.g., building/room1/lighting/command). Actuator devices subscribed to these topics (e.g., relay switches, dimmable drivers, or IR-based controllers) interpret the fuzzy output and execute the required actions. For example, the lighting system may dim to a medium level if luminance is moderate and occupancy is detected.
  • Monitoring and Feedback: Control decisions and sensor updates are logged and can be visualized via an application-layer dashboard. This enables facility managers to monitor system behavior in real time and review historical patterns for further optimization.
This distributed operational logic ensures low-latency, local decision-making, while maintaining global visibility and configurability through standard IoT communication protocols. The integration of JFML-IoT provides a transparent and interpretable control mechanism, particularly suitable for energy-sensitive environments.

4.3. Implemented Sensors and Actuators

The JFML-IoT library includes a wide and extensible set of sensors and actuators designed to support the development of fuzzy logic-based IoT applications. Its modular architecture allows the integration of a broad variety of devices, enabling seamless connectivity with low-power embedded systems and real-time communication through protocols such as MQTT.
Although JFML-IoT provides implementations for a large number of devices, this section highlights a representative selection of sensors and actuators particularly suitable for the energy management scenario addressed in this paper. These devices cover essential variables such as temperature, humidity, CO2 concentration, ambient light, and human presence, as well as control interfaces for lighting, ventilation, and HVAC systems.
The precision and measurement error of the selected sensors were considered during the system design, based on the specifications provided in their technical data sheets. The DHT22 sensors for temperature and humidity offer a typical accuracy of ±0.5 °C and ±2% RH, respectively. The BH1750 light sensors provide an illuminance resolution of 1 lux with an accuracy of ±20%. The MH-Z19 CO2 sensor has a stated accuracy of ±50 ppm or ±5%, whichever is greater. The HC-SR501 PIR occupancy sensors are binary devices with a detection range of up to 6 m, but no quantified precision is defined due to their nature. These specifications are aligned with the tolerances commonly acceptable for indoor environmental monitoring and have been considered in the fuzzy rule design to absorb small fluctuations and ensure robust control.
These components provide direct integration with the fuzzy inference engine by transforming raw data into fuzzy linguistic variables and applying actuator decisions in response to rule-based outputs. Each device is encapsulated within a reusable class that adheres to the abstract interfaces defined in the library, ensuring consistency and maintainability across diverse implementations.
It is important to note that the list presented in Table 1 is not exhaustive. The JFML-IoT library supports many more sensor and actuator models beyond those shown here, and it has been designed to simplify the addition of new devices as needed. This extensibility is particularly valuable in smart building environments where sensing and actuation requirements evolve with the scale and specificity of the deployment.
These devices play an important role in validating the proposed fuzzy energy management system, serving as representative hardware for demonstrating the framework’s interoperability and modularity. Rather than focusing solely on hardware capabilities, the emphasis lies on how seamlessly these components can be integrated within the JFML-IoT ecosystem to support real-time, interpretable, and adaptable energy control strategies in indoor environments.

5. Case Study: Experimental Validation in a Representative Smart Building Scenario

This section describes the experimental validation of the proposed energy management system built on top of the JFML-IoT framework. The aim is not to evaluate the framework itself, but to validate the performance and responsiveness of a real fuzzy control solution deployed in a realistic but controlled smart building environment.
To this end, we selected a representative office room and instrumented it with real sensors and actuators to simulate common building dynamics, including variable occupancy, lighting, and indoor air conditions. This environment enables repeatable experiments and clear evaluation criteria without the complexity of full-building variability. Importantly, this setup prioritizes occupant comfort while ensuring energy-efficient responses, consistent with the expert-driven philosophy described in the introduction.
The primary objectives of this case study are threefold: (i) to confirm the technical feasibility of deploying fuzzy logic controllers on embedded systems using the existing JFML-IoT library; (ii) to demonstrate the scalability and modularity of the system through the integration of multiple sensors and actuators distributed throughout the monitored space; and (iii) to assess whether the system’s behavior aligns with the expectations of domain experts in terms of occupant comfort and energy efficiency. By utilizing the FML, the fuzzy control logic is defined in a transparent and interpretable format, ensuring reusability and consistency with expert-defined knowledge.
To illustrate these capabilities, we begin by describing the physical deployment scenario, including the number and distribution of sensors and actuators within the environment (Section 5.1). We then present the technical implementation of these components within the JFML-IoT framework, detailing how input and output variables are instantiated and mapped to the corresponding hardware interfaces (Section 5.4). Next, we describe the design of the fuzzy rule-based system (FRBS) through collaboration with a panel of domain experts, covering the definition of linguistic variables, terms, and fuzzy rules (Section 5.2). This is followed by the encoding of the FRBS in FML, in accordance with the IEEE Std 1855-2016 specification (Section 5.3). Several test scenarios are then evaluated to assess the system’s behavior under diverse environmental conditions and to validate its control effectiveness (Section 5.5). Finally, Section 5.6 provides a summary of the overall system behavior across all scenarios and discusses its runtime performance on embedded platforms, with insights into inference latency and resource usage.

5.1. Scenario Description and Operational Flow

The case study is conducted within a real-world indoor environment that serves as a representative deployment scenario for evaluating the proposed energy management system. The selected environment is a medium-sized office room of approximately 30 square meters, located within an academic building. This space is regularly used by staff and students, exhibiting variable occupancy patterns and dynamic environmental conditions throughout the day. This room serves as a representative testbed to evaluate the performance and scalability of the energy management framework.
Figure 2 illustrates both the spatial arrangement and the operational flow of the system components. The room is divided into two sensing zones (Zone 1 and Zone 2), each equipped with an ESP32-based embedded node connected to temperature and humidity sensors (DHT22), illuminance sensors (BH1750), and passive infrared (PIR) detectors (HC-SR501) for occupancy monitoring. A centrally located CO2 sensor (MH-Z19), also managed by an ESP32 node, ensures global air quality tracking. Actuators—including dimmable LED drivers, a ventilation fan, and an HVAC interface—are controlled via a dedicated ESP32 module. Two Raspberry Pi units are used: one to host the MQTT broker and another to execute the fuzzy inference engine (JFML-IoT).
The system operation unfolds in five sequential stages:
  • Sensor Data Acquisition and Publication: Each ESP32 node continuously collects environmental data and publishes it to a local MQTT broker (step 1).
  • Message Handling: The MQTT broker, hosted on a Raspberry Pi (step 2), receives and distributes messages in real time to relevant subscribers.
  • Fuzzy Inference: A second Raspberry Pi (step 3) runs the JFML-IoT engine, which subscribes to the sensor data, executes the fuzzy rule-based inference using the FML configuration, and determines the appropriate control actions.
  • Actuation: Control commands are transmitted via MQTT to the actuator node (step 4), which governs dimmable LED lights, the ventilation fan, and HVAC outputs.
This modular and asynchronous architecture enables autonomous, real-time adaptation to environmental changes while preserving system flexibility and interoperability.
Table 2 summarizes the input and output variables used in the fuzzy inference process, along with the associated sensor or actuator for each. These variables are directly mapped to physical devices deployed in the room, providing interpretable links between environmental conditions and system decisions. Their configuration also supports human interpretability and traceability of decisions through FML-compliant rule bases.

5.2. Design of the Fuzzy Rule-Based System

The design of the FRBS in this study was guided by a structured expert knowledge elicitation process, aiming to capture domain-specific control strategies for lighting, ventilation, and HVAC management in dynamic indoor environments. The rule base was deliberately constructed from the perspective of qualified domain experts—such as HVAC engineers and building automation specialists—rather than end-users. This choice aligns with the system’s focus on technical subsystems requiring operational reliability, safety compliance, and context-aware reasoning, which are best addressed through expert-driven design.
The methodology followed a multi-stage protocol:
  • Domain Expert Panel: A panel of five domain experts was convened, including two senior HVAC engineers, one building automation specialist, and two academic researchers in fuzzy systems. All experts had over 10 years of experience in their respective domains.
  • Variable Selection and Definition: Experts reviewed the list of sensor and actuator variables (Section 5.1) and jointly selected the subset most relevant for energy optimization and comfort regulation. Each variable was associated with predefined linguistic labels (e.g., Low, Medium, High) standardized using triangular/trapezoidal membership functions.
  • Initial Rule Drafting: An initial set of 40 fuzzy rules was proposed by the system developers based on commonly accepted HVAC and lighting strategies. These rules followed an IF–THEN structure with 2–3 antecedents and 1 consequent.
  • Expert Evaluation and Feedback Quantification: Each expert independently reviewed the proposed rules using a standardized feedback form. For each rule, the expert rated the following:
    • Clarity (Scale: 1–5).
    • Relevance (Scale: 1–5).
    • Redundancy (Yes/No).
    • Suggested Edits (Free-Text Comments).
    These responses were consolidated into a matrix representing expert–rule evaluations. Rules scoring below a threshold average (e.g., relevance < 3.5 or clarity < 3) were flagged for revision.
  • Consensus Building: Discrepancies were resolved through moderated online sessions following a Delphi-inspired process. Experts discussed flagged rules and iteratively refined their structure. In cases of persistent disagreement (three instances), a weighted voting system was used to reach a final decision.
  • AI-Assisted Rule Review: To complement expert feedback, a generative AI tool (OpenAI GPT-4) was used to
    • Detect syntactic redundancy and inconsistent phrasing;
    • Suggest rule clustering or merging based on similarity;
    • Provide alternative formulations for ambiguous rules.
    These suggestions were reviewed by experts but not directly adopted without their approval. AI served primarily as a support mechanism to accelerate early iterations.
  • Inter-Expert Agreement Analysis: To quantify consensus, a rule agreement matrix was computed based on binary matches (agree/disagree) for each rule. The average inter-rater agreement (Fleiss’ κ ) was 0.78, indicating substantial agreement. A summary of agreement levels for a representative subset of rules is shown in Table 3.
  • FML Encoding and Validation: The final set of 36 approved rules was encoded using the IEEE Std 1855-2016 Fuzzy Markup Language (FML) and validated syntactically and semantically with the JFML-IoT parser. Domain experts conducted a final walk-through validation session to ensure semantic alignment with their expectations.
This extended methodology ensures a high degree of rigor, transparency, and traceability in the knowledge engineering process. The combination of structured expert review, consensus protocols, and AI-assisted refinement supports both interpretability and reproducibility in the design of the fuzzy inference engine.
Figure 3 illustrates the triangular membership functions defined for each variable, while Table 4 presents the final set of fuzzy rules approved by the expert panel and employed in this case study.

5.3. FML-Based Representation of the Fuzzy Rule-Based System

To ensure standardization, portability, and interoperability across heterogeneous platforms, the FRBS defined in the previous subsection is encoded using the FML, as specified in the IEEE std 1855-2016. FML is an XML-based language that provides a structured and formalized representation of fuzzy systems, including their variables, membership functions, and rule bases.
The use of FML enables seamless integration with the JFML-IoT framework and ensures that the designed fuzzy logic controllers can be interpreted, validated, and executed by compliant software components across embedded and distributed systems.
The structure of the FML document used in this case study consists of three main blocks:
  • Knowledge Base: It defines all model input and output variables, specifying for each the linguistic terms and the corresponding membership functions as determined by the expert panel (see Figure 3). Each variable corresponds to a physical parameter described in Section 5.1.
  • Rule Base: It contains the set of fuzzy IF-THEN rules validated by the expert panel and summarized in Table 4. Each rule references linguistic terms from the knowledge base.
  • FIS Configuration: It specifies the type of inference engine (e.g., Mamdani), aggregation, and defuzzification methods used.
An example excerpt of the FML encoding for the variable Room Temperature 1 is shown below (Listing 1):
Listing 1. FML definition for input variable “Room Temperature 1”.
<KnowledgeBase name="EnergyKB">
    <FuzzyVariable name="RoomTemperature1" domainLeft="0" domainRight="40"
             type="input">
         <FuzzyTerm name="Low">
             <TriangularShape param1="0" param2="0" param3="20"/>
         </FuzzyTerm>
         <FuzzyTerm name="Medium">
             <TriangularShape param1="15" param2="22.5" param3="30"/>
         </FuzzyTerm>
         <FuzzyTerm name="High">
             <TriangularShape param1="25" param2="40" param3="40"/>
         </FuzzyTerm>
    </FuzzyVariable>
</KnowledgeBase>
A corresponding rule using this variable and referencing the fuzzy output for HVAC control might look like (Listing 2):
Listing 2. FML encoding of a fuzzy rule.
<RuleBase name="EnergyRuleBase" activationMethod="MIN" andMethod="MIN"
                   orMethod="MAX"
                   ruleConnectionMethod="AND">
    <Rule name="R1" connector="and" weight="1.0" operator="MIN">
        <Antecedent>
            <Clause>
                <Variable>RoomTemperature1</Variable>
                <Term>High</Term>
            </Clause>
            <Clause>
                <Variable>Occupancy1</Variable>
                <Term>True</Term>
            </Clause>
        </Antecedent>
        <Consequent>
            <Clause>
                <Variable>HVACControl</Variable>
                <Term>CoolingHigh</Term>
            </Clause>
        </Consequent>
    </Rule>
</RuleBase>
All variables defined in Table 2 are encoded in the knowledge base with appropriate linguistic terms and membership functions, and all rules listed in Table 4 are translated into structured FML format. The model employs the minimum and maximum operators for the logical and and or operations, respectively, and utilizes the center of gravity method as the defuzzification operator to perform fuzzy inference [19].
This representation enables full compatibility with the JFML-IoT inference engine, ensuring that the proposed system can operate across several devices while maintaining transparency and compliance with the IEEE std 1855-2016. The complete FML file used in this case study is available for download from the official JFML website   (https://www.jfml.es/, accessed on 16 July 2025) and the JFML-IoT GitHub repository (https://github.com/JfMRes/JFML_IoT, accessed on 16 July 2025). These resources also provide additional illustrative examples, video demonstrations, and documentation to facilitate reproducibility and adoption by the research and development community.

5.4. Implementation of the JFML-IoT-Based Energy Management System

This section presents the implementation details of the proposed energy management system using the JFML-IoT framework. The implementation illustrates how to instantiate and configure the components required to deploy the control system in a real-world scenario. It includes the creation of sensor and actuator objects, the association of devices with embedded systems (e.g., RasperryPi, Arduino or ESP32), and the configuration of a central inference node executing the fuzzy logic controller encoded in FML.

5.4.1. Sensor and Actuator Object Instantiation

In the current version of JFML-IoT, all sensors and actuators are implemented as subclasses of the abstract classes Sensor and Actuator, respectively. These classes are available in the official GitHub repository (https://github.com/JfMRes/JFML_IoT, accessed on 16 July 2025) and allow flexible instantiation for various IoT platforms using MQTT as the communication protocol.
Each sensor or actuator is instantiated with its identifier, MQTT topic, and relevant configuration parameters. For example, see (Listing 3):
Listing 3. Instantiation of sensors and actuators.
TemperatureSensor temperature1 = new TemperatureSensor(
                         "Temperature1", "mqtt/zone1/temp");
TemperatureSensor temperature2 = new TemperatureSensor(
                         "Temperature2", "mqtt/zone2/temp");
HumiditySensor humidity1 = new HumiditySensor(
                         "Humidity1", "mqtt/zone1/humidity");
HumiditySensor humidity2 = new HumiditySensor(
                         "Humidity2", "mqtt/zone2/humidity");
IlluminanceSensor illuminance1 = new IlluminanceSensor(
                         "Illuminance1", "mqtt/zone1/lux");
IlluminanceSensor illuminance2 = new IlluminanceSensor(
                         "Illuminance2", "mqtt/zone2/lux");
OccupancySensor occupancy1 = new OccupancySensor(
                         "Occupancy1", "mqtt/zone1/occupancy");
OccupancySensor occupancy2 = new OccupancySensor(
                         "Occupancy2", "mqtt/zone2/occupancy");
CO2Sensor co2 = new CO2Sensor("CO2Level", "mqtt/co2");
 
HVACControlActuator hvac = new HVACControlActuator(
                         "HVACControl", "mqtt/hvac/control");
VentilationControlActuator ventilation = new VentilationControlActuator(
                         "VentilationControl", "mqtt/ventilation/control");
LightingControlActuator light1 = new LightingControlActuator(
                         "LightingControl1", "mqtt/zone1/light/set");
LightingControlActuator light2 = new LightingControlActuator(
                         "LightingControl2", "mqtt/zone2/light/set");

5.4.2. Association of Devices to Embedded Systems

Each embedded system (e.g., ESP32, Raspberry Pi) is defined as an instance of the class EmbeddedSystem, grouping the sensors and actuators deployed in a specific room or zone (Listing 4):
Listing 4. Assignment of devices to embedded systems.
EmbeddedSystem zone1 = new EmbeddedSystemESP32("Zone_1");
zone1.addSensor(temperature1);
zone1.addSensor(humidity1);
zone1.addSensor(illuminance1);
zone1.addSensor(occupancy1);
zone1.addActuator(light1);
 
EmbeddedSystem zone2 = new EmbeddedSystemESP32("Zone_2");
zone2.addSensor(temperature2);
zone2.addSensor(humidity2);
zone2.addSensor(illuminance2);
zone2.addSensor(occupancy2);
zone2.addActuator(light2);
 
EmbeddedSystem zoneCentral = new EmbeddedSystemESP32("Zone_Central");
zoneCentral.addSensor(co2);
 
EmbeddedSystem zoneAir = new EmbeddedSystemESP32("Zone_Air");
zoneAir.addActuator(ventilation);
zoneAir.addActuator(hvac);

5.4.3. Definition of Communication Node with MQTT

The embedded systems communicate via MQTT with a central coordinator, which subscribes to sensor topics and publishes commands to actuators. A communication node is defined as follows (Listing 5):
Listing 5. Definition of the central communication node.
EmbeddedSystem nodeMQTT = new EmbeddedSystemRPi("nodeMQTT");
nodeMQTT.addEmbeddedSystem(zone1);
nodeMQTT.addEmbeddedSystem(zone2);
nodeMQTT.addEmbeddedSystem(zoneCentral);
nodeMQTT.addEmbeddedSystem(zoneAir);
 
MQTT mqtt = new MQTT("MQTTNode","tcp://ip_address:1883");
nodeMQTT.addMQTT(mqtt);

5.4.4. Loading the FML File and Executing Inference

The fuzzy controller, previously defined in FML, is parsed and linked to the inference engine hosted in a central node. The node periodically collects sensor data and executes the inference process (Listing 6):
Listing 6. Loading and binding FML controller to the system.
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("nodeJFML");
nodeJFML.addJFMLIoTNode(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.

5.5. 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 CO2 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 CO2 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 CO2. Table 6 details the input values.
Table 7 presents the fuzzy rules triggered during inference, along with their descriptions and activation degrees. These rules reflect a combination of environmental and occupancy factors that prompt specific system responses.
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 CO2 concentration activates rule R16, which adjusts both the ventilation and HVAC systems accordingly. The final output represents a combined and coherent control response aligned with the environmental conditions present in the room.
Overall, the fuzzy inference mechanism demonstrates robustness, consistency with expert-defined logic, and adaptability in complex, multi-input scenarios. The system successfully combines concurrent environmental cues and yields interpretable control signals, reinforcing its suitability for real-world deployment in smart building environments.

5.5.2. Scenario S2: Low Temperature and No Occupancy

This scenario explores a low-energy demand situation where indoor temperature is low, no occupants are present in the room, and both CO2 and illuminance levels remain within moderate thresholds. These conditions are typical of a non-occupied office during early morning hours or breaks. Table 9 lists the specific sensor readings used in this simulation.
Several fuzzy rules were triggered in this scenario, reflecting the system’s conservative behavior in low-demand contexts. Table 10 summarizes the active rules, while Table 11 presents the corresponding inferred control values. Since the room is unoccupied, rule R25 is triggered to deactivate all systems, thereby minimizing energy consumption. However, slightly elevated CO2 levels are detected, which leads to the activation of rules R17 and R26. These rules introduce a minimal level of ventilation to prevent a further increase in CO2 concentration. As a result, the output values for all control systems remain close to zero, except for the ventilation system, which is moderately activated in accordance with the environmental conditions.
The fuzzy reasoning system demonstrates appropriate conservative behavior under minimal energy demand, minimizing unnecessary activations and aligning well with human expert expectations in unoccupied and thermally neutral scenarios.

5.5.3. Scenario S3: Medium CO2 and Occupancy

This scenario evaluates the fuzzy controller’s behavior in a situation with moderate indoor temperature, high occupancy, and elevated CO2 concentration. The selected sensor values simulate a typical working environment with two occupied zones and moderate illuminance. Table 12 details the input values used.
The fuzzy inference results are summarized in Table 13, while Table 14 shows the inferred control values. As observed in Scenario 1, the occupancy of the space triggers rule R24, which serves to initialize the environmental control systems at a baseline level of thermal and visual comfort. Subsequently, the detection of medium temperature levels in both monitored zones leads to the activation of rules R02 and R05, resulting in a reduction in the HVAC system’s output to conserve energy while maintaining comfort. Additionally, the illuminance levels are assessed to be slightly below the medium threshold, which prompts the system to activate lighting control at the Dim setting, as per the conditions defined in rules R08, R11, and reinforced by R24. Lastly, medium levels of CO2 are identified, which triggers rule R16. This rule adjusts both the ventilation and HVAC systems to ensure proper air quality by reducing CO2 concentration within the space.
In summary, Scenario S3 confirms the ability of the fuzzy controller to
  • Integrate multiple rule contributions under medium environmental loads;
  • Prioritize ventilation in response to air quality degradation;
  • Maintain moderate control actions that reflect realistic operating expectations.

5.5.4. Scenario S4: Low Light and Occupancy

This scenario analyzes the system’s response to a situation with low ambient light, full occupancy in both zones, and moderate environmental conditions. This configuration is representative of a late afternoon or cloudy indoor environment with adequate air quality but insufficient daylight. Table 15 details the input values.
The fuzzy system inference activated key rules, including R2, R5, R12, R17, and R24. These rules are consistent with the low-light and full-occupancy context. Table 16 lists the contributing rules and their degrees of activation, while Table 17 summarizes the inferred output values.
Given the presence of occupants, rule R24 is activated to initialize the environmental control systems at a baseline comfort level. Sensor readings indicate very low CO2 concentrations and medium temperature, resulting in the activation of rules R02, R05, and R17 to decrease the intensity of the HVAC and ventilation systems while preserving thermal comfort. Additionally, low illuminance levels detected in both zones lead to the activation of rules R09 and R12, thereby increasing artificial lighting to maintain visual comfort.
Overall, Scenario S4 demonstrates the fuzzy system’s capacity to
  • Prioritize visual comfort under low-lighting conditions while maintaining energy efficiency;
  • React to nuanced combinations of environmental factors and occupancy;
  • Produce interpretable, graded outputs even under overlapping rule activation.

5.5.5. Scenario S5: Low/High Light, Un/Occupancy, and High Humidity

This scenario evaluates the system’s response to a situation in which one zone of the room is unoccupied and exposed to low illuminance, while the second zone is occupied and subject to high illuminance. Both zones present elevated humidity levels. This configuration is representative of a heterogeneous indoor environment, such as a partially lit space with varying occupancy, potentially occurring during transitional periods of the day or in buildings with uneven natural light distribution and high moisture levels. Table 18 details the input values.
Table 19 lists the contributing rules and their degrees of activation, while Table 20 summarizes the inferred output values.
As observed, rule R24 is activated to establish a baseline comfort environment in the room due to the presence of at least one occupied zone. Illuminance sensors detect high lighting levels in the occupied area and very low lighting in the unoccupied zone. Consequently, rule R10 is triggered to deactivate the lighting system in the well-lit (occupied) zone, while Rule R13 is activated to increase lighting in the darker (unoccupied) area. This coordinated response helps avoid stark contrasts in brightness across the room, thereby enhancing visual comfort for occupants. Finally, humidity sensors report elevated levels in the occupied zone, prompting the activation of rule R22, which increases HVAC intensity to a high level. However, rule R5, detecting medium temperature in the same area, and rule R17, responding to low CO2 levels, both contribute to reducing the overall intensity of the HVAC. These combined activations result in a moderated and balanced control output that maintains comfort while optimizing energy usage.
Overall, this scenario highlights the fuzzy controller’s capability to
  • Adjust lighting outputs in a spatially differentiated manner, reducing illumination in well-lit, occupied areas while compensating for low-light conditions in unoccupied zones to maintain a visually balanced environment;
  • Manage conflicting HVAC demands by integrating humidity, temperature, and air quality indicators, leading to a moderated system response;
  • Provide interpretable and adaptive control actions through the coordination of multiple overlapping rules in a heterogeneous indoor context.

5.6. General Performance Remarks

The proposed system demonstrated adequate performance in managing the different systems available in the room based on the information provided by the sensors, enabling energy-efficient operation while maintaining a comfortable environment for the occupants and preventing hazardous gas concentrations. The system’s behavior across all tested scenarios supports its suitability for intelligent building control, while also offering a high degree of interpretability. This transparency allows domain experts to understand, validate, and refine the system’s decisions—particularly in cases where behaviors may be suboptimal—thus facilitating adaptation to user-specific needs and preventing undesired actions in similar future situations. For instance, rule R24 is designed to initiate system activation at a baseline comfort level when occupancy is detected. Other rules then modulate system behavior in response to the room’s specific environmental conditions. If a stronger emphasis on energy savings is desired, rule R24 can be removed to reduce baseline energy usage. However, such a change would require careful redesign of the rule base, potentially involving the addition of new rules to preserve comfort while minimizing consumption.
The use of FRBSs to manage IoT infrastructures aligns with established guidelines and supports compliance with the European Union’s AI Act (https://artificialintelligenceact.eu/, accessed on 16 July 2025), which promotes the development of trustworthy artificial intelligence systems. By ensuring interpretability and transparency, these systems can build user trust and confidence in AI-driven automation. Additionally, the low cost of the proposed solution makes it a promising candidate for implementing efficient energy management strategies in low-performing buildings across the European space, contributing to cost reductions for both citizens and small enterprises.
Although a detailed comparative analysis lies beyond the scope of this work, the proposed system was experimentally deployed and evaluated on two widely used embedded platforms: the ESP32 and the Raspberry Pi 3B+. These platforms are well-documented in the literature for their low energy consumption and sufficient computational capabilities for embedded inference tasks. The average inference time remained below 20 milliseconds, ensuring real-time responsiveness. Furthermore, overall resource usage was consistently low, with CPU utilization remaining under 10% and memory usage below 50% on both platforms. These results confirm the practical feasibility of the proposed solution for real-time energy management in smart building environments and pave the way for future work focused on more extensive benchmarking and performance evaluation.

6. Conclusions

This work presents a comprehensive framework for intelligent energy management in smart buildings based on the JFML-IoT library and compliant with the IEEE Std 1855-2016. By leveraging the modular and lightweight architecture of JFML-IoT, the proposed system enables interpretable fuzzy control logic to be deployed on low-power, embedded devices, offering a viable alternative to conventional, cloud-dependent energy management approaches.
A key contribution of this work lies in the complete methodological pipeline for developing interpretable and expert-informed FRBSs, from sensor and actuator integration to the definition, validation, and formal encoding of rules in FML. The methodology is grounded in real-world requirements and expert domain knowledge, ensuring that the resulting behavior of the system aligns with human reasoning and operational expectations in dynamic indoor environments.
Unlike purely data-driven control strategies, our approach prioritizes interpretability, modularity, and human-in-the-loop validation. This allows facility managers and system designers to understand, adjust, and trust the system’s behavior, which is essential for real-world adoption in sensitive domains such as energy and comfort regulation.
The experimental case study demonstrates the practical effectiveness of the system in realistic indoor conditions. A series of representative scenarios were simulated to assess the controller’s response to a diverse range of environmental situations, including variations in temperature, occupancy, illuminance, and air quality. The results confirmed that the system is capable of dynamically adjusting actuation levels for HVAC, ventilation, and lighting in a manner that is consistent with expert reasoning and energy efficiency objectives. Moreover, the system appropriately avoids unnecessary energy consumption in favorable conditions while activating targeted actions when environmental comfort or air quality demands it, validating both the interpretability and operational adequacy of the defined fuzzy rules.
In terms of implementation, the system exhibited low computational load and fast response times when deployed on embedded platforms such as ESP32 and Raspberry Pi 3B+, with average inference times under 20 milliseconds and CPU usage below 10%. Although exhaustive benchmarking was not within the scope of this work, these observations reinforce the feasibility of deploying fuzzy controllers in real-time embedded IoT scenarios.
Future work will focus on expanding the inference capabilities of JFML-IoT with adaptive learning techniques to support hybrid expert data-driven rule generation. Moreover, further evaluation under real-time operating constraints and larger deployment environments will be conducted to assess scalability and long-term performance. Additionally, although advanced security features such as encryption and data privacy safeguards were not explicitly implemented in this prototype, the communication layer is compatible with secure protocols like MQTT over TLS. This provides a solid foundation for incorporating authentication, encrypted messaging, and compliance with data protection regulations such as GDPR in future deployments. Another promising direction for future research involves integrating the proposed fuzzy control framework with Building Information Modeling (BIM) platforms or Digital Twin technologies. These models offer rich semantic and structural representations of the building environment that could complement our edge-oriented, rule-based approach, enabling context-aware and coordinated energy control strategies that bridge long-term planning with real-time decision making. The presented system constitutes a solid and extensible foundation for human-interpretable control in smart buildings, paving the way toward more transparent, adaptive, and trustworthy energy management infrastructures.

Limitations and Critical Points

While the proposed system has demonstrated promising results in terms of interpretability and operational feasibility, several limitations must be acknowledged. First, the current implementation was validated in a controlled, small-scale environment using predefined fuzzy rule sets. This setup does not fully reflect the variability, unpredictability, and complexity of large-scale or long-term building operation scenarios. Additionally, although the fuzzy rule base was developed through a structured expert elicitation process, the system does not yet incorporate mechanisms for automatic rule refinement, online adaptation, or data-driven learning. As a result, its responsiveness may be constrained in environments with evolving usage patterns or unexpected behaviors.
Another limitation lies in the validation process itself, which was conducted using representative but static scenarios. This restricts the generalizability of the results and calls for future empirical studies involving continuous monitoring under dynamic, real-world conditions. Furthermore, the current system lacks advanced security features—such as encrypted communication channels and authentication protocols—which would be essential for safe deployment in production environments.
The rule base design was intentionally focused on the perspective of technical domain experts (e.g., HVAC engineers, building automation specialists), without incorporating direct input from end-users. While this ensures context-aware and safe control logic, it may limit the system’s ability to personalize comfort settings or adapt to individual behavioral preferences. This could affect user acceptance and optimal calibration in heterogeneous occupancy scenarios. Future extensions should explore hybrid strategies that integrate expert knowledge with end-user feedback or adaptive learning to enhance personalization and scalability.
Moreover, the current study did not quantify the energy savings or environmental impact (e.g., CO2 reduction) attributable to the fuzzy control system. Although the experimental setup enables energy-efficient operation in principle, the absence of detailed subsystem-level consumption data (HVAC, lighting, ventilation) precludes a rigorous assessment of performance gains. Similarly, no comfort metrics (e.g., Predicted Mean Vote index) were recorded, limiting the comprehensiveness of the evaluation.
These gaps highlight key directions for future research. Longitudinal deployments should include subsystem-level energy monitoring, comparison with baseline control systems, and modeling of environmental benefits based on regional electricity carbon factors. In parallel, a techno-economic analysis encompassing hardware costs, installation, maintenance, and potential disruptions (e.g., power outages) would allow for estimation of payback periods across different deployment scales. These efforts are critical to inform the cost–benefit profile and real-world adoption potential of the proposed architecture.

Author Contributions

Conceptualization, M.M.-R., C.C., J.A.-F. and J.M.S.-H.; methodology, J.A.-F. and J.M.S.-H.; software, C.C. and J.M.S.-H.; validation, M.M.-R. and J.A.-F.; formal analysis, M.M.-R., C.C., J.A.-F. and J.M.S.-H.; investigation, M.M.-R., J.A.-F. and J.M.S.-H.; resources, J.M.S.-H.; data curation, J.A.-F. and J.M.S.-H.; writing—original draft preparation, M.M.-R., C.C., J.A.-F. and J.M.S.-H.; writing—review and editing, M.M.-R., C.C., J.A.-F. and J.M.S.-H.; visualization, M.M.-R., C.C., J.A.-F. and J.M.S.-H.; supervision, J.M.S.-H.; project administration, J.M.S.-H.; funding acquisition, J.A.-F. and J.M.S.-H. All authors have read and agreed to the published version of the manuscript.

Funding

This research was partially supported by MICIU/AEI (10.13039/501100011033) under Grant/Award Number PID2022-142151OB-I00, and by the Instituto de Salud Carlos III co-funded by the European Union and the European Regional Development Fund (ERDF)—A Way of Making Europe—under Grant/Award Numbers PI20/00711 and PI23/00129.

Data Availability Statement

Conflicts of Interest

The authors declare no conflicts of interest.

References

  1. Lu, V.L.; Chen, X.; Chen, J.; Jiao, K. Toward Energy-Efficient Buildings: Perspectives and Approaches; Elsevier: Amsterdam, The Netherlands, 2025. [Google Scholar]
  2. Scrucca, F.; Ingrao, C.; Barberio, G.; Matarazzo, A.; Lagioia, G. On the role of sustainable buildings in achieving the 2030 UN sustainable development goals. Environ. Impact Assess. Rev. 2023, 100, 107069. [Google Scholar] [CrossRef]
  3. Jettanasen, C.; Thongsuk, S.; Sottiyaphai, C.; Songsukthawan, P.; Chiradeja, P.; Lertwanitrot, P.; Ananwattanaporn, S.; Ngaopitakkul, A. An approach to energy conservation in lighting systems using luminaire-based sensor for automatic dimming. Sci. Rep. 2025, 15, 3302. [Google Scholar] [CrossRef] [PubMed]
  4. Pistochini, T.; Ellis, M.; Meyers, F.; Frasier, A.; Cappa, C.; Bennett, D. Method of test for CO2-based demand control ventilation systems: Benchmarking the state-of-the-art and the undervalued potential of proportional-integral control. Energy Build. 2023, 301, 113717. [Google Scholar] [CrossRef]
  5. Reddy, V.J.; Ghazali, M.F.; Kumarasamy, S. Advancements in phase change materials for energy-efficient building construction: A comprehensive review. J. Energy Storage 2024, 81, 110494. [Google Scholar] [CrossRef]
  6. Chung, M.H.; Yoo, S.; Jung, W.N.; Jeong, H.; Yoo, K.H. Self-powered airflow sensor based on energy harvesting of ventilation air in buildings. Adv. Fiber Mater. 2023, 5, 1788–1798. [Google Scholar] [CrossRef]
  7. Marques, G.; González-Briones, A. Internet of Things for Smart Environments; Springer: Berlin/Heidelberg, Germany, 2023. [Google Scholar]
  8. Houssein, E.H.; Othman, M.A.; Mohamed, W.M.; Younan, M. Internet of Things in Smart Cities: Comprehensive Review, Open Issues, and Challenges. IEEE Internet Things J. 2024, 11, 34941–34952. [Google Scholar] [CrossRef]
  9. Ahmed, M.R.; Myo, T.; Aseeri, M.A.; Al Baroomi, B.; Kaiser, M.; Srimal, W. Internet of Things-Based Smart Building for Energy Efficiency. In Future Energy: Challenge, Opportunity, and, Sustainability; Springer: Berlin/Heidelberg, Germany, 2023; pp. 87–97. [Google Scholar]
  10. García-Monge, M.; Zalba, B.; Casas, R.; Cano, E.; Guillén-Lambea, S.; López-Mesa, B.; Martínez, I. Is IoT monitoring key to improve building energy efficiency? Case study of a smart campus in Spain. Energy Build. 2023, 285, 112882. [Google Scholar] [CrossRef]
  11. Perera, A.; Godaliyadda, R.; Hakkinen, J.; Katz, M. Lighting the Way for a Sustainable Future: Overcoming Challenges in Light-Based IoT and Data-Energy Networking. IEEE Commun. Mag. 2025, 1–7. [Google Scholar] [CrossRef]
  12. Cheng, Y.L.; Lim, M.H.; Hui, K.H. Impact of internet of things paradigm towards energy consumption prediction: A systematic literature review. Sustain. Cities Soc. 2022, 78, 103624. [Google Scholar] [CrossRef]
  13. Nikpour, M.; Yousefi, P.B.; Jafarzadeh, H.; Danesh, K.; Shomali, R.; Asadi, S.; Lonbar, A.G.; Ahmadi, M. Intelligent energy management with IoT framework in smart cities using intelligent analysis: An application of machine learning methods for complex networks and systems. J. Netw. Comput. Appl. 2025, 235, 104089. [Google Scholar] [CrossRef]
  14. Lee, E.; Seo, Y.D.; Oh, S.R.; Kim, Y.G. A Survey on Standards for Interoperability and Security in the Internet of Things. IEEE Commun. Surv. Tutor. 2021, 23, 1020–1047. [Google Scholar] [CrossRef]
  15. Moudgil, V.; Hewage, K.; Hussain, S.A.; Sadiq, R. Integration of IoT in building energy infrastructure: A critical review on challenges and solutions. Renew. Sustain. Energy Rev. 2023, 174, 113121. [Google Scholar] [CrossRef]
  16. Xue, S.; Huang, H.; Liu, J.; Yang, Q.; Zhao, L.; Wu, H. An Effective Scheme to Solve Critical Data Missing Problems for IoT-Based Smart Energy Management. IEEE Internet Things J. 2025, 12, 4466–4474. [Google Scholar] [CrossRef]
  17. Gu, X.; Han, J.; Shen, Q.; Angelov, P.P. Autonomous learning for fuzzy systems: A review. Artif. Intell. Rev. 2023, 56, 7549–7595. [Google Scholar] [CrossRef]
  18. Mendel, J.M. Explainable Uncertain Rule-Based Fuzzy Systems; Springer: Berlin/Heidelberg, Germany, 2024. [Google Scholar]
  19. Kruse, R.; Mostaghim, S.; Borgelt, C.; Braune, C.; Steinbrecher, M. Fuzzy Control. In Computational Intelligence: A Methodological Introduction; Springer International Publishing: Berlin/Heidelberg, Germany, 2022; pp. 451–470. [Google Scholar]
  20. Arun, M.; Efremov, C.; Nguyen, V.N.; Barik, D.; Sharma, P.; Bora, B.J.; Kowalski, J.; Le, H.C.; Truong, T.H.; Cao, D.N. Fuzzy logic-supported building design for low-energy consumption in urban environments. Case Stud. Therm. Eng. 2024, 64, 105384. [Google Scholar] [CrossRef]
  21. IEEE 1855-2016; IEEE Standard for Fuzzy Markup Language, Standard 1855-2016. IEEE: Piscataway, NJ, USA, 2016; pp. 1–89. Available online: https://standards.ieee.org/findstds/standard/1855-2016.html (accessed on 16 July 2025).
  22. Soto-Hidalgo, J.M.; Alonso, J.M.; Acampora, G.; Alcalá-Fdez, J. JFML: A java library to design fuzzy logic systems according to the IEEE std 1855-2016. IEEE Access 2018, 6, 54952–54964. [Google Scholar] [CrossRef]
  23. Rodriguez-Lozano, F.J.; Gámez-Granados, J.C.; Banos, O.; Alcalá-Fdez, J.; Soto-Hidalgo, J.M. An approach to bridge the gap between ubiquitous embedded devices and JFML: A new module for Internet of Things. In Proceedings of the IEEE International Conference on Fuzzy Systems (FUZZ-IEEE 2021), Luxembourg, 11–14 July 2021; pp. 1–6. [Google Scholar] [CrossRef]
  24. Amadeo, M.; Cicirelli, F.; Guerrieri, A.; Ruggeri, G.; Spezzano, G.; Vinci, A. When edge intelligence meets cognitive buildings: The COGITO platform. Internet Things 2023, 24, 100908. [Google Scholar] [CrossRef]
  25. Hosamo, H.; Mazzetto, S. Data-Driven Ventilation and Energy Optimization in Smart Office Buildings: Insights from a High-Resolution Occupancy and Indoor Climate Dataset. Sustainability 2024, 17, 58. [Google Scholar] [CrossRef]
  26. Sayed, A.N.; Himeur, Y.; Bensaali, F. Deep and transfer learning for building occupancy detection: A review and comparative analysis. Eng. Appl. Artif. Intell. 2022, 115, 105254. [Google Scholar] [CrossRef]
  27. Gugueoth, V.; Safavat, S.; Shetty, S.; Rawat, D. A review of IoT security and privacy using decentralized blockchain techniques. Comput. Sci. Rev. 2023, 50, 100585. [Google Scholar] [CrossRef]
  28. Llaria, A.; Dos Santos, J.; Terrasson, G.; Boussaada, Z.; Merlo, C.; Curea, O. Intelligent buildings in smart grids: A survey on security and privacy issues related to energy management. Energies 2021, 14, 2733. [Google Scholar] [CrossRef]
  29. Hazra, A.; Rana, P.; Adhikari, M.; Amgoth, T. Fog computing for next-generation internet of things: Fundamental, state-of-the-art and research challenges. Comput. Sci. Rev. 2023, 48, 100549. [Google Scholar] [CrossRef]
  30. Demil, S.; Abdmeziem, M.R. Incentivizing task offloading in IoT: A distributed auctions-based DRL approach. Internet Things 2025, 30, 101493. [Google Scholar] [CrossRef]
  31. Al Sayed, K.; Boodi, A.; Sadeghian Broujeny, R.; Beddiar, K. Reinforcement learning for HVAC control in intelligent buildings: A technical and conceptual review. J. Build. Eng. 2024, 95, 110085. [Google Scholar] [CrossRef]
  32. King, E.; Yu, H.; Lee, S.; Julien, C. Sasha: Creative goal-oriented reasoning in smart homes with large language models. Proc. ACM Interactive Mob. Wearable Ubiquitous Technol. 2024, 8, 1–38. [Google Scholar] [CrossRef]
  33. Song, Y.; Li, J.; Bian, Y.; Cai, Z. Predicting User Behavior in Smart Spaces with LLM-Enhanced Logs and Personalized Prompts. In Proceedings of the AAAI Conference on Artificial Intelligence, Philadelphia, PA, USA, 25 February–4 March 2025; Volume 39, pp. 764–772. [Google Scholar]
  34. Himeur, Y.; Ghanem, K.; Alsalemi, A.; Bensaali, F.; Amira, A. Artificial intelligence based anomaly detection of energy consumption in buildings: A review, current trends and new perspectives. Appl. Energy 2021, 287, 116601. [Google Scholar] [CrossRef]
  35. Haghighat, M.; MohammadiSavadkoohi, E.; Shafiabady, N. Applications of Explainable Artificial Intelligence (XAI) and interpretable Artificial Intelligence (AI) in smart buildings and energy savings in buildings: A systematic review. J. Build. Eng. 2025, 107, 112542. [Google Scholar] [CrossRef]
  36. Okoro, U.G.; Mubaraq, A.; Olugu, E.U.; Lawal, S.A.; Wong, K.Y. A dynamic maintenance planning methodology for HVAC systems based on Fuzzy-TOPSIS and failure mode and Effect Analysis. J. Build. Eng. 2024, 98, 111326. [Google Scholar] [CrossRef]
  37. Wu, D.; Yang, H.; Xu, K.; Meng, X.; Yin, S.; Zhu, C.; Jin, X. Data and knowledge fusion-driven Bayesian networks for interpretable fault diagnosis of HVAC systems. Int. J. Refrig. 2024, 161, 101–112. [Google Scholar] [CrossRef]
  38. Abdolhosseini, M.; Abdollahi, R. Designing and Implementing a Lighting Control System Based on Constrained Info-Fuzzy, to Save Energy and Satisfy Users. IEEE Trans. Ind. Inform. 2024, 20, 6718–6725. [Google Scholar] [CrossRef]
  39. Prince; Hati, A.S.; Kumar, P. An adaptive neural fuzzy interface structure optimisation for prediction of energy consumption and airflow of a ventilation system. Appl. Energy 2023, 337, 120879. [Google Scholar] [CrossRef]
  40. Halhoul Merabet, G.; Essaaidi, M.; Ben Haddou, M.; Qolomany, B.; Qadir, J.; Anan, M.; Al-Fuqaha, A.; Abid, M.R.; Benhaddou, D. Intelligent building control systems for thermal comfort and energy-efficiency: A systematic review of artificial intelligence-assisted techniques. Renew. Sustain. Energy Rev. 2021, 144, 110969. [Google Scholar] [CrossRef]
  41. Salari, S.; Karimi, A. Introducing an integrated approach for fire safety assessment in healthcare facilities by interval valued neutrosophic-AHP and Fuzzy Inference System. Heliyon 2025, 11, e41660. [Google Scholar] [CrossRef] [PubMed]
  42. Abbasi, M.; Tokhi, M.O.; Eyvazzadeh, N.; Falahati, M.; Zokaei, M. Prioritization of noise abatement methods for controlling hospital noise pollution. J. Low Freq. Noise Vib. Act. Control 2024, 43, 1126–1138. [Google Scholar] [CrossRef]
  43. Alghassab, M.A. Fuzzy-based smart energy management system for residential buildings in Saudi Arabia: A comparative study. Energy Rep. 2024, 11, 1212–1224. [Google Scholar] [CrossRef]
  44. Maghfiroh, H.; Wahyunggoro, O.; Cahyadi, A.I. Energy management in hybrid electric and hybrid energy storage system vehicles: A fuzzy logic controller review. IEEE Access 2024, 12, 56097–56109. [Google Scholar] [CrossRef]
  45. Cavus, M.; Dissanayake, D.; Bell, M. Deep-Fuzzy Logic Control for Optimal Energy Management: A Predictive and Adaptive Framework for Grid-Connected Microgrids. Energies 2025, 18, 995. [Google Scholar] [CrossRef]
  46. Konecny, J.; Prauzek, M.; Borova, M. Fuzzy Controlled Wavelet-Based Edge Computing Method for Energy-Harvesting IoT Sensors. IEEE Internet Things J. 2023, 10, 18909–18918. [Google Scholar] [CrossRef]
  47. Lu, J.; Ma, G.; Zhang, G. Fuzzy Machine Learning: A Comprehensive Framework and Systematic Review. IEEE Trans. Fuzzy Syst. 2024, 32, 3861–3878. [Google Scholar] [CrossRef]
  48. Kim, H.; Kim, S.; Lee, J. Integration of IoT sensor data and BIM for real-time energy performance simulation. Autom. Constr. 2023, 149, 104931. [Google Scholar] [CrossRef]
  49. Arsiwala, M.; Mahalle, P.; Gudadhe, M.; Pradhan, S. A hybrid BIM and fuzzy logic model for optimizing building energy performance. Sustainability 2023, 15, 16436. [Google Scholar] [CrossRef]
Figure 1. Modular architecture of the proposed energy management system, organized into four functional layers: perception, communication, processing, and application. The diagram illustrates data flow and communication mechanisms (e.g., MQTT, REST, WebSocket) across layers and networks (LAN/WAN).
Figure 1. Modular architecture of the proposed energy management system, organized into four functional layers: perception, communication, processing, and application. The diagram illustrates data flow and communication mechanisms (e.g., MQTT, REST, WebSocket) across layers and networks (LAN/WAN).
Applsci 15 08208 g001
Figure 2. Schematic layout and operation flow of the experimental room. The setup includes two sensing zones equipped with ESP32-based nodes and environmental sensors (temperature, humidity, illuminance, occupancy), as well as a central CO2 sensor. Step 1: Sensors collect data and publish it via MQTT. Step 2: A Raspberry Pi hosts the MQTT broker to manage data exchange. Step 3: Another Raspberry Pi runs the JFML-IoT engine, subscribes to sensor data, and performs fuzzy inference. Step 4: Control decisions are sent back via MQTT to the actuator node, which manages lighting and HVAC systems.
Figure 2. Schematic layout and operation flow of the experimental room. The setup includes two sensing zones equipped with ESP32-based nodes and environmental sensors (temperature, humidity, illuminance, occupancy), as well as a central CO2 sensor. Step 1: Sensors collect data and publish it via MQTT. Step 2: A Raspberry Pi hosts the MQTT broker to manage data exchange. Step 3: Another Raspberry Pi runs the JFML-IoT engine, subscribes to sensor data, and performs fuzzy inference. Step 4: Control decisions are sent back via MQTT to the actuator node, which manages lighting and HVAC systems.
Applsci 15 08208 g002
Figure 3. Membership functions defined for the case study.
Figure 3. Membership functions defined for the case study.
Applsci 15 08208 g003
Table 1. Examples of sensors and actuators available in JFML-IoT for energy management.
Table 1. Examples of sensors and actuators available in JFML-IoT for energy management.
Device TypeModelJFML-IoT Class
Temperature SensorDHT22DHT22Sensor
Humidity SensorDHT22DHT22Sensor
CO2 SensorMH-Z19MHZ19Sensor
Illuminance SensorBH1750BH1750Sensor
Occupancy SensorHC-SR501 (PIR)PIRSensor
Lighting ActuatorPWM-controlled LED driverLightingActuator
Ventilation ActuatorRelay-controlled fan switchVentilationActuator
HVAC ActuatorRelay or IR-based HVAC controlHVACActuator
Table 2. Defined variables and associated devices.
Table 2. Defined variables and associated devices.
Input VariablesDescriptionDomainSensors
Room Temperature 1Temperature in °C (zone 1)[0–40]DHT22 Sensor
Room Temperature 2Temperature in °C (zone 2)[0–40]DHT22 Sensor
Room Humidity 1Relative humidity in % (zone 1)[0–100]DHT22 Sensor
Room Humidity 2Relative humidity in % (zone 2)[0–100]DHT22 Sensor
Illuminance 1Light level in lux (zone 1)[0–1000]BH1750 Light Sensor
Illuminance 2Light level in lux (zone 2)[0–1000]BH1750 Light Sensor
Occupancy 1Motion detection (binary, zone 1)[0–1]HC-SR501 PIR Sensor
Occupancy 2Motion detection (binary, zone 2)[0–1]HC-SR501 PIR Sensor
CO2 LevelAir quality in ppm[400–2000]MH-Z19 CO2 Sensor
Output VariablesDescriptionDomainActuators
Lighting Control 1Light dimming level (zone 1)[0–1]PWM-controlled LED Driver
Lighting Control 2Light dimming level (zone 2)[0–1]PWM-controlled LED Driver
Ventilation ControlVentilation system state[0–1]Relay-based Fan Switch
HVAC ControlHVAC on/off or power level[0–1]Relay-based HVAC Interface
Table 3. Example of inter-expert agreement levels for a subset of fuzzy rules. Agreement scores are computed based on a 5-point scale (0–4) where 4 indicates unanimous agreement.
Table 3. Example of inter-expert agreement levels for a subset of fuzzy rules. Agreement scores are computed based on a 5-point scale (0–4) where 4 indicates unanimous agreement.
Fuzzy RuleAgreement Score (0–4)
IF Room Temperature 1 is High AND Occupancy 1 is True THEN HVAC Control is Max4
IF Illuminance 1 is Low AND Occupancy 1 is True THEN Lighting Control 1 is Bright4
IF CO2 Level is High AND Occupancy 2 is True THEN Ventilation Control is On3
IF Room Temperature 2 is Low AND Occupancy 2 is False THEN HVAC Control is Medium2
IF Illuminance 2 is Medium AND Occupancy 2 is True THEN Lighting Control 2 is Dim4
Table 4. Final fuzzy rules defined by the expert panel.
Table 4. Final fuzzy rules defined by the expert panel.
RuleFuzzy Rules
R01IF RoomTemperature1 IS High AND Occupancy1 IS True THEN HVACControl IS Max, VentilationControl IS Moderate
R02IF RoomTemperature1 IS Medium AND Occupancy1 IS True THEN HVACControl IS Low
R03IF RoomTemperature1 IS Low AND Occupancy1 IS True THEN HVACControl IS Max, VentilationControl IS Moderate
R04IF RoomTemperature2 IS High AND Occupancy2 IS True THEN HVACControl IS Max, VentilationControl IS Moderate
R05IF RoomTemperature2 IS Medium AND Occupancy2 IS True THEN HVACControl IS Low
R06IF RoomTemperature2 IS Low AND Occupancy2 IS True THEN HVACControl IS Max, VentilationControl IS Moderate
R07IF Illuminance1 IS High THEN LightingControl1 IS Off
R08IF Illuminance1 IS Medium AND Occupancy1 IS True THEN LightingControl1 IS Dim
R09IF Illuminance1 IS Low AND Occupancy1 IS True THEN LightingControl1 IS Bright
R10IF Illuminance2 IS High THEN LightingControl2 IS Off
R11IF Illuminance2 IS Medium AND Occupancy2 IS True THEN LightingControl2 IS Dim
R12IF Illuminance2 IS Low AND Occupancy2 IS True THEN LightingControl2 IS Bright
R13IF Illuminance1 IS Low AND Occupancy1 IS False AND Occupancy2 IS True THEN LightingControl1 IS Dim
R14IF Illuminance2 IS Low AND Occupancy2 IS False AND Occupancy1 IS True THEN LightingControl2 IS Dim
R15IF CO2Level IS High THEN VentilationControl IS Max
R16IF CO2Level IS Medium THEN VentilationControl IS Moderate, HVACControl IS Low
R17IF CO2Level IS Low THEN VentilationControl IS Off
R18IF CO2Level IS High AND Occupancy2 IS True THEN VentilationControl IS Max
R19IF RoomHumidity1 IS High AND RoomTemperature1 IS High THEN HVACControl IS High
R20IF RoomHumidity1 IS High AND Occupancy1 IS True AND RoomTemperature1 IS Medium THEN HVACControl IS High
R21IF RoomHumidity2 IS High AND RoomTemperature2 IS High THEN HVACControl IS High
R22IF RoomHumidity2 IS High AND Occupancy2 IS True AND RoomTemperature2 IS Medium THEN HVACControl IS High
R23IF RoomHumidity1 IS Low OR RoomHumidity2 IS Low THEN HVACControl IS High
R24IF Occupancy1 IS True OR Occupancy2 IS True THEN HVACControl IS Medium, VentilationControl IS Moderate, LightingControl1 IS Dim, LightingControl2 IS Dim
R25IF Occupancy1 IS False AND Occupancy2 IS False THEN HVACControl IS Off, VentilationControl IS Off, LightingControl1 IS Off, LightingControl2 IS Off
R26IF Occupancy1 IS False AND Occupancy2 IS False AND CO2Level IS Low THEN HVACControl IS Off, VentilationControl IS Moderate, LightingControl1 IS Off, LightingControl2 IS Off
Table 5. Test scenarios and corresponding input values.
Table 5. Test scenarios and corresponding input values.
ScenarioTe.1Hum.1Illu.1Oc.1Te.2Hum.2Illu.2Oc.2CO2
S1: High Temp + Occupied3555600133607001800
S2: Low Temp + Unoccupied1245400014505000500
S3: Medium CO2 + Occupancy22.5503501224545011300
S4: Low Light + Occupancy2050100121551501400
S5: Low/High Light +
Un/Occupancy +
High Humidity
208550021808501400
Table 6. Input values for Scenario S1.
Table 6. Input values for Scenario S1.
Input VariableValueInput VariableValue
RoomTemperature135.0 °CRoomTemperature233.0 °C
RoomHumidity155.0%RoomHumidity260.0%
Occupancy11.0Occupancy21.0
Illuminance1600.0 lxIlluminance2700.0 lx
CO2 Level800.0 ppm
Table 7. Activated rules and membership degrees for Scenario S1.
Table 7. Activated rules and membership degrees for Scenario S1.
RuleDescriptionMembership Degree
R01IF RoomTemperature1 IS High AND Occupancy1 IS True THEN HVACControl IS Max, VentilationControl IS Moderate0.67
R04IF RoomTemperature2 IS High AND Occupancy2 IS True THEN HVACControl IS Max, VentilationControl IS Moderate0.53
R08IF Illuminance1 IS Medium AND Occupancy1 IS True THEN LightingControl1 IS Dim0.67
R11IF Illuminance2 IS Medium AND Occupancy2 IS True THEN LightingControl2 IS Dim0.34
R16IF CO2Level IS Medium THEN VentilationControl IS Moderate, HVACControl IS Low0.2
R24IF Occupancy1 IS True OR Occupancy2 IS True THEN HVACControl IS Medium, VentilationControl IS Moderate, LightingControl1 IS Dim, LightingControl2 IS Dim1.0
Table 8. Inferred output values for Scenario S1.
Table 8. Inferred output values for Scenario S1.
Output Var.HVACControlVentilationControlLightingControl1LightingControl2
Inferred Value0.5810.4670.4670.467
Table 9. Input values for Scenario S2.
Table 9. Input values for Scenario S2.
Input VariableValueInput VariableValue
RoomTemperature112.0 °CRoomTemperature214.0 °C
RoomHumidity145.0%RoomHumidity250.0%
Occupancy10.0Occupancy20.0
Illuminance1400.0 lxIlluminance2500.0 lx
CO2 Level500.0 ppm
Table 10. Inference results and active rules for Scenario S2.
Table 10. Inference results and active rules for Scenario S2.
RuleDescriptionMembership Degree
R17IF CO2Level IS Low THEN VentilationControl IS Off0.75
R25IF Occupancy1 IS False AND Occupancy2 IS False THEN HVACControl IS Off, VentilationControl IS Off, LightingControl1 IS Off, LightingControl2 IS Off1.0
R26IF Occupancy1 IS False AND Occupancy2 IS False AND CO2Level IS Low THEN HVACControl IS Off, VentilationControl IS Moderate, LightingControl1 IS Off, LightingControl2 IS Off0.75
Table 11. Inferred output values for Scenario S2.
Table 11. Inferred output values for Scenario S2.
Output Var.HVACControlVentilationControlLightingControl1LightingControl2
Inferred Value00.32400
Table 12. Input values for Scenario S3.
Table 12. Input values for Scenario S3.
Input VariableValueInput VariableValue
RoomTemperature122.5 °CRoomTemperature222.0 °C
RoomHumidity150.0%RoomHumidity245.0%
Occupancy11.0Occupancy21.0
Illuminance1350.0 lxIlluminance2450.0 lx
CO2 Level1300.0 ppm
Table 13. Inference results and active rules for Scenario S3.
Table 13. Inference results and active rules for Scenario S3.
RuleDescriptionMembership Degree
R02IF RoomTemperature1 IS Medium AND Occupancy1 IS True THEN HVACControl IS Low1.0
R05IF RoomTemperature2 IS Medium AND Occupancy2 IS True THEN HVACControl IS Low0.93
R08IF Illuminance1 IS Medium AND Occupancy1 IS True THEN LightingControl1 IS Dim0.5
R11IF Illuminance2 IS Medium AND Occupancy2 IS True THEN LightingControl2 IS Dim0.83
R16IF CO2Level IS Medium THEN VentilationControl IS Moderate, HVACControl IS Low0.67
R24IF Occupancy1 IS True OR Occupancy2 IS True THEN HVACControl IS Medium, VentilationControl IS Moderate, LightingControl1 IS Dim, LightingControl2 IS Dim1.0
Table 14. Inferred output values for Scenario S3.
Table 14. Inferred output values for Scenario S3.
Output Var.HVACControlVentilationControlLightingControl1LightingControl2
Inferred Value0.4260.4670.4670.467
Table 15. Input values for Scenario S4.
Table 15. Input values for Scenario S4.
Input VariableValueInput VariableValue
RoomTemperature120.0 °CRoomTemperature221.0 °C
RoomHumidity150.0%RoomHumidity255.0%
Occupancy11.0Occupancy21.0
Illuminance1100.0 lxIlluminance2150.0 lx
CO2 Level400.0 ppm
Table 16. Inference results and active rules for Scenario S4.
Table 16. Inference results and active rules for Scenario S4.
RuleDescriptionMembership Degree
R02IF RoomTemperature1 IS Medium AND Occupancy1 IS True THEN HVACControl IS Low0.67
R05IF RoomTemperature2 IS Medium AND Occupancy2 IS True THEN HVACControl IS Low0.8
R09IF Illuminance1 IS Low AND Occupancy1 IS True THEN LightingControl1 IS Bright0.67
R12IF Illuminance2 IS Low AND Occupancy2 IS True THEN LightingControl2 IS Bright0.5
R17IF CO2Level IS Low THEN VentilationControl IS Off1.0
R24IF Occupancy1 IS True OR Occupancy2 IS True THEN HVACControl IS Medium, VentilationControl IS Moderate, LightingControl1 IS Dim, LightingControl2 IS Dim1.0
Table 17. Inferred output values for Scenario S4.
Table 17. Inferred output values for Scenario S4.
Output Var.HVACControlVentilationControlLightingControl1LightingControl2
Inferred Value0.40.3310.630.61
Table 18. Input values for Scenario S5.
Table 18. Input values for Scenario S5.
Input VariableValueInput VariableValue
RoomTemperature120.0 °CRoomTemperature221.0 °C
RoomHumidity185.0%RoomHumidity280.0%
Occupancy10Occupancy21
Illuminance150.0 lxIlluminance2850.0 lx
CO2 Level400.0 ppm
Table 19. Inference results and active rules for Scenario S5.
Table 19. Inference results and active rules for Scenario S5.
RuleDescriptionMembership Degree
R05IF RoomTemperature2 IS Medium AND Occupancy2 IS True THEN HVACControl IS Low0.8
R10IF Illuminance2 IS High THEN LightingControl2 IS Off0.5
R13IF Illuminance1 IS Low AND Occupancy1 IS False AND Occupancy2 IS True THEN LightingControl1 IS Dim0.83
R17IF CO2Level IS Low THEN VentilationControl IS Off1.0
R22IF RoomHumidity2 IS High AND Occupancy2 IS True AND RoomTemperature2 IS Medium THEN HVACControl IS High0.5
R24IF Occupancy1 IS True OR Occupancy2 IS True THEN HVACControl IS Medium, VentilationControl IS Moderate, LightingControl1 IS Dim, LightingControl2 IS Dim1.0
Table 20. Inferred output values for Scenario S5.
Table 20. Inferred output values for Scenario S5.
Output Var.HVACControlVentilationControlLightingControl1LightingControl2
Inferred Value0.480.330.460.11
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Martínez-Rojas, M.; Cano, C.; Alcalá-Fdez, J.; Soto-Hidalgo, J.M. Interpretable Fuzzy Control for Energy Management in Smart Buildings Using JFML-IoT and IEEE Std 1855-2016. Appl. Sci. 2025, 15, 8208. https://doi.org/10.3390/app15158208

AMA Style

Martínez-Rojas M, Cano C, Alcalá-Fdez J, Soto-Hidalgo JM. Interpretable Fuzzy Control for Energy Management in Smart Buildings Using JFML-IoT and IEEE Std 1855-2016. Applied Sciences. 2025; 15(15):8208. https://doi.org/10.3390/app15158208

Chicago/Turabian Style

Martínez-Rojas, María, Carlos Cano, Jesús Alcalá-Fdez, and José Manuel Soto-Hidalgo. 2025. "Interpretable Fuzzy Control for Energy Management in Smart Buildings Using JFML-IoT and IEEE Std 1855-2016" Applied Sciences 15, no. 15: 8208. https://doi.org/10.3390/app15158208

APA Style

Martínez-Rojas, M., Cano, C., Alcalá-Fdez, J., & Soto-Hidalgo, J. M. (2025). Interpretable Fuzzy Control for Energy Management in Smart Buildings Using JFML-IoT and IEEE Std 1855-2016. Applied Sciences, 15(15), 8208. https://doi.org/10.3390/app15158208

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop