149 American Scientific Research Journal for Engineering, Technology, and Sciences (ASRJETS) ISSN (Print) 2313-4410, ISSN (Online) 2313-4402 © Global Society of Scientific Research and Researchers http://asrjetsjournal.org/ Increase Microgrid's Consumer Comfort by Using Fuzzy and Optimization Algorithms Zeinab Khalilian a *, Ahmad MokhtarBand b a Universitr Of Applied Sience And Technology.CenterOf(JahadDaneshgahi),Ahwaz,Iran b Department Of Electrical Engineering,ShahidTondgooyan Petrochemical Company, Mahshahr,Iran a Email: zeinab.khalilian2011@gmail.com b Email: ahmad.mokhtaband20@gmail.com Abstract Whereas the most important fundamental factor for today’s human is energy and wasting energy leads to increasing costs and destruction of natural resources, it is attempted through using modern and electronic methods to optimize the energy consumption and preventing of wasting energy. According to technological advancements and level of knowledge of people and having different electronic means, it is applied from several methods including: wireless sensor networks at home automation, energy management system, BEMS system and intelligent electrical keys on building to respond the requirements of users that leads to comfort of users, reducing costs, optimization of energy consumption and prevention of wasting energy. In this article, it is benefit from intelligent control methods by using optimization algorithms (PSO & GA) and fuzzy logic for controlling energy of building in order to obtain the maximum welfare and comfort of inhabitants in a building using from new pneumatic and solar recyclable resources. In order to show this performance, it is benefit from simulation at MATLAB environment. Keywords: Energy management; intelligent control ; Microcontrollers; Microgrids ; Multi-agent systems . 1. Introduction During recent 20 years, there was specific attitude toward climate architecture in building. The main purpose of climate architecture is economizing energy by using glass and solar light system, natural ventilation, heating mass, support wall, cooling systems with evaporation and radiation; nevertheless, in non-climate architecture it is focused on designing and manufacturing climate buildings that is advantage is using solar radiation and natural air flow for normal warming and cooling. three main factors for determining the life quality of inhabitants of building are including: Quality of climate , Visual welfare , Thermal welfare. ------------------------------------------------------------------------ * Corresponding author. American Scientific Research Journal for Engineering, Technology, and Sciences (ASRJETS) (2021) Volume 75, No 1, pp 149-166 150 According to broadness and intelligent network, the main elements out of electrical industry play key role. There are abundant technologies for developing intelligent network that their application and development leads to comfort in the field out of electricity industry. All of these issues refer to complicacy and broadness of intelligent distribution network project and necessity of having comprehensive and integrated look toward offering a plan for developing intelligent networks. Therefore, this article offers an intelligent control method by benefiting from PSO algorithm and fuzzy logic for controlling level of energy consumption in building for obtaining to maximum welfare of inhabitants of a building through applying pneumatic and solar recyclable resources. 2. Multi-Agent Control Framework The overall micro-grid system has two operation modes,which are grid-connected mode and isolated mode. The gridconnected mode will only be used when the local renewable generation is far less than the load demands. In this work, simulation studies are carried out to demonstrate the operation of a building in different situations in a 24-hour time period, which is isolated from the power grid and supplied by renewable energy resources. Two renewable generation resources are used to supply power including solar energy and wind power. Solar energy is generated from solar radiation through photovoltaic panels. Wind power is produced from wind turbines. Also, a storage battery is used to store redundant energy for use during periods of energy deficiency. By charging batteries during low demand periods and releasing energy in high demand periods, battery reduces the time of energy deficiency. Photovoltaic panels and wind turbines work as distributed energy resources; and battery is used for distributed storage. The whole building can be seen as a controllable load. The multi-agent control system is developed to manage different energy resources and maintain the highest users’ comfort. Multi-agent technology has been successfully applied in various fields such as transportation, robotics, process control, and manufacturing. Agent is the fundamental element of multi-agent systems, and it can be a piece of software or a physical entity. Overall, the agent has certain common characteristics, including capability of responding to the change of environment as well as abilities in achieving autonomy and accomplishing communication [9-10]. Fig1 illustrates the multi-agent based control framework of the overall integrated building and Microcontrollerssystem. Hierarchical multi-agent control system is proposed which consists of two primary categories of agents including central coordinator-agent and local controller-agents. The local controller-agents are classified into local temperature controller-agent, local illumination controller-agent, and local air quality controller-agent based on their different control functions. Each local controller-agent corresponds to and controls one of the three comfort factors including temperature, illumination and CO2 concentration. The central coordinator-agent is responsible for coordinating all local controller-agents, incorporating the customers’ personal preferences, and cooperating with the optimizer to maximize the occupants’ comfort as quickly as possible. There are other agents in this multi-agent control system called load agents. They are used to shed controllable or non-critical loads to maintain the high comfort level when the system suffers from insufficient power supply [11]. American Scientific Research Journal for Engineering, Technology, and Sciences (ASRJETS) (2021) Volume 75, No 1, pp 149-166 151 Figure 1: control framework of the integrated building and microcontrollers system The particle swarm optimization (PSO) algorithm utilizes the outdoor information and users’ preference range to tune the set points. Different customers could set their different comfort ranges based on their preferences, which can be represented as [Tmin,Tmax],[Lmin,Lmax] and [Amin ,Amax]. Here T, L and A denote temperature, illumination and CO2 concentration, respectively. Three local controller-agents are distributed in corresponding subsystems to control thermal comfort, visual comfort and air quality. Fuzzy controllers are applied to calculate the required power which is needed to maintain high comfort by ontrolling he actuators of the subsystem. Theerrors between the measured values and the set points are used as inputs to the fuzzy controllers. The required power will be compared to the adjusted power from central coordinator-agent to obtain the actual power to be used. If the power from the central coordinator-agent is sufficient, the indoor environmental parameters will be maintained at comfortable values; otherwise, the indoor comfort level will decrease. 3. System Modeling Central coordinator-agent and local controller-agents are the most significant elements in this multi-agent control system. 3.1 Central Coordinator-agent The mathematical model of the central coordinator-agent is described below: Comfort = Ɛ1[ 1 – (errorT / Tset)2 ] + Ɛ2 [ 1 – (errorL / Lset)2 ] + Ɛ3 [ 1 – (errorA / Aset)2 ] PTK+1 = PTK + m1 PLK+1 = PLK + m2 PAK+1 = PAK + m3 PTK + PLK + PAK = PinK American Scientific Research Journal for Engineering, Technology, and Sciences (ASRJETS) (2021) Volume 75, No 1, pp 149-166 152 PinK ≤ PmaxK where: Comfort is the overall comfort of users, which is in the range of [0,1] and the control goal is to maximize its value. Ɛ1 ,Ɛ2 and Ɛ3 are the weighting factors of importance. Customer can define their own preferred values, and all the factors are in [0,1] and Ɛ1 + Ɛ2 + Ɛ3 = 1. Tset, Lset and Aset are the set values of temperature, illumination and air quality, respectively. error is the difference between measured value and set value. Pk is the required power from the local controller-agents. Pin is the injected power from the distributed renewable energy resources. Pmax is the maximum power generation from all of the distributed renewable energy resources. m is a small value used to compensate for the distribution losses. k is the time instant. 3.2 Local Controller-agents Figure 2: Structure of local subsystems Local controller-agents are applied in three local subsystems to control thermal comfort, visual comfort and air quality, respectively. Fig 2 shows the structure of the local subsystems. The local controller-agent takes the adjusted power from the central controller and the error between real environmental parameters and the set points as inputs. Fuzzy rules are applied to calculate the required power in uncertain circumstances. Comparison is carried out between the required power calculated and the adjusted power from the central controller-agent to determine the actual power to be used. It is used to drive the actuators to control indoor environmental parameters which decide the users’ overall comfort level. The actuators are auxiliary heating/cooling, electrical lighting and ventilating for controlling the thermal comfort, visual comfort and air quality, respectively. Thus, Local Subsystem Adjusted Power Control Coordinator-agent Outdoor Sensor Data Fuzzy Controller comparison Actuators(Auxiliary Heating/Cooling ,Electrical Lighting,Ventilator) PID Controller Indoor Environmental Parameters Consumed Power Required Power Set Pointers American Scientific Research Journal for Engineering, Technology, and Sciences (ASRJETS) (2021) Volume 75, No 1, pp 149-166 153 the indoor environmental parameters can be controlled by the corresponding actuators in local subsystems. 3.2.1 Local Temperature Agent To calculate the required power which maintains the indoor thermal comfort, a fuzzy PD controller is developed for this subsystem. The input of this fuzzy controller includes the error errorT and the change of error cerrorT . The error errorT is the differences between outdoor sensor data and the set point. The change of error cerrorT represents the difference between the previous and present errors. The membership functions of the inputs and output of the fuzzy PD controller are shown in Fig 3 and Fig 4 and Fig 5 and Fig 6 [12]. The membership functions of the inputs and outputs include the following values: NegativeLarge (NL), Negative Medium (NM), Negative Small (NS), Zero (ZE), Positive Small (PS), Positive Medium (PM) and Positive Large (PL). The rules of the fuzzy controller are shown in Table I. Figure 3: Membership functions of local temperature controller Figure 4: Membership functions of local illumination controller Figure 5: Membership functions of local ventilation controller American Scientific Research Journal for Engineering, Technology, and Sciences (ASRJETS) (2021) Volume 75, No 1, pp 149-166 154 Figure 6: Fuzzy parameter output range Table 1: Fuzzy control rules for local temperature controller Required Power Error T NL NM NS ZE PS PM PL CerroeT NL NL NS PS PL PL PL PL NM NL NM ZE PM PM PL PL NS NL NM NS PS PM PL PL ZE NL NM NS ZE PS PM PL PS NL NL NM NS PS PM PL PM NL NL NM NM ZE PM PL PL NL NL NL NL NS PS PL The output of the fuzzy controller is the required power which maintains the indoor temperature at the set point. If its value is negative, the heating system is working; if the value of required power is positive, the cooling system is working. 3.2.2 Local Illumination Agent A fuzzy controller is developed to calculate the required power for electrical lighting. Illumination level is utilized as measured parameters to indicate visual comfort, which is measured in lux. The input of the local illumination fuzzy controller is the error between the outdoor illumination level and the indoor set point. The output is the required power to be consumed in the lighting system. The membership functions of the input and output of the local illumination controller are shown inFig7 and Fig 8. The rules of the local illumination controller are shown in Table II. American Scientific Research Journal for Engineering, Technology, and Sciences (ASRJETS) (2021) Volume 75, No 1, pp 149-166 155 Figure 7: The membership fanction of light intensity controller Figure 8: Fuzzy parameter output range Table 2: Fuzzycontrol rules for local illumination controller error L VS Small LS SS OK Large Required Added Power VL Large LL SL OK Small 3.2.3 Local Air Quality Agent CO2 concentration is used as an index to indicate air quality in the building environment, which is measured in ppm. A fuzzy controller is applied to the local air quality subsystem tocalculate the required power for the ventilator. The input of the local fuzzy controller is the error between the outdoor CO2 concentration and the indoor set point. The output is the required power to be used to control the ventilation system. The membership functions of the input and output of the fuzzy controller are shown in Fig9 and Fig 10. The rules of the local ventilation controller are shown in TABLE III. Figure 9: membership functions of local ventilation controller American Scientific Research Journal for Engineering, Technology, and Sciences (ASRJETS) (2021) Volume 75, No 1, pp 149-166 156 Figure 10: Fuzzy parameter output range Table 3: Fuzzy control rules for local ventilation controller errorA Low OK SH LH High Required Power OFF ON SH LH High The output of the fuzzy controller will be compared to the adjusted power from the central coordinator-agent. If the adjusted power is sufficient, the power used for control equals the required power. Thus the indoor comfort will be maintained; otherwise, the indoor comfort will be compromised. The actual power derived is applied to actuators to control the indoor environmental comfort. 4. Optimizer Particle swarm optimization (PSO) algorithm is utilized to optimize the multi-agent control system. It is introduced by Kennedy and Eberhart in 1995 and has turned out to be an effective optimization tool to solve large-scale non-linear problems [13-14]. PSO is inspired by animal social behavior. It utilizes a number of particles which represent possible solutions to fly through the solution space to find the best solution by updating velocities and locations. As compared with other optimization techniques, PSO has a bunch of advantages. For instance, PSO is easy to implement since it has fewer parameters to adjust. It is more prone to escaping from the local optimal solutions and locating the global optimal solution quickly [15-17]. Let l and v be the location and velocity of the particle, respectively; and pbestandgbestrepresent the local best position and global best position, espectively. The update of velocity and location obeys the following formulas: V K+1 = α vk + δ 1r1[pbestk- Lk] +δ2 r2[gbestk – Lk](۵-٧) Lk+1 = lk + vk+1 Whereαis the inertia factor, δ1 and δ2 are two positive acceleration constants, r1 and r2 are two uniform random numbers in [0,1], and k is the iteration index. American Scientific Research Journal for Engineering, Technology, and Sciences (ASRJETS) (2021) Volume 75, No 1, pp 149-166 157 5. Simulation results The multi-agent control system is developed to manage the power of an autonomous building supplied by renewable energy resources in a 24-hour time domain. 5.1 Power Generation Fig 11 and Fig 12 and Fig 13 shows the variations of output from three 4.5 KW solar collectors in a typical sunny day and the variations of the wind energy output in a 24-hour time scale [18-19]. Fig14 shows the aggregated power production from these two distributed renewable energy sources. Also the battery used can store a maximum of 35 kilowatt hours of energy. In order to preserve its life time, minimum storage threshold is set as 5 kilowatt hours. Figure 11: Power from PVs Figure 12: Power from wind turbines Figure 13: Power from all the renewabl energy resources American Scientific Research Journal for Engineering, Technology, and Sciences (ASRJETS) (2021) Volume 75, No 1, pp 149-166 158 Figure 14: PSO algorithm results in 4000 repeat The occupants’ comfort ranges are set as T =[67,76.2] (k),L =[750,850] (lux) and A =[400,850] (ppm). They are used as constraints in PSO to optimize the set oints based on the comfort function defined in (1). With the change of outdoor environmental parameters, the variations of set points within 24 hours are shown in Fig 15 and Fig 16 and Fig 17 including the emperature,illumination level and CO2 concentration. As compared with the set points without PSO, the errors between set points and outside sensor data become smaller after PSO is applied. Multi-agent Control System with PSO and Load Agent Customers’ comfort cannot be kept at the highest level throughout the day due to the varying power supply from the intermittent distributed renewable resources. Load agent is applied to shed some controllable loads from other devices in the building to respond to power shortage. Fig 15 and Fig 16 and Fig 17 llustrates the minimum amount of non-critical loads shed. The final comfort value after using PSO and load agent together is shown in Fig 18 It can be seen that the overall comfort is continuously maintained at its highest level due to optimization and load shedding. The proposed multi-agent 7 control system turns out to be promising in chieving effective energy and comfort management in the integrated building and Microcontrollerssystem. Figure 15: variation of set point temperature with and without PSO American Scientific Research Journal for Engineering, Technology, and Sciences (ASRJETS) (2021) Volume 75, No 1, pp 149-166 159 Figure 16: variation of set point temperature with and without PSO Figure 17: variation of set point temperature with and without PSO illustrates the total power demands from the three local controller-agents before and after PSO is applied to adjust the set points. Likewise, Fig 18 shows the battery charge/discharge patterns without and with PSO. It can be seen that the power consumption is significantly reduced, and the battery depletion time is also reduced by using PSO. Figure 18: The demand by customers with and without PSO American Scientific Research Journal for Engineering, Technology, and Sciences (ASRJETS) (2021) Volume 75, No 1, pp 149-166 160 In simulations, all the user-defined weighting factors are set to be1/3, which means each comfort factor takes the same importance. Fig 19 and Fig 20 show the comfort values without and with PSO, respectively. Figure 19: Chart welfare without pso algorithm Figure 20: Chart welfare with pso algorithm From the simulation results, the comfort level is improved after applying PSO to optimize the set points. The occupants gain a longer time when the highest comfort level is maintained; meanwhile, the power consumption is considerably reduced. PSO is able to balance the total power consumption and customers’ comfort by American Scientific Research Journal for Engineering, Technology, and Sciences (ASRJETS) (2021) Volume 75, No 1, pp 149-166 161 enhancing the building intelligence. Fig 21.shows Once the program is intended for system and Fig 22 shows Chart welfare of residents after the scheduled time And be required to controllers as follows. Figure 21: Once the program is intended for system Figure 22: chart welfare of residents after the scheduler time And be required to controllers as follows : Prequired=PT+PL+PA. If the cost per megawatt consumed by the controller is $ 12 per hour, Price needed with and without the use of PSO algorithm is as follows Price needed with and without the use of PSO algorithm that show in Fig 23. Find the most hours during the day using the PSO algorithm will pay less money And a total cost of US $ 3171 to $ 2462 per day reduced. American Scientific Research Journal for Engineering, Technology, and Sciences (ASRJETS) (2021) Volume 75, No 1, pp 149-166 162 Figure 23: Price needed with and without the use of PSO algorithm 5.2 Simulation with Load Planning and GA Algorithm It is observed that the homogeneity of genetic algorithm in comparison to PSO algorithm is improved up to level of 0.2 and this is due to influence of 2 methods of juncture and mutation in genetic algorithm. Therefore, in compliance with changes of welfare, the costs may be reduced; nevertheless, the homogeneity of PSO algorithm happens earlier which reveals local search in PSO algorithm. Finally, it is concluded that the genetic algorithm has better performance.Thete are show in Fig 24 and Fig 25 and Fig 26 and Fig 27 and Fig 28 . Figure 24: Confort chart with GA American Scientific Research Journal for Engineering, Technology, and Sciences (ASRJETS) (2021) Volume 75, No 1, pp 149-166 163 Figure 25: variation of set point temperature with and without GA Figure 26: Once the program is intended for system Figure 27: Chart welfare of residents after the scheduled time And be required to controllers as follows American Scientific Research Journal for Engineering, Technology, and Sciences (ASRJETS) (2021) Volume 75, No 1, pp 149-166 164 Figure 28: Price Needed with and without the use of GA algorithm 6. Conclusions Increasing penetration of distributed resources makes the Microcontrollersa promising power system configuration for future grids. The performance of the proposed multi-agent control demonstrates the potentials and advantages for its application to the Integrated building and Microcontrollerssystem. In this control system, customers’ preference is considered and a certain degree of intelligence is embedded using pso. This multi-agent control framework can also be extended to other Microcontrollersapplications. In the future study, a more comprehensive and versatile objective function may be defined as the overall comfort index used in the optimization process. References [1] Z. Wang, R. Yang and L. Wang, ―Multi-agent intelligent controller design for smart and sustainable buildings,‖ IEEE International Systems Conference, San Diego, April 2010. [2] Z. Wang, R. Yang and L. Wang, ―Multi-agent control system with intelligent optimization for smart and energyefficient buildings,‖ the 36th Annual Conference of the IEEE Industrial Electronics Society,Phoenix, AZ, November, 2010. [3] Erdinc O, Tas¸cıkaraoglu ˘ A, Paterakis N, Eren Y, Catalao ˜ JPS. End-user comfort oriented day-ahead planning for responsive residential HVAC demand aggregation considering weather forecasts. IEEE Transactions on Smart Grid 2017;8:362–72. [4] A. Nikoobakht, J. Aghaei , M. Shafe-khah , J. P. S. Catal˜ ao, Assessing Increased Flexibility of Energy Storage and Demand Response to Accommodate a High Penetration of Renewable Energy Sources, IEEE Transactions on Sustainable Energy, 2018, Early Access. [5] J. Prado; W. Qiao, A Stochastic Decision-Making Model for an Electricity Retailer with Intermittent Renewable Energy and Short-term Demand Response, IEEE Transactions on Smart Grid, 2018, Early American Scientific Research Journal for Engineering, Technology, and Sciences (ASRJETS) (2021) Volume 75, No 1, pp 149-166 165 access. [6] Leithon J, Sun S, Lim T. Demand Response and Renewable Energy Management Using Continuous-Time Optimization. IEEE Transactions on Sustainable Energy 2018;9:991–1000. [7] Asensio M, Quevedo P, Delgado G, Contreras J. Joint Distribution Network and Renewable Energy Expansion Planning Considering Demand Response and Energy Storage—Part I: Stochastic Programming Model. IEEE Transactions on Smart grid 2018;9:655–66. [8] Wang Y, Yang W, Liu T. Appliances considered demand response optimisation for smart grid. IET Generation, Transmission & Distribution 2017;11:856–64. [9] Park L, Jang Y, Cho S, Kim J. Residential Demand Response for Renewable Energy Resources in Smart Grid Systems. IEEE Transactions on Industrial Informatics 2017;13:3165–73. [10] Maharjan S, Zhang Y, Gjessing S, Tsang D. User-Centric Demand Response Management in the Smart Grid With Multiple Providers. IEEE Transactions on Emerging Topics in Computing 2017;5:494–505. [11] Mortaji H, Ow S, Moghavvemi M, Almurib H. Load Shedding and Smart-Direct Load Control Using Internet of Things in Smart Grid Demand Response Management. IEEE Transactions on Industry Applications 2017;53:5155–63. [12] Hussain M, Gao Y. A review of demand response in an effcient smart grid environment. The Electricity Journal 2018;31:55–63. [13] Wang Y, Yujing. Huang, Y. Wang, M. Zeng, F. Li, Y. Wang, Y. Zhang. Energy management of smart micro-grid with response loads and distributed generation considering demand response. Journal of Cleaner Production 2018;197:1069–83. [14] Good N, Ellis K, Mancarella P. Review and classifcation of barriers and enablers of demand response in the smart grid. Renewable and Sustainable Energy Reviews 2018;72:57–72. [15] Aghajani GR, Shayanfar HA, Shayeghi H. Demand side management in a smart micro-grid in the presence of renewable generation and demand response. Energy 2018;126:622–37. [16] Shakeri M, Shayestegan M, Abunima H, Salim SM, Akhtaruzzaman M, Alamoudc ARM, et al. An intelligent system architecture in home energy management systems (HEMS) for effcient demand response in smart grid. Energy and Buildings 2018;136:154–64. [17] Fong KF, Hanby VI, Chow TT. HVAC system optimization for energy management by evolutionary programming. Energ Buildings 2008;38:220–31. [18] Moon S, Lee J. Multi-Residential Demand Response Scheduling With Multi-Class Appliances in Smart American Scientific Research Journal for Engineering, Technology, and Sciences (ASRJETS) (2021) Volume 75, No 1, pp 149-166 166 Grid. IEEE Transactions on Smart Grid 2018;9:2518–28. [19] Yong JY, Ramachandaramurthy VK, Tan KM, Mithulananthan N. A review on the state-of-the-art technologies of electric vehicle, its impacts and prospects. Renew Sust Energ Rev 2015;49:365–85. [20] Mwasilu F, Justo JJ, Kim EK, Do TD, Jung JW. Electric vehicles and smart grid interaction: a review on vehicle to grid and renewable energy sources integration. Renew Sust Energ Rev 2014;34:501–16. [21] Román TGS, Momber I, Abbad MR, Miralles ÁS. Regulatory framework and business models for charging plug-in electric vehicles: infrastructure, agents, and commercial relationships. Energ Policy 2011;39:6360–75 [22] Papadimitriou CN, Kleftakis VA, Hatziargyriou ND. A novel islanding detection method for microgrids based on variable impedance insertion. Electr Power Syst Res 2015;121:58–66.