Development of a Modelling and Simulation Method for Residential Electricity Consumption Analysis in a Community Microgrid System

There is an increasing number of microgrid applications for power system networks at different voltage levels. Community microgrid systems are also being encouraged in order to increase energy efficiency, reduce electricity bills, and alleviate the reliability problem with respect to power delivery for local residential users. Understanding electricity information can help in effective management and control of various energy sources operated in community microgrid systems. This paper thus aims to develop a simulation-based electricity analysis scheme for a real community microgrid configuration using a proposed modelling methodology, simulation mechanisms, and a power balancing control strategy under the MATLAB environment. Simulation results considering different weather conditions report the observed performance of electricity analysis. In addition, calculations of electricity bills depending on two electricity rates are discussed, representing the benefits of electricity bill reduction when electricity users accepted the power supply from community microgrid systems.


Introduction
Security, reliability, and economy are the main basic requirements for the operation of the electric power system.With economic growth driving a gradual increase in electricity demand, electric power systems have recently introduced advanced grid or new energy technologies to satisfy these demands.In many advanced electric grid technologies, the microgrid (ugrid) system is one of most important applications, acting as a controllable localized electricity supplier for providing reliable energy to area demand facilities, promoting energy savings, minimizing carbon emissions, and reducing electricity bills for electricity users [1,2].The major components of ugrid systems include distributed/renewable energy resources, different types of energy storage systems (ESSs), grid-connected and islanding operation mechanisms, and various real-time monitoring and management/control methods.According to developed ugrid technologies and market segments, the types of state-of-art ugrid systems can be categorized as follows.The first category refers to the campus ugrid.The University of California, San Diego (UCSD) and Center of Illinois Institute of Technology (IIT) have developed ugrids in this category [3,4].Secondly, there is the military ugrid.Sandia National Laboratories [5] have led a Smart Power Infrastructure Demonstration for Energy Reliability and Security (SPIDERS) Joint Capability Technology Demonstration (JCD) program that plans a three-phase ugrid demonstration site at military bases in Hickam, Fort Carson, and Camp H.M. Smith, respectively.Thirdly, there are commercial and industrial (C&I) ugrids.Mesa del Sol in New Mexico has created a commercial-scale ugrid through a Sandia National Laboratories and Japan New Energy and Industrial Technology Development Organization (NEDO) collaboration to offer a clean slate for testing and demonstrating the latest ugrid technologies [6].Fourthly, remote (off-grid) and island ugrids are shown for example by the University of Chile, which developed Chile's first ugrid project in a remote area called Huatacondo [6].This ugrid system uses a social supervisory control and data acquisition (Social-SCADA) approach to assist the information exchange among electric system users, and then further improve the operation and maintenance of the system.Another category is comprised of community and utility ugrids, seen in three practical applications in Taiwan:

•
Xinglong Public Housing in [7] was constructed by the Taipei City Government using various energy management system designs, electric vehicle (EV) charging station integrations, demand response control, and advanced metering and monitoring technologies to realize a smart house scenario in a community ugrid (C-ugrid).

•
The Kaohsiung Xiaolin Village C-ugrid in [8] was supported by a project of the Department of Industrial Technology (DoIT) of the Ministry of Economy Affairs (MOEA), Taiwan.This village suffered from Typhoon Morakot in 2009, and most of electric grid infrastructures were severely damaged.To raise the electrification in this remote village, a C-ugrid system was thus planned and installed.It integrates C-ugrid management control, and uses large amounts of solar power and retired-battery ESSs to provide power supply to the electricity users in village.Even if the utility electric grid fails to supply power, electricity in village continues to be provided and will not be interrupted due the capability of C-ugrid system operating in islanding mode.

•
The Kinmen Dongkeng C-ugrid [9], as shown in Figure 1, is an upgrade of Taiwan's first ESS-based ugrid system at Kinmen Kinshui elementary school, extending from one ugrid user scenario in the original system to a scenario with fifteen community users.The system is also supported by the DoIT project.The operational purpose of this system is to demonstrate C-ugrid integration technology in a low-voltage distribution system.New Mexico has created a commercial-scale ugrid through a Sandia National Laboratories and Japan New Energy and Industrial Technology Development Organization (NEDO) collaboration to offer a clean slate for testing and demonstrating the latest ugrid technologies [6].Fourthly, remote (off-grid) and island ugrids are shown for example by the University of Chile, which developed Chile's first ugrid project in a remote area called Huatacondo [6].This ugrid system uses a social supervisory control and data acquisition (Social-SCADA) approach to assist the information exchange among electric system users, and then further improve the operation and maintenance of the system.Another category is comprised of community and utility ugrids, seen in three practical applications in Taiwan:  Xinglong Public Housing in [7] was constructed by the Taipei City Government using various energy management system designs, electric vehicle (EV) charging station integrations, demand response control, and advanced metering and monitoring technologies to realize a smart house scenario in a community ugrid (C-ugrid). The Kaohsiung Xiaolin Village C-ugrid in [8] was supported by a project of the Department of Industrial Technology (DoIT) of the Ministry of Economy Affairs (MOEA), Taiwan.This village suffered from Typhoon Morakot in 2009, and most of electric grid infrastructures were severely damaged.To raise the electrification in this remote village, a C-ugrid system was thus planned and installed.It integrates C-ugrid management control, and uses large amounts of solar power and retired-battery ESSs to provide power supply to the electricity users in village.Even if the utility electric grid fails to supply power, electricity in village continues to be provided and will not be interrupted due the capability of C-ugrid system operating in islanding mode.


The Kinmen Dongkeng C-ugrid [9], as shown in Figure 1, is an upgrade of Taiwan's first ESSbased ugrid system at Kinmen Kinshui elementary school, extending from one ugrid user scenario in the original system to a scenario with fifteen community users.The system is also supported by the DoIT project.The operational purpose of this system is to demonstrate C-ugrid integration technology in a low-voltage distribution system.The seventh category comprises other ugrids.As seen in [10], a 380 VDC data center as a part of direct current (DC) ugrid at Duke Energy was presented.A "solar-to-EV" project was performed at the San Diego Zoo to present how energy storage, EV charging and solar energy can be successfully integrated in autonomous electric vehicle ugrid [11].SIEMENS now is trying to develop blockchain technology in the New York Brooklyn ugrid system [12].Different types of ugrid systems can scale to be economically efficient, environmentally supportive, and produce varied levels of self-sustainable power.Based on these ugrid categories, research related to ugrid technology includes: (1) distributed energy resource (DER) integration technology; (2) ugrid grid-supporting capability; (3) applications power electronics technology in the ugrid, (4) ugrid economics; (5) operation, control and protection of the ugrid; (6) ugrid communication; and (7) standardization and testing of the ugrid.Authors of [13,14] present complete surveys on these issues; and in this paper, the residential-type C-ugrid is the major object to be investigated and discussed.
For residential electricity users, the greatest electricity consumption is generally due to use of various electric appliances, like lighting devices, air conditioners, washing machines etc., for each user.With increasing use of electricity by these users, traditional fuel-type power generations may not able to provide sufficient electricity due to a lacking system upgrade.Furthermore, electricity users are not able to take initiative in participating in demand regulation under the single-direction power flow situation.This may force residential electricity users to face the risk of power outage.To overcome the problem, an application of the C-ugrid is thus introduced, integrated into electric grid to provide sustainable energy sources for electricity supporting services to multiple electricity customers within a community.When the C-ugrid operates into electric grid, the electricity can thus be observed from different locations in system, such as utility grid side, user side, and C-ugrid energy facility (i.e., inverter) output side.Meanwhile, if it can effectively monitor the electricity status on these sides, it will be able to help the electricity users in the C-ugrid carry out correct energy management and system control.Simulations, in addition, are often required for ugrid analysis purposes.Simulations can assist researchers to test different problem scenarios in a simulated domain in an economical way.Overall, this paper thus aims to propose a simulation-based electricity analysis method for a C-ugrid system based on the configuration in Figure 1 by integrating various modelling and simulation methodologies.The rest of this paper is organized as follows.Section 2 describes the C-ugrid system layout and major characteristics of the study.Section 3 illustrates the proposed modelling methodology, simulation mechanism, and control strategy used in the C-ugrid system.Section 4 presents the simulation results of using different test scenarios in this work, and conclusions are given in Section 5.

Layout and Characteristics of the Studied Community Microgrid System
According to the real configuration in Figure 1, the layout of the studied C-ugrid is illustrated in Figure 2. It consists of following major elements: (1) an utility grid that is in charge of grid-connected support and provides general alternating current (AC) electric power to each home user; (2) when daily solar insolation is sufficient, photovoltaic (PV) systems act as major DERs on site that supply electric power to each home user as well as ESS charging; (3) battery energy storage (BES) units are used to store remaining electricity from PV systems, and release these electricity to home users at nighttime; and (4) electric load units that are formed by an independent or an aggregated home users.In this study, the C-ugrid is connected to a single-phase 220 V utility grid and normally operates on a grid-connected mode.In this study, the C-ugrid is connected to a single-phase 220 V utility grid and normally operates in grid-connected mode.According to the distinction between the daytime and nighttime, C-ugrid includes following operation states:

•
Daytime with sufficient solar insolation-almost all the home users' electricity is supplied by PV systems in the C-ugrid, and the utility grid may only contribute a little or does not provide any electricity; it depends on the level of the load demand.Meanwhile, PV systems may also supply power to BES units for charging.

•
Daytime with insufficient solar insolation-all home users' electricity is mainly supplied by the utility grid and a little from PV systems in the C-ugrid.Meanwhile, BES units may charge with limited PV power.Once the PV power is all consumed by home users, the BES unit may stop charging.

•
Nighttime with sufficient BES electricity-all home users' electricity is first supplied by BESs until their power exhausted.Then, the utility grid may take the place of BESs to continue to supply power to home users.

•
Nighttime without BES electricity-all home users' electricity is only supplied by the utility grid.
Later, a proposed control strategy is developed under these operational principles.

Proposed Modelling Methodology, Simulation Mechanism, and Control Strategy
Figure 3 shows the detailed assembly of the C-ugrid in Figure 2 that is constructed according to the real system configuration in Figure 1.It uses a utility grid, PV systems, and BES units as major power sources to supply home users in the C-ugrid.All electricity simulation analysis in this C-ugrid is created in the MATLAB/Simulink environment that integrates the following modelling methodology, real-time simulation mechanism, and power balancing control strategy:

Modelling Methodology
MATLAB/Simulink and its SimPowerSystems (SPS) toolbox are used for modelling [15].In this study, a detailed model is a priority for consideration since it can better present the dynamic behaviour of the circuit assembly.

Photovoltaic System Model
As shown in Figure 4, the PV system model in study mainly includes the circuit of the PV array and maximum power point tracking (MPPT) charger that consists of MPPT control and a boost DC/DC converter.For the circuit of the PV array, the single-diode equivalent current source model, which describes the v-i characteristic of Equations ( 1) to (6) of the solar cell, is used.In Equations ( 1) to (6), i is the output current of the PV, iPH is the current generated by the incident light, i0 is the reverse saturation or the leakage current of diodes, q is the electron charge, v is the output voltage of

Proposed Modelling Methodology, Simulation Mechanism, and Control Strategy
Figure 3 shows the detailed assembly of the C-ugrid in Figure 2 that is constructed according to the real system configuration in Figure 1.It uses a utility grid, PV systems, and BES units as major power sources to supply home users in the C-ugrid.All electricity simulation analysis in this C-ugrid is created in the MATLAB/Simulink environment that integrates the following modelling methodology, real-time simulation mechanism, and power balancing control strategy.

Modelling Methodology
MATLAB/Simulink and its SimPowerSystems (SPS) toolbox are used for modelling [15].In this study, a detailed model is a priority for consideration since it can better present the dynamic behaviour of the circuit assembly.

Proposed Modelling Methodology, Simulation Mechanism, and Control Strategy
Figure 3 shows the detailed assembly of the C-ugrid in Figure 2 that is constructed according to the real system configuration in Figure 1.It uses a utility grid, PV systems, and BES units as major power sources to supply home users in the C-ugrid.All electricity simulation analysis in this C-ugrid is created in the MATLAB/Simulink environment that integrates the following modelling methodology, real-time simulation mechanism, and power balancing control strategy:

Modelling Methodology
MATLAB/Simulink and its SimPowerSystems (SPS) toolbox are used for modelling [15].In this study, a detailed model is a priority for consideration since it can better present the dynamic behaviour of the circuit assembly.

Photovoltaic System Model
As shown in Figure 4, the PV system model in study mainly includes the circuit of the PV array and maximum power point tracking (MPPT) charger that consists of MPPT control and a boost DC/DC converter.For the circuit of the PV array, the single-diode equivalent current source model, which describes the v-i characteristic of Equations ( 1) to (6) of the solar cell, is used.In Equations ( 1) to (6), i is the output current of the PV, iPH is the current generated by the incident light, i0 is the reverse saturation or the leakage current of diodes, q is the electron charge, v is the output voltage of

Photovoltaic System Model
As shown in Figure 4, the PV system model in study mainly includes the circuit of the PV array and maximum power point tracking (MPPT) charger that consists of MPPT control and a boost DC/DC converter.For the circuit of the PV array, the single-diode equivalent current source model, which describes the v-i characteristic of Equations ( 1) to (6) of the solar cell, is used.In Equations (1) to (6), i is the output current of the PV, i PH is the current generated by the incident light, i 0 is the reverse saturation or the leakage current of diodes, q is the electron charge, v is the output voltage of the PV, k is Boltzmann constant, T is the temperature in Kelvin, and A is the ideal factor of the PV (generally A = 1-1.5).The series resistance R S and the parallel resistance R P represent the effect on PV conversion efficiency, i SCr is the short-circuit current under the standard testing condition (STC; usually as 1000 W/m 2 , 25 • C with AM 1.5 G solar spectral), λ is current solar insolation, i rs is reverse saturation current, T r and T are the temperatures under STC and current, respectively, N s and N p are series and parallel numbers of solar cells, and K i and K v are temperature coefficients of short-circuit current and open-circuit voltage, respectively.The required parameters in the model can be obtained from the PV module product datasheets, and the calculation procedures for R S and R P are concluded in [16] and [17].A boost type DC/DC converter circuit is used to raise the voltage from PV system.In addition, the output performance of the PV system may often be affected by the ambient temperature and sunlight insolation.To ensure the PV output power always stays at a maximum power point, the perturbation and observation (P&O) method is implemented in the PV system [18].
the PV, k is Boltzmann constant, T is the temperature in Kelvin, and A is the ideal factor of the PV (generally A = 1-1.5).The series resistance RS and the parallel resistance RP represent the effect on PV conversion efficiency, iSCr is the short-circuit current under the standard testing condition (STC; usually as 1000 W/m 2 , 25 °C with AM 1.5 G solar spectral), λ is current solar insolation, irs is reverse saturation current, Tr and T are the temperatures under STC and current, respectively, Ns and Np are series and parallel numbers of solar cells, and Ki and Kv are temperature coefficients of short-circuit current and open-circuit voltage, respectively.The required parameters in the model can be obtained from the PV module product datasheets, and the calculation procedures for RS and RP are concluded in [16] and [17].A boost type DC/DC converter circuit is used to raise the voltage from PV system.In addition, the output performance of the PV system may often be affected by the ambient temperature and sunlight insolation.To ensure the PV output power always stays at a maximum power point, the perturbation and observation (P&O) method is implemented in the PV system [18].

Battery Energy Storage and Bi-Directional DC/DC Converter Models
The MATLAB/Simulink built-in user-defined battery model is used as BES, as shown in Figure 5.It provides four types of battery types: lead-acid, lithium ion, nickel metal hydride and nickel cadmium.The required parameters of each battery model are battery types, nominal voltage, rated capacity and initial state of charge (SOC), and the description of this generic battery model is presented in [15].In Figure 5, a one-arm two-level time-stamped-bridge block in MATLAB/Simulink is used to model the bi-directional DC/DC converter.A constant current control mode is considered

Battery Energy Storage and Bi-Directional DC/DC Converter Models
The MATLAB/Simulink built-in user-defined battery model is used as BES, as shown in Figure 5.It provides four types of battery types: lead-acid, lithium ion, nickel metal hydride and nickel cadmium.The required parameters of each battery model are battery types, nominal voltage, rated capacity and initial state of charge (SOC), and the description of this generic battery model is presented in [15].In Figure 5, a one-arm two-level time-stamped-bridge block in MATLAB/Simulink is used to model the bi-directional DC/DC converter.A constant current control mode is considered for the bi-directional DC/DC converter, and its controller in Figure 6 mainly divides into two functional parts, the reference current calculation and the current reference control.The former is used to determine the charging or discharging current of BES units depending on the proposed coordination control strategy, and the latter uses the calculation results from the former to generate the trigger signal of the rear converter's switching components.
for the bi-directional DC/DC converter, and its controller in Figure 6 mainly divides into two functional parts, the reference current calculation and the current reference control.The former is used to determine the charging or discharging current of BES units depending on the proposed coordination control strategy, and the latter uses the calculation results from the former to generate the trigger signal of the rear converter's switching components.

Single-Phase DC/AC Inverter Model
A single-phase full-bride DC/AC voltage source inverter with unipolar pulse width modulation (PWM) switching is modelled in Figure 7, which in charges of the power conversion between DC bus and AC grid/load sides.To maintain the inverter DC input current waveform and to provide stable regulation capability in inverter AC output, a dual-loop control in Figure 8 is used for the inverter.This controller consists of inner voltage loop and outer current loop controls; the former provides the inverter input DC-link voltage regulation, and the latter is used for inverter AC output current control.Error of DC voltage occurs via transfer function Gv and the current limiter, which is used for inverter capacity limits to obtain current command io* as input of current control loop.Outer current control may let inverter current io follow io* via the integral amplifier to produce reference voltage signal vfb, then vfb compares with measured inverter AC output voltage vff and this finally used to obtain the PWM signals.Some variables present in Figure 8 include Vdcbus and Vdcbus* are measured DC voltage at DC link and referenced DC voltage, respectively, Kv and KI are voltage and sensing gains, respectively, KS is hall sensor gain, and Vcon is control voltage that input to PWM generator.for the bi-directional DC/DC converter, and its controller in Figure 6 mainly divides into two functional parts, the reference current calculation and the current reference control.The former is used to determine the charging or discharging current of BES units depending on the proposed coordination control strategy, and the latter uses the calculation results from the former to generate the trigger signal of the rear converter's switching components.

Single-Phase DC/AC Inverter Model
A single-phase full-bride DC/AC voltage source inverter with unipolar pulse width modulation (PWM) switching is modelled in Figure 7, which in charges of the power conversion between DC bus and AC grid/load sides.To maintain the inverter DC input current waveform and to provide stable regulation capability in inverter AC output, a dual-loop control in Figure 8 is used for the inverter.This controller consists of inner voltage loop and outer current loop controls; the former provides the inverter input DC-link voltage regulation, and the latter is used for inverter AC output current control.Error of DC voltage occurs via transfer function Gv and the current limiter, which is used for inverter capacity limits to obtain current command io* as input of current control loop.Outer current control may let inverter current io follow io* via the integral amplifier to produce reference voltage signal vfb, then vfb compares with measured inverter AC output voltage vff and this finally used to obtain the PWM signals.Some variables present in Figure 8 include Vdcbus and Vdcbus* are measured DC voltage at DC link and referenced DC voltage, respectively, Kv and KI are voltage and sensing gains, respectively, KS is hall sensor gain, and Vcon is control voltage that input to PWM generator.

Single-Phase DC/AC Inverter Model
A single-phase full-bride DC/AC voltage source inverter with unipolar pulse width modulation (PWM) switching is modelled in Figure 7, which in charges of the power conversion between DC bus and AC grid/load sides.To maintain the inverter DC input current waveform and to provide stable regulation capability in inverter AC output, a dual-loop control in Figure 8 is used for the inverter.This controller consists of inner voltage loop and outer current loop controls; the former provides the inverter input DC-link voltage regulation, and the latter is used for inverter AC output current control.Error of DC voltage occurs via transfer function G v and the current limiter, which is used for inverter capacity limits to obtain current command i o * as input of current control loop.Outer current control may let inverter current i o follow i o * via the integral amplifier to produce reference voltage signal v fb , then v fb compares with measured inverter AC output voltage v ff and this finally used to obtain the PWM signals.Some variables present in Figure 8 include V dcbus and V dcbus * are measured DC voltage at DC link and referenced DC voltage, respectively, K v and K I are voltage and sensing gains, respectively, K S is hall sensor gain, and V con is control voltage that input to PWM generator.

Real-Time Simulation Mechanism
Figure 9 shows the architecture of the studied C-ugrid in a real-time simulation environment.When the whole C-ugrid is simulated with only one personal computer (PC) it may face a worsesolution efficiency condition, i.e., it takes too much time to complete one simulation.This is due to MATLAB/Simulink limited calculation capability.In order to overcome this problem and perform time-series simulation analysis with a higher efficiency, the real-time simulation mechanism (RTSM) is used in this work [19].The RTSM includes two parts: the host PC and target cluster.In the former, a desktop with Intel 4 Cores 3.30 GHz CPUs and 8.0 GB RAM is used, and in the latter, the OP5600 HIL box with two Intel Xeon 6 Cores 3.46 GHz CPUs and 4.0 GB RAM is used, which provides multi-cluster nodes for parallel simulations.Data exchange between different cluster nodes is done though the shared memory that has ultra-low latency in the same order of the CPU system memory and thus allows the parallel simulation of electric power systems at a certain microsecond time step.The Ethernet protocol with a 100-Mbps data rate has been established to carry out the communication and data conversion between the target cluster and the host PC.The target cluster runs on a Redhat real-time operating system (RTOS), which is mostly emphasized for computational purposes.The host PC runs on a Windows 7.0 operating system where MATLAB/Simulink, SPS toolbox and Real-Time Workshop (RTW) are installed for system modelling, compilation, code loading and monitoring outputs.The real-time interfacing software RT-LAB, which builds parallel tasks from the original Simulink models and runs them on each cluster node of the OP5600 HIL box, is also required for the host PC.
A fixed-step solver may be required for the real-time simulators due to its computational efficiency.Despite the fact that SPS supports a fixed-step solver based on the Tustin method, the SPS toolbox alone cannot satisfy the demands in real-time simulation due to some limitations [20].A software toolkit added to the SPS toolbox called the Advanced Real-Time Electro-Mechanical Simulator (ARTEMIS) is thus introduced and offers an alternative to the Tustin method of the SPS toolbox, which provides enhanced algorithms to support real-time implementation of power system

Real-Time Simulation Mechanism
Figure 9 shows the architecture of the studied C-ugrid in a real-time simulation environment.When the whole C-ugrid is simulated with only one personal computer (PC) it may face a worsesolution efficiency condition, i.e., it takes too much time to complete one simulation.This is due to MATLAB/Simulink limited calculation capability.In order to overcome this problem and perform time-series simulation analysis with a higher efficiency, the real-time simulation mechanism (RTSM) is used in this work [19].The RTSM includes two parts: the host PC and target cluster.In the former, a desktop with Intel 4 Cores 3.30 GHz CPUs and 8.0 GB RAM is used, and in the latter, the OP5600 HIL box with two Intel Xeon 6 Cores 3.46 GHz CPUs and 4.0 GB RAM is used, which provides multi-cluster nodes for parallel simulations.Data exchange between different cluster nodes is done though the shared memory that has ultra-low latency in the same order of the CPU system memory and thus allows the parallel simulation of electric power systems at a certain microsecond time step.The Ethernet protocol with a 100-Mbps data rate has been established to carry out the communication and data conversion between the target cluster and the host PC.The target cluster runs on a Redhat real-time operating system (RTOS), which is mostly emphasized for computational purposes.The host PC runs on a Windows 7.0 operating system where MATLAB/Simulink, SPS toolbox and Real-Time Workshop (RTW) are installed for system modelling, compilation, code loading and monitoring outputs.The real-time interfacing software RT-LAB, which builds parallel tasks from the original Simulink models and runs them on each cluster node of the OP5600 HIL box, is also required for the host PC.
A fixed-step solver may be required for the real-time simulators due to its computational efficiency.Despite the fact that SPS supports a fixed-step solver based on the Tustin method, the SPS toolbox alone cannot satisfy the demands in real-time simulation due to some limitations [20].A software toolkit added to the SPS toolbox called the Advanced Real-Time Electro-Mechanical Simulator (ARTEMIS) is thus introduced and offers an alternative to the Tustin method of the SPS toolbox, which provides enhanced algorithms to support real-time implementation of power system

Real-Time Simulation Mechanism
Figure 9 shows the architecture of the studied C-ugrid in a real-time simulation environment.When the whole C-ugrid is simulated with only one personal computer (PC) it may face a worse-solution efficiency condition, i.e., it takes too much time to complete one simulation.This is due to MATLAB/Simulink limited calculation capability.In order to overcome this problem and perform time-series simulation analysis with a higher efficiency, the real-time simulation mechanism (RTSM) is used in this work [19].The RTSM includes two parts: the host PC and target cluster.In the former, a desktop with Intel 4 Cores 3.30 GHz CPUs and 8.0 GB RAM is used, and in the latter, the OP5600 HIL box with two Intel Xeon 6 Cores 3.46 GHz CPUs and 4.0 GB RAM is used, which provides multi-cluster nodes for parallel simulations.Data exchange between different cluster nodes is done though the shared memory that has ultra-low latency in the same order of the CPU system memory and thus allows the parallel simulation of electric power systems at a certain microsecond time step.The Ethernet protocol with a 100-Mbps data rate has been established to carry out the communication and data conversion between the target cluster and the host PC.The target cluster runs on a Redhat real-time operating system (RTOS), which is mostly emphasized for computational purposes.The host PC runs on a Windows 7.0 operating system where MATLAB/Simulink, SPS toolbox and Real-Time Workshop (RTW) are installed for system modelling, compilation, code loading and monitoring outputs.The real-time interfacing software RT-LAB, which builds parallel tasks from the original Simulink models and runs them on each cluster node of the OP5600 HIL box, is also required for the host PC.
A fixed-step solver may be required for the real-time simulators due to its computational efficiency.Despite the fact that SPS supports a fixed-step solver based on the Tustin method, the SPS toolbox alone cannot satisfy the demands in real-time simulation due to some limitations [20].A software toolkit added to the SPS toolbox called the Advanced Real-Time Electro-Mechanical Simulator (ARTEMIS) is thus introduced and offers an alternative to the Tustin method of the SPS toolbox, which provides enhanced algorithms to support real-time implementation of power system simulations that improve the computation speed and increase numerical stability while preserving accuracy.With the use of RTSM, a complicated C-ugrid model, as indicated in Figure 3, may be separated into five subsystem models, i.e., 5 cluster nodes work on 5 CPU cores, 1 subsystem master (SM_PVM) and 4 subsystem slaves (SS_PVC, SS_COV, SS_INV and SS_AC), and then the computation of each subsystem model can be performed in parallel on an OP5600 HIL box.This higher efficiency computation mechanism is thus used to decrease the computation burden and raise the simulation speed.simulations that improve the computation speed and increase numerical stability while preserving accuracy.With the use of RTSM, a complicated C-ugrid model, as indicated in Figure 3, may be separated into five subsystem models, i.e., 5 cluster nodes work on 5 CPU cores, 1 subsystem master (SM_PVM) and 4 subsystem slaves (SS_PVC, SS_COV, SS_INV and SS_AC), and then the computation of each subsystem model can be performed in parallel on an OP5600 HIL box.This higher efficiency computation mechanism is thus used to decrease the computation burden and raise the simulation speed.

Proposed Control Strategy
The purpose of proposed control strategy is to carry out electric power balancing between energy source power generation and home user power consumption.The C-ugrid may operate to provide as much home user electricity as possible when alternative energy sources, PV power generation and BES stored power are sufficient, and decrease the power supply from the utility grid.The flowchart in Figure 10 shows the proposed control strategy for coordinate management of the PV system and BES in the C-ugrid.At the beginning of the flow, required solar insolation and home user load profile data are input for C-ugrid operation.PV power generation PPV and home users' consumed electricity PLoad are then used as judgments.If PPV > PLoad is true, the requirement of BES over-voltage protection is then checked.If state of charge (SOC) is less than upper limit, 90% here, the C-ugrid controls the home users' required electricity to be supplied by PPV, and the remains of PPV are used to charge BESs; meanwhile, there is no home user electricity from utility grid Pgrid.If the SOC is higher than the upper limit, it means that the BES units are in a fully charged state and BESs may turn to an over-voltage protection state.Once PPV > PLoad is false (poor solar insolation condition), BES low-voltage protection may be checked, and if the SOC is less than the lower limit, 40% here, home user electricity may be supplied by limited PPV, and Pgrid must thus be required to compensate insufficient PV power.Meanwhile, BES enters a low-voltage protection state and does not provide any power.When SOC is higher than lower limit, home user electricity may be supplied by limited PPV, Pgrid, and BES power PBES; meanwhile, PBES output is determined by the remaining energy storage in the BES units.This proposed control strategy is finally implemented at the front end of the bidirectional DC/DC converter in Figure 6.

Proposed Control Strategy
The purpose of proposed control strategy is to carry out electric power balancing between energy source power generation and home user power consumption.The C-ugrid may operate to provide as much home user electricity as possible when alternative energy sources, PV power generation and BES stored power are sufficient, and decrease the power supply from the utility grid.The flowchart in Figure 10 shows the proposed control strategy for coordinate management of the PV system and BES in the C-ugrid.At the beginning of the flow, required solar insolation and home user load profile data are input for C-ugrid operation.PV power generation P PV and home users' consumed electricity P Load are then used as judgments.If P PV > P Load is true, the requirement of BES over-voltage protection is then checked.If state of charge (SOC) is less than upper limit, 90% here, the C-ugrid controls the home users' required electricity to be supplied by P PV , and the remains of P PV are used to charge BESs; meanwhile, there is no home user electricity from utility grid P grid .If the SOC is higher than the upper limit, it means that the BES units are in a fully charged state and BESs may turn to an over-voltage protection state.Once P PV > P Load is false (poor solar insolation condition), BES low-voltage protection may be checked, and if the SOC is less than the lower limit, 40% here, home user electricity may be supplied by limited P PV , and P grid must thus be required to compensate insufficient PV power.Meanwhile, BES enters a low-voltage protection state and does not provide any power.When SOC is higher than lower limit, home user electricity may be supplied by limited P PV , P grid , and BES power P BES ; meanwhile, P BES output is determined by the remaining energy storage in the BES units.This proposed control strategy is finally implemented at the front end of the bi-directional DC/DC converter in Figure 6.

Performance of Proposed Simulation Procedure
The completed implementation of the proposed simulation procedure, shown in Figure 11, has been carried out by integrating the modelling methodologies, RTSM, and the proposed control strategy in the MATLAB/Simulink environment; meanwhile, various supporting tools are used as well.In Figure 11, three stages: data input and initialization, simulations, and results, are classified as responsible for performing different tasks, and the implementations of these tasks are summarized as follows:


Step 1: Definition of a C-ugrid system topology by users or based on a real system configuration, as in the case in this study.Then, required assemblies in the C-ugrid can be clarified; these may contain traditional electric sources such as the utility grid, impedances such as transmission lines, DERs like PV systems and BES units, power conversion devices such as the DC/DC converter and DC/AC inverter, required controller designs for different facilities, and load units.Some initialization works can be done in this step, for example setting the capacity of PV systems and BESs initial SOC state.


Step 2: Data collection and arrangement as model inputs.Meanwhile, solar insolation and the load electricity profile are required in this study, and a pyranometer and power meters for every user on real sites are used to record these data.Data from the meters are first stored as excel files and are then imported to the MATLAB workspace; these data are further numerically processed by the MATLAB m-file program, and then saved to MATLAB workspace again to wait for a call

Performance of Proposed Simulation Procedure
The completed implementation of the proposed simulation procedure, shown in Figure 11, has been carried out by integrating the modelling methodologies, RTSM, and the proposed control strategy in the MATLAB/Simulink environment; meanwhile, various supporting tools are used as well.In Figure 11, three stages: data input and initialization, simulations, and results, are classified as responsible for performing different tasks, and the implementations of these tasks are summarized as follows: • Step 1: Definition of a C-ugrid system topology by users or based on a real system configuration, as in the case in this study.Then, required assemblies in the C-ugrid can be clarified; these may contain traditional electric sources such as the utility grid, impedances such as transmission lines, DERs like PV systems and BES units, power conversion devices such as the DC/DC converter and DC/AC inverter, required controller designs for different facilities, and load units.Some initialization works can be done in this step, for example setting the capacity of PV systems and BESs initial SOC state.

•
Step 2: Data collection and arrangement as model inputs.Meanwhile, solar insolation and the load electricity profile are required in this study, and a pyranometer and power meters for every user on real sites are used to record these data.Data from the meters are first stored as excel files and are then imported to the MATLAB workspace; these data are further numerically processed by the MATLAB m-file program, and then saved to MATLAB workspace again to wait for a call from the models.Here, the numerical process for the data includes removal of invalid data, and data length regulation.Furthermore, once input data are not able to be obtained on site, any assumed parameters can be used as well for the models.

•
Step 3: Here, the C-ugrid system model is developed by MATLAB/Simulink and its SPS toolbox based on the defined topology in step 1.All the components in the C-ugrid are modelled in detail according to the methodologies in Section 3.1; in addition, the controller designs and power balancing control strategy are achieved.In this step, all the work is done at the host PC of RTSM, and the ARTEMIS and RT-LAB software are then used to help the running of real-time simulation in step 4 [20].

•
Step 4: In order to run parallel computing in RTSM, a completed C-ugrid model developed in step 3 should be broken as several sub-models by model partition as described in Section 3.2.These separated sub-models are then loaded to the target cluster in RTSM from the host PC by an Ethernet communication.Then, with the operation of RTOS in the target cluster, real-time simulation can be implemented.

•
Step 5: Results from the step 4 can be further analyzed based on the defined test scenario, and these results can be presented in various ways like time-series electricity distributions, the per hour bar chart and quantified tables, etc.Finally, equations for different electricity rates can provided to evaluate the electricity bill of total home users in the C-ugrid.In this step, excel and MATLAB m-file programs are again used as support for graphical or numerical analyses and processes.
Appl.Sci.2017, 7, 733 10 of 19 from the models.Here, the numerical process for the data includes removal of invalid data, and data length regulation.Furthermore, once input data are not able to be obtained on site, any assumed parameters can be used as well for the models.


Step 3: Here, the C-ugrid system model is developed by MATLAB/Simulink and its SPS toolbox based on the defined topology in step 1.All the components in the C-ugrid are modelled in detail according to the methodologies in Section 3.1; in addition, the controller designs and power balancing control strategy are achieved.In this step, all the work is done at the host PC of RTSM, and the ARTEMIS and RT-LAB software are then used to help the running of real-time simulation in step 4 [20].


Step 4: In order to run parallel computing in RTSM, a completed C-ugrid model developed in step 3 should be broken as several sub-models by model partition as described in Section 3.2.These separated sub-models are then loaded to the target cluster in RTSM from the host PC by an Ethernet communication.Then, with the operation of RTOS in the target cluster, real-time simulation can be implemented. Step 5: Results from the step 4 can be further analyzed based on the defined test scenario, and these results can be presented in various ways like time-series electricity distributions, the per hour bar chart and quantified tables, etc.Finally, equations for different electricity rates can provided to evaluate the electricity bill of total home users in the C-ugrid.In this step, excel and MATLAB m-file programs are again used as support for graphical or numerical analyses and processes.

Data input and initialization Simulations Results
• Step 1: preparation and Initialization of components/parameters for modelling based on a given system topology Supporting tools: power meters, pyranometer excel and MATLAB m-file

Simulation Results
The main purpose in the following simulations can be used to observe the home user electricity consumption under the considered scenarios by the proposed modelling methodology and simulation mechanism.All simulations are implemented based on the configuration in Figure 3; but only one C-ugrid is simulated here and home users are formed by aggregating five independent single-phase, 60 Hz, 220 V residential users.Part of main used parameters in simulations are collected by field measurements in the real C-ugrid system in Figure 1.For example, information on the capacity of 17.28 kW for the PV system, the capacity of 38 kWh for BES units, and one-day solar insolation data, shown in Figure 12, is collected by a pyranometer, and the information on five home users' total electricity demands, in Figure 13, is collected by the power meter installed for each user.

Simulation Results
The main purpose in the following simulations can be used to observe the home user electricity consumption under the considered scenarios by the proposed modelling methodology and simulation mechanism.All simulations are implemented based on the configuration in Figure 3; but only one C-ugrid is simulated here and home users are formed by aggregating five independent single-phase, 60 Hz, 220 V residential users.Part of main used parameters in simulations are collected by field measurements in the real C-ugrid system in Figure 1.For example, information on the capacity of 17.28 kW for the PV system, the capacity of 38 kWh for BES units, and one-day solar insolation data, shown in Figure 12, is collected by a pyranometer, and the information on five home users' total electricity demands, in Figure 13, is collected by the power meter installed for each user.

Case 1
In Case 1, solar insolation in Figure 12a is used to simulate the C-ugrid operation on a sunny day and the Figure 13 electricity profile is used as load demand.Sunrise was at about 05:53 and sundown was at about 17:55; during this period, sufficient power can be provided by the PV system for home user electricity as well as BES charging power.This is shown in Figure 14a, in the PV system power supply section.After about 17:55, the PV system is out of service, and then BES units turn to a discharging state that continues to supply electricity to home users until BES runs out at about 21:32.This is indicated in Figure 14a, in the BES power supply section.For the time before about 05:53 and after about 21:32, no power can be provided by either the PV system or BES, and home user required electricity may thus must be supplied by the utility grid, as shown in Figure 14a, the utility grid power supply section.Furthermore, the PV system provides little power at the beginning of sunrise.From about 05:53 to 07:30, home user electricity is supplied by both the utility grid and the PV system.A clearer electricity distribution for each hour for different power supply sources in the C-ugrid is found in Figure 14b.Table 1 shows the quantified electricity of each hour relating to Figure 14b; for a total of 5 home users, load demand electricity of 83.63 kWh in the C-ugrid is provided by the utility grid of 30.75 kWh and C-ugrid of 52.88 kWh, respectively.Furthermore, overall operation of BES is presented in Figure 14c and d; the former shows the SOC variation, and the latter gives the charging and discharging power of BES. (a) 3. 13

Case 1
In Case 1, solar insolation in Figure 12a is used to simulate the C-ugrid operation on a sunny day and the Figure 13 electricity profile is used as load demand.Sunrise was at about 05:53 and sundown was at about 17:55; during this period, sufficient power can be provided by the PV system for home user electricity as well as BES charging power.This is shown in Figure 14a, in the PV system power supply section.After about 17:55, the PV system is out of service, and then BES units turn to a discharging state that continues to supply electricity to home users until BES runs out at about 21:32.This is indicated in Figure 14a, in the BES power supply section.For the time before about 05:53 and after about 21:32, no power can be provided by either the PV system or BES, and home user required electricity may thus must be supplied by the utility grid, as shown in Figure 14a, the utility grid power supply section.Furthermore, the PV system provides little power at the beginning of sunrise.From about 05:53 to 07:30, home user electricity is supplied by both the utility grid and the PV system.A clearer electricity distribution for each hour for different power supply sources in the C-ugrid is found in Figure 14b.Table 1 shows the quantified electricity of each hour relating to Figure 14b; for a total of 5 home users, load demand electricity of 83.63 kWh in the C-ugrid is provided by the utility grid of 30.75 kWh and C-ugrid of 52.88 kWh, respectively.Furthermore, overall operation of BES is presented in Figure 14c,d; the former shows the SOC variation, and the latter gives the charging and discharging power of BES.

Case 1
In Case 1, solar insolation in Figure 12a is used to simulate the C-ugrid operation on a sunny day and the Figure 13 electricity profile is used as load demand.Sunrise was at about 05:53 and sundown was at about 17:55; during this period, sufficient power can be provided by the PV system for home user electricity as well as BES charging power.This is shown in Figure 14a, in the PV system power supply section.After about 17:55, the PV system is out of service, and then BES units turn to a discharging state that continues to supply electricity to home users until BES runs out at about 21:32.This is indicated in Figure 14a, in the BES power supply section.For the time before about 05:53 and after about 21:32, no power can be provided by either the PV system or BES, and home user required electricity may thus must be supplied by the utility grid, as shown in Figure 14a, the utility grid power supply section.Furthermore, the PV system provides little power at the beginning of sunrise.From about 05:53 to 07:30, home user electricity is supplied by both the utility grid and the PV system.A clearer electricity distribution for each hour for different power supply sources in the C-ugrid is found in Figure 14b.Table 1 shows the quantified electricity of each hour relating to Figure 14b; for a total of 5 home users, load demand electricity of 83.63 kWh in the C-ugrid is provided by the utility grid of 30.75 kWh and C-ugrid of 52.88 kWh, respectively.Furthermore, overall operation of BES is presented in Figure 14c and d; the former shows the SOC variation, and the latter gives the charging and discharging power of BES. (a) 3. 13

Case 2
Using Figure 12b solar insolation data to simulate how the C-ugrid operates in cloudy day conditions, the same electricity profile in Figure 13 is again considered as the load demand.In this case, the solar insolation is worse than that in case 1, the PV system may thus be thought to only provide limited PV power.In the simulation results in Figure 15a, home user electricity is supplied by the PV system and BES only between about 10:06 and 17:29.Power supply by DERs in this case is less than that in case 1. Electricity distribution of each hour for different power supplies in the C-ugrid is found in Figure 15b.Table 2 shows the quantified electricity of each hour relating to Figure 15b; the total load demand electricity for 5 home users was 83.63 kWh in the C-ugrid, and this was supplied by the utility grid (52.47 kWh) and C-ugrid (31.16 kWh).Due to the poorer solar insolation, the power output of C-ugrid was more reduced than that in case 1.In Figure 15c, it was found that insufficient solar insolation caused limited BES charging, and a maximum SOC of about 53% of BES was indicated in it.Input and output power of BES is shown in Figure 15d as well.for all day electricity; and a rate of 0.91 NT$/kWh is required for the part of total used electricity exceeding 2000 kWh.Finally, a base cost of 75 NT$/month must be included for one electricity bill.Table 4 also shows the electricity bill calculated by RSTOU rates; meanwhile, one electricity bill still includes two months of 62 days electricity use, and it supposes 42 days for weekdays and 16 days for weekend days.It is found that one-day peak time electricity use for the case 1 sunny day scenario is quite low, the use is only 5.17 kWh since there is sufficient solar insolation to drive the PV system to supply much more electricity to home users, and the total electricity bill is about NT$3857.For the cloudy day in case 2, peak time electricity use increases to 25.35 kWh, and the total electricity bill is NT$8270.For home user electricity coming only from the utility grid, the total electricity bill reaches about NT$15,925.Compared to the results in these two tables, the electricity bill savings benefit for the residential home users with C-ugrid power supply is more significant than that without C-ugrid operations.Moreover, it is found that the residential home users in this study who choose RSTOU rates can obtain more savings in electricity bills.However, it is thought this may be possible for the residential home users with a high degree of electricity use, i.e., the used case in this study; other cases should be considered so home users can appropriately determine used electricity rates.Investigations and discussions of above-mentioned results are mainly focussed on single C-ugrid configurations.With the increasing C-ugrid size, this implies that more and more residential electricity users are introduced to C-ugrid, which may be due to the increasing electrification.Then multiple C-ugrids topology can form in a specific area.The impact of this changed topology may cause a rising scale and complexity of proposed models.If increased C-ugrids provide different specifications and operational features to the original system, those differences should all be considered and modelled in the proposed methodologies and controls.Other extended works of this paper are expected to integrate the functionalities of energy/load prediction, energy source capacity optimization, create metering infrastructure reading interfaces, and set up energy control human-machine implementation for investigations and applications to C-ugrid operation, planning, and demand-side management issues.

Conclusions
Understanding the use of electricity from different energy sources in a C-ugid can be helpful for user demand management and system operation control.In this paper, a modelling and simulation method for a C-ugrid system is developed to study electricity analysis of residential users.To study the performance of electricity analysis, proposed schemes that integrate various modelling methodologies, implementation of real-time simulation, and power balancing control strategies to manage PV and BES facilities are carried out in a real C-ugrid configuration.Meanwhile, collected data including load electricity profile and solar insolation on a real site are used as inputs of the models.Two different weather scenarios, sunny and cloudy, are considered in simulations so as to observe the power supply capabilities among different energy sources to users in the C-ugrid.Results found that, with better solar insolation, users can obtain a power supply for a longer time from DERs in the C-ugrid, and also present a more noticeable benefit in electricity savings than that in poorer weather case.Finally, two different electricity rates are included to provide the calculation information of electricity based on the results from prior simulations.The major contribution of this paper is to present an effective simulation mechanism under the MATLAB/Simulink environment for the electricity analysis in C-ugrid systems, and it can flexibly be modified so as to comply with different simulation requirements when faced with various system topologies.

Figure 2 .
Figure 2. Illustration of C-ugrid layout in the study.BES: battery energy storage.

Figure 3 .
Figure 3. Detail circuit assembly of the C-ugrids in study.

Figure 2 .
Figure 2. Illustration of C-ugrid layout in the study.BES: battery energy storage.

Figure 2 .
Figure 2. Illustration of C-ugrid layout in the study.BES: battery energy storage.

Figure 3 .
Figure 3. Detail circuit assembly of the C-ugrids in study.

Figure 3 .
Figure 3. Detail circuit assembly of the C-ugrids in study.

Figure 6 .
Figure 6.Controller design of a bi-directional DC/DC converter.

Figure 8 .
Figure 8. Controller design of a single-phase DC/AC inverter.

•Figure 11 .
Figure 11.Block diagram of implementation of proposed simulation procedure.

Figure 11 .
Figure 11.Block diagram of implementation of proposed simulation procedure.

Figure 12 .
Figure 12.Used solar insolation data for the PV system.(a) Normal insolation-simulated sunny day condition; (b) Low insolation-simulated cloudy day condition.

Figure 12 .
Figure 12.Used solar insolation data for the PV system.(a) Normal insolation-simulated sunny day condition; (b) Low insolation-simulated cloudy day condition.

Figure 12 .Figure 13 .
Figure 12.Used solar insolation data for the PV system.(a) Normal insolation-simulated sunny day condition; (b) Low insolation-simulated cloudy day condition.

Figure 13 .
Figure 13.Used load electricity profile for a total of five home users.(a) Time-series electricity profile; (b) Cumulative electricity distribution for each hour.

Figure 13 .
Figure 13.Used load electricity profile for a total of five home users.(a) Time-series electricity profile; (b) Cumulative electricity distribution for each hour.

Figure 15 .
Figure 15.Simulation results for case 2. (a) Electricity response in the simulated C-ugrid; (b) Electricity distribution for each hour in the simulated C-ugrid; (c) Charging and discharging states of BES units in the simulated C-ugrid; (d) Input and output power of BES units in the simulated C-ugrid.

Table 4 .
Calculations of electricity bill overall in the C-ugrid under residential-type simple time-of-use (RSTOU) rates.Supposes there are no losses in load demands, one bill includes 2 months (supposing 46 weekdays and 16 weekend days) of electricity consumption, and also supposes that daily used electricity in these 2 months is all the same.A base cost of NT$75 per month is required.Calculation of electricity bill: Total bill = {75 (base cost) + [(total peak time electricity per day (weekdays) × 4.01) + (total off peak electricity per day (weekdays) × 1.65)] × (weekdays) + [weekend days × total electricity per day (weekend days) × 1.65] + (total used electricity per bill − 2000) × 0.91} × 2.