Multi-Agent System-Based Microgrid Operation Strategy for Demand Response

1 Department of Electrical Engineering, Inha University, 100, Inha-ro, Nam-gu, Incheon 402-751, Korea; chj119119@gmail.com 2 School of Electrical Engineering, Kookmin University, Jeongneung-ro, Seongbuk-gu, Seoul 136-702, Korea; dungate@naver.com (S.-H.K.); chung@kookmin.ac.kr (I.-Y.C.) 3 Department of Electrical Engineering, Myongji University, 116, Myongji-ro, Cheoin-gu, Yongin-si, Gyeonggi-do 449-728, Korea; erichan@mju.ac.kr * Correspondence: djwon@inha.ac.kr; Tel.: +82-32-860-7404; Fax: +82-32-863-5822


Introduction
A microgrid is a small power system that includes distributed generation (DG), an energy storage system, and a controllable load [1,2].In general, a microgrid operates optimally with the microgrid central controller (MGCC), which can control DG and the controllable load in addition to monitoring the microgrid system [3].Typically, the microgrid can be operated in islanded mode or grid-connected mode [4].In the islanded mode, the MGCC has to ensure power balance and control of voltage and frequency in the microgrid, but in the grid-connected mode, the MGCC can operate more economically because the utility grid is responsible for solving problems such as voltage control and frequency oscillation in the microgrid.
Intelligent agents can determine their performance autonomously by recognizing the surrounding environment and communicating with other agents.On the basis of these features, the microgrid can be operated using a number of agents.Recently, a microgrid operation technique through multi-agent system (MAS) has been studied [5,6].Similar to the central control method of a traditional power system, a top-level agent or energy management system ensures the optimal Energies 2015, 8,[14272][14273][14274][14275][14276][14277][14278][14279][14280][14281][14282][14283][14284][14285][14286] DAP to minimize the electricity price.The agent can compare the sales benefit and incentive for participation in EDR and determine whether to participate in EDR.The detailed algorithm is described as follows.

Algorithm for BESS Agent
The BESS is used for frequency regulation, system reserve, demand-side management capacity, and augmentation of renewable energy resources [13].In this study, the scheduling algorithm of the BESS is designed using a fuzzy expert system that can obtain an appropriate margin during the day and a real-time operation algorithm is responsible for handling emergency situations.The fuzzy expert system utilizes fuzzy logic to represent ambiguous scenarios instead of Boolean logic [14].

Algorithm for BESS Agent
The BESS is used for frequency regulation, system reserve, demand-side management capacity, and augmentation of renewable energy resources [13].In this study, the scheduling algorithm of the BESS is designed using a fuzzy expert system that can obtain an appropriate margin during the day and a real-time operation algorithm is responsible for handling emergency situations.The fuzzy expert system utilizes fuzzy logic to represent ambiguous scenarios instead of Boolean logic [14].

Algorithm for BESS Agent
The BESS is used for frequency regulation, system reserve, demand-side management capacity, and augmentation of renewable energy resources [13].In this study, the scheduling algorithm of the BESS is designed using a fuzzy expert system that can obtain an appropriate margin during the day and a real-time operation algorithm is responsible for handling emergency situations.The fuzzy expert system utilizes fuzzy logic to represent ambiguous scenarios instead of Boolean logic [14].In this study, the scheduling algorithm was designed to determine if it is charging or discharging using the fuzzy system as the input membership functions of the BESS SOC and hourly DAP. Figure 2 shows a membership function of the fuzzy system applied in this study.In the step-by-step descriptions, the BESS's SOC and the electricity price are determined by a preset fuzzy input membership function.The output membership function is determined by the SOC and the electricity price membership function through the fuzzy rule.Table 1 represents the fuzzy rule in this algorithm.All cases were evaluated and combined.Finally, the charge/discharge value was determined by the scalar value whose aggregated output membership function is defuzzification by the centroid method.Figure 3 shows a flowchart of the BESS scheduling algorithm.The BESS has an agent that receives the electricity price from the MGCC.The agent determines the hourly BESS output using the fuzzy system with the hourly SOC and electricity price.In the scheduling algorithm, the BESS has a driving range of 30% to 100% of the SOC.When the calculated SOC is greater or lower than the operating range, the agent determines the maximum value within the SOC constraints.The defuzzification value from the fuzzy system determines the BESS power output.Depending on this output, it is possible to perform BESS scheduling over a 24 h period by repeatedly calculating the SOC of the next time.Figure 4 presents a flowchart of the real-time BESS operation algorithm.When the agent receives an emergency signal from the MGCC, the BESS discharges until an SOC of 20% is reached.After the EDR periods, the BESS performs rescheduling with the scheduling algorithm for the remaining time.

Algorithm for Intelligent Load Agent
It should be noted that the intelligent load in this study is assumed to be an industrial load for the manufacturing industry.An intelligent load consists of a controllable load that is controlled by the time, and a fixed load that is maintained at all times for the operation of a factory.In this paper, an intelligent load scheduling algorithm for DR is proposed considering the labor costs and the electricity price of the different time period from the authors' previous study [11].In general, when a product is produced, its costs can be classified as the raw material costs, labor cost, electricity price, and other costs (transmission expense and external effect, etc.).The raw material cost and other costs In this study, the scheduling algorithm was designed to determine if it is charging or discharging using the fuzzy system as the input membership functions of the BESS SOC and hourly DAP. Figure 2 shows a membership function of the fuzzy system applied in this study.In the step-by-step descriptions, the BESS's SOC and the electricity price are determined by a preset fuzzy input membership function.The output membership function is determined by the SOC and the electricity price membership function through the fuzzy rule.Table 1 represents the fuzzy rule in this algorithm.All cases were evaluated and combined.Finally, the charge/discharge value was determined by the scalar value whose aggregated output membership function is defuzzification by the centroid method.Figure 3 shows a flowchart of the BESS scheduling algorithm.The BESS has an agent that receives the electricity price from the MGCC.The agent determines the hourly BESS output using the fuzzy system with the hourly SOC and electricity price.In the scheduling algorithm, the BESS has a driving range of 30% to 100% of the SOC.When the calculated SOC is greater or lower than the operating range, the agent determines the maximum value within the SOC constraints.The defuzzification value from the fuzzy system determines the BESS power output.Depending on this output, it is possible to perform BESS scheduling over a 24 h period by repeatedly calculating the SOC of the next time.Figure 4 presents a flowchart of the real-time BESS operation algorithm.When the agent receives an emergency signal from the MGCC, the BESS discharges until an SOC of 20% is reached.After the EDR periods, the BESS performs rescheduling with the scheduling algorithm for the remaining time.

Algorithm for Intelligent Load Agent
It should be noted that the intelligent load in this study is assumed to be an industrial load for the manufacturing industry.An intelligent load consists of a controllable load that is controlled by the time, and a fixed load that is maintained at all times for the operation of a factory.In this paper, an intelligent load scheduling algorithm for DR is proposed considering the labor costs and Energies 2015, 8, 14272-14286 the electricity price of the different time period from the authors' previous study [11].In general, when a product is produced, its costs can be classified as the raw material costs, labor cost, electricity price, and other costs (transmission expense and external effect, etc.).The raw material cost and other costs are fixed costs.Therefore, the labor cost and electricity price in each time period are important variables.Thus, the hourly production costs calculated by Equations ( 1) and ( 2) are used in the scheduling algorithm for the maximum benefit per day.
Energies 2015, 8, page-page 5 are fixed costs.Therefore, the labor cost and electricity price in each time period are important variables.Thus, the hourly production costs calculated by Equations ( 1) and ( 2) are used in the scheduling algorithm for the maximum benefit per day.At each time, this can be expressed by the formula as follows Equations ( 1) and (2): where: Bene f it sell : Benefit between product price and cost.
Equation ( 1) represents the cost of the product, and Equation ( 2) represents the sale benefit per product.Finally, labor costs are classified as normal working hours, overtime working hours, and night working hours as listed in Table 2. Figure 5 presents a flowchart for the intelligent load scheduling algorithm.The intelligent load agent received the electric price data of each time interval from the MGCC.The intelligent load agent calculates the production costs in Equation ( 1) and sorts them in ascending order.The intelligent load agent then uses the maximum power in order from the lowest cost of time.The remainder of the production volume after using the maximum power is used in the next time with low cost.When the scheduling algorithm is complete, the intelligent load agent sends data to the load hardware in chronological order.
Figure 6 presents the flowchart of an intelligent load real-time operating algorithm.Initially, the daily schedule of the load is determined by the scheduling algorithm.The load agent verifies whether the signal is received from the MGCC before EDR occurs.The EDR signal has two data sets: (1) time period of EDR and (2) incentive by participating in EDR: where: I ptq: Incentive at time t; P con ptq: Controllable Power at time t; P Load ptq: Load Power at time t.
In Equation (3), P con ptq denotes the controllable power for manufacturing of products, and P Load ptq denotes the entire load power, which includes the controllable power and the fixed load for operating the factory.When the EDR signal is received at the load agent, the agent confirms Equation (3).If the equation is satisfied, the agent decides to participate in EDR.If the right-hand term is larger than the left-hand term in Equation ( 3), the agent retains the original scheduling.If the load participates in EDR, the agent reschedules for the elapsed time period of EDR in accordance Energies 2015, 8, 14272-14286 with the scheduling algorithm.On the other hand, if the load does not participate in EDR, the load agent is affected by the scheduling algorithm.Here, it assumes that the power requirement at EDR is greater than the load.Therefore, all controllable loads except for the fixed load should be reduced in that time period.

Operation Algorithm for MGCC
Figure 7 is the MGCC management algorithm considering the overall system stability.In general, the MGCC receives data (electricity price, emergency signal) from the upper EMS and sends this data and signal to lower agents.Further, the MGCC can monitor the power and control by sending any signal to the agents.In the grid-connected microgrid, however, problems such as the

Operation Algorithm for MGCC
Figure 7 is the MGCC management algorithm considering the overall system stability.In general, the MGCC receives data (electricity price, emergency signal) from the upper EMS and sends this data and signal to lower agents.Further, the MGCC can monitor the power and control by sending any signal to the agents.In the grid-connected microgrid, however, problems such as the

Operation Algorithm for MGCC
Figure 7 is the MGCC management algorithm considering the overall system stability.In general, the MGCC receives data (electricity price, emergency signal) from the upper EMS and sends this data and signal to lower agents.Further, the MGCC can monitor the power and control by sending any signal to the agents.In the grid-connected microgrid, however, problems such as the capacity of a transformer, transmission/distribution cable, and capacity of the PCC can occur.Considering these problems, the MGCC receives the expected charging power from the BESS agent, and if the total power in the microgrid exceeds the allowable value at the PCC, the MGCC sends a charging delay signal to the BESS agent.If not, the MGCC does not send a delay signal.The MGCC considers the power in the microgrid and the PCC capacity.Therefore, this system can be applied without other system changes if another DG or load is added to the system and the communication has been transmitted.
Energies 2015, 8, page-page and if the total power in the microgrid exceeds the allowable value at the PCC, the MGCC sends a charging delay signal to the BESS agent.If not, the MGCC does not send a delay signal.The MGCC considers the power in the microgrid and the PCC capacity.Therefore, this system can be applied without other system changes if another DG or load is added to the system and the communication has been transmitted.

Simulation Results
Figure 8 shows the construction of the HILS test system with the MGCC program and agents.In this study, the MGCC program is used for monitoring and managing this system, and the agents of the BESS and load were constructed to verify the performance of the proposed algorithm and simulate the microgrid operation [15].The following describes each component of the system.Before connecting to the hardware, OPAL-RT was used for the HILS to test the communication and operation between the MGCC and the agent.

MGCC Program
The MGCC program was constructed using Visual Basic 6.0 and communicates with each agent using Zigbee.First, when each agent's ID is sent to the MGCC and registered, it follows the monitoring and control of the agent's state.As shown in Figure 8, the MGCC program shows the status and mode of the microgrid operation and sends a scheduling and emergency signal to agents.The scheduling and emergency signal sent by the MGCC contains information on the hourly price, emergency predictive time, and incentive.

Simulation Results
Figure 8 shows the construction of the HILS test system with the MGCC program and agents.In this study, the MGCC program is used for monitoring and managing this system, and the agents of the BESS and load were constructed to verify the performance of the proposed algorithm and simulate the microgrid operation [15].The following describes each component of the system.Before connecting to the hardware, OPAL-RT was used for the HILS to test the communication and operation between the MGCC and the agent.

MGCC Program
The MGCC program was constructed using Visual Basic 6.0 and communicates with each agent using Zigbee.First, when each agent's ID is sent to the MGCC and registered, it follows the monitoring and control of the agent's state.As shown in Figure 8, the MGCC program shows the status and mode of the microgrid operation and sends a scheduling and emergency signal to agents.

Agents
In this study, the agent consisted of a FreeScale board (EVB9S12XDP512).The agent performed each operation algorithm by receiving the signal containing a variety of information from the MGCC.The agent was connected by hardware using a CAN bus.Therefore, each agent could monitor and control the power output of the hardware connected to the agent.

Case Study
Table 3 shows scenarios for the verification of each agent's algorithm.The RTP electricity price in this study was applied by referring to the Illinois state RTP program in the United States.As mentioned earlier, the test microgrid consisted of the BESS and the intelligent load.The BESS in all scenarios was set to an initial SOC of 40%, a rate power of 1 kW, and a rate capacity of 3 kW/h.With an intelligent load, it was assigned a minimum maintenance load of 0.6 kW and a controllable load of 1.8 kW.In all scenarios, the hourly maximum production volume was 11, and the daily maximum production volume was 126.In practice, the load and the BESS rate power were higher than the setting value.On the other hand, the hardware testing in laboratory condition was set as described earlier.Figure 9 shows the HILS test result in scenario 1.The RTP in summer is similar to the load curve, in which the load is higher in the afternoon than in the morning.Figure 8 shows the electricity price production cost, load active power, BESS active power, and BESS SOC from the top to the bottom.Each agent starting from ① makes the power output reference that is conducted by the operation algorithm in time order.The hourly production cost of the products can be derived from the electric price from the load agent.Therefore, it is possible to perform load scheduling line with the hourly cost of production for maximum benefit.Accordingly, the load can be confirmed by the lowest production cost to the maximum productivity.Since product cost is affected by the labor cost, the industrial load is operated during daytime with low labor cost.In the BESS, the agent charges at

Agents
In this study, the agent consisted of a FreeScale board (EVB9S12XDP512).The agent performed each operation algorithm by receiving the signal containing a variety of information from the MGCC.The agent was connected by hardware using a CAN bus.Therefore, each agent could monitor and control the power output of the hardware connected to the agent.

Case Study
Table 3 shows scenarios for the verification of each agent's algorithm.The RTP electricity price in this study was applied by referring to the Illinois state RTP program in the United States.As mentioned earlier, the test microgrid consisted of the BESS and the intelligent load.The BESS in all scenarios was set to an initial SOC of 40%, a rate power of 1 kW, and a rate capacity of 3 kW/h.With an intelligent load, it was assigned a minimum maintenance load of 0.6 kW and a controllable load of 1.8 kW.In all scenarios, the hourly maximum production volume was 11, and the daily maximum production volume was 126.In practice, the load and the BESS rate power were higher than the setting value.On the other hand, the hardware testing in laboratory condition was set as described earlier.9 shows the HILS test result in scenario 1.The RTP in summer is similar to the load curve, in which the load is higher in the afternoon than in the morning.Figure 8 shows the electricity price production cost, load active power, BESS active power, and BESS SOC from the top to the bottom.Each agent starting from 1 makes the power output reference that is conducted by the operation algorithm in time order.The hourly production cost of the products can be derived from the electric price from the load agent.Therefore, it is possible to perform load scheduling line with the hourly cost of production for maximum benefit.Accordingly, the load can be confirmed by the lowest production cost to the maximum productivity.Since product cost is affected by the labor cost, the industrial load is operated during daytime with low labor cost.In the BESS, the agent charges at dawn at a low electricity price and initial SOC and discharges at 7 and 10 h at the comparatively high electricity price and SOC.The 7 and 10 h are not the most expensive time period of electricity price.However, since the SOC that is one of input variables of the fuzzy system is enough high, the BESS can discharge.The SOC is relatively low at time 2 but the BESS discharge because the electricity price is in the most expensive time period.The BESS charges again because the SOC is too low at time 18.Scenario 1 is the base scenario that is compared to the other scenarios.The base scenario can be show the following.
(1) The load agent is affected by labor cost as compared to the electricity price; (2) The BESS agent performs for maintaining a certain SOC range; (3) As shown in Figure 9, the two agents do not interfere with each other and the two agents consumed power at 10 h.
Energies 2015, 8, page-page dawn at a low electricity price and initial SOC and discharges at 7 and 10 h at the comparatively high electricity price and SOC.The 7 and 10 h are not the most expensive time period of electricity price.However, since the SOC that is one of input variables of the fuzzy system is enough high, the BESS can discharge.The SOC is relatively low at time ② but the BESS discharge because the electricity price is in the most expensive time period.The BESS charges again because the SOC is too low at time 18.Scenario 1 is the base scenario that is compared to the other scenarios.The base scenario can be show the following.( 1) The load agent is affected by labor cost as compared to the electricity price; (2) The BESS agent performs charge/discharge for maintaining a certain SOC range; (3) As shown in Figure 9, the two agents do not interfere with each other and the two agents consumed power at 10 h. Figure 10 presents the HILS test result for DAP in summer with the EDR signal.This scenario is based on the scheduling result of the summer DA_RTP, and therefore it is the same as scenario 1 until the EDR signal is generated at ② In this scenario, however, the EDR signal with the EDR occurred time and participation incentive is entered as seen in Figure 11, and this signal is sent to each agent by clicking on the EDR button in the MGCC program between ① and ② in Figure 10.When each agent receives the EDR signal, the agent executes a real-time algorithm for the EDR situation.The EDR time period is defined between two hours from the input time in the MGCC program.In this scenario, the time at 13 of EDR time (②) and 750 won/kWh for the incentive are entered.From Figure 10, the load reduces the power, and the BESS discharges at this EDR time period.If EDR has occurred, the BESS SOC is set to 20% lower than the usual day.The BESS is charged again at time 18 (③) at a low electricity price and SOC.The BESS does not charge at time 15  Figure 10 presents the HILS test result for DAP in summer with the EDR signal.This scenario is based on the scheduling result of the summer DA_RTP, and therefore it is the same as scenario 1 until the EDR signal is generated at 2 In this scenario, however, the EDR signal with the EDR occurred time and participation incentive is entered as seen in Figure 11, and this signal is sent to each agent by clicking on the EDR button in the MGCC program between 1 and 2 in Figure 10.When each Energies 2015, 8, 14272-14286 agent receives the EDR signal, the agent executes a real-time algorithm for the EDR situation.The EDR time period is defined between two hours from the input time in the MGCC program.In this scenario, the time at 13 of EDR time ( 2 ) and 750 won/kWh for the incentive are entered.From Figure 10, the load reduces the power, and the BESS discharges at this EDR time period.If EDR has occurred, the BESS SOC is set to 20% lower than the usual day.The BESS is charged again at time 18 ( 3 ) at a low electricity price and SOC.The BESS does not charge at time 15 because EDR has finished as the electricity price is too high for charging.Finally, the BESS charges at times 21 and 24 because the electricity price is low.The load must reproduce for the reduced volume during the EDR period.Therefore, the load is shifted with 19 to 21 h having a low cost after the EDR period.In this scenario, as shown in Figure 12, most of the settings are the same as in scenario 2 except for the charging delay signal.The MGCC receives the BESS output after the EDR period.Therefore, it is possible to generate a charging delay signal as determined by the microgrid stability.In a grid-connected microgrid, all agents can operate for their own economic advantages under any  In this scenario, as shown in Figure 12, most of the settings are the same as in scenario 2 except for the charging delay signal.The MGCC receives the BESS output after the EDR period.Therefore, it is possible to generate a charging delay signal as determined by the microgrid stability.In a grid-connected microgrid, all agents can operate for their own economic advantages under any  In this scenario, as shown in Figure 12, most of the settings are the same as in scenario 2 except for the charging delay signal.The MGCC receives the BESS output after the EDR period.Therefore, it is possible to generate a charging delay signal as determined by the microgrid stability.In a grid-connected microgrid, all agents can operate for their own economic advantages under any situation.If the maximum allowable power is available for the transformer capacity, transmission, and distribution cable capacity at the PCC point, which is connected to the grid, the MGCC cannot allow the output of each agent from the standpoint of the global objective of the system.In this study, the maximum allowable power at the PCC is 2.5 kW.The load shifting time is the same as in scenario 2. Therefore, the BESS charging time is delayed at 21 h, which is in contrast to scenario 2 because the load is reduced at 21 h.If the BESS charge at 21 h, the microgrid's injection power does not exceed 2.5 kW at PCC point.So the MGCC does not generate a delay signal for BESS agent.Since then, the BESS changes a standby state at 22 h because the SOC is higher than 40% and maintains stable range, and the BESS charges by low electricity prices from 23 h.
Energies 2015, 8, page-page not exceed 2.5 kW at PCC point.So the MGCC does not generate a delay signal for BESS agent.Since then, the BESS changes a standby state at 22 h because the SOC is higher than 40% and maintains stable range, and the BESS charges by low electricity prices from 23 h.

Experimental Results
This study simulated the intelligent distributed operation and control in the smartgrid environment that the new distribution simulator connects the BESS and the intelligent load.The new distribution simulator can monitor the state of microgrid and electricity quality from a remote PC connected to the Ethernet.The new distribution simulator can construct any power system network as setting in software installed in the PC and store real-time data from the installed power quality meter.On the other hand, because there is no feature that can see the graphically data display stored in the program, it can be compared graphically using the Excel program This study simulated intelligent distributed operation and control in a smart grid environment in which the new distribution simulator connects the BESS and the intelligent load.The new distribution simulator can monitor the state of the microgrid and the electricity quality from a remote PC connected to the Ethernet.The new distribution simulator can construct any power system network with suitable settings in software installed in the PC and store real-time data from the installed power quality meter.However, the program is unable to display stored data graphically.MS Excel can be used for a graphical comparison.
Figure 13 shows a distribution simulator for hardware test.Figure 14 shows an intelligent load device and an energy storage device used in the hardware test.The two devices are connected to the

Experimental Results
This study simulated the intelligent distributed operation and control in the smartgrid environment that the new distribution simulator connects the BESS and the intelligent load.The new distribution simulator can monitor the state of microgrid and electricity quality from a remote PC connected to the Ethernet.The new distribution simulator can construct any power system network as setting in software installed in the PC and store real-time data from the installed power quality meter.On the other hand, because there is no feature that can see the graphically data display stored in the program, it can be compared graphically using the Excel program This study simulated intelligent distributed operation and control in a smart grid environment in which the new distribution simulator connects the BESS and the intelligent load.The new distribution simulator can monitor the state of the microgrid and the electricity quality from a remote PC connected to the Energies 2015, 8, 14272-14286 Ethernet.The new distribution simulator can construct any power system network with suitable settings in software installed in the PC and store real-time data from the installed power quality meter.However, the program is unable to display stored data graphically.MS Excel can be used for a graphical comparison.
Figure 13 shows a distribution simulator for hardware test.Figure 14 shows an intelligent load device and an energy storage device used in the hardware test.The two devices are connected to the new distribution simulator, and each device operates on the output from the connected agent.The inverter connected to the BESS and intelligent load has a rated capacity of 5 kW.The oscilloscope is installed at the point where the hardware is connected to the simulator for comparison with the PQM data in the software.In this study, the hardware test was performed for scenario 1 and compared with the HILS test result.In the hardware test, it was difficult to visualize the electrical price and production costs, and the BESS SOC was calculated in the agent because of the simulation difference between the actual performance time of the BESS and the scaled time interval for simulation.
Figure 15 presents the HILS test result and the hardware test result for scenario 1.The two test results differ, but the overall charging and discharging and load patterns are the same.However, because of the difference between the scaled time interval and the actual time, a few milliseconds delay occurred owing to data transmission and calculation of the algorithm.If the system operates for one day, this problem can be solved by synchronization using a GPS system and other algorithms for solving the time delay problem.In this study, the hardware test was performed for scenario 1 and compared with the HILS test result.In the hardware test, it was difficult to visualize the electrical price and production costs, and the BESS SOC was calculated in the agent because of the simulation difference between the actual performance time of the BESS and the scaled time interval for simulation.
Figure 15 presents the HILS test result and the hardware test result for scenario 1.The two test results differ, but the overall charging and discharging and load patterns are the same.However, because of the difference between the scaled time interval and the actual time, a few milliseconds delay occurred owing to data transmission and calculation of the algorithm.If the system operates for one day, this problem can be solved by synchronization using a GPS system and other algorithms for solving the time delay problem.In this study, the hardware test was performed for scenario 1 and compared with the HILS test result.In the hardware test, it was difficult to visualize the electrical price and production costs, and the BESS SOC was calculated in the agent because of the simulation difference between the actual performance time of the BESS and the scaled time interval for simulation.
Figure 15 presents the HILS test result and the hardware test result for scenario 1.The two test results differ, but the overall charging and discharging and load patterns are the same.However, because of the difference between the scaled time interval and the actual time, a few milliseconds delay occurred owing to data transmission and calculation of the algorithm.If the system operates for one day, this problem can be solved by synchronization using a GPS system and other algorithms for solving the time delay problem.
Energies 2015, 8, 14272-14286 13 Figure 15 presents the HILS test result and the hardware test result for scenario 1.The two test results differ, but the overall charging and discharging and load patterns are the same.However, because of the difference between the scaled time interval and the actual time, a few milliseconds delay occurred owing to data transmission and calculation of the algorithm.If the system operates for one day, this problem can be solved by synchronization using a GPS system and other algorithms for solving the time delay problem.

Conclusions
This study examined the microgrid operation method using MAS.The agent, through a micro control unit and microgrid components, is constructed for a hardware test, and an operation algorithm is included for DR.The operation algorithm includes a scheduling algorithm and a real-time operation algorithm for emergency situations.The load agent schedules with the objective of minimizing the production cost by considering hourly electricity prices and labor costs.The BESS agent schedules by using a fuzzy algorithm.Because the BESS operation algorithm considers the hourly BESS SOC and the electricity price, the BESS maintains a constant SOC range to prepare for emergency situations.
Each agent in the microgrid operates for its individual benefit.The MGCC in the study does not control the output of the agent even if EDR occurs.However, although these individual operation strategies ensure the maximum benefit of each agent, they can be a problem from the system stability perspective because the agents do not have access to system information.Although the microgrid constructs distributed MAS, the MGCC's role as a coordinator is required for monitoring and sending a grid's signal and information to each agent.
Consequently, we verified that the microgrid system that includes each agent applied the proposed algorithms for the load and the BESS with the DR program.Further, this study not only simulates but also implements in HILS be employing a new distribution simulator through wireless communication.In a future study, agents corresponding to renewable sources such as a wind turbine will be included in this system.A more detailed scenario and operation strategy considering renewable energy sources will be developed.

Figure 1 .
Figure 1.Configuration of microgrid in this paper.

Figure 4 .
Figure 4. Flow chart of BESS real-time algorithm.

Figure 6 .
Figure 6.Flow chart of intelligent load real-time algorithm.

Figure 11 .
Figure 11.Emergency demand response (EDR) data input display in the MGCC program.

Figure 11 .
Figure 11.Emergency demand response (EDR) data input display in the MGCC program.

Figure 11 .
Figure 11.Emergency demand response (EDR) data input display in the MGCC program.

Figure 15 .
Figure 15.Hardware test result compared to the HILS test result of scenario 1 (a) Measurement at the oscilloscope installed in front of each piece of hardware; (b) Data stored in a new distribution simulator.

Table 2 .
Labor cost rate at each time period.

Table 3 .
Scenario for the proposed algorithm.

Table 3 .
Scenario for the proposed algorithm.