IoT-Based Real Time Energy Management of Virtual Power Plant Using PLC for Transactive Energy Framework

The growing interest with the developments of renewable sources owing to less environmental pollution creates challenges for the grid operators. Virtual Power Plant (VPP) is a novel concept that will integrate the small distributed energy resources and will act as a single conventional power plant in the electricity market. As a core energy management system in VPP, the energy should be dispatched optimally for achieving the maximum profit. Therefore, smart energy management is developed in this article of VPP with Programmable Logic Controller (PLC) and Internet of Things (IoT) in a unified market environment that integrates the DA and RT market. The cost characteristics for the interruptible load, battery storage system are modelled individually. The PLC and IoT based automation is proposed for optimal dispatch strategy of VPP. The proposed scheme can efficiently handle the energy demand for the VPP domain. Four different scenarios are considered with different loading conditions for validation of the concept of smart energy management. The profitability for each scenario is shown with the experimental results.


INDEX TERMS
Power imbalance due to the uncertainty of solar generation γ t Regulation price for buying the energy from the grid P Imb t Power imbalance due to the uncertainty of solar generation P Fore t Forecasted generation in the DA Scheduled generation at the time market P sche t Scheduled generation at time t

I. INTRODUCTION
The energy management for virtual power plants is a very important issue as it integrates small distributed energy resources with different characteristics [1]. The conception of the smart home and automation is one of the most useful and recent advancements in the field of IoT. The financial aspects and the power consumption are getting more preference to make the smart home more convenient for people. An IoT-based home automation system was developed that provides an efficient smart home that will effectively control the usage of the appliances by load schedule. Moreover, solar power generation is also considered to reduce the power consumption from the national grid [2]. The power consumption data can be efficiently measured using a smart energy meter. IoT-enabled smart energy meters are developed for real-time load management. This application can also be used as a smart home controller where the electrical appliances can be controlled smartly [3]. The optimal energy management of the microgrid is developed using generation and demand-side management. The optimal operation model is developed using the minimum cost of operation and maintenance and by developing the optimal scheduling strategy of the generation sources. [4]. Demand-side management is a mostly used method of managing the energy sources, in which the consumer is subjected to pay a high price for the peak load condition. This paper has implemented such a system of demand-side management in which the user can control and monitor the loads from a single platform. The demand-side management with the internet of things has made the system more user-friendly [5]. A cost-effective system is developed for renewable energy sources in microgrids. This cost-effective system is provided for demand-side management in micro-grids. IoT platform UBIDOTS is used for making the data accessible from anywhere across the world. Depending on the trend in demand-side management, a multiple regression model is developed to make changes in the system [6]. A novel algorithm is represented for minimizing the power disruption due to sudden load changes. Shedding, forecasting, and smart direct load control are used in this algorithm using the Internet of Things. A simulation system was developed to test the algorithm with one hundred customers to check the feasibility of the algorithm [1]. The smart meter application was provided a bi-channel communication, by producing the billing details of consumed energy via the GSM module and the other related information of supplying utility. In this paper, the entire data is concentrated into one storage system which facilitates both the utility and the consumers to access the real-time data anywhere from the world [7]. A cost-effective energy management system was developed in this paper. Source management in which the parallel operation of sources is considered for meeting the variable demand, load automation, and overcurrent protection with IoT and real-time monitoring of loads [8]. As a part of demand-side management, smart energy meters play a key role in measuring the power consumption data efficiently. In this paper, an IoT-based smart energy meter is developed for real-time load management. The energy data can be monitored with the mobile application. This application has also been used as a smart home [9]. A novel algorithm is used for smart direct load control which is used to minimize the power outages due to sudden changes in grid load. The real-time load control is also developed in this paper using stream analytics and the Internet of Things [3]. A compact power conversion system (PCS) is proposed in this paper for virtual power plants that consist of a residential battery and solar systems aggregated with IoT. The PCS is based on a threeport converter (TPC) which seeks to reduce cost using the combination of several power conversion systems in a single system. Double line frequency (DLF) power fluctuations are the key issues for any single conversion system. In this paper, a simulation model is developed with MATLAB Simulink for controlling DLF flows in the PCS [10]. Virtual Power Plant optimizes its operation by coordinating and optimizing the operation of Distributed generation, battery switch stations, and storage systems. In this paper, the optimal dispatch strategy of VPP is developed for a unified electricity market that combines real-time and day-ahead trading. The optimal dispatch strategy is developed using the Fruit Fly algorithm for maximizing the profit considering the parameters of fluctuating market price, load demand, and retail price [11]. In VPP the EVs and DERs serve as the energy delivery devices and form a self-sufficient island of the power distribution grid. In this paper, the application of 5G-enabled technologies is shown for VPP that can detect the phase-to-ground faults in the presence of DG [12].
Waste management is one of the key issues nowadays to maintain the health and hygiene of the environment. In this paper, an IoT-based garbage monitoring system is developed which will measure the trash level in the containers and will send alerts for the concerned authorities. NodeMCU ESP8266 controller is used for detecting the bin parameters of the container [13]. IoT-based technologies are rapidly growing due to advancements in technologies for different aspects of life. As this technology is having different useful benefits, the impacts of environmental effects of this technology should be monitored. So, a review is presented in this paper regarding the highlights and challenges of IoT-based technologies for the environment, transportation, and low carbon products [14]. A cloud-based architecture is developed for the improvement of smart industrial systems based on the remote control and monitoring systems. The architecture is implemented on an automated electric induction motor case [17]. The application of IoT for smart Grid is discussed in this literature. The smart grid performs the tasks such as smart appliance control, distributed generation management, and integration of renewable energies. The smart energy management system is used for the smart grid that includes demand-side management, power control, cost management, sustainability. The smart energy management system can be handled by several optimization algorithms, soft computing methods for maintaining grid security [18]. The production efficiency of the industrial system can be improved by combining the industrial system with internet connectivity. In this paper, a survey is done regarding the recent advances of the industrial internet which includes the key technologies, future challenges of industrial the internet [19]. The integration of small-scale distributed energy resources is the key issue for low and medium-voltage networks. Three categories of energy management systems are considered in this paper such as (i) Co-ordinated approach for managing several users (ii) Un-coordinated approach for individual users and (iii) peer-to-peer energy trading for decentralized energy markets. A review is presented here based on the comparative analysis, categories of the three different strategies [20]. The IoT-based monitoring network is developed in the paper with free software that aims at cost reduction related to sensing modules, data storage, and commercial data loggers. The proposed IoT-based monitoring strategy is tested for three grid-connected PV systems placed in Germany, Brazil, and Fortaleza, Maracanau. A web page called Web Monitor is developed for the real-time monitoring of three plants [21]. As a core energy management system, proper maintaining scheduling of DERs is one of the key issues of VPP for maintaining grid security. In this paper, a new personal rapid transit system is used for price-based unit commitment to maximizing profit [22]. The key feature of the renewable energy sources is to reduce the greenhouse gas emission, that is the aim of the UK to reduce by 80% up to the year 2050. In this literature integration of the IoT-Distributed, energy system model for the microgrid is studied. This framework collects the information of weather data and sensor data to reduce the mismatch of load and generation data [23]. The Internet of Things can be utilized for transforming the power grid into an energy-sharing inter-grid. Future smart grid should accomplish the vision of the Internet of Things with energy so that people can produce energy from renewables in their offices, homes, and factories. A smart grid with intelligent periphery or GRIP is proposed in this paper that includes energy management system (EMS) controlled distribution grids, transmission grids, and micro-grids [24]. The Raspberry Pi and Arduino are different boards with different technical characteristics. The Raspberry Pi is a mini-computer whereas the Arduino is a microcontroller. Both the boards should run with very low power such as battery packs [26]. PLC-based PV monitoring systems are developed [27]- [29]. The huge consumption of fossil fuels has led to global warming and air pollution. VPP is the solution for this which aggregates different renewable generation with storage devices such as electric vehicles (EV). Wind power generation is considered renewable generation and the uncertainty modelling of wind generation, market prices, and EV is developed using a novel uncertainty modelling method [30]. The optimal location and placement of an energy storage system are developed in order to minimize the overall cost of VPP. The model is developed with a mixed-integer non-linear programming method and the conditional value at risk method is used for the uncertainty modelling [31].
A novel combined model is developed for generic VPP or GVPP that represents both the electrical and economic performances of VPP [32]. The enhancement of the integration of renewable energy sources and the energy storage system [33]. Most IoT-enabled devices use batteries as the power sources which require replacements in very few years. As the replacement cost is very high, so harvesting energy from natural resources removes the dependency of the IoT networks on batteries. An energy harvesting sub-system is developed for IoT networks [34]. The advancement of communication and sensing technologies and their rapid penetration in the modern grid system has led to the security, connectivity, bandwidth management, and data processing problem for the grid. A review is done regarding the main challenges and issues of integrating IoT in energy systems [35]. The recent IoT-enabled sensor-based big data applications, computing models regarding smart sustainable cities of the future are reviewed [36]. Internet of Things or IoT enables object-toobject and person-to-object communications using sensors, actuators, and other smart technologies. IoT and bi-cycle sharing systems are developed that will make the transportation of the city more convenient and green [37]. To address this issue a novel algorithm is proposed for smart direct load control. Stream analytics and the internet of things are used for providing real-time load control and to generate a daily schedule for the customers, to provide a forecasted load model From the above literature survey, it can be summarized as follows There are fewer works on IoT-based energy management. Very less literature deals with IoT-based energy systems, uses ESP 8266, Raspberry-Pi microcontroller for small-scale applications. The PLC-based energy monitoring is also developed for residential applications. So, to bridge the research gap, a PLC(S7-1200) and IoT-based smart energy management are developed for Virtual Power Plant in the unified electricity market. The unified market strategy, the forecasted parameters, power imbalances, marginal pricing are explained in a detailed manner in this work.
The paper contribution is outlined as follows Smart energy management system is developed for VPP with PLC.  To investigate the effectiveness of the proposed method, optimal energy management is carried out for four different scenarios in the unified market. The unified market strategy such as forecasted generation, a load of DA market, power purchasing, selling price, and the power imbalance cost or regulation price is also elaborately explained in this paper. Both source and load management are developed for VPP with a PLC-based automation system. The overall paper is arranged as follows-the 2nd section deals with the strategy of the smart energy management system, 3rd section deals with the simulation of optimal energy management of VPP with PLC for four different scenarios. The hardware setup is shown and explained in the 4th section. The last section deals with the simulation results for each scenario and the overall analysis and conclusion are drawn in the last section.
The theoretical modelling of the IoT-based smart energy management system of VPP is shown in Figure 1. The detailing of the sources used is described in Table 1. Table 1 Rating of the input source

II. PARTICULARS OF THE MARKET
The market plan considered here is the unified market which is the combination of Day-ahead (DA) and Real-time (RT) market. The commitment of supplying the power is made in the DA market before 24 hours of supplying the load. The spot price or the marginal price is settled in the DA market depending on the generation. The energy selling price to the consumers is fixed dependent on the load which is known as the retail price of the consumers. Any deviation of commitment made in the DA market or shortage of the power supply that can't be met with a storage device will be sorted out by giving the penalty to the consumers which is also denoted by regulation price. As a core energy management system, the VPP will optimally dispatch the energy among its consumers and will charge the energy storage system for surplus energy generation. The data forecasted in the DA market are load data, generation data, the marginal price for the generation. The data considered for the RT market are the retail price fixed between the VPP and the consumers based on the load, the imbalance cost which is to be met in the RT market. The VPP will purchase the power from the grid only when the available sources including storage devices are not enough to meet the demand taking into consideration that the power purchasing price from the grid is comparatively low from the power imbalance cost. The optimal dispatch strategy of VPP is developed in two ways in this paper.
• By using the minimum amount of available generation sources at the period of low demand and using the maximum amount of generation for the peak-demand condition.
• By maximizing the profit of selling the energy to the consumers.
The elaborate explanation of the market strategy, parameters forecasted in the DA market such as the marginal price considered of VPP, parameters that have been met in the RT market such as the imbalance cost, dynamic pricing of the grid on an hourly basis is shown in Figure 2.
The optimal scheduling model of the VPP in the unified electricity market can be formulated as,

A. PROBLEM FORMULATION
The optimal scheduling model of the VPP in a unified electricity market can be formulated as, The architecture of the IoT based smart energy management system of VPP. (1) The cost function of the IL can be formulated as The cost of the BESS can be formulated as The imbalance cost can be formulated as The power imbalance can be formulated as

III. STRATEGY OF IOT BASED SMART ENERGY MANAGEMENT SYSTEM
The strategy of the overall energy management system is illustrated in this section.

A. OUTLINE OF THE PROPOSED ENERGY MANAGEMENT SYSTEM
The architecture of the IoT-based smart energy management system (SOLAR POWER LOAD MANAGER) is shown in Figure 3. The supply is given to the loads from solar panels and mains through the programmable logic controller (PLC) and two-pole two-way selector switches. The state of charge (SOC) of the battery connected to the solar panel will determine the supply to the load. If the SOC of the battery is equal or above, then the threshold value (70% of the battery voltage) the loads can be supplied from the solar generation, or else the loads will be supplied through mains. The whole operation of the system is controlled and monitored using PLC and SCADA systems. Two DC and Six AC multifunction meters (MFM) are used to measure the voltage, current, and energy consumption reading.

B. COMPONENTS USED
The operating principles of the involved modules are described in this section.

C. SOURCE MANAGEMENT
In this work two sources of solar generation have been used, which are of rating 2 kW,55v and 1Kw,33v. The two sources are connected to the load through a battery and charge controller of rating 48v,200Ah, and 24v,150Ah. In this mode of operation, the sources are to be managed according to the demand variation. The whole operation of the source management is controlled and monitored using PLC and SCADA systems. Four different scenarios have been considered for simplification of the operation of source management. In this work, the varying loads are represented by the loads connected to the classroom. The controller will send the signal to the relay switches which will trip according to the load condition. The constitution of the loads is shown in Table 2.
The forecasted solar generation of the DA market is shown in Figure 4. The generation is considered for both the solar generation in hours The solar generation forecasting is made based on some data such as solar irradiation, temperature, and the position of the solar panel with the sun. The forecasted load of the DA market is shown in Figure 5 on an hourly basis. The loads considered here are the university loads. The regulation price of the RT market is shown in Table 3. This price is dependent on the power imbalance which is met in the RT market.
The marginal price of the DA market, power purchasing, and selling price for the real-time market is shown in Table 4. The profit obtained by VPP in the unified market is calculated VOLUME 9, 2021   based on these prices. A brief description of the four scenarios considered is stated in this section.
D. SCENARIO 1 In this scenario, the source management is developed for full load condition, 2400 watts. Due to the increment of demand, the current required to satisfy the load also increases. So, in this condition total of 3 kW of solar generation is used to meet the demand. The relay connected across the source trips as indicated by the display in Solar Power Manager. Depending on the SOC of the battery the PLC will send the signal to utilize both sources. If the battery SOC is less than the threshold value (80% of the battery voltage), then the loads will be supplied from the mains. The deficiency in the generation can be met by the imbalance cost in the RT market or by purchasing the power from the grid when the purchasing cost is low. The profit attained by VPP in this scenario is shown in the simulation results in Table 5.

E. SCENARIO 2
In the second scenario, the smart energy management of VPP is developed for the off-peak condition. The total load considered here is 1200 watts. The solar generation of 2 kW is considered in this scenario. The 1 kW solar generation is used to charge the battery. The loads will be supplied depending on the battery SOC. If the generation is less, then the load can be supplied from the grid depending on the purchasing price or by giving the penalty to the consumers. F. SCENARIO 3 In the third scenario, the smart energy management of VPP is considered for the load of 600 W. The solar generation of 1 kW is used in this scenario as the load supplied is less in this scenario. So, VPP has taken the right decision of using the least available sources in this scenario.
G. SCENARIO 4 This scenario also deals with a light load condition of 400 watts and the least available source is used for supplying the loads. The loads are supplied depending on the battery SOC condition. If the battery SOC is less than the threshold value, the loads can be supplied using the mains on the condition that the power purchasing price from the grid is comparatively lower than the power imbalance cost.
The flowchart of the source management process is shown in Figure 6. The above-mentioned four scenarios are also shown according to the loading condition. The PLC will get the data of the battery voltage, current, and SOC from the DC MFM, and based on the SOC values loads are to be operated.

H. DEMAND SIDE MANAGEMENT
This mode of operation represents the varying demand. The current required to satisfy the demand increases with the increment of loading. The demand-side management is developed here in two ways VOLUME 9, 2021  • By supplying the loads from the mains, if the power purchasing price is low.
• By using the storage system of VPP.

I. ENERGY MANAGEMENT SYSTEM WITH INTERNET OF THINGS
Internet of Things (IoT) is used for controlling the whole operation of optimal energy management remotely. In this work, the TIA portal version 16.1 and Node-red programming tool are used for wiring the hardware devices. The data of current, voltage and energy consumption of the loads can be monitored from remote places using a PC, laptop, or mobile. Some screenshots of the voltage, current, and power consumption data of the solar generation and the loads are given in Figures 7, 8, 9, 10, 11, 12.
The auto mode operation of the Solar Power Manager is shown in Figure 7, where the status shown as the 2kW system is supplying the loads and the 1 kW system is in OFF condition.
The voltage, current parameters of the 2 kW system is shown in Figure 8.

J. CONTROLLER
The flexible configuration, compact design, and powerful instruction set make the S7-1200 controller a perfect solution    for varieties of applications. The programming language used for S7-1200 is LAD (Ladder logic) which is a graphical programming language. A programmable logic controller (PLC)   is used for monitoring and controlling the operation of a smart energy management system for a Virtual Power Plant. The parameters of the battery, solar generation, inverter, and energy consumption are sensed by the controller and according to the control logic, it will operate. The alteration of the solar power generation will take place according to the signal sent from the CPU of the PLC. The programming in PLC can be developed using the ladder logic and the demand response algorithm. In this paper, the ladder logic is used and some images of the ladder logic are shown in Figure 13. After getting the signal from the controller the logic operation will be executed. At peak demand condition total solar generation of 3 kW is used, which activates when the relay trips after getting the signal from the controller. The Wi-Fi-enabled Raspberry-pi is used with the PLC for the smart energy management system.
The display of the MFM connected to the 2kW system battery is shown in Figure 9.
The display of the battery parameters connected to the 1 kW system is shown in Figure 10.
The display of the battery parameters at the initial condition is shown in Figure 11. PLC(S71200) is used here as a master controller in which TIA (Totally integrated automation) is used for coding purposes. Total 14 different networks are used for developing the optimal dispatch strategy of VPP in a simplified manner.
Initially, the PLC will check for the status of the operation whether it is in manual/auto condition. If the status is in Auto mode, then the PLC will operate according to the logic. This operation is considered in-network 9. There are a total of 10 MFM of which 6 are ACMFM and 4 are DCMFM. Each MFM will collect 30 values of current, voltage, power factor, energy consumption and send it to the PLC. The PLC will operate as the logic applied. In Raspberry-Pi Nod-Red is used for collecting and displaying the data from PLC through the Internet. The connection diagram of the load with a controller is shown in Figure 14.

K. NETWORK 1
The ladder logic applied for data collection from the MFM is shown in Figure 13.
RS-485, also known as TIA-485(-A) or EIA-485, is a standard defining the electrical characteristics of drivers and receivers for use in serial communications systems. The connection of MFM with PLC and Raspberry Pi through RS-485 is shown in Figure 14. The DPDT relay is used for controlling the contacts.

IV. EXPERIMENTAL SETUP OF SMART ENERGY MANAGEMENT SYSTEM
The experimental design of the IoT-based smart energy management system of VPP is discussed here.

A. BRIEF DESCRIPTION OF THE OVERALL SYSTEM SETUP
The diagram of the IoT Based Solar Power Manager is shown in Figure 15. This is used for the optimal energy management of VPP with PLC and IoT. The Solar Power Manager consists of four DC Multifunction meters and 6 AC Multifunction meters. Moreover, a changeover switch is there for changing the operation from manual control to smart control and viceversa.
The condition or the logic applied to the controller is used to run the appliances according to the task allocated. The whole operation can be supervised and controlled VOLUME 9, 2021  with the adjacent system and can be remotely controlled with the computer or mobile. The communication system RS485 for sending the data from all the meters to the controller is shown in Figure 16. The images of the PLC controller and the connection diagram of the relay-contactor with PLC are shown in Figure 17, Figure 18 respectively.

B. BRIEF DESCRIPTION OF THE SOURCE AND LOADS
The sources used here are solar generation sources of 2 Kw, 55 V and 1 Kw, 33 V respectively. The panels are connected in series and a total of six batteries are used here each with a 12 V rating. The loads considered are the university classroom loads and as the interruptible load, we are considered the PCs that are used for the experimental work.

C. INTERFACING WITH THE DISPLAY UNIT
The Solar Power Manager -device used for the parameters display such as battery voltage, charging current, the voltage and current of the Solar panel, Inverter power, and energy consumption of the load are displayed in the DC and AC multifunction meter. The communication port RS 485 is used to collect the parameters from the meters and send them to the controller. The controller will send the signal for further operation of switching ON or OFF the 1 kW solar generation. The data can be monitored from the local computer or using IoT. In the IoT-based Solar Power Manager, a total of six no. of multifunction meters have been used for data display. The ACMFM or AC Multifunction meters are used for displaying the voltage, current, power, and energy consumption parameters of the inverter and loads.

V. EXPERIMENTAL RESULTS AND DISCUSSION
The test results for the above four scenarios are described here.

A. FIRST SCENARIO
The first scenario deals with the full-load condition of 2400 watts. So, a total of 3kW of Solar generation is used here in this scenario. The forecasted generation and actual generation are shown in Table 4. Based on the marginal price in the DA market and grid purchasing/selling price the total profit is calculated for the unified market. The profit obtained in this scenario is shown in Table 6.
The profit values of the first scenario individually for the DA market and RT market and then for the unified market are shown in Table 5. From the table, it is clear that as solar generation is not available for the first 6 hours, so VPP has to purchase the power from the grid. VPP has sold the power to the grid during the peak hours of the daytime.
The power purchasing price from the grid is low compared to the power imbalance cost during these hours. So, VPP has taken the right decision of purchasing the power from the grid for supplying the load. It can be summarized as follows.
• The total solar generation used is 3 kW and the total load considered is 2400 W.
• The energy transaction with the grid is based on the power purchasing price from the grid at that interval.
• In the first 6 hours, the power purchasing price of the grid is low and the demand is also less. So, VPP has purchased the power from the grid during these hours for supplying the load.
• The regulation price or power imbalance cost is high compared to the power purchasing price from the grid.
• VPP has achieved the maximum profit at 10 hours by selling the power to the grid.
The profit obtained for the first scenario is shown in Figure 19. The positive values show the amount of power sold to the grid in 24 hours. The negative values indicate the amount of power purchased from the grid in 24 hours. It is clear from the Figure that the amount of power sold to the grid is more compared to the amount of power purchased from the grid.

B. SECOND SCENARIO
The load supplied for the second scenario is 1200 watts So, only 2kW solar generation is used in this scenario. The profit obtained in this scenario is shown in Table 6. The total profit is calculated based on the profit gained by VPP in the DA and RT markets. The DA profit is achieved based on the marginal price considered and the power transaction with the grid is done based on the generation and load. The profit obtained for the RT market is based on the number of power transactions with the grid. The particulars considered for the second scenario can be summarized as • The loads considered is 1200 watt • Only 2 kW solar generation is used for this scenario • The solar generation is not there during the first 7 hours and the last 5 hours. So, the power is purchased from the grid for supplying the loads during these hours.
• VPP sold the power to the grid during 8-19 hours and achieved the maximum profit at 12 hours.
The profit values for the second scenario are calculated for the unified market and are shown in Figure 20. The positive values indicate the amount of power sold to the grid. The negative values denote the amount of power purchased from the grid. It is clear from the table that the power purchasing price from the grid is low compared to the power imbalance VOLUME 9, 2021  cost during these hours. So, purchasing power from the grid during these hours is the right decision taken by VPP. Moreover, it can be seen that VPP will achieve the maximum profit when the generation is more.

C. THIRD SCENARIO
The load supplied for the third scenario is 600 watts. So, only1 kW solar generation is used in this scenario. The forecasted generation and the real-time generation are shown in Table 7. in which the profit is calculated for both DA and RT market and calculated for a unified market. The profit obtained in this scenario is shown in Table 7.
It can be seen that the profit will be maximum when the generation is more. As there is no generation for the first 7 hours, so VPP has preferred the power purchase from the grid during these hours as the purchasing price is low compared to the power imbalance cost. The VPP is selling the power to the grid from 8-19 hours when the university loads are in peak condition. During the last 5 hours, VPP has to purchase the power from the grid as there is no generation. The particulars of the third scenario can be summarized as follows • The loads considered here are 600 watts. • Only 1 kW solar generation is used for supplying the load.
• VPP has purchased the power from the grid during the first 7 hours and the last 8-19 hours.   • The power purchasing price from the grid is low during these hours compared to the regulation price or power imbalance cost.
• VPP has achieved the maximum profit at 12 hours by selling the power to the grid during 8-19 hours. The profit obtained for the third scenario is shown in Figure 21. The positive values denote the amount of power sold to the grid and the negative values denote the amount of power purchased from the grid.

D. FOURTH SCENARIO
The load supplied for the second scenario is 400 Watt. So, 1kW solar generation is used in this scenario. The profit obtained in this scenario is shown in Table 8. The minimum available solar generation is used for the third and fourth scenarios, as the considered load is also less. The VPP has 97654 VOLUME 9, 2021 achieved the maximum profit during the peak hours of the daytime when the power selling price to the grid is also high. For the last 4 hours, the VPP has to purchase the power from the grid as there is no generation during these hours. The profit obtained for the fourth scenario is shown in Figure 22 where the positive values indicate the power sold to the grid and negative values indicate the power purchased from the grid. The features considered for the fourth scenario can be summarized as follows • The load considered in this scenario is 400 watts. • 1 kW solar generation is only used for supplying the loads.
• VPP has purchased the power from the grid during off-peak hours and when the power purchasing price is low.
• VPP has sold the power to the grid during 8-19 hours and the maximum power sold at 12 hours.

VI. OVERALL ANALYSIS AND COMPARISON OF THE FOUR SCENARIOS
The comparison of the profit values for all four scenarios is shown in Table 9. with various microcontrollers.
The profit values for all the four scenarios is shown in Table 10. It is clear from the table that the profit obtained is maximum for the first scenario with four different micro-VOLUME 9, 2021 controllers. The highest profit is obtained with PLC for the first scenario It can be summarized from the table that the profit obtained By VPP is maximum for scenario 1. In this scenario, the maximum available sources have been used for supplying the peak load. The power sold to the grid is also maximum in this scenario. In the second scenario, as the load is half, so less generation source is used and the power sold to the grid is less than the first scenario. The third scenario using the quarter load condition in which the profit obtained is less as we are using the least available sources. The profit obtained for the fourth scenario is more than the third scenario as the least available source is used for fewer amount loads compared to the third scenario.
The profit obtained for each scenario in 24 hours is shown in Figure 23. It indicates that the profit achieved is maximum for the first scenario, the minimum profit is achieved in the third scenario as the least generation is used for off-peak loading conditions. The profit values of the three scenarios are compared in Table 9. By using different microcontrollers.

VII. CONCLUSION
Energy management is of the key importance of VPP as it integrates various small DERs based on their parameters and characteristics. However, this will create problems for grid security as several DERs have different characteristics. So, this paper presents a PLC and IoT-based optimal energy management system for VPP in the unified electricity market. The Solar generation and the university loads are forecasted for the DA market. The amount of power consumption by the consumers and the amount of power transaction with the grid is explained in this paper with four scenarios. The profit for the unified market and the separate market is calculated for all the scenarios. The method uses PLC and IoT-based automation for optimal energy management by managing the source and loads of VPP.
The real-time model of IoT based smart energy management system is developed in the VPP lab of the Hindustan Institute of Technology and Science. PLC and Raspberry Pi are used for managing the source and the loads used by sending the control signals to the relay switches. The Nod-Red programming tool is used for programming PLC. The available Solar generation of VPP structure can be used as the storage system as well as for supplying the loads, depending on the loading condition.
Future direction can be optimal energy management of VPP by considering more than one type of DERs and modelling the uncertainties of the intermittent sources for real-time operation. Moreover, some other controllers can be used for developing the optimal energy management operation of VPP.
K. R. DEVABALAJI received the bachelor's degree in electrical and electronics engineering and master's degree in power electronics and drives from Anna University, Chennai, and the Ph.D. degree from the Vellore Institute of Technology, Deemed University, Vellore, in recognizing his significant contribution in the area of distribution system. He is currently working as an Assistant Professor (SG) with the Department of Electrical and Electronics Engineering, Hindustan Institute of Technology and Science, Chennai. He is also involved in the project titled ''Optimal Dispatch of Virtual Power Plant Using Cyber-Physical Controller for Real-Time EMS,'' funded by the Royal Academy of Engineering, U.K., with worth of £80 000. This project was expected to be completed by April 2021.
S. JOSEPH ANTONY is currently an Associate Professor with the School of Chemical and Process Engineering, University of Leeds, U.K. He performs a number of inter-disciplinary research projects using a wide range of computational tools, such as DEM, FEM, and theoretical and advanced experimental procedures in his research. He has made several publications in reputed international journals and conference proceedings. His primary research interest includes powder processes under industrial conditions.
He received the prestigious MIT Young Researcher Fellowship Award for Exemplary Research in computational mechanics.
SIMON OCHEME received the Ph.D. degree in computational fluid dynamics in order to have deeper understanding of the complex physics, of renewable energy systems to maximize economics of motion. His research interests include system integration of renewable energy power sources, like wind, photovoltaic, and advanced energy storage systems.
THANIKANTI SUDHAKAR BABU (Senior Member, IEEE) received the B.Tech. degree from Jawaharlal Nehru Technological University, Ananthapur, India, in 2009, the M.Tech. degree in power electronics and industrial drives from Anna University, Chennai, India, in 2011, and the Ph.D. degree from VIT University, Vellore, India, in 2017.
From 2019 to 2020, he was associated with the Institute of Power Engineering, Universiti Tenaga Nasional (UNITEN), Malaysia, as a Postdoctoral Researcher. He is currently working as an Associate Professor with the Department of Electrical Engineering, Chaitanya Bharathi Institute of Technology, Hyderabad, India. He has published more than 60 research articles in various renowned international journals. His research interests include design and implementation of solar PV systems, renewable energy resources, power management for hybrid energy systems, storage systems, fuel cell technologies, electric vehicles, and smart grids. He has been acting as an editorial board member and a reviewer for various reputed journals, such as IEEE and IEEE ACCESS, IET, Elsevier, and Taylor and Francis.
HASSAN HAES ALHELOU (Senior Member, IEEE) is currently a Faculty Member with Tishreen University, Lattakia, Syria. He is also with University College Dublin, Ireland. He has published more than 130 research articles in high-quality peer-reviewed journals and international conferences. He has participated in more than 15 industrial projects. His major research interests include power systems, power system dynamics, power system operation and control, dynamic state estimation, frequency control, smart grids, microgrids, demand response, load shedding, and power system protection. T. YUVARAJ received the B.E. degree in electrical and electronics engineering and M.E. degree in power electronics and drives from Anna University, Chennai, India, in 2011 and 2013, respectively, and the Ph.D. degree from VIT University, Vellore, India, in 2017. He is currently a Senior Assistant Professor with the Department of Electrical and Electronics Engineering, Saveetha School of Engineering, Saveetha Institute of Medical and Technical Sciences, Chennai. He has published more than 40 Web of Science/Scopus indexed journals. His research interests include optimal allocation of compensating devices in the distribution networks using optimization algorithms and power electronics applications in power systems. He is a member of IET and IAENG. He has served as a reviewer for various reputed journals, such as IEEE, Elsevier, Springer, Taylor and Francis, and Interscience journals.