Adaptive HVAC System Based on Fuzzy Controller Approach

: Heating, ventilation, and air conditioning (HVAC) system performance research has re‑ ceived much attention in recent years. Many researchers suggest a set of appropriate fuzzy inputs that can be used to design fuzzy rules‑based smart thermostats or controllers that can respond to demand‑controlled ventilation, which in turn optimizes HVAC energy usage and provides satisfac‑ tory indoor temperatures. Previous research has focused on limited input parameters, such as indoor occupancy status, ambient temperature, and humidity constraints, which cannot efficiently and pre‑ cisely manage thermal comfort. Hence, this study proposes a novel fuzzy controller with additional input parameters to keep indoor thermal comfort consistent with the corresponding number of oc‑ cupants. The process employs an automatic fuzzy rule generation method to simplify the task of generating rules in the fuzzy inference system (FIS) using Mamdani FIS. A design‑builder is used for modeling the HVAC systems. Local weather data were used to conduct simulations via Energy‑ Plus. The thermal comfort analysis using the Fanger model for three different scenarios shows that the proposed FIS controller can successfully respond to the indoor comfort variation in all possible scenarios and ensure a satisfactory comfort level. The proposed method demonstrates up to 50% energy savings if occupants do not worry about comfort.


Introduction
Research has found an unexpected 2.9% growth in worldwide energy consumption in building sectors compared to a typical yearly increase of 1.5%, and this number is expected to rise dramatically in the coming years.Demand was consistent across different nations, with China and the United States emerging as the world's greatest energy consumers since 2002 [1].This trend is closely related to population growth, the expansion of industry and building infrastructure, climate change, and governments' efforts to improve the living standards of their citizens.Furthermore, there has been an atypical rise in the demand and shipment of energy-intensive appliances such as microwaves, hair dryers, air conditioners, heating systems, televisions, and other home appliances worldwide [2].
HVAC systems are significant energy consumers, contributing up to 80% of building peak loads [3,4] due to their reliance on ambient conditions.Studies on demand response programs in [5][6][7] presented techniques to help customers schedule peak load profiles during periods of peak energy consumption or transition to renewable energy systems.Studies on fuzzy controllers have proposed predictive model control (PMC) [8,9], artificial neural networks (ANN) [7,[10][11][12][13], and adaptive control (AC) [14][15][16] to lower energy usage based on occupant comfort needs.The PMC technique has been used to optimize occupant comfort [3,17], while ANN and AC provide solutions to optimize energy usage performance during periods of extreme heat [18][19][20] while maintaining acceptable indoor comfort levels.
Most of these studies use ambient temperature and humidity to control indoor comfort and energy consumption [21][22][23].Studies in [24,25] argue that ambient temperature and humidity cannot fully or precisely reflect the occupant's thermal comfort sensation in light of other parameters.Consequently, this study modified IoFClime [26] to implement occupancy-based controls to deal with the aforementioned challenge and achieve high energy savings potential.IoFClime is an HVAC-based controller that implements fuzzy logic to manage room temperature while taking into consideration outdoor conditions.
A fuzzy inference engine was used to model inputs with a specified number of defined rules to keep the indoor temperature consistent with the desired comfort level under three possible scenarios.A feedback loop was included to deal with changes in the desired comfort level, and a real-time electricity tariff was used to evaluate the proposed approach against energy consumption and thermal comfort levels.
The proposed approach can reduce energy consumption by up to 50% when occupants choose to sacrifice thermal comfort for energy savings, in comparison with the study in [26] (IoFClime).The proposed fuzzy controller has the following key contributions:

•
The interface allows the occupant to set the desired setpoint on the thermostat.

•
Depending on the desired setpoint, the controller picks up and regulates energy consumption within the range of the occupant's desired thermal comfort zone.

•
Finally, the proposed approach can be utilized to take on additional parameters.
This research is organized as follows: The literature review in Section 2 presents analyses of the recent smart HVAC controller.The problem formulation is presented in Section 3.An overview of system implementation is presented in Section 4. The study results are presented in Section 5. Finally, Section 6 concludes the study.

Literature Review
Over the years, HVAC equipment has been used in buildings to improve indoor thermal comfort and ensure healthy living environments [27].HVAC equipment has historically consumed more than twice the expected primary energy demand because of poor operational management.Recently, the research in [1] described automated strategies to turn on HVAC systems when spaces are occupied and turn them off when spaces are vacant.These strategies use occupant data and indoor metrological conditions to formulate a model that activates the controller and controls the HVAC operation.The procedures to minimize HVAC energy consumption can be classified into predictive and non-predictive approaches [1,2].

Existing Predictive Control
Predictive control automates the management of HVAC operations based on dynamic indoor weather conditions or occupancy data.Predictive control uses an explicit control system modeled with different parameters to meet demand response design criteria.In other words, predictive control relies on external signals that are supplied in advance to activate demand control.One of the advantages of predictive control is that changes to the occupancy schedule do not affect the performance of the controller.The current prediction algorithm in [28][29][30][31][32] requires a control value like cost, heat demand, or photovoltaic generation to fulfill demand as cheaply as possible.This suggests that controllers must be supplied with the proper input to determine the ideal moment to use energy.Thus, the control system must use the input data to obtain the best output possible from the process.A typical example proposed in [33] uses a more advanced controller that uses inference rules frequently.The scheduling strategy often relies on precedents and practical resource restrictions to estimate job start and finish times, whereas rule-based strategies have specified membership functions and inference rules for control decision-making.
Studies in [8,[34][35][36] use real-time occupancy information collected through various installed devices such as passive infrared, audio, carbon dioxide, and camera sensors within the perimeter of interest to detect and predict occupancy in the space.These approaches attempt to minimize the false results in occupancy prediction from the previous literature and improve appliance energy consumption.However, these approaches face challenges in predicting actual human occupancy to avoid false negatives triggered by non-human objects such as pets.Similarly, predicting the total number of occupants in the building and adjusting thermal comfort levels accordingly is another challenge.
The study in [37] discusses an HVAC controller that uses carbon dioxide (CO 2 ) and passive infrared sensors to detect occupants and send a signal to the actuator to regulate temperature depending on the number of occupants in the building.Although these sensors are widely used in the previous literature, their commercial application is not practical, as suggested by [38].A similar approach applied CO 2 in conjunction with ML algorithms.The evaluation of the results indicates solid performance even with sudden changes in temperature in the perimeter of interest when space has been occupied.
A study in [8,39,40] proposed a controller for occupancy detection using audio to effectively identify human occupancy.This controller used a Gaussian mixture model to estimate the total number of occupants in a space.The proposed method achieved a certain level of accuracy but with a high number of false results caused by nearby external sounds.Similarly, the approach required all indoor occupants to speak simultaneously to perform the occupancy estimation for HVAC ventilation control.
To enhance the accuracy of the controller in [9], the study in [39] introduced a background cancelation procedure to deal with noise inference from undesirable sources by ignoring the frequency level of the desired sound frequency threshold.The idea relies on the strength of the sound frequency received by the background cancelation algorithm, which reduces false alarms by 11-12% and energy consumption by 3.54%.Despite the application of the background cancelation algorithm, the study suffers from false occupancy prediction.
A controller proposed in [41] combined camera-based image and video processing with the help of computer vision (CV) libraries and estimated total occupancy numbers through headcount or indoor object tracking.A similar approach in [42] used single-camera occupancy detection to control ventilation in the lecture theater through a headcount estimation procedure.The experimental results show good performance in occupancy prediction.However, the false results described in the report occurred due to poor camera coverage when students randomly entered or exited the perimeter of interest.The major challenge of this study is poor occupant detection during periods of occupancy overlap.
An adaptive controller is proposed in [43][44][45][46] that uses a collaboration of optical and passive infrared cameras to detect human occupancy in space.The idea is to reduce potential false alarms by using a single camera to ensure reliable detection, thereby increasing HVAC energy savings and improving thermal comfort.

Existing Non-Predictive Control
A controller that implements non-predictive control relies heavily on fixed timetables.It uses such data to create a model that predicts when a building will be filled and uses that information to regulate HVAC operation.In a setting where activities follow a predetermined daily schedule, this sort of control strategy may be useful.Commercial structures like offices, labs, and corporate environments are fantastic illustrations that reflect the literature [22,[47][48][49][50].However, this strategy would not be effective in places where occupancy does not adhere to a set timetable.Most of the non-predictive controllers, such as those in [43,51], employ binary algorithms and demonstrate that frequent on/off cycling tends to shorten the lifespan of electrical appliances.As such, more advanced controllers in [52] using decision control algorithms such as fuzzy logic were designed as improvements to binary algorithms with sets of values other than zeros and ones, allowing for additional control.
The research in [12] proposes controlling HVAC energy usage according to demand, as the controller can postpone operation whenever electricity prices are at their highest.A similar approach in [7] uses a scheduling strategy to determine which control signal will activate energy consumption.This strategy uses a rule-based technique to quickly access the power grid voltage or rate stabilization and is an excellent example of model-based control.
The schedule-based controller previously used in [7,[53][54][55][56] reduces energy costs and prevents the usage of appliances during times of high demand.For instance, it is possible to schedule standby equipment to operate when energy costs are lower so that other appliances in the house may operate.Both runtime and static techniques may be used to provide this control.

Problem Formulation
A reactive response must deal with the dynamic variation of indoor comfort through demand-controlled ventilation.Most of the existing solutions are limited to ambient temperature and humidity, while, in fact, there is a much larger set of additional input factors that combine to drive healthy indoor thermal comfort.For example, the initialized setpoint is one of the essential parameters defining desired comfort levels and has been ignored in previous research [20].These input factors include occupancy number, desired comfort level, metabolic activity, clothing, perceived temperature, and airspeed.However, not all these inputs can be practically modeled and implemented in a control system.For this reason, temperature-and humidity-based controllers are not efficient for maintaining desired comfort levels and high energy savings potential.
This study proposes an adaptive controller utilizing five input factors, as shown in Figure 1.
Appl.Sci.2023, 13, x FOR PEER REVIEW 4 of 20 advanced controllers in [52] using decision control algorithms such as fuzzy logic were designed as improvements to binary algorithms with sets of values other than zeros and ones, allowing for additional control.The research in [12] proposes controlling HVAC energy usage according to demand, as the controller can postpone operation whenever electricity prices are at their highest.A similar approach in [7] uses a scheduling strategy to determine which control signal will activate energy consumption.This strategy uses a rule-based technique to quickly access the power grid voltage or rate stabilization and is an excellent example of model-based control.
The schedule-based controller previously used in [7,[53][54][55][56] reduces energy costs and prevents the usage of appliances during times of high demand.For instance, it is possible to schedule standby equipment to operate when energy costs are lower so that other appliances in the house may operate.Both runtime and static techniques may be used to provide this control.

Problem Formulation
A reactive response must deal with the dynamic variation of indoor comfort through demand-controlled ventilation.Most of the existing solutions are limited to ambient temperature and humidity, while, in fact, there is a much larger set of additional input factors that combine to drive healthy indoor thermal comfort.For example, the initialized setpoint is one of the essential parameters defining desired comfort levels and has been ignored in previous research [20].These input factors include occupancy number, desired comfort level, metabolic activity, clothing, perceived temperature, and airspeed.However, not all these inputs can be practically modeled and implemented in a control system.For this reason, temperature-and humidity-based controllers are not efficient for maintaining desired comfort levels and high energy savings potential.
This study proposes an adaptive controller utilizing five input factors, as shown in Figure 1.This study uses an 11-point thermal sensation scale (on a scale of −5 to 5), as shown in Figure 2.
Since an 11-point scale covers both sides and a mid-point, we can consider the right half (1 to 5) as a 5-point scale on the positive side.Similarly, we can consider the left half (−1 to −5) as a five-point scale on the negative side.This study employed this scale to allow the occupants to choose their comfort satisfaction levels and participate in the demand response program, thereby offering a choice between maximizing energy savingsand striking a balance between comfort and energy savings.

Overview of the Proposed Fuzzy Controller
Fuzzy logic systems (FLSs) have shown solid proficiency in decision-making research that deals with approximations rather than exact values.Additionally, their mathematical modeling requirements for practical implementation in a control system are not complex compared to conventional techniques [57].For this reason, the study utilizes FLS for the design and implementation of the proposed controller presented in Figure 2. The fuzzybased HVAC controller consists of four main components: fuzzification, inference engine, fuzzy rule base, and defuzzification.Figure 2 shows these elements as well as the overall "−1" "−2" "−4" "−3" "−5" "4" "3" "2" "1" "0" "5" Since an 11-point scale covers both sides and a mid-point, we can consider the right half (1 to 5) as a 5-point scale on the positive side.Similarly, we can consider the left half (−1 to −5) as a five-point scale on the negative side.This study employed this scale to allow the occupants to choose their comfort satisfaction levels and participate in the demand response program, thereby offering a choice between maximizing energy savingsand striking a balance between comfort and energy savings.

Overview of the Proposed Fuzzy Controller
Fuzzy logic systems (FLSs) have shown solid proficiency in decision-making research that deals with approximations rather than exact values.Additionally, their mathematical modeling requirements for practical implementation in a control system are not complex compared to conventional techniques [57].For this reason, the study utilizes FLS for the design and implementation of the proposed controller presented in Figure 2. The fuzzybased HVAC controller consists of four main components: fuzzification, inference engine, fuzzy rule base, and defuzzification.Figure 2 shows these elements as well as the overall FLC design.Each element influences the controller's efficiency and behavior.For instance, during the fuzzification process, the fuzzy component translates measurements of crisp input data into fuzzy data or membership functions (MFs) known as linguistic variables, which are analogous to human decision-making.The fuzzy inference method combines the MFs and the control rules (i.e., rule base) in the second stage to produce the control output.The basis of a fuzzy inference engine's operation is its rule base, and those rules have a strong affinity with human emotion and intuition.Specifically, it offers the knowledge required for the language control rules underlying fuzzification and defuzzification.
The MATLAB Fuzzy Logic Toolbox offers tools to construct and update fuzzy inference systems in the design process of the FL controller for HVAC.The total flow process of the FLC-designed system is shown in Figure 2. Fuzzy logic controllers come in two varieties: Mamdani-based controllers and Takagi-Sugenos-based controllers.We used the Mamdani-type FIS methodology as a fuzzy inference method because the Sugeno FIS does not have an output membership function while the Mamdani-type FIS does.
The input variables used in the proposed controller include temperature (T), humidity (H), occupancy (O), initialized setpoint (Is), and energy price (P).These inputs are fuzzified to generate fuzzy membership functions (MFs), which are part of fuzzy sets defined in a readable and understandable format.
As shown in Figure 2, the FIS takes four crisp inputs and fuzzified them, generating fuzzy MFs using the fuzzy engine.It then applies fuzzy operators to fuzzy MFs to construct fuzzy rules that signify the fuzzy input relationship effect on the output variable through a fuzzifier.The fuzzy model proposed to manage the HVAC system is implemented using Mamdani FIS.
The following rules and assumptions are followed for Mamdani FIS, and the conclusion using the linguistic variables is mathematically presented in Equation (1).For example, IF (Outdoor T ) is ("Warm") AND (Indoor T ) is ("Warm") AND (P-Rate) is ("Low") AND (Occ) is ("Present") AND (ISP) is ("Low") AND ( Humidity rel ) is "Normal," THEN ventilation frequency is "Normal." For the energy consumption cost, the following formula (see Equation ( 2)) is used to calculate the total hourly energy consumption cost: where Cost(h) represents hourly cost, EC(h) represents energy consumption on an hourly interval, and P represents the electricity tariffs based on real-time price (RTP).
The peak-to-average (PAR ) formula is used to obtain information on the peak load during a power imbalance (see Equation ( 3)).

PAR =
Load maximum Load average (3) To determine the efficiency of the proposed approach, the following equation (see Equation ( 4)) is used to calculate the efficiency gain compared to previous approaches, where Value pre represents the efficiency attained by an existing study and Value pro represents the efficiency achieved by the proposed approach.

The Proposed Model
The proposed FIS HVAC controller utilizes a rule-based inference system to determine the optimal setpoint using combinations of input values from the sensors and price values from the smart grid.Depending on the inputs and energy prices, the rules are fired, and the optimal setpoint value is delivered to the controller to adjust the desired temperature.The proposed HVAC controller can be extended with an additional number of parameters to increase the control efficiency and can be embedded in an IoT system.
RTOS is a highly scalable micro-kernel-based real-time operating system designed for scalability and reliability and is easier to implement with IoT applications.For this reason, the study considered the Nucleus RTOS operating system.The combinatoric method generates 175 rules automatically based on the five proposed input parameters.The variation in ambient temperature and humidity is measured using the thermodynamic model [57], occupancy number using the million per pert model [25], and energy price from the smart grid incentive, which is sent to the feedback loop system together with the desired initialized setpoint.

Modeling of Indoor Cooling System
This study adopts the indoor cooling strategy proposed in [52,58] to maintain the desired temperature level in a zone.Figure 3 shows that the air conditioner has provided the zone with the required energy to maintain the desired temperature corresponding to the initial thermostat setpoint settings.
The peak-to-average (PAR) formula is used to obtain information on the peak load during a power imbalance.
To determine the efficiency of the proposed approach, the following equation (see Equation ( 4)) is used to calculate the efficiency gain compared to previous approaches, where Value represents the efficiency attained by an existing study and Value represents the efficiency achieved by the proposed approach.

The Proposed Model
The proposed FIS HVAC controller utilizes a rule-based inference system to determine the optimal setpoint using combinations of input values from the sensors and price values from the smart grid.Depending on the inputs and energy prices, the rules are fired, and the optimal setpoint value is delivered to the controller to adjust the desired temperature.The proposed HVAC controller can be extended with an additional number of parameters to increase the control efficiency and can be embedded in an IoT system.
RTOS is a highly scalable micro-kernel-based real-time operating system designed for scalability and reliability and is easier to implement with IoT applications.For this reason, the study considered the Nucleus RTOS operating system.The combinatoric method generates 175 rules automatically based on the five proposed input parameters.The variation in ambient temperature and humidity is measured using the thermodynamic model [57], occupancy number using the million per pert model [25], and energy price from the smart grid incentive, which is sent to the feedback loop system together with the desired initialized setpoint.

Modeling of Indoor Cooling System
This study adopts the indoor cooling strategy proposed in [52,58] to maintain the desired temperature level in a zone.Figure 3 shows that the air conditioner has provided the zone with the required energy to maintain the desired temperature corresponding to the initial thermostat setpoint settings.Whenever the building is occupied, the occupancy prediction sensor attached to the thermostat sends a signal to the proposed controller, which in turn commands the air conditioner to start operating depending on the number of occupants in the building.The air Whenever the building is occupied, the occupancy prediction sensor attached to the thermostat sends a signal to the proposed controller, which in turn commands the air conditioner to start operating depending on the number of occupants in the building.The air conditioner works by introducing outdoor air (OA) to increase the cooling load and dilute the level of CO 2 produced by occupants, updating the thermal comfort to an acceptable level.The exhaust air (EA) is connected to the outdoor air damper to control the flow of return air (RA) to attract combination air (MA) into the air handling unit.The combination air is dehumidified by a cooling coil (CC), humidified by a humidifier (HD), and heated by a heating coil (HC) to achieve the preferred air mixture for the air-conditioned zone.
The model starts by measuring the difference between sensible heat temperature (T HA ), outside air moisture (M OA ), room temperature (T RA ), and return air moisture (M RA ) and sends a signal to the controller.After that, the control parameters of the mass flow rate of the air stream ( .m a ), heater input power percentage (α), humidifier output power percentage (γ), and outside air damper opening (ß) of the HD, HC, and CC are changed, and the air conditioner then begins to lower the room temperature.The given values of T HA are again compared with room T RA and M RA and sent to the feedback loop.The steady flow in the mixing procedure for energy optimization can be presented as shown in Equation (5).
The mass of moisture air can be balanced as shown in Equation ( 6). (

Cooling Model
This study adopted a cooling model [52,58] to convert the energy in a chiller, which uses a chilled water cycle in conjunction with the evaporator.The steam in moist air condenses moisture as air moves through it, resulting in a lower temperature in the chilled water and a higher temperature in the return air dewpoint.The chilled water coil receives the mixed air, eliminating the sensible and latent heat of the air (Qes and Qel).The dehumidified and cooled air is fed to the heater.As air circulates in the chilled water, the heat exchange rate reaches 100%, making it easier to extract condensed moisture from the coil instantly by gravity (see Figure 4), representing steady flow operation.
conditioner works by introducing outdoor air (OA) to increase the cooling load and dilute the level of CO2 produced by occupants, updating the thermal comfort to an acceptable level.The exhaust air (EA) is connected to the outdoor air damper to control the flow of return air (RA) to attract combination air (MA) into the air handling unit.The combination air is dehumidified by a cooling coil (CC), humidified by a humidifier (HD), and heated by a heating coil (HC) to achieve the preferred air mixture for the air-conditioned zone.
The model starts by measuring the difference between sensible heat temperature (T ), outside air moisture (M ), room temperature (T ), and return air moisture (M ) and sends a signal to the controller.After that, the control parameters of the mass flow rate of the air stream (m ), heater input power percentage (α), humidifier output power percentage (γ), and outside air damper opening (ß) of the HD, HC, and CC are changed, and the air conditioner then begins to lower the room temperature.The given values of T are again compared with roomT andM and sent to the feedback loop.The steady flow in the mixing procedure for energy optimization can be presented as follows: The mass of moisture air can be balanced as follows:

Cooling Model
This study adopted a cooling model [52,58] to convert the energy in a chiller, which uses a chilled water cycle in conjunction with the evaporator.The steam in moist air condenses moisture as air moves through it, resulting in a lower temperature in the chilled water and a higher temperature in the return air dewpoint.The chilled water coil receives the mixed air, eliminating the sensible and latent heat of the air (Qes and Qel).The dehumidified and cooled air is fed to the heater.As air circulates in the chilled water, the heat exchange rate reaches 100%, making it easier to extract condensed moisture from the coil instantly by gravity (see Figure 4), representing steady flow operation.By ignoring the variance potential and kinetic energy, the energy optimization of the chilled water can be presented as follows: The energy of dry air and water vapor is divided into the humid air energy variance: By ignoring the variance potential and kinetic energy, the energy optimization of the chilled water can be presented as Equation ( 7) The energy of dry air and water vapor is divided into the humid air energy variance: Since Qes affects only the air temperature and Qel affects only the air vapor, then Equation ( 8) can be written as shown in Equations ( 9) and (10):
Equation ( 10) can be simplified to the vapor mass conservation equation, as presented in Equation (11).
Q el h fg = .

Humidifier Model
The output power (γ . Q L ) of the humidifier is used to transfer electrical energy to latent heat.A steam humidification model is applied to the system to adjust the humidity of the air supply.The air that the machine has treated is pumped into the air conditioning zone.However, under this condition, variations in humidity can affect the indoor temperature.Equation ( 12) represent humidifier which can be used as a basic vapor mass conservation equation.The humidifier can be presented as follows:

Integration of the Thermal Comfort Model
The variation in temperature, occupancy, and other indoor variables that can transfer heat to the space can significantly influence the thermal comfort of the air-conditioned zone.Therefore, the thermal comfort variation modeling based on the dynamic energy optimization equation in [52] is adopted as follows: .
If the potential and kinetic energy variations are disregarded, Equation ( 13) can be reduced as follows: .
Since different indoor parameters can influence air conditioning loads, the thermal comfort state can represent .Q rs and .Q rl , and Equation ( 14) can be used to derive the energy optimization (Equation ( 15)) for an air-conditioned zone: The change in the air-conditioned zone humidity is presented below: where .m a c p (T SA −T RA ) is energy and .m a (w SA −w RA ) is mass vapor, considering the vari- ation in indoor parameters in the air conditioning zone.Equation ( 16) can be joined with the thermal model.The resulting equations (see Equations ( 17) and ( 18)) below are applied to measure the variation inindoor comfort.Q rl h fg (18)

System Model Implementation
When dealing with the control system, the operation is mathematically modeled for traditional buildings but is not needed in intelligent systems (i.e., model-free automatic controllers).Model-free controllers previously proposed in [52, 58,59] do not implement feedback control.One of the reasons is that these studies were designed to recognize occupancy status as an indicator of occupants present in the building.However, predicting the occupancy status in the building cannot provide enough information to adjust the setpoint temperature accurately.
Hence, the research considered occupancy numbers intending to make the controller respond whenever occupants enter or exit the building.Previous research [31,59] presents a framework on how occupancy can be estimated and used by the fuzzy controller to balance HVAC energy consumption with thermal comfort according to the occupancy of the building.Therefore, unlike in previous studies, the proposed controller can adjust setpoint temperature concerning room occupancy without having to adjust other parameters like indoor carbon dioxide or humidity through feedback control.At the same time, occupants can choose their preferred comfort levels through initialized setpoints using an adaptive control strategy [24].

Temperature Input
Indoor temperature is a crucial factor in assessing user comfort.In many cases, indoor temperature is the driving factor that influences HVAC energy consumption.Maintaining an average temperature in harsh weather conditions can lead to high energy consumption.

System Model Implementation
When dealing with the control system, the operation is mathematically modeled for traditional buildings but is not needed in intelligent systems (i.e., model-free automatic controllers).Model-free controllers previously proposed in [52, 58,59] do not implement feedback control.One of the reasons is that these studies were designed to recognize occupancy status as an indicator of occupants present in the building.However, predicting the occupancy status in the building cannot provide enough information to adjust the setpoint temperature accurately.
Hence, the research considered occupancy numbers intending to make the controller respond whenever occupants enter or exit the building.Previous research [31,59] presents a framework on how occupancy can be estimated and used by the fuzzy controller to balance HVAC energy consumption with thermal comfort according to the occupancy of the building.
Therefore, unlike in previous studies, the proposed controller can adjust setpoint temperature concerning room occupancy without having to adjust other parameters like indoor carbon dioxide or humidity through feedback control.At the same time, occupants can choose their preferred comfort levels through initialized setpoints using an adaptive control strategy [24].

Temperature Input
Indoor temperature is a crucial factor in assessing user comfort.In many cases, indoor temperature is the driving factor that influences HVAC energy consumption.Maintaining an average temperature in harsh weather conditions can lead to high energy consumption.Figure 5 depicts the indoor temperature membership.The variable temperature was modeled with five fuzzy sets for indoor temperature labeled normal (N), warm (W), hot (H), very hot (VH), and extremely hot (EH), with a value range of 15-40 °C.

Humidity Input
The humidity variable has a significant influence on the change in the desired thermal comfort level.Therefore, incorporating relative humidity into the proposed system is essential to assessing indoor comfort.The ASHRAE standard, based on the guidelines presented in [24,25], was used to model temperature and humidity to ensure indoor thermal comfort.Therefore, humidity is modeled with three fuzzy sets labeled low (L), normal (N), and high (H) with a value range of 30-100%.

Occupancy Input
Occupancy status has been used in previous studies as an indicator of room occupation to start ventilation activities, but it could not be used to increase or describe ventilation requirements.This study proposes the occupancy number as an input to a controller that can be used to set a temperature setpoint proportional to the occupancy number to balance energy consumption and thermal comfort.
This study uses an occupancy prediction methodology proposed in our previous work [59].The procedure consists of the room occupancy measurement and an output that is fed to the fuzzy system to generate the appropriate setpoint temperature.
Figure 6 displays the membership values for the occupancy input parameter and is labeled absent, low, medium, or high.The proposed controller can handle a 175-occupancy capacity.
The humidity variable has a significant influence on the change in the desired thermal comfort level.Therefore, incorporating relative humidity into the proposed system is essential to assessing indoor comfort.The ASHRAE standard, based on the guidelines presented in [24,25], was used to model temperature and humidity to ensure indoor thermal comfort.Therefore, humidity is modeled with three fuzzy sets labeled low (L), normal (N), and high (H) with a value range of 30-100%.

Occupancy Input
Occupancy status has been used in previous studies as an indicator of room occupation to start ventilation activities, but it could not be used to increase or describe ventilation requirements.This study proposes the occupancy number as an input to a controller that can be used to set a temperature setpoint proportional to the occupancy number to balance energy consumption and thermal comfort.
This study uses an occupancy prediction methodology proposed in our previous work [59].The procedure consists of the room occupancy measurement and an output that is fed to the fuzzy system to generate the appropriate setpoint temperature.
Figure 6 displays the membership values for the occupancy input parameter and is labeled absent, low, medium, or high.The proposed controller can handle a 175-occupancy capacity.

Initialized Setpoint
The initialized setpoint is considered an input parameter to enable occupants to adjust the thermostat setpoints to fit their needs and preferences.For example, to minimize energy consumption and sacrifice comfort satisfaction, a high setpoint can be considered.On the other hand, if the occupant cares more about comfort than energy consumption, a lower setpoint is used.At the same time, a normal setpoint enables the thermostat to balance thermal comfort with energy consumption.On a timely basis, the proposed controller monitors the variation in initialized setpoints and assists in applying the applicable rule to adjust the thermostat based on occupant preference.The initialized setpoint values used are based on the recommendations in [24,52] for healthy indoor conditions.The initialized setpoint variable is modeled with three fuzzy sets labeled low (L), normal (N), and high (H) (see Figure 7).

Initialized Setpoint
The initialized setpoint is considered an input parameter to enable occupants to adjust the thermostat setpoints to fit their needs and preferences.For example, to minimize energy consumption and sacrifice comfort satisfaction, a high setpoint can be considered.On the other hand, if the occupant cares more about comfort than energy consumption, a lower setpoint is used.At the same time, a normal setpoint enables the thermostat to balance thermal comfort with energy consumption.On a timely basis, the proposed controller monitors the variation in initialized setpoints and assists in applying the applicable rule to adjust the thermostat based on occupant preference.The initialized setpoint values used are based on the recommendations in [24,52] for healthy indoor conditions.The initialized setpoint variable is modeled with three fuzzy sets labeled low (L), normal (N), and high (H) (see Figure 7).

Electricity Tariff
During the simulation process, it is essential to define the type of electricity tariff considered.Different electricity tariffs produce different output results on both energy usage and the distribution of thermal comfort analysis.Based on the three electricity tariffs proposed in [20], this study considered real-time pricing (see Figure 8) for evaluating

Electricity Tariff
During the simulation process, it is essential to define the type of electricity tariff considered.Different electricity tariffs produce different output results on both energy usage and the distribution of thermal comfort analysis.Based on the three electricity tariffs proposed in [20], this study considered real-time pricing (see Figure 8) for evaluating the proposed controller.The choice of electricity tariff is highly subjective to the types of building appliances.However, HVAC users can greatly benefit from a real-time pricing scheme that provides them with current energy costs and offers energy consumption choices (sacrifice of comfort, comfort satisfaction, or balance of energy cost with comfort level).Additionally, an occupant can modify the choice at any given moment as necessary, especially when receiving incentives from the grid during periods of extreme heat.The variable electricity tariff is modeled with three fuzzy sets labeled low (L), normal (N), and high (H) (see Figure 8).

Electricity Tariff
During the simulation process, it is essential to define the type of electricity tariff considered.Different electricity tariffs produce different output results on both energy usage and the distribution of thermal comfort analysis.Based on the three electricity tariffs proposed in [20], this study considered real-time pricing (see Figure 8) for evaluating the proposed controller.The choice of electricity tariff is highly subjective to the types of building appliances.However, HVAC users can greatly benefit from a real-time pricing scheme that provides them with current energy costs and offers energy consumption choices (sacrifice of comfort, comfort satisfaction, or balance of energy cost with comfort level).Additionally, an occupant can modify the choice at any given moment as necessary, especially when receiving incentives from the grid during periods of extreme heat.The variable electricity tariff is modeled with three fuzzy sets labeled low (L), normal (N), and high (H) (see Figure 8).Most energy suppliers today do not offer a flat rate for the energy used throughout the day.Residents noticed the difference in wholesale prices, particularly in harsh weather or during peak hours.When there is a large electricity demand.occupants will be charged Most energy suppliers today do not offer a flat rate for the energy used throughout the day.Residents noticed the difference in wholesale prices, particularly in harsh weather or during peak hours.When there is a large electricity demand.occupants will be charged the highest rate per kilowatt/hour during this time.Alternately, the proposed controller used the energy price parameter as an input value to control HVAC energy consumption.The parameter is provided with three membership variables as indicated in Figure 9 ("Low", "Normal" and "High") to help occupants lower the HVAC energy usage.the highest rate per kilowatt/hour during this time.Alternately, the proposed controller used the energy price parameter as an input value to control HVAC energy consumption.The parameter is provided with three membership variables as indicated in Figure 9 ("Low", "Normal" and "High") to help occupants lower the HVAC energy usage.

Generation of FIS Rules
The proposed approach is implemented using fuzzy rules to measure total energy usage.The rules in the FIS tend to increase in conjunction with the FIS input parameters.Combinatorics and 175 weightage rules are added to the existing 486 rules in [57].The weightage is assigned to each input parameter in the algorithm, which is then used to measure the score, which is then used to assign values to output parameters.
The process of FLC involves a fuzzification process to initialize and define all the input membership functions, a rule definition process to assign the required output fuzzy

Generation of FIS Rules
The proposed approach is implemented using fuzzy rules to measure total energy usage.The rules in the FIS tend to increase in conjunction with the FIS input parameters.
Combinatorics and 175 weightage rules are added to the existing 486 rules in [57].The weightage is assigned to each input parameter in the algorithm, which is then used to measure the score, which is then used to assign values to output parameters.
The process of FLC involves a fuzzification process to initialize and define all the input membership functions, a rule definition process to assign the required output fuzzy value to the input parameter membership functions, and a defuzzification process following rule evaluation to achieve a crisp value for energy consumption.After that, the remaining performance metrics are determined.
To avoid the combinatorial growth of the IF-THEN rule, the score parameter is introduced as an indicator of energy consumption.The overall weights assigned to the variables' membership functions are used to measure the score.The weights are determined by the membership function, with weights of 0, 1, and 2 for low, medium, and high membership functions (see Algorithm 1).
The occupancy input parameter has binary weights of 0 or 1.The model for the rule generation algorithm is based on the score (S) of combinations of input parameters, as presented in Equation ( 19) below.

Simulation and Discussion
The proposed model's simulation analysis is discussed in this section to demonstrate the effect of the FIS feedback loop and the impact of adding an occupancy parameter.Due to the nature and behavior of the building occupancy, this study considered a 10 kW HVAC system for a small room.For testing and validation, air flow should be from the higher pressure zone to the lower pressure zone in the room, the fresh air intake must be calculated for each HVAC cycle, the average air velocity of laminar flow should be 90 ± 20%, and openings such as doors or windows should be closed (not to exceed more than 15 min) to allow room comfort levels to recover properly.
The case study incorporated an innovative lightweight structure approach utilizing a stick-built timber frame and a cassette floor-building system.The thermal properties and thicknesses of the building materials are shown in Table 1.These attributes are useful for assessing occupant dynamics and steady behavior.It is important to note that ethical approval was obtained from the Monash University Research Ethics Committee.Subsequently, informed consent was obtained from all participants involved in this research.

Impact of Using Feedback Loop
In this scenario, the proposed controller aims to respond to a change in the electricity tariff using the RTP scheme and change the initialized setpoint based on defining FIS rules.The proposed controller is designed to respond appropriately under the three scenarios considered in this study, though any additional scenario can be incorporated by simply modifying the fuzzy rules.The three scenarios include (a) when the occupants are concerned about the cost of energy usage and are keen to engage in the demand control strategy; (b) when the occupants are concerned with comfort requirements and are willing to bear the cost of electricity at any hour of the day; and (c) when the occupants try to balance comfort and energy usage and are willing to compromise the comfort level when the energy tariff is at its peak rate.
A temperature of 24 • C is within the acceptable indoor comfort level and is chosen as the initial setpoint throughout the experiments.Note that the temperature values used in the figures are in degrees Celsius throughout the study.Similarly, the study adopts ASHRAE Standard 55 for Thermal Environmental Conditions for Human Occupancy throughout the study [60].
Figure 10 represents the hourly indoor temperature in Johor Bahru, Malaysia.From 8:00 a.m. to 9:00 a.m. and from 4:00 p.m. to 8:00 p.m., the temperature was "hot."From9:00 p.m. to 11:00 a.m. and from 3:00 p.m. to 4:00 p.m., the temperature was considered "very hot." Figure 11 represents the state of indoor temperatures from 8:00 a.m. to 5:00 p.m..The goal of the controllers is to bring the room temperature to a satisfactory level under the initialized temperature (24 °C).The operation patterns indicate that both the existing and proposed controllers achieved fairly cool room temperatures except during peak energy demand periods.One of the reasons is that the occupants were worried about the cost of energy during these hours.In this setup, the feedback loop control did not show any impact during these hours, causing a predicted percentage of dissatisfaction (PPD) of 20% and 37% at 24.9 °C and 25.8 °C, respectively.Similarly, to maintain a healthy comfort level, no room should go beyond 20% PPD. Figure 11 represents the state of indoor temperatures from 8:00 a.m. to 5:00 p.m..The goal of the controllers is to bring the room temperature to a satisfactory level under the initialized temperature (24 • C).The operation patterns indicate that both the existing and proposed controllers achieved fairly cool room temperatures except during peak energy demand periods.One of the reasons is that the occupants were worried about the cost of energy during these hours.In this setup, the feedback loop control did not show any impact during these hours, causing a predicted percentage of dissatisfaction (PPD) of 20% and 37% at 24.9 • C and 25.8 • C, respectively.Similarly, to maintain a healthy comfort level, no room should go beyond 20% PPD.The pattern of indoor temperature control in the second scenario is the same as the state of the first scenario for the existing method, while the proposed approach reflects excellent temperature control during very hot periods, as indicated in Figure 12.This indicates that the proposed approach can manage indoor comfort through feedback loop control, resulting in an overall minimum and maximum PPD of 4.4% and 10% occurring at 24.1 °C and 24.3 °C, respectively, keeping indoor comfort satisfactory.One of the limitations of the existing approaches [26,52,57,58] is the lack of feedback loop control to respond to undesired comfort situations, especially in the afternoon when the temperature is not stable.The pattern of indoor temperature control in the second scenario is the same as the state of the first scenario for the existing method, while the proposed approach reflects excellent temperature control during very hot periods, as indicated in Figure 12.This indicates that the proposed approach can manage indoor comfort through feedback loop control, resulting in an overall minimum and maximum PPD of 4.4% and 10% occurring at 24.1 • C and 24.3 • C, respectively, keeping indoor comfort satisfactory.One of the limitations of the existing approaches [26,52,57,58] is the lack of feedback loop control to respond to undesired comfort situations, especially in the afternoon when the temperature is not stable.
excellent temperature control during very hot periods, as indicated in Figure 12.This indicates that the proposed approach can manage indoor comfort through feedback loop control, resulting in an overall minimum and maximum PPD of 4.4% and 10% occurring at 24.1 °C and 24.3 °C, respectively, keeping indoor comfort satisfactory.One of the limitations of the existing approaches [26,52,57,58] is the lack of feedback loop control to respond to undesired comfort situations, especially in the afternoon when the temperature is not stable.As can be seen in Figure 13, from 11:00 p.m. to 3:00 p.m., the temperature was "extremely hot."However, the proposed controller brought the temperature down as much as possible to ensure a satisfactory comfort level while accounting for the cost of energy consumption.As can be seen in Figure 13, from 11:00 p.m. to 3:00 p.m., the temperature was "extremely hot."However, the proposed controller brought the temperature down as much as possible to ensure a satisfactory comfort level while accounting for the cost of energy consumption.Similarly, in the third scenario, unlike the existing approach, the proposed approach reflects moderate temperature adjustment during very hot and extreme hours.This indicates that the proposed approach can manage indoor comfort levels through a feedback loop according to the state of the electricity tariff (see Figure 13).During peak hours, the cost of electricity tends to be higher than the rest of the day because of high energy demand.This is a strategy applied by energy providers to lower their energy loads and avoid power imbalances.

Energy Consumption
Because thermal comfort was given more consideration in both Scenario 2 and Scenario 3 (see Section 5.2), the controller had to keep the thermostat operating continuously to maintain the desired comfort level.Consequently, HVAC energy consumption increased.Whenever the room temperature reaches the desired comfort level, the thermostat shuts off the compressor for a while before the room temperature deviates from the desired level.This process will continue as long as the occupants are in the space.
As shown in Figure 14, the HVAC energy consumption is 18.6328 kW for Scenario 1, 32.4284 kW for Scenario 2, and 25.6724 kW for Scenario 3. In comparison with existing approaches [26] (IoFClime), the proposed approach can reduce energy consumption by up to 45% with the help of feedback loop control.Similarly, in the third scenario, unlike the existing approach, the proposed approach reflects moderate temperature adjustment during very hot and extreme hours.This indicates that the proposed approach can manage indoor comfort levels through a feedback loop according to the state of the electricity tariff (see Figure 13).During peak hours, the cost of electricity tends to be higher than the rest of the day because of high energy demand.This is a strategy applied by energy providers to lower their energy loads and avoid power imbalances.

Energy Consumption
Because thermal comfort was given more consideration in both Scenario 2 and Scenario 3 (see Section 5.2), the controller had to keep the thermostat operating continuously to maintain the desired comfort level.Consequently, HVAC energy consumption increased.Whenever the room temperature reaches the desired comfort level, the thermostat shuts off the compressor for a while before the room temperature deviates from the desired level.This process will continue as long as the occupants are in the space.
As shown in Figure 14, the HVAC energy consumption is 18.6328 kW for Scenario 1, 32.4284 kW for Scenario 2, and 25.6724 kW for Scenario 3. In comparison with existing approaches [26] (IoFClime), the proposed approach can reduce energy consumption by up to 45% with the help of feedback loop control.

Energy Consumption
Because thermal comfort was given more consideration in both Scenario 2 and Scenario 3 (see Section 5.2), the controller had to keep the thermostat operating continuously to maintain the desired comfort level.Consequently, HVAC energy consumption increased.Whenever the room temperature reaches the desired comfort level, the thermostat shuts off the compressor for a while before the room temperature deviates from the desired level.This process will continue as long as the occupants are in the space.
As shown in Figure 14, the HVAC energy consumption is 18.6328 kW for Scenario 1, 32.4284 kW for Scenario 2, and 25.6724 kW for Scenario 3. In comparison with existing approaches [26] (IoFClime), the proposed approach can reduce energy consumption by up to 45% with the help of feedback loop control.

Impact of Occupancy Variation
This section provides thermal comfort analysis with respect to the varying number of occupants in the conditioned zone using three different established scenarios.The proposed controller's primary goal is to achieve changes in indoor parameters that influence the level of thermal comfort.In this case, the controller is expected to respond to variations in the occupancy number through the feedback loop operation.
The interpretation of thermal comfort analysis with respect to the variation of occupancy is presented in Figure 15.This analysis was performed under the same indoor temperature and humidity settings as in Figures 11 and 12.The initial setpoint of 24 • C was set for 10 occupants.Every five minutes, 10 occupants were added to the zone, and a feedback loop was expected to update the controller with the current state of thermal comfort each time occupants were added.

Impact of Occupancy Variation
This section provides thermal comfort analysis with respect to the varying number of occupants in the conditioned zone using three different established scenarios.The proposed controller's primary goal is to achieve changes in indoor parameters that influence the level of thermal comfort.In this case, the controller is expected to respond to variations in the occupancy number through the feedback loop operation.
The interpretation of thermal comfort analysis with respect to the variation of occupancy is presented in Figure 15.This analysis was performed under the same indoor temperature and humidity settings as in Figures 11 and 12.The initial setpoint of 24°C was set for 10 occupants.Every five minutes, 10 occupants were added to the zone, and a feedback loop was expected to update the controller with the current state of thermal comfort each time occupants were added.HVAC operation is one of the primary factors that ensure a healthy living environment, which many studies claim can improve occupant productivity at work.This study adopted the Fanger thermal comfort scale to assess the potential of the proposed controller tomanage room temperature.Figure 15 represents the analysis of the thermal comfort of the proposed controller examined for three different scenarios (Scenario1, Scenario 2, and Scenario 3).In all scenarios, the controller is expected to maintain a room temperature of 19-24°C regardless of weather conditions or the number of occupants in the room.The controller was designed to assess thermal conditions and notify the thermostat to increase or decrease HVAC operation through feedback loop HVAC operation is one of the primary factors that ensure a healthy living environment, which many studies claim can improve occupant productivity at work.This study adopted the Fanger thermal comfort scale to assess the potential of the proposed controller to manage room temperature.Figure 15 represents the analysis of the thermal comfort of the proposed controller examined for three different scenarios (Scenario 1, Scenario 2, and Scenario 3).In all scenarios, the controller is expected to maintain a room temperature of 19-24 • C regardless of weather conditions or the number of occupants in the room.The controller was designed to assess thermal conditions and notify the thermostat to increase or decrease HVAC operation through feedback loop control every 30 min.
Thermal perception information in Figure 15 indicates that in Scenario 1, 10% of the participants reported normal (comfortable) temperature, 35% of the participants reported a warm temperature, 40% of the participants had no report, and 15% of the participants reported feeling very hot.
In Scenario 2, 88% of the participants reported a normal (comfortable) temperature and only 12% reported a warm feeling.Similarly, in Scenario 3, 78% of the participants reported a normal temperature, with only 22% of the participants reporting a warm temperature.
Our analysis demonstrates that Scenarios 2 and 3 produced the most satisfactory results, which were within the defined comfort bounds.Conversely, Scenario 1 produced the least satisfactory results.

Conclusions
Occupancy number and desired comfort level are essential parameters in modeling thermal comfort control, but they are often ignored or inappropriately applied.To attain higher energy savings and satisfactory comfort, the occupancy number and desired comfort parameters must be considered.This study added occupancy and desired comfort parameters to the existing FIS to improve the user experience with regard to energy savings and thermal comfort.Consequently, the defined fuzzy rules were modified to deal with various scenarios.Compared with the existing fuzzy approaches, the results indicate that our study performed better in maintaining the desired comfort level with lower energy consumption.
The major limitations of the proposed controller include difficulty in setting appropriate temperatures as the number of occupants increases in the building and difficulty setting appropriate temperatures in buildings exposed to external factors that modify the original atmosphere of the building (e.g., laboratories, kitchens, etc.).In the future, we will investigate adding other input parameters to the proposed approach to account for real-world scenarios, determine the estimated energy consumption during peak hours, and provide occupants with options for energy consumption.Because the proposed system only allows occupants to specify their comfort preference level without presenting the current electricity tariff, occupancy prediction can also be improved through the machine learning technique.This is because using carbon dioxide to predict the number of occupants before and during the ventilation process is quite subjective.Another possible improvement in this study is the use of an "early" temperature, which could significantly improve energy consumption and thermal comfort by predicting occupant arrival and departure.

Figure 1 .
Figure 1.Fuzzy-based HVAC controller.This study uses an 11-point thermal sensation scale (on a scale of −5 to 5), as shown in Figure2.

Figure 5
depicts the indoor temperature membership.The variable temperature was modeled with five fuzzy sets for indoor temperature labeled normal (N), warm (W), hot (H), very hot (VH), and extremely hot (EH), with a value range of 15-40 • C. Appl.Sci.2023, 13, x FOR PEER REVIEW 9

22 Figure 14 .
Figure 14.Comparison of energy consumption under three settings.

Figure 15 .
Figure 15.Analysis of occupant thermal comfort perception for the proposed approach.

Figure 15 .
Figure 15.Analysis of occupant thermal comfort perception for the proposed approach.
to Humidity rel [n] do ForOutdoor T [1] to Outdoor T [n] do ForIndoor T [1] to Indoor T [n] do ForP rates [1] to P rates [n] do ForISP s [1] to ISP s [n] do

Table 1 .
The thermal properties and thicknesses of the building materials.