computers Article
Air Condition’s PID Controller Fine-Tuning Using Artificial Neural Networks and Genetic Algorithms Maryam Malekabadi, Majid Haghparast *
ID
and Fatemeh Nasiri
Department of Computer Engineering, Yadegar-e-Imam Khomeini (RAH) Shahre Rey Branch, Islamic Azad University, Tehran, Iran;
[email protected] (M.M.);
[email protected] (F.N.) * Correspondence:
[email protected] or
[email protected]; Tel.: +98-912-646-9737 Received: 9 February 2018; Accepted: 11 May 2018; Published: 21 May 2018
Abstract: In this paper, a Proportional–Integral–Derivative (PID) controller is fine-tuned through the use of artificial neural networks and evolutionary algorithms. In particular, PID’s coefficients are adjusted on line using a multi-layer. In this paper, we used a feed forward multi-layer perceptron. There was one hidden layer, activation functions were sigmoid functions and weights of network were optimized using a genetic algorithm. The data for validation was derived from a desired results of system. In this paper, we used genetic algorithm, which is one type of evolutionary algorithm. The proposed methodology was evaluated against other well-known techniques of PID parameter tuning. Keywords: genetic algorithms; optimization; artificial neural network
1. Introduction In general, optimization is a set of methods and techniques that is used to achieve the minimum and maximum values of mathematical functions, including linear and nonlinear functions. Essentially, optimization methods are divided in two forms: evolutionary separation methods and gradient-based methods. Nowadays, due to advances in science and technology, many methods have been developed so that the traditional gradient-based optimization methods became obsolete. Through evolutionary optimization methods, we introduce a genetic algorithm optimization method that can be applied to a neural network and Fuzzy nerve training. The first simulation efforts were conducted by Mac Klvk and Walter Pitts using the logical model of neuronal function that has formed the basic building blocks of most of today’s artificial neural networks [1–4]. The performance of this model is based on inputs and outputs. If the sum of entries is greater than the threshold value, the so-called neurons will be stimulated. The result of this model was the implementation of simple functions such as AND and OR [5]. The neuron adaptive linear model is another system, and was the first neural network used by Vydrv and Hough (Stanford University) in 1960 for real problems [6]. In 1969, Misky and Papert wrote a book where the perceptron plan was unable to solve any problems and they stopped conducting research in this field for several years [5]. In 1974, Vrbas set up learning with backward propagation as if it was a multi-layered instruction with even stronger rules education [7]. There are many studies on the tuning of PID controller parameters. For example [8] fuzzy logic is used for parameter tuning of a PID controller [9,10], and the IMC method has been used for the tuning of PID. The PID controller has been used in some studies involving air conditioning systems. The CARLA algorithm has been used in the tuning of a PID controller in an air temperature controller [11]. This algorithm is an online algorithm that has a good performance level in practical applications. Nowadays, too many changes in artificial neural network technology have occurred. The main contribution of this work is to create an online neural network for control that is based on an online network where it is normal to expect better results. Computers 2018, 7, 32; doi:10.3390/computers7020032
www.mdpi.com/journal/computers
Computers 2018, 7, 32
2 of 14
In Section 2, we describe the system model and related works. In Section 3, we provided the proposed methodology. Finally, in Section 4, we present the simulation results, and we provide a general conclusion in Section 5. A complete list of references is also provided. 2. Related Work The Earth system model always displays many of changes in the earth’s climate. International agreements such as the Kyoto Protocol and the Copenhagen Accord emphasize the reduction of carbon dioxide propagation as one of the main ways to deal with risk of climate change [12]. The suggestions made by the Chinese Government’s Electric and Mechanical Services Organization (25.5 ◦ C), EU expansion and Innovation of China (26 ◦ C), and the Ministry of Economy and Knowledge Republic of Korea (26–28 ◦ C) are related to the thermal environment and its optimization [13]. It is also possible to refer to the suggestion of the Carrier 1 software (25–26.2 ◦ C) in relation to the internal temperature [14]. The result of this research is logical and presents an acceptable increase in the average temperature of the air in summer. On the other hand, one of the most important human environmental requirements is the provision of thermal comfort conditions. The most common definition of thermal comfort has been defined by the ASHRAE Standard 55, which defines thermal comfort is that condition of mind that expresses satisfaction with the thermal environment [15]. Furthermore, researchers have concluded that humans spend between 80 and 90 percent of their lives in an indoor environment [16]. Hence, indoor air quality like thermal comfort, has a direct impact on the health, productivity, and morale of humans [17]. An increase in the average indoor air temperature in summer can improve the energy consumption of air conditioning systems and consequently is a solution against undesirable climate changes [18]. However, this action may disturb the residents’ thermal comfort conditions, especially in the summer. Therefore, optimizing energy consumption in air conditioning systems is a useful action to maintain thermal comfort conditions [19]. Among the most important studies in this area is the research that has been undertaken by Tian et al. [20]. By assessing the mean local air age, Tian et al. showed the average of the people’s vote indicator, relative to the thermal conditions of the environment and the percentage of dissatisfaction of the individuals. The “Layer Air Conditioning System” is able to meet the requirements of an increased internal air temperature by providing thermal comfort conditions only in the inhalation area of individuals [13]. Morovvat [21] examined the “Layer Air Conditioning System” in conjunction with the Hydronic Radiation Cooler, comprehensively in terms of thermal comfort, air quality, and energy consumption, and as part of his findings, he confirmed the conclusions of Tian et al. [20]. The combination of genetic algorithms with neural networks has been utilized, and provided prominent results in many real life applications [22–24]. A genetic algorithm is used by the strategy to solve the on-line optimization problem of multiple parameters [25].Marefat and Morovvat [26] introduced the combination of “Layer Air Conditioning System” with ceiling radiant cooling as a new way to provide thermal comfort. Lane et al. used a numerical simulation to compare the thermal comfort conditions and indoor air quality with a displacement and mixing air conditioning system in a room [27–29]. The radial basis function network offers a viable alternative to the two-layer neural network in many applications of signal processing [30]. Lane et al. compared annual energy consumption by mixing layer and displacement air conditioning systems and concluded that for a case study, the energy savings of layer air conditioning systems were 25% and 44% higher than displacement and mixing air conditioning systems. The proposed dynamic model is as Equation (1): y(k) =
a(k)·y(k − 1) + u(k − 1) + 0.2u(k − 2) 1 + y2 (k − 1)
(1)
Computers 2018, 7, 32
3 of 14
In Equation (1), PEER a(k) is a parameter Computers 2018, 7, x; doi: FOR REVIEW
changeable with time and will be given as Equation (2): www.mdpi.com/journal/computers
−0.3k −0.3k a(= k)1.4(1 = 1.4− 10.9e − 0.9e a(k) )
(2)
(2)
3. The Proposed Methodology 3. The Proposed Methodology Our work maintains an emphasis close loop control systems. In particular, the proposed approach Our work maintains an emphasis close loop control systems. In particular, the proposed updates in real time an A/C’s PID parameters using an optimized ANN. In this section, the following approach updates in real time an A/C’s PID parameters using an optimized ANN. In this section, the points should be considered: following points should be considered: The input to networks is designed to train the neural network error, an error derived 1. 1.The input datadata to networks is designed to train the neural network error, an error derived fromfrom the input output. the input and and output. 2. The designed network has four inputs outputs. 2. The designed network has four inputs and and threethree outputs. Simulations executed using MatLab software the neural network toolbox. 3. 3.Simulations werewere executed using MatLab software and and the neural network toolbox. Comparison performance ofneural the neural network system is squared the squared square of system 4. 4.Comparison performance of the network system is the square of system errorerror displayed as Equation displayed as Equation (3): (3): N 1 N N 1 (e1i )2N= (3) ∑ (2ti − ai )2 1F = N ∑ N 2 (3) F = ∑(ei )i=1= ∑(t i −i= a i1) N N i=1
i=1
In the above equation, (N) is the number of tested samples; (ti ) represents the neural network In the above equation, (N) isthe theactual number tested samples; (ti)For represents the neural network outputs; and (a andofavailable outputs. more information on all types i ) represents outputs; and (ai) represents actual and available outputs. For more information all types of of activation functions, the in the MATLAB software, three activation functions—aonsigmoid tangent, activation functions, in the MATLAB software, three activation functions—a sigmoid tangent, a a sigmoid log function and a linear function—are displayed in Figure 1. sigmoid log function and a linear function—are displayed in Figure 1.
Figure 1. (a)1.Sigmoid tangent; (b) sigmoid log function; and (c) function charts. Figure (a) Sigmoid tangent; (b) sigmoid log function; andpurelin (c) purelin function charts.
Computers 2018, 7, 32
4 of 14
Computation 2018, 6, x FOR PEER REVIEW
4 of 14
3.1. Control Systems
Computation 2018, 6, x FOR PEER REVIEW
4 of 14
3.1. Control Systems the structure and genetic algorithm, in this section our intention was to use a After expressing Computation 2018, 6, x FOR PEER REVIEW 4 of 14 3.1. Control Systems powerfulAfter optimization to train neural networkinand PIDtoparameters. expressingmethod the structure andthe genetic algorithm, this extract section the our controller intention was use a 3.1. Systems optimization method train the neural network and section extract the First,powerful we Control explain the structure of to the PID controller. After expressing the structure and genetic algorithm, in this our controller intention PID was parameters. to use a First, we explain themethod structure of thethe PID controller. powerful optimization to train neural network and extract the controller PID parameters. After expressing the structure and genetic algorithm, in this section our intention was to use a 3.1.1. Expression of structure the Performance ofcontroller. Classical PID Controllers First,powerful we explain the of the to PID optimization method train the neural network and extract the controller PID parameters. 3.1.1. Expression of the Performance of Classical PID Controllers First, wesystems explain the structure of in theboth PID controller. Control are available open loop control and closed loop control methods. Both 3.1.1. Expression of the Performance of Classical PID Controllers Control systems are available in both open loop control closed loop control methods. Both methods of control depend on the system architecture and theand control method used for that architecture. 3.1.1. Expression of the Performance Classical PID Controllers methods of control depend on system architecture and the control method used Both for that Control systems are available in the bothof open loop control and closed loop control methods. Control systems with feedback can be divided into two types. The first of these is single-input and architecture. Control systems with feedbackarchitecture can be divided two types.method The firstused of these singlemethods of control depend on the system andinto the control foristhat Control systems arethe available bothisopen loop control and loop control methods. Bothoften single-output systems, and secondinone the multi-input andclosed multi-output control systems, input andControl single-output systems, and the second one into is the multi-input and multi-output control architecture. systems with feedback can be divided two types. The first of these is singlemethods of control depend on the system architecture and the control method used for that referred to asoften multi-variable systems. systems, referred to ascontrol multi-variable control systems. input and single-output and the second one the multi-input and multi-output control architecture. Controlsystems, systems with feedback can be is divided into two types. The first of these is singlesystems, often referred to as multi-variable systems. input and single-output systems, andcontrol the second one is the multi-input and multi-output control Open-Loop Control Systems Open-Loop Control Systems systems, often referred to as multi-variable control systems. Open-Loop Control Systems A loop control system produceananoptimal optimal output value without receiving a A loop control systemisisdesigned designed to to produce output value without receiving a feedback system. In system this case, thethe reference signal to actuator and theactuator actuator controls the Open-Loop Control Systems feedback system. In this case, reference signalis isgiven given to the actuator the controls A loop control is designed to produce an optimal output valueand without receiving a the process. Figure 2 shows thereference structure of such agiven control system. feedback system. In this case, the signal is to the actuator and the actuator controls process. Figure 2 shows the structure of such a control system. A loop control system is designed to produce an optimal output value without receiving a the process. Figure 2 shows the structure of such signal a control system. feedback system. In this case, the reference is given to the actuator and the actuator controls
Desired output the process. Figure 2 shows the structure of such a control system. Activator process
Output Output Output
Desired output response Activator process response Desired output Figure 2. Open-loop control systems. Activator process Figure 2. Open-loop control systems. responseFigure 2. Open-loop control systems.
Closed Loop Control Systems Figure 2. Open-loop control systems. Closed Loop Control Systems In closed loop control systems, the difference between the actual output and the desired output closed loop control systems, the difference between the output and thesignal. desired Closed Control Systems isIn sent toLoop the controller, and thisthe difference is often amplified andactual is known error Theoutput In closed loop control systems, difference between the actual output andas thean desired output isissent to theof controller, and this difference is Figure often amplified and is known as an errorThe signal. The structure such a control system is shown in 3. sent to the controller, and this difference is often amplified and is known as an error signal. In closed loop control systems, the difference between the actual output and the desired output structure such acontrol controlsystem system isdifference shown inisFigure 3. structure of to such is shown in Figure 3. amplified is sent thea controller, and this often and is known as an error signal. The
Closed Loop Control Systems
Reference Reference input Reference input input
structure of such a control system is shown in Figure 3.
Subtractor Subtractor Subtractor
controller controller controller
process process process
Sensor Sensor Figure 3. Closed loop control system. Sensor Figure 3. Closed loop control system.
Process Process Output Process Output Output
Figure 3. Closed loop control system. Multi-Input, Multi-Output Control Systems Figure 3. Closed loop control system. Multi-Input, Multi-Output Control Systems By increasing the complexity of the control systems as well as increasing the number of control Multi-Input, Multi-Output Control Systems Multi-Input, Multi-Output variables, it was necessary toControl use theSystems structure of a multi-variable control system, which the same By increasing the complexity of the control systems as well as increasing the number of is control Byshown increasing the4.complexity of the control systems as well as increasing theisnumber of control as in Figure variables, it was necessary to use the structure of a multi-variable control system, which the By increasing the complexity of the control systems as well as increasing the number same of control as shown in Figure 4. variables, it was necessary to use the structure of a multi-variable control system, which is the same as variables, it was necessary to use the structure of a multi-variable control system, which is the same
shown Figure 4. asin shown in Figure 4.
Figure 4. Multi-input and multi-output control systems. Figure 4. Multi-input and multi-output control systems.
Figure 4. Multi-input controlsystems. systems. Figure 4. Multi-inputand andmulti-output multi-output control
Computers 2018, 7, 32
5 of 14
Computers 2018, 7, x; doi: FOR PEER REVIEW
www.mdpi.com/journal/computers
Proportional–Integral–Derivative Control (PID) Proportional–Integral–Derivative Control (PID) The PID control logic is widely used in controlling industrial processes. Due to the simplicity and The PID control logic is widely in controlling industrial processes. Due to the simplicity flexibility of these controllers, controlused engineers are using more of them in industrial processes and and flexibility of these controllers, control engineers are using more of them in industrial processes systems. A PID controller has proportional, integral, and derivative terms, and its transfer function and systems. A PID has proportional, integral, and derivative terms, and its transfer can be represented as controller Equation (4), function can be represented as Equation (4), K K ( s ) = Kp + K i i + Kd s (4) (4) K(s) = K p + s + K d s s where K represents the proportional gain, K represents the integral integral gain, gain, and and K Kdd represents represents the the p i where Kp represents the proportional gain, Ki represents the derivative gain. By adjusting the controller gain, the controller can perform the desired control, which derivative gain. By adjusting the controller gain, the controller can perform the desired control, which thesame sameas asthat thatshown shownin inFigure Figure 5. 5. isisthe
Kp e(t)
u(t) r(t)
e(t) +
-
t
Ki ʃ e(t)dt
process
y(t)
0
Kd de(t)/dt
Figure5.5.Closed Closedloop loopcontrol controlsystem systemwith withPID PIDcontroller. controller. Figure
3.2.Neural NeuralNetwork Network 3.2. Thestructure structureof ofthe theartificial artificialneural neuralnetwork networkmodel modelisisinspired inspiredby bybiological biologicalneurons. neurons.According According The tothe thecharacteristics characteristicsof ofbiological biologicalneurons, neurons,we wecan canmention mentionnonlinearity, nonlinearity,simplicity simplicityof ofcomputational computational to units, and and learning learning capabilities. capabilities. InInan anartificial artificialneuron, neuron,each eachofofthe theinput inputvalues valuesisisinfluenced influencedby by units, weight, which which is isaafunction functionof ofthis thisweight, weight,similar similarto tothe thesynaptic synapticconnection connectionin inaanormal normalneuron. neuron.The The weight, processor elements elements consist consist of of two two parts. parts.The Thefirst firstpart partadds addsthe theweighted weightedinputs, inputs,and andthe thesecond secondpart part processor non-linear filter filter called called the the active active function function of of the the neuron. neuron. This This function function compresses compresses the the output output isis aa non-linear values of of an an artificial artificial neuron neuron between between asymptotic asymptotic values. values. We We use use multi-layer multi-layer perceptron perceptron with with one one values hiddenlayer, layer, and andinputs inputsof ofnetwork networkare arederived derivedfrom fromerror error of of system. system.Output Outputof ofsystem systemisiscontroller controller hidden coefficients, and and performance performance loss loss function function is is error error from from desired desired value in the next step. coefficients, This compression compressionallows allowsthe the output outputof of the the processor processor elements elementsto to remain remain within within aa reasonable reasonable This range.Among Amongthe thefeatures featuresof ofartificial artificialneural neuralnetworks, networks,we wecan cannote notelearning learningcapability, capability,information information range. dispersion,generalizability, generalizability,parallel parallelprocessing, processing,and andresistance. resistance.One Oneof ofthe theapplications applicationsof ofthis thistype type dispersion, of network network isis classification, classification, identification identification and and pattern pattern recognition, recognition, signal signal processing, processing, time time series series of prediction, modeling optimization, financial issues, insurance, security, the stock prediction, modeling and andcontrol, control, optimization, financial issues, insurance, security, themarket, stock and entertainment. Neural Neural networks have the ability change online; online; however, in the genetic market, and entertainment. networks have the to ability to change however, in the algorithm, which which is essentially an online algorithm, thisthis is not possible. if the the genetic algorithm, is essentially an online algorithm, is not possible.ItItisisnormal normal that if controllerisis online, online, itit will will provide provide better better answers. answers. controller Inthe thedesign designof ofneural neuralnetworks, networks,and andespecially especiallythe theneural neuralnetwork networkof ofdelayed delayedtime, time,the thedesigner designer In dealswith withthe theproblem problemofofselecting selecting the right network design. In general, if a network deals the right network forfor thethe design. In general, if a network withwith the the least complexity minimum parameter greatest accuracyininidentifying identifyingthe theinput input least complexity andand the the minimum parameter hashas thethe greatest accuracy patterns,itit is is called called an an appropriate appropriate network. network. patterns, A variety of network training is supervised learning, unsupervised learning, and reinforcement learning, which introduce a number of ways of learning in the following:
Computers 2018, 7, 32
6 of 14
A variety of network training is supervised learning, unsupervised learning, and reinforcement learning, which introduce a number of ways of learning in the following: (A) Perceptron training Computation 2018, 6, x FOR PEER REVIEW
6 of 14
For example, the perceptron learning algorithm includes:
(A) 1. Perceptron Assigningtraining random values to weights 2. example, Applying perceptron to eachalgorithm training example For thethe perceptron learning includes: 3. Ensuring that all training examples have been evaluated correctly [Yes: the end of the algorithm, 1. Assigning random values to weights No: go back to step 2] 2. Applying the perceptron to each training example 3. Ensuring that all trainingalgorithm examples have been evaluated correctly [Yes: the end of the algorithm, (B) Back propagation No: go back to step 2] Perceptron have been found in artificial neural network designs, which are characterized by the (B) Back propagation algorithm formation of a multi-layered feed forward structure. The neural synaptic coefficient was configured to Perceptron have been found in artificial neuralthe network are characterized by the be able to estimate ideal processing through methoddesigns, of backwhich propagation error. formation of a multi-layered feed forward structure. The neural synaptic coefficient was configured (C) toBack-propagation algorithmthrough the method of back propagation error. to be able estimate ideal processing (C) Back-propagation algorithm on a multi-layer network weight, the back propagation method was To obtain more information
conducted by using the gradient descent method to minimize theback errorpropagation square between the outputs of To obtain more information on a multi-layer network weight, the method was the network and objective function. conducted by using the gradient descent method to minimize the error square between the outputs The proposed control structure in this designed method is presented as a block diagram of Figure 2 of the network and objective function. andproposed its controlcontrol equation is Equation (5): designed method is presented as a block diagram of The structure in this Figure 2 and its control equation is Equation (5): u(k) = u(k − 1) + kp ey (k) − ey (k − 1) + ki ey (k) (5) u(k) = u(k − 1) +k+d kepy{e −− 2eeyy((k k −−11)} eyk(ikey−(k) 2) (ky )(k) ) ++ (5) + k d {ey (k) − 2ey (k − 1) + ey (k − 2)} where u is the controller output in the PID controller designed method using the neural network. where u is The the controller output PID controller designed using the neural network. overall shape of in thethe closed loop structure withmethod the controller and the system conversion The overall shape of the closed loop structure with the controller and the system conversion function is shown in Figures 6–8. function is shown in Figures 6–8. Error BP Alghorithm
Display4
r Kp y Ki e Kd de Neural Network
e De Differential Error
Kp To Workspace2 Ki To Workspace3 Kd To Workspace4
Display Display1 Display2
Y To Workspace1
I
To Workspace5 kp ki u u kd e PID Controller1
Step
y Scope Plant
Display5 error To Workspace FigureFigure 6. The structure of the simulinked closed closed loop with the neural network and theand PIDthe controller. 6. The structure of the simulinked loop with the neural network PID controller.
Computers 2018, 7, 32
7 of 14
Computers 2018, 7, x; doi: FOR PEER REVIEW Computers 2018, 7, x; doi: FOR PEER REVIEW
1 r
r
011 r 011
u
012 u 012
1 r
2 y
2 y e
3 e
3 e
4 de
de
4 de
013 e 013
04 de 04 Input Layer Input Layer
www.mdpi.com/journal/computers www.mdpi.com/journal/computers
021 021 To Work space2 021 IN31 KP IN21 To Work space2 022 021 IN31 KP IN21 022 To Work space1 022 IN32 To Work space1 022 IN32 IN22 023 IN22 023 To Work space3 023 IN33 KI 023 To Work space3 IN33 KI 024 IN23 024 To Work space4 IN23024 IN34 To Work space4 024 025 IN34 025 space5 IN24 025 To Work IN35 KD IN24 025 To Work space5 IN35 KD Output Layer Hidden Layer Output Layer Hidden Layer
1
2
3
1
2
3
FigureFigure 7. MLP Perceptron) neuralneural network structure with three layers. 7. (Multilayer MLP (Multilayer Perceptron) network structure with three layers. Figure 7. MLP (Multilayer Perceptron) neural network structure with three layers. [y1] From6
[y1] From6
[k] Keu K+ [k] [k] Keu K[k] Go to 5 From5 Gain1 Math Gain2 + Clock Function From5 Gain1 Math Gain2 [U] Go to 5 1 Function U 1.4 1 Go to 5 [U] U Go to 5 Constant1 1.4 Constant1 [U] 1/Z [U1] 1/Z [U1] [y1] From [U] Unit Delay Go to 1 x From Unit Delay Go to 1 From4 [y1]Product x + + From4 Product+ 1/Z 1/Z K[U2] 1 + 1/Z 1/Z K[U2] Unit Unit Constant 1 Gain Go to 2 Delay2 Delay1 Unit Unit Constant Gain Go to 2 Delay2 Delay1 [y] 1/Z [y1] [y] Delay31/ZGo to 3 [y1] From3 Unit Clock
x x / x + Product1 xDivide / Product1 Divide + [U1]
1 y + +
From1 [U1] + From1 [U2] From2 [U2]
+ + +
1 y
[y] Go to 4 [y] Go to 4
From2
From3 Unit Delay3 Go to 3
Figure 8. Plant dynamic structure. Figure 8. Plant dynamic structure. Figure 8. Plant dynamic structure.
3.3. Genetic Algorithms 3.3. Genetic Algorithms 3.3. introduce Genetic Algorithms We the genetic algorithm optimization method and its basic concepts in this section. We introduce the genetic algorithm optimization method and its basic concepts in this section. The genetic algorithm an genetic evolutionary solution for optimizing the and problem. In the neuralin network We introduceisthe algorithm optimization method its basic concepts this section. The genetic algorithm is an evolutionary solution for optimizing the problem. In the neural network design, used algorithm genetic algorithm to optimizesolution the weights of the neural to network the Thewe genetic is an evolutionary for optimizing the network. problem. According In the neural design, we used genetic algorithm to optimize the weights of the neural network. According to the case study, our network is an on-line network that is trained by passing time. The cost function design, we used genetic algorithm to optimize the weights of the neural network. Accordingofto the case study, our network is an on-line network that is trained by passing time. The cost function of GA iscase based on systems error isofan desired value and this to update weights of neural study, our network on-line network that algorithm is trained tries by passing time. The cost function of GA is based on systems error of desired value and this algorithm tries to update weights of neural networks a manner that theerror errorofofdesired desire value minimum amount. GA isinbased on systems valuereaches and thisthe algorithm tries to update weights of neural networks in a manner that the error of desire value reaches the minimum amount. networks in a manner that the error of desire value reaches the minimum amount. 3.3.1. Genetic Algorithm Optimization Method 3.3.1. Genetic Method 3.3.1. Genetic Algorithm Algorithm Optimization Optimization Method The genetic algorithm is based on a biological process to solve optimization problems with and The genetic algorithm isisbased on a biological process to solve optimization problems with and The genetic algorithm based a biological process to on solve optimization problems without constraints. The basis of the geneticonalgorithms work is based population, which includes with without constraints. The basis the genetic algorithms work iswork basedisonbased population, which includes and without constraints. The of basis the genetic algorithms on population, which the factors of population generation andofoptimization. In this algorithm, an initial population is the factors of population generation and optimization. In this algorithm, an initial population is includes thethe factors of population generation and amount optimization. In this algorithm, initial generated, then individuals that have the least are selected randomlyan from thepopulation first generated, then the individuals that have the least amount are selected randomly from the first is generated, thenThe the genetic individuals that have least amount randomlyprocess from the generated population. algorithm is anthe algorithm based are on selected the reproduction of first generated population. The genetic algorithm is an algorithm based on the reproduction process of generatedThis population. Theisgenetic algorithm is an algorithmofbased on the reproduction process of the the creatures. algorithm obtained from the generation chromosomes and chromosomal the creatures. This algorithm is obtained from the generation of chromosomes and chromosomal creatures. algorithm is obtained from thewith generation of chromosomes and chromosomal changes made This in the reproduction process and the production and variation of numberschanges of changes made in the reproduction process and with the production and variation of numbers of made in the process thean production and variation of numbers of chromosomes, chromosomes, thereproduction defined interval willand try with to find optimal value. chromosomes, the defined interval will try to find an optimal value. thethis defined interval willvalues try to find anvariables optimal are value. In method, the first of the randomly generated as the initial population. In this method, the first values of the variables are randomly generated as In this method, the first values of the variables randomly generated as the the initial initial population. population. Then, by using mutation and intersection, the parents areare generated from the initial population, then Then, by using mutation and intersection, the parents are generated from the initial population, then Then, by using mutation parents are generated initial population, new numbers are produced asand newintersection, populations.the The population with the from initialthe population is placed then new numbers are produced as new populations. The population with the initial population is placed new numbers are and produced as neware populations. with the initial population is placed in the cost function, the values extracted The and population arranged according to the minimum and in in the cost function, andvalues the values are extracted and arranged according to the minimum and the cost function, and the are extracted and arranged according to the minimum and maximum maximum values. Finally, after proper algorithmic repetition, the optimal value of the function is maximum values. Finally, after proper algorithmic repetition, the optimal value of the function is
Computers 2018, 7, 32
8 of 14
values. Finally, after proper algorithmic repetition, the optimal value of the function is extracted. In this section, we deal with the definitions and common terminology in the genetic algorithm as follows:
•
•
•
Individual: In genetics, each individual is referred to as a member of the population who can participate in the reproduction process and create a new member population that will create an increased population of these individuals. Population and production: In genetics, the population is a collection of all individuals that are present in the population, are capable of generating a generation and creating a new one and, consequently, producing a new population. Parents: This refers to individuals that intend to participate in the reproduction process and produce a new individual.
3.3.2. The Mathematical Structure of the Genetic Algorithm Genetic algorithms can be used to solve optimization problems using the following steps: Step 1: At this stage, an initial population has been created randomly in proportion to the number of variables that optimize its function. After creating the initial population, the function value is calculated for each individual in the first population. Step 2: In this step, the intersection operation is run to create new chromosomes from the current population in the proceeding step. First, the rate of intersection Pc is chosen (the selection rate was optional) to perform the intersection, then appropriate chromosomes are selected proportional to the rate of the selected intersections before the intersection operation is run according to Equation (6): V1new = V1 + (1 − µ)·V2 V2new = V2 + (1 − µ)·V1
(6)
In the above equations, V2new and V1new are new chromosomes that have been created by the intersection operation, V2 and V1 are the parent chromosomes, and µ is a random number. Step 3: In this step, the mutation action is run. First, a random number between zero and one is created according to the size or number of genes in the population (number of genes = population size * number of variables), then the Pm mutation rate is set (the selection of a random value). Then, the mutation action is run according to the following equation where Vknew is a new chromosome that has been caused by mutation action and Xknew is new gene has been altered by mutation action. Equation (7) is: Vknew = [X1 , . . . , Xknew , . . . , Xn ], Xknew = Xk + ∆ t, XU k − Xk OR t b Xknew = Xk − ∆ t, Xk − X1k , ∆(t, y) = y·r·(1 − ) T
(7)
1 In Equations (1) and (2), XU k , Xk are the upper and lower borders of Xk , respectively; r is a random number between zero and one; ∆(t, y) with increasing t will tend towards zero; T is the production maximum in the algorithm; and t is the number of production at the moment. Step 4: In this step, chromosomes in the initial population and chromosomes in the new population in terms of size function based on the values in ascending order are arranged. In proportion to the size of the population, they enter the production cycle. Finally, the minimum function is selected and introduced as the minimum function. Step 5: The algorithm is a repetition-based algorithm, so the algorithm must be repeated to the maximum desired value so that the function is moved to the optimal point (maximal or minimal) or stop conditions in the algorithm are created.
Computers 2018, 7, 32
9 of 14
4. Experimental Result 4.1. Dataset Description In general, the studies and the results obtained with different numbers of hidden layers for the neural network are summarized in the table below. It is worth mentioning that the chosen training algorithm used a genetic algorithm. Furthermore, the size of the hidden layers in all cases was a single layer. The size of the database was initially 10 samples. As the network was online, the dates changed over time. The criterion for selecting the training and testing data was the lowest error. The number of hidden layers was the layer between the input and output layers. 10 samples are initial samples for training. Then new samples are generated by system as time passes and are used in training. The genetic algorithm selected the best weights that avoided unwanted conditions such as over fitting. 4.2. Optimal Networks Topology By examining Table 1, it is clear that a hidden layer led to better results. For this reason and to continue the design of the neural network, a number of hidden layers were considered as one layer. In the next step, selecting the best training algorithm for designing a neural network is considered. Table 1. Consideration of the results of the neural network with a different number of hidden layers.
Neural Network of Performance Criterion
The Number of Hidden Layer Neural Network
21.56 1.34 14.38 7.66 5.21
No hidden layer A hidden layer Two hidden layers Three hidden layers Four hidden layers
According to different training algorithms in MATLAB software, neural network training is considered with two hidden layers. The activator function that is used in the hidden layers in all tested networks, is the tansig activation function. The activation function of the output layer is also considered as the linear. According to the results presented in Table 2, the best training method for the existing data was the training method with the genetic algorithm. Therefore, the training algorithm was finally considered as the genetic algorithm. In the next step, the choice of the desired neural network parameters, the types of activator functions in the hidden layers as well as the out layer of the designed neural network were considered. According to the results shown in Table 3, the lowest error rate and best performance occurred when the activation function on the hidden layer, the logsig type, and the output layer were of the logsig type. The final stage of selecting the neural network parameters was the selection of the size of the hidden layers. By using the results from the previous section, there were two layers with logsig activator functions. Furthermore, the output activator function was the logsig function. Now, by searching for a number of results for different sizes of hidden layers, we reviewed and selected the best available options. In this step, we simulate the system for hidden layers with different size from 1 to 10, and we obtain the results in Table 4. According to the results obtained in Table 4, the best solution for the designed neural network occurred when the hidden layer size was 5. It is notable that the proposed method for choosing the best mode for the neural network was merely a local choice, and that it was possible to obtain better results by changing and selecting the parameters out of the range investigated.
Computers 2018, 7, 32
10 of 14
Table 2. Consideration of the results of testing different training algorithms on the desired neural network. Training Algorithm
Neural Network of Performance Criterion
Trainlm Trainbfg Trainrp Trainscg Traincgb Traincgf Traincgp Traionoss Traingdx Traingd Traingdm Traingda Genetic algorithm
1.384 2.214 2.562 4.651 3.563 2.201 1.493 3.452 2.856 1.132 1.081 2/342 0.596
Table 3. The results of the consideration of different activator functions in the proposed design of the neural network. Activator Functions
Neural Network of Performance Criterion
Output Layer
Hidden Layer
6.371 6.526 4.411 2.321 0.931 2.504 0.956 1.732 3.043
purelin logsig tansig purelin logsig tansig purelin logsig tansig
Purelin Purelin Purelin Logsig Logsig logsig tansig tansig tansig
Table 4. The neural network performance results with different hidden layer size. Neural Network of Performance Criterion
Hidden Layer Size
Neural Network of Performance Criterion
Hidden Layer Size
0.932 1.215 1.368 1.116 0.874
1 2 3 4 5
2.788 1.546 1.012 0.994 1.016
6 7 8 9 10
4.3. Optimal PID Outputs According to the discussion in the previous section, the final designed neural network is as follows. The number of hidden layers of the designed network was considered to be two layers. The hidden layer consisted of a logsig activator function and the output layer of the activator function was also the logsig function. Additionally, the training algorithm was the genetic algorithm. The size of the layers by using the values obtained in the table was 5, therefore there were 5 neurons for the hidden layer. The output waveforms along with the output of the PID controller are shown in Figures 9–12.
According to the discussion in the previous section, the final designed neural network is as follows. The number of hidden layers of the designed network was considered to be two layers. The hidden layer consisted of a logsig activator function and the output layer of the activator function was also the logsig function. Additionally, the training algorithm was the genetic algorithm. The size of the layers by using the values obtained in the table was 5, therefore there were 5 neurons for the hidden Computers 2018, 7, 32 layer. The output waveforms along with the output of the PID controller are shown in Figures 9–12. 11 of 14
Figure 9. 9. Output ofof the controlled system controllerdesigned designedwww.mdpi.com/journal/computers withthe theneural neural network. Figure Output thePEER controlled systemwith with the the PID controller with network. Computers 2018, 7, x; x; doi: doi: FOR REVIEW Computers 2018, 7, FOR PEER REVIEW www.mdpi.com/journal/computers Computers 2018, 7, x; doi: FOR PEER REVIEW www.mdpi.com/journal/computers
Figure 10. 10. PID PID controller controller output output was was designed designed with with the the neural network network and and genetic genetic training. training. Figure Figure 10.10. PID controller output andgenetic genetictraining. training. Figure PID controller outputwas wasdesigned designedwith withthe theneural neural network network and
Figure 11. 11. Minimization Minimization chart chart of of the the objective objective function function (sum (sum of of squared squared errors) errors) by by the the genetic genetic Figure Figure 11. Minimization the objective function of squared errors) by thealgorithm. genetic Figure 11. Minimization chartchart of theofobjective function (sum of(sum squared errors) by the genetic algorithm. algorithm. algorithm.
Figure Convergence thePID PIDcontroller controllerparameters parameters designed designed by by Figure 12.12. Convergence ofofthe by the theneural neuralnetwork. network. Figure Figure 12. 12. Convergence Convergence of of the the PID PID controller controller parameters parameters designed designed by the the neural neural network. network.
As we we can see see in Figure Figure 11, the the objective function function was the the sum of of the squares squares of the the error. The The As As we can can see in in Figure 11, 11, the objective objective function was was the sum sum of the the squares of of the error. error. The objective function had some defects that, consequently caused the over mutation in the transient objective objective function function had had some some defects defects that, that, consequently consequently caused caused the the over over mutation mutation in in the the transient transient response of of the the system. system. To To solve solve this this problem, problem, the the objective objective function, function, in in terms terms of of the the sum sum of the the response response of the system. To solve this problem, the objective function, in terms of the sum of of the squares of the error plus the weight function of the over mutation, was chosen as Equation (8). squares squares of of the the error error plus plus the the weight weight function function of of the the over over mutation, mutation, was was chosen chosen as as Equation Equation (8). (8). n n n
Fitness function function = ∑ ∑ error(i) error(i)222 + + W ∗∗ M Mp (8) Fitness Fitness function = =∑ error(i) + W W ∗ Mpp (8) (8) i=1
(8) (8) (8)
Computers 2018, 7, 32
12 of 14
As we can see in Figure 11, the objective function was the sum of the squares of the error. The objective function had some defects that, consequently caused the over mutation in the transient response of the system. To solve this problem, the objective function, in terms of the sum of the squares of the error plus the weight function of the over mutation, was chosen as Equation (8). n
Fitness function =
∑ error(i)2 + W ∗ Mp
(8)
i=1
The output waveform of the closed-loop system with the genetic algorithm training in comparison Computation 6, PEER REVIEW 12 with the BP2018, algorithm shown in Figures 13 and 14. Computation 2018, 6, xx FOR FORis PEER REVIEW 12 of of 14 14
Figure 13. The output waveform of the controlled system with controllers designed by the neural Figure13. 13.The Theoutput outputwaveform waveformof ofthe thecontrolled controlledsystem systemwith withcontrollers controllersdesigned designedby bythe theneural neural Figure networks BPNN (Back Propagation Neural Network) and GANN (Genetic Algorithm coupled with networksBPNN BPNN(Back (BackPropagation PropagationNeural NeuralNetwork) Network)and andGANN GANN(Genetic (GeneticAlgorithm Algorithmcoupled coupledwith with networks Neural Network). NeuralNetwork). Network). Neural
Figure 14. Neural network controller outputs designed by BPNN and GANN. Figure14. 14.Neural Neuralnetwork networkcontroller controlleroutputs outputsdesigned designedby byBPNN BPNNand andGANN. GANN. Figure
5. 5. Conclusions Conclusions 5. Conclusions In In this this paper, paper, we we discussed discussed the the design design of of aa PID PID controller controller with with aa neural neural network network and and the the use use of of In this paper, we discussed the design system. of a PIDFirst, controller with a neural network and the system use of genetic algorithms for an air conditioning the modeling of the air conditioning genetic algorithms for an air conditioning system. First, the modeling of the air conditioning system genetic algorithms At for an airstage, conditioningon system.available First, the modeling of the air conditioning system was was carried carried out. out. At this this stage, based based on the the available information, information, the the system system equations equations were were was carried out. At this stage, based on the available information, the system equations were obtained. obtained. In the second stage, a discussion about the PID controller and how to determine obtained. In the second stage, a discussion about the PID controller and how to determine its its In the second stage, a discussion about the PID controller neural and how to determine its coefficients was coefficients coefficients was was completed. completed. After After that, that, we we examined examined the the neural networks networks and and how how to to determine determine the the completed. After that, we examined the neural networks and how to for determine the PID controller PID PID controller controller coefficients coefficients with with this this method. method. Different Different conditions conditions for the the neural neural network network were were coefficients with this method. Different conditions for the neural network were considered, and the in considered, and in these conditions, we examined the designed network. Finally, we determined considered, and in these conditions, we examined the designed network. Finally, we determined the these conditions, we examined the designed network. Finally, we determined the best network, which best best network, network, which which has has the the lowest lowest operating operating system system error error criterion. criterion. has the lowest operating system error criterion. Out of all of the training algorithms, the genetic algorithm Out of all of the training algorithms, the genetic algorithm was was selected selected to to most most effectively effectively train train the neural network according to the obtained results. The objective function was minimized the neural network according to the obtained results. The objective function was minimized by by the the genetic genetic algorithm, algorithm, and and the the sum sum of of the the squares squares of of errors errors was was considered considered to to be be defective. defective. These These defects defects caused caused an an over over mutation mutation in in the the transient transient response response system. system. To To solve solve this this problem, problem, the the objective objective function was defined as the sum of the squares of error plus the over mutation weighting function was defined as the sum of the squares of error plus the over mutation weighting function. function. By By defining defining the the appropriate appropriate cost cost function, function, we we tried tried to to obtain obtain values values that that were were acceptable acceptable with with aa high high ratio. Finally, by simulating a final controlled system, we examined the system response, control ratio. Finally, by simulating a final controlled system, we examined the system response, control
Computers 2018, 7, 32
13 of 14
Out of all of the training algorithms, the genetic algorithm was selected to most effectively train the neural network according to the obtained results. The objective function was minimized by the genetic algorithm, and the sum of the squares of errors was considered to be defective. These defects caused an over mutation in the transient response system. To solve this problem, the objective function was defined as the sum of the squares of error plus the over mutation weighting function. By defining the appropriate cost function, we tried to obtain values that were acceptable with a high ratio. Finally, by simulating a final controlled system, we examined the system response, control signal, and compared the results of the trained neural network with the back propagation algorithm. By comparing the results, it could be seen that the proposed method had advantages over other methods such as the back-propagation algorithm. Author Contributions: The authors contributed equally to the reported research and writing of the paper. All authors have read and approved the final manuscript. Conflicts of Interest: The authors declare no conflict of interest.
References 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19.
Winter, R.; Widrow, B. MADALINE RULE II: A training algorithm for neural networks (PDF). In Proceedings of the IEEE International Conference on Neural Networks, San Diego, CA, USA, 24–27 July 1988; pp. 401–408. Waibel, A.; Hanazawa, T.; Hinton, G.; Shikano, K.; Lang, K.J. Phoneme Recognition Using Time-Delay Neural Networks. IEEE Trans. Acoust. Speech Signal Process. 1989, 37, 328–339. [CrossRef] Krauth, W.; Mezard, M. Learning algorithms with optimal stabilty in neural networks. J. Phys. A Math. Gen. 2008, 20, L745–L752. [CrossRef] Guimarães, J.G.; Nóbrega, L.M.; da Costa, J.C. Design of a Hamming neural network based on single-electron tunneling devices. Microelectron. J. 2006, 37, 510–518. [CrossRef] Mui, K.W.; Wong, L.T. Evaluation of neutral criterion of indoor air quality for air-conditioned offices in subtropical climates. Build. Serv. Eng. Res. Technol. 2007, 28, 23–33. [CrossRef] ASHRAE. Design for Acceptable Indoor Air Quality; ANSI/ASHRAE Standard 62-2007; American Society of Heating, Refrigerating and Air-Conditioning Engineers, Inc.: Atlanta, GA, USA, 2007. Levermore, G.J. Building Energy Management Systems: An Application to Heating and Control; E & FN Spon: London, UK; New York, NY, USA, 1992. Rahmati, V.; Ghorbani, A. A Novel Low Complexity Fast Response Time Fuzzy PID Controller for Antenna Adjusting Using Two Direct Current Motors. Indian J. Sci. Technol. 2018, 11. [CrossRef] Dounis, A.I.; Bruant, M.; Santamouris, M.J.; Guarracino, G.; Michel, P. Comparison of conventional and fuzzy control of indoor air quality in buildings. J. Intell. Fuzzy Syst. 1996, 4, 131–140. Tan, W. Unified tuning of PID load frequency controller for power systems via IMC. IEEE Trans. Power Syst. 2010, 25, 341–350. [CrossRef] Howell, M.N.; Best, M.C. On-line PID tuning for engine idle-speed control using continuous action reinforcement learning automata. Control Eng. Pract. 2000, 8, 147–154. [CrossRef] European Union. The New Directive on the Energy Performance of Buildings, 3rd ed.; European Union: Brussels, Belgium, 2002. Tian, L.; Lin, Z.; Liu, J.; Yao, T.; Wang, Q. The impact of temperature on mean local air age and thermal comfort in a stratum ventilated office. Build. Environ. 2011, 46, 501–510. [CrossRef] Hui, P.S.; Wong, L.T.; Mui, K.W. Feasibility study of an express assessment protocol for the indoor air quality of air conditioned offices. Indoor Built Environ. 2006, 15, 373–378. [CrossRef] The American Society of Heating, Refrigerating and Air-Conditioning Engineers (ASHRAE). Thermal Environment Conditions for Human Occupancy; ASHRAE Standard 55: Atlanta, GA, USA, 2004. Wyon, D.P. The effects of indoor air quality on performance and productivity. Indoor Air 2004, 14, 92–101. [CrossRef] [PubMed] Fanger, P.O. What is IAQ. Indoor Air 2006, 16, 328–334. [CrossRef] [PubMed] Lundgren, K.; Kjellstrom, T. Sustainability Challenges from Climate Change and Air Conditioning Use in Urban Areas. Sustainability 2013, 5, 3116–3128. [CrossRef] Maerefat, M.; Omidvar, A. Thermal Comfort; Kelid Amoozesh: Tehran, Iran, 2008; pp. 1–10.
Computers 2018, 7, 32
20. 21.
22.
23. 24. 25. 26. 27. 28. 29. 30.
14 of 14
Tian, L.; Lin, Z.; Liu, J.; Wang, Q. Experimental investigation of thermal and ventilation performances of stratum ventilation. Build. Environ. 2011, 46, 1309–1320. [CrossRef] Morovat, N. Analysis of Thermal Comfort, Air Quality and Energy Consumption in a Hybrid System of the Hydronic Radiant Cooling and Stratum Ventilation. Master’s Thesis, Department of Mechanical Engineering, Tarbiat Modares University, Tehran, Iran, 2013. Protopapadakis, E.; Schauer, M.; Pierri, E.; Doulamis, A.D.; Stavroulakis, G.E.; Böhrnsen, J.; Langer, S. A genetically optimized neural classifier applied to numerical pile integrity tests considering concrete piles. Comput. Struct. 2016, 162, 68–79. [CrossRef] Oreski, S.; Oreski, G. Genetic algorithm-based heuristic for feature selection in credit risk assessment. Expert Syst. Appl. 2014, 41, 2052–2064. [CrossRef] Ghamisi, P.; Benediktsson, J.A. Feature selection based on hybridization of genetic algorithm and particle swarm optimization. IEEE Geosci. Remote Sens. Lett. 2015, 12, 309–313. [CrossRef] Wang, S.; Jin, X. Model-based optimal control of VAV air-conditioning system using genetic algorithms. Build. Environ. 2000, 35, 471–487. [CrossRef] Maerefat, M.; Morovat, N. Analysis of thermal comfort in space equipped with stratum ventilation and radiant cooling ceiling. Modares Mech. Eng. 2013, 13, 41–54. Yu, B.F.; Hu, Z.B.; Liu, M. Review of research on air conditioning systems and indoor air quality control for human health. Int. J. Refrig. 2009, 32, 3–20. [CrossRef] Yang, S.; Wu, S.; Yan, Y.Y. Control strategies for indoor environment quality and energy efficiency—A review. Int. J. Low-Carbon Technol. 2015, 10, 305–312. Mui, K.W.; Wong, L.T.; Hui, P.S.; Law, K.Y. Epistemic evaluation of policy influence on workplace indoor air quality of Hong Kong in 1996–2005. Build. Serv. Eng. Res. Technol. 2008, 29, 157–164. [CrossRef] Chen, S.; Cowan, C.F.N.; Grant, P.M. Orthogonal Least Squares Learning Algorithm for Radial Basis Function Networks. IEEE Trans. Neural Netw. 2010, 2, 302–309. [CrossRef] [PubMed] © 2018 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (http://creativecommons.org/licenses/by/4.0/).