Intelligent Tuning of PID Using Metaheuristic Optimization for Temperature and Relative Humidity Control of Comfortable Rooms

. In order to provide the comfortable areas for human, the comfortable rooms are the basic needs area, controlled temperature, and relative humidity (RH). The aim of this study is to control and maintain the temperature and RH of the comfortable room using a proportional integral derivative (PID) controller tuned by metaheuristic optimization. In tuning gains of the PID controller, the modern metaheuristic optimizations, ant colony optimization (ACO), and symbiotic organism search (SOS) are applied and the performance of the proposed control system is compared to that of the traditional methods. In the experimental testing, the controlled room size is tested in the area of width 7.80m, length 8.00m, and height 3.80m. The simulation results show that the performance of the proposed control system-tuned gains of PID controllers by using SOS algorithm has the least steady-state error with 15% rise time and also the overshoot can reach the setpoint. In the case of disturbance occurring in the system, the proposed control system is able to approach the setpoint. Therefore, the PID controller tuned by SOS algorithm can regulate the temperature and humidity of the comfortable room, proﬁciently.


Introduction
One of the most important in human life for working, resting, and others is in a comfortable environment for performing activities.Its effectiveness concentrates on work efficiency, quality of life, labour productivity, and also human health.By human nature, an average human being spends 90 percent of his life in a room to perform various activities [1].As mentioned previously, a room that makes human comfortable is a crucial part considered while performing indoor activities.In schools, a comfortable environmental condition can increase learning by students [2].In hospitals, a comfortable room can reduce seclusion, restraint use, and assaultive behaviors of clients [3].To construct a comfortable room, both environmental conditions and human factors affect the thermal comfort.For environmental conditions, temperature and RH play an important role.
ere are many research studies about thermal comfort rooms with an air-conditioned system such as drying room [4] and garment workshop room in schools [2] and hospitals [3].
According to the American Society of Heating, Refrigerating and Air-Conditioning Engineers (ASHRAE) standard, thermal comfort is the condition of the mind expressing satisfaction with the thermal environment.ailand is a country situated in tropical zones.e comfortable temperature range of ASHRAE standard is between 22 °C and 27 °C.Also, the thermal comfort for the humid tropical range is between 24 °C and 27 °C limit with an RH of 50% to 60% [5].
In order to control the temperature and RH within the comfort range, PID controllers are widely applied.e proper design of the PID controller plays an important role in balancing the temperature and RH.Xiaochen and Chunxuan [6] studied how to control the temperature and RH of an air-conditioned room using a PID controller design method based on internal model control (IMC-PID) for controlling the multivariable system.Febiyani et al. [2] studied the influence of temperature and RH on meat-dry room, which caused overuse of energy, by using a digital separation method.e analysis showed that there was a clear pairing in drying room control.e deviation of RH control would increase 1-1.5%, and the accuracy of temperature control will increase up to ±0.1 °C.Gouda [7] studied the strategic development of controlling fuzzy ventilation to ventilate hot air and reduce humidity in a laboratory.e combination of improving the condition and the steady state in creating comfort conditions was studied to set the range of setpoint.In general, the capacity of ventilation control system based on sprinkle process decreases the energy usage and improves environmental condition.Hung et al. [8] studied an interesting controlling method by advance setting of the intelligent predetermined control method (IPCM) in order to improve the use of energy and water.An increase in temperature with a stable RH under the condition of no load is considered to test the possibility of IPMC.e results showed that IPCM could save energy and water and also had complexity in controlling temperature and humidity accurately.Outanoute et al. [9] introduced a method focused on using artificial intelligence in constructing a model of temperature and RH within a glass house.Recurrent artificial neural network, time relay, and MATLAB/Simulink were also used.
e experiment showed that this method could predict the temperature and RH within a glass house with high accuracy.Behrooz et al. [10] suggested a new model using fuzzy cognitive map (FCM) to control the parameter of air conditioning (A/C) of direct expansion (DX).e design of FCM suitable for airconditioning systems might increase the efficiency of energy use and save more energy for building automation.
Over the last decades, metaheuristic algorithms are becoming an increasingly popular part of the optimization method implanted to simplify the difficulties.It is inspired by natural behaviors and biological events.Most of the ACO and SOS methods are widely applied in the simulation systems.However, these are not applied to the real systems.Evidently, ACO and SOS are very challenging algorithms to be considered.
e ACO is a metaheuristic algorithm proposed to solve hand combinatorial optimization problems.It is inspired from the behavior of real ants with the pheromone trail laid by them.e ACO can be applied to different fields of work, especially for tuning PID.Chiha et al. [11] proposes a new tuning PID controller method using multiobjective ACO compared to Ziegler-Nichols (Z-N), genetic algorithm (GA), and ACO.Qiu et al. [12] applied ACO tuning to the PID algorithm for precision control of functional electrical simulation.On the other hand, the SOS was first introduced in 2014 as a new metaheuristic optimization algorithm by Cheng and Prayogo [13].It describes the symbiotic interaction strategies among organisms in order to survive in an ecosystem.Many research studies apply SOS to tune the PID controllers for wastewater treatment process [14], integrated power system, multiarea power system, and load frequency control [15].Furthermore, there are some studies combining SOS and ACO with many techniques for tuning PID.Huang [16] combines two metaheuristic algorithms, genetic algorithm (GA) and ACO, for finding the optimal kinematic controller of four-wheeled omnidirectional mobile robots.
eir simulation results present better performance in achieving both trajectory tracking and stabilization.Çelik and Öztürk [17] propose a hybrid SOS and simulated annealing (hSOS-SA) technique applied to tune PID controllers for automatic voltage regulators (AVRs).e results were more accurate and more stable than using the original SOS.Truong et al. [18] improved SOS algorithms by integrating Quasi-Opposition-Based Learning (QOBL) and Chaotic Local Search (CLS) for global optimization problems.
e proposed algorithm provides a more accurate solution than the original SOS.
ere are many studies which applied the metaheuristic optimization for tuning the PID controller and also improved these algorithms to obtain better solutions for various problems.However, only a few research studies established in real-world systems.Blondin et al. introduce a novel combination of ACO and Nelder-Mead method (ACO-NM) to find an optimum tuning for PID controllers.
ey present for solving the real automatic voltage regulator (AVR) problems.e ACO-NM obtains better or equivalent solutions [19].Mandava and Vundavilli propose the newly Modified Chaotic Invasive Weed Optimization (MCIWO) algorithms for tuning to obtain gains of K p , K i , and K d for the biped robot [20].
e MCIWO is seen to converge quickly when compared with the PSO-based controller.erefore, it is unsure how metaheuristic optimization performs in tuning the optimal PID controller applied for the real-world systems.
As mentioned earlier, this study aims to apply metaheuristic algorithms ACO and SOS in tuning the PID controller for controlling temperature and RH by constructing the real comfortable room system.In Section 2, the information about comfortable room and four optimization control techniques of Z-N, pole placement, ACO, and SOS are briefly described.Meanwhile, the comfortable room plant and the optimal parameters of ACO and SOS are illustrated in Section 3. e results of this study are therefore investigated and discussed to show how ACO and SOS perform in Section 4. Finally, the overview of this study is summarized in Section 5.

Theories
2.1.Principle of Comfortable Room.In order to make people feel comfortable, a comfortable room is designed and controlled following the ASHRAE 55 standard which sets the prediction index for predicting comfort condition of a person to the surrounding environment.is is called the predicted mean vote (PMV).e comfort temperature is defined between 23 and 27 °C, and RH is in the range of 30-70%.
e principle of refrigeration is the process of extracting heat from a room that requires a temperature drop by using the heat transfer process through the refrigerant.en, the refrigerant transfers heat to the outside air by using the vapor process, condensation, expansion, and evaporation.However, the A/C system is able to control the 2 Journal of Control Science and Engineering temperature in the control area according to the desired conditions.e A/C system can control not only the temperature but also the RH, quality, circulation air, and noise levels in air-conditioned or working areas [5].

Relative Humidity and Moisture Content.
Relative humidity is the ratio of water vapor pressure to the saturation water vapor pressure at the same temperature and pressure.RH can be expressed as follows: where P w is a partial pressure of the actual water vapor present in the air and P ws is a saturation of pure water vapor at the same temperature.e moisture content or humidity ratio is the mass ratio of water vapor in humid air to the mass of dry air.It can be formulated as where m w and m a are the masses of water vapor and dry air, respectively [6].
Figure 1 shows the states of temperature, RH, and moisture content in the air-conditioning system.e condition of the air at various positions goes to the position state 1. e air has a high, dry bulb temperature (Tdb), and a certain amount of RH is passed through the evaporator coil.
e temperature decreases by 100%.RH and some water droplets come out of the cooling system set becoming air at position 2. e air will pass through the heater wire causing the temperature to rise while the specific humidity is stable becoming climate at position 3.
en, the air will pass through the humidifier to become the air with desired RH and desired temperature in a comfortable room at position 4.

Ziegler-Nichols Method.
e process of selecting the control parameters is known as controller tuning.In 1942, Z-N suggested rules for tuning PID controllers [21].e values of PID parameters are set based on the experimental step responses, or the value of that results in marginal stability when only proportional control action is used.Z-N rules are useful when mathematical models of plants are not known.Such rules suggest a set of values that will provide a stable operation of the system.However, the result of the system may exhibit a large maximum overshooting in the step response, which is unacceptable.In such cases, the series of fine tunings for an acceptable result are obtained.In fact, the Z-N tuning rules provide an educated guess for the parameter values and provide a starting point for fine tuning, rather than giving the final settings for and in a single shot.Figure 2 shows the Z-N diagram open loop and close loop.e switch is selected for the manual positioning in the process of open-loop test.Consequently, the switch will be selected for auto positioning in the process of closed-loop test [21].
From Figure 2, a step-by-step signal block is used to examine the system response using an open-loop test, choosing the switch for manual positioning, and closed-loop test, also by selecting the switch for auto positioning.In this research, an open-loop test is examined to find the plant model and the parameters of PID controller are shown in (3) and Table 1, respectively.e transfer function of open-loop test can be approximated by using the first-order system with a delay time as where T, L, and K are the time constant, delay time, and process gain, respectively, C(S) is a process response, U(S) is a unit-step input signal, and G p (S) is a process transfer function [21].Figure 3 indicates the open-loop test when the signals enter into the loop by the unit-step response.Table 1 shows the Z-N rule based on step response of the plant's open-loop method, and also, the gain values of the controller, K p , T i , and T d , a proportional gain, a integral time, and a derivative time, respectively, are demonstrated [21].

Pole Placement Method.
e pole placement method is a controller designed by specifying the controller gains of K p , K i (integral gain), and K d (derivative gain) showing effectiveness of the poles of the closed system in meeting the desired pole location by comparing the coefficients with the second-order system relative to the natural frequency (ω n ) and damp damping ratio (ξ) value as where ω n is a natural frequency and ξ is a damping ratio [21].

Ant Colony Optimization
. ACO is, a population-based metaheuristic algorithm, inspired by the real behavior of ants hunting for food.ACO is used to find the optimal solutions to solve the nonlinear problems.e ants move on the graph based on stochastic process and bias of a pheromone.Generally, ants will travel from their nest to the food source and return to the nest after getting the food.While travelling, ants will release a chemical called pheromone for other ants to follow, either by smelling or tracing the tract of pheromone.After a while, pheromone will evaporate due to its chemical property.Due to this property, the route which is too long will cause total evaporation of pheromone.However, for a short route, there is more chance to produce pheromone while going out and returning before evaporation of pheromone.When lots of ants travel together or travel many times, the density of pheromone will decrease because the evaporation is higher, and if there are few ants, there will be less pheromone since there is more evaporation.Few ants will also cause dilution of pheromone, hence not attracting other ants [22].us, ACO is used in real-world problems for finding the best path on a weighted graph.Journal of Control Science and Engineering eoretically, the ants choose the nodes or the cities to travel and release a pheromone by a probabilistic state transition rule [23]: e ants select the node by multiplying the relative influence of pheromone factor, τ ij , with an exponential power of a constant α, and heuristic factor, η ij , with an heuristic information power of a constant β.
e probability distribution for choosing the next node can be written as where h is the selected node belonging to S, S is a set of nodes, and α ≥ 0 and β ≥ 0 are the constants that determine the relative influence of the pheromone values and the heuristic values on the decision of the ant with probability In ACO, the heuristic factor is computed as where f(X) is an objective function of X at j.In the computation of the global updating rule, the different pheromone factors can be defined as where Q is a constant related to the quality of pheromone trails laid by ants and L k is the cost of the tour performed by the k th ant.
In the following local updating rule, the pheromone factor of the next step can be calculated as where Δτ ij (t) �  m k�1 τ ij (t), m is the number of ants, ρ is a coefficient, ρ ∈ (0, 1) of persistence of the trail during a cycle, and (1 − ρ) is the evaporation of trail between generations n g and n g + 1. Figure 4 indicates the diagram of ACO.

Symbiotic Organisms
Search.SOS is a step of searching living organisms.It is of up-to-date development having a high tendency for metaheuristic optimization.Furthermore, SOS is a natural philosophy inspired by the behavior of reaction between organisms living in the nature.In general, the process of organisms developing a symbiotic relationship is considered a kind of strategy in adapting with the change in the environment [24].e SOS algorithm has two control parameters: ecosize and maximum function evaluation (MaxFE).e ecosize represents the number of organisms in the ecosystem.MaxFE represents the maximum number of iterations.e cycle of the three types of research will imitate the biological relationship called mutualism, commensalism, and parasitism.When processing the three steps, SOS is able to transfer the population, called ecological solution, which is possible in the area with a tendency of researching in the best path of the area.Figure 5 shows the diagram of SOS: To solve the problem of new value, X i is calculated according to the commensal between organisms.In computing the new organism X inew , X i will be updated only when moved properly to a new place: Organism X j is sampled from the ecology and functions as the starting point of parasite vector trying to replace X j in the ecological system.e two types of organisms will be evaluated to check the capacity.If the parasite vector has a higher value, it will kill X j .If the strength of X j is better than that of X j , it will have immunity against the parasite and parasite vector will not be able to survive in the ecological system [25].

PID Controller.
PID controller is a feedback control system used widely in the industrial processes and buildings.
e error signal is obtained by the difference of variability in the process and the setpoint value required.e controller tries to reduce the error as much as possible by adjusting the input signal of the process.e variant of PID adjusts according to the nature of the system.Block diagram of PID controller is shown in Figure 6 [26].
PID parameter calculation depends on three variables: proportion (P), integration (I), and derivative (D).Proportion is set by using the result of the error.An integral is set based on the principle of error sum occurred while derivative is set from the basis of the changing rate of the error.
e weight gained from the combination of these three variants will be used for adjusting the process.

Journal of Control Science and Engineering
Adjusting the parameter constant in PID controllers can help to develop the model for controlling suitable process needed.e response of the controller will be in the form of controller vibration up to the error, overshoots, and oscillation.e PID method may not be guaranteed to be the most suitable controller or able to make the process always stable.
For real use application, only one or two models are applied depending on the process.PID is also known as proportional integral (PI), proportional derivative (PD), proportional (P), or integral (I) controller.PID controller Mv(t) is based on the combination of three variables as follows: Locally, update the pheromone trails using the local updating rule as in equation ( 9) Globally, update the pheromone trails using the global updating rule in equation ( 8) ( where P out , I out , and D out are the results of proportional, integral, and derivative output signals of PID controller system, respectively, U(t) is the desired process value or setpoint (SP), C(t) is the measured process value (PV), and e(t) is an error, calculated as C(t)-U(t).

Mathematical Model for Tuning the Gain of PID
Controller.In this paper, the mathematical modelling has been proposed for tuning the PID controller and novel parameter optimization is constructed as follows: objective function: minimize(MSE) where MSE �  n i�1 (C(s) − R(s)) 2 , C(s) is a temperature or RH setpoint, and R(s) is a temperature or RH output.
e interval of three constraints K p , K i , and K d is collected covering from the maximum and minimum values in each case of tuning K p , K i , and K d with Z-N and pole placement as shown in Table 2.

Experimental Comfortable Room Setup.
e experimental comfortable room is set within the area of width 7.80 m, length 8.00 m, and height 3.80 m with two sets of 25,000 BTU air conditioners.Figure 7 shows the structure of a comfortable room.e real comfortable room system is constructed as shown in Figure 8.
Based on Figures 7 and 8, tools in comfortable room used in this study consist of dSPACE, heat tank, heater, and evaporator.e dSPACE is a tool for receiving and sending signals both from analog to digital, and vice versa.Heat tank refers to the heater, which boils water to increase RH required by the system.e heater is a machine used to increase the temperature as required by the system.Evaporator is an air-conditioning set which increases or reduces the temperature as required by the system.In order to compute the ACO and SOS algorithms, the MATLAB/ Simulink is applied for designing, controlling, and processing the procedure.
Figure 9 shows the steps of conducting the research to control temperature and RH using the PID controller.To calculate the most suitable parameter, the following four methods of state water level are determined as follows: Step 1: collect data and review related research Step 2: construct mathematical models of the original and up-to-date model Step 3: design the original PID controller (using MATLAB/Simulink) consisted of controlling by pole placement and Z-N methods Step 4: design an up-to-date PID controller (using MATLAB/Simulink) for controlling by pole placement and Z-N methods

Parameter Setting.
e schematic of a comfortable room when PID controllers are added and the control interface for controlling temperature and RH after gaining the PID controller are shown in Figures 10(a For solving most of optimization problems, the number of ants (NA) and ecosize are usually chosen between 10 and 50.MSE is used to determine the optimal case based on the least MSE.e parameters α, β, and ρ of the ACO are set at 0.5, 0.5, and 0.05, respectively.e parameter settings of the ACO are determined by step testing in the range, namely, 0 < α < 1, 0 < β < 1, and 0 < ρ < 0.1 [27].Five different cases of NA and ecosize are examined which varies from 5, 10, 20, 30, and 50.For ACO, the optimal NA is 20 and 5 for temperature and RH, respectively.For SOS, the most suitable ecosize is 30 for both temperature and RH. e number of iterations is determined under the condition of converging to the least MSE.e stopping criteria are set to 100 iterations for both ACO and SOS.All parameter settings for the real comfortable room are shown in Table 3.
e data of Z-N are calculated from Table 1, and the data of pole placement are computed from (3). e collected data of the ACO and SOS are simulated using MATLAB/ Simulink.e setpoint of the RH is set at 60% in case of temperature control chosen from the smallest mean square error.For controlling the RH, the setpoint is set at 25 °C of temperature.

Results and Discussion
Block diagram of PID controller with Z-N and pole placement methods is shown in Figure 11.Block diagram of PID    According to Table 2, the gain values of K p , K i , and K d with the least MSE are collected.
e 95% confidence interval is examined to declare the best results for the real comfortable room system.e simulation results of the RH control using the 4-methodology comparison including Z-N, pole placement, ACO, and SOS found that there are two best rise time responses from the ACO and the SOS  method.It can be seen the overshoot of both ACO and SOS satisfies within the range of 95% confidence interval in case of temperature controlling whereas the rise time of ACO is shorter than SOS.Consequently, the overshoot of SOS is within the range of 95% confidence interval while ACO cannot be used for RH control.erefore, the optimal case of gaining values of K p , K i , and K d by ACO and SOS is the best to control the temperature and RH, respectively, compared to others.After the optimal gained values of K p , K i , and K d are found, the simulation results are used in designing and controlling the comfortable room as shown in Figure 14.For the real comfortable room system, the gained values of K p , K i , and K d from the best experimental case for temperature and RH control are applied to examine their performance.Temperature and RH vary along upward and downward steps.
e temperature is within the interval of 20-25 °C, 25-30 °C, and 30-35 °C for upward variation.For downward variation, the temperature decreases at three intervals of 35-30 °C, 30-25 °C, and 25-20 °C.In the same way, RH is monitored upward for 50-60% and 60-70% and downward for 70-60% and 60-50%.As shown in Figure 14, the process response of temperature is considered by 60% of RH.It can be seen that the optimal parameters gain PID of ACO algorithm is capable of controlling the temperature oscillated near the setpoint.
e optimum experimental results of SOS algorithm for controlling RH are applied to control temperature as shown in Figure 15.e results of the upward sequent control of the RH ranging 50-60% and 60-70% and the downward sequent control of the RH ranging 70-60% and 60-50% reveal the controllable RH, followed by the RH SP signal.Figure 16 shows the process response results load interruption.As a result, SOS algorithm can be also used to control RH in a comfortable room, proficiently.It shows the responses of the control system in the comfortable room.e system can manipulate temperature and RH in the case of the load change condition.is leads to an oscillation of the temperature and the RH.However, the SOS control system is in charge of regulating the temperature and the RH back to the set point, efficiently.

Conclusion
In this study, the metaheuristic optimization algorithm is applied to find the optimal gain values of the PID controller in controlling temperature and RH for the real comfortable room system.Two metaheuristic algorithms of SOS and ACO are chosen to investigate by comparing with the Z-N and pole placement.e simulation results show that the optimal gain values of the PID controller derived from the ACO algorithm influence the fast achievement to a setpoint of the temperature.e SOS algorithm achieves the best performance with RH control.In order to apply the best simulation result with the real comfortable room system, the results are still able to control both temperature and RH, even though there is load changing in the comfortable room.For future work, the multiobjective functions of ACO and SOS algorithms are modified for controlling temperature and RH to accuracy for the real comfortable room system.12 Journal of Control Science and Engineering ) input for open-loop test U(s) input for close-loop test Output signal for open-loop test and close-loop test Man.Auto.

Figure 1 : 1 Figure 3 :
Figure 1: States of air properties in the comfortable room.(a) A/C system.(b) Psychometric chart.

Figure 11 :Figure 12 :Figure 10 :
Figure 11: Block diagram of PID controller by the Z-N and pole placement method.(a) Temperature plant.(b) RH plant.

Table 1 :
[21]tuning rule based on step response of plant by the open-loop method[21].

Table 2
indicates the parameter gain values of PID controllers using Z-N, pole

Table 2 :
Parameter gain of PID controller using various design methods.

Table 3 :
Parameter setting of ACO and SOS.