Development of an Energy Management System Control Algorithm for a Remote Community Microgrid System

Rural communities are often unable to access electrical energy as they are located away from the national grid. Renewable energy sources (RESs) make it possible to provide electrical energy to these isolated areas. Sustainable generation is possible at a local level and is not dependent on connection to a national power grid. The size of microgrid systems is dependent on the amount of energy that needs to be drawn and the amount of energy that has to be stored. Mechanical and electrical system component sizes become bigger due to increased operational energy requirements. Increases in component sizes are required on growing power networks when higher current levels are drawn. Energy management of microgrids must thus be introduced to prevent overloading the power grid network and to extend the operational life of the storage batteries. Energy management systems (EMSs) consist of different components which are seen as operational units. Operational units are responsible for measurement, communication, decision-making and power supply switching control to manipulate the power output to meet the energy demands. Due to the increasing popularity of DC home appliances, it is important to explore the possibility of keeping these microgrids on a DC voltage basis. Electrical generation equipment such as photovoltaic panels can be used to generate DC at designed voltage levels. The energy management system connects the user loads and generation units together to form the microgrid. Photovoltaic (PV) sources, energy management system (EMS) and user load parameters differ in the simulation software in order to observe how the control algorithm executes load shedding. A Stokvel-type charge share concept is dealt with where the state-ofcharge (SOC) of batteries and user consumption will determine how grid loads are managed. Load shedding within the grid is executed by monitoring energy flow and calculating how much energy is allowed to be used by each consumer. The energy management system is programmed to always provide the largest amount of energy to the consumer with the lowest energy consumption for each day. The batteries store surplus electrical energy during the day. Load shedding starts at 18:00 h each day. Users © 2016 The Author(s). Licensee InTech. This chapter is distributed under the terms of the Creative Commons Attribution License (http://creativecommons.org/licenses/by/3.0), which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited. will be disconnected from the grid whenever their allocated energy capacity gets depleted.

The size of microgrid systems is dependent on the amount of energy that needs to be drawn and the amount of energy that has to be stored. Mechanical and electrical system component sizes become bigger due to increased operational energy requirements. Increases in component sizes are required on growing power networks when higher current levels are drawn.
Energy management of microgrids must thus be introduced to prevent overloading the power grid network and to extend the operational life of the storage batteries. Energy management systems (EMSs) consist of different components which are seen as operational units. Operational units are responsible for measurement, communication, decision-making and power supply switching control to manipulate the power output to meet the energy demands. Due to the increasing popularity of DC home appliances, it is important to explore the possibility of keeping these microgrids on a DC voltage basis. Electrical generation equipment such as photovoltaic panels can be used to generate DC at designed voltage levels. The energy management system connects the user loads and generation units together to form the microgrid.
Photovoltaic (PV) sources, energy management system (EMS) and user load parameters differ in the simulation software in order to observe how the control algorithm executes load shedding. A Stokvel-type charge share concept is dealt with where the state-ofcharge (SOC) of batteries and user consumption will determine how grid loads are managed. Load shedding within the grid is executed by monitoring energy flow and calculating how much energy is allowed to be used by each consumer. The energy management system is programmed to always provide the largest amount of energy to the consumer with the lowest energy consumption for each day. The batteries store surplus electrical energy during the day. Load shedding starts at 18:00 h each day. Users

Introduction
Over 1.2 billion people around the world do not have access to electricity, including over 550 million people in Africa and 300 million people in India [1]. The traditional approach to serve these communities has been to extend the national grid to wherever possible. This approach is technically and financially inefficient for remote communities due to a combination of capital scarcity, availability of insufficient energy, reduced grid reliability, extended building times and construction challenges to connect remote areas [1].
As the national grid is not accessible to all rural communities, power harnessing equipment must be brought to locations having the available electricity generation resources [2]. Currently, rural communities without access to electricity are dependent on natural resources such as wood and coal. Other processed resources such as liquefied petroleum gas, paraffin and candles are used for producing light and heat for their basic energy requirements.
Communities in rural Africa, though widespread, are quite isolated. Consequently, the energy suppliers find it difficult to supply electricity to these regions, as both capital and running costs for long-distance power transmission can be quite high. In addition, suppliers must provide suitably skilled personnel and deploy equipment from other areas, as rural villages do not have the required infrastructure or the skills required to install and maintain such infrastructure linking them to the national power grid. Hence, much of rural sub-Saharan Africa has limited or no supply of electrical energy from a national grid [3].
Basic electricity required for cooking and lighting, which are taken for granted in urban areas, is not readily available in remote rural areas. To resolve this problem, a constant supply of low-voltage power is required. The studies conducted so far have focussed only on the methods to supply electrical energy to these remote dwellings and also to control and manage the electricity being generated and consumed from microgrids [4]. Microgrids can be a better solution for these rural communities as they can provide the villages with their own electricity supply.
Microgrids are islanded systems that harvest, manage, distribute and consume electrical energy. A limited amount of energy can be stored by batteries. Various concept designs of microgrid technologies are being studied and practically implemented all over the world [5].
State of charge (SOC) is a measure of the full range of available energy that can be delivered by a battery. This range is measureable between when a battery is fully charged and when it is carries no or minimum residual charge according to the battery's electrochemical charac-teristics. Batteries are designed to store only a certain amount of energy. The design capacity of the battery determines the limited amount of energy that can be drawn from it. The available SOC of the batteries is distributed among the loads by the application of an energy management system (EMS).
Schnitzer et al. [1] recorded that technologically and operationally, microgrid distributed systems have the capacity to provide communities with electricity services, particularly in rural and peri-urban areas of less developed countries. Less developed countries do not have the national grid to feed power to rural settlements. Electrical energy can be generated with the latest microgrid technology at rural settlement locations.
By installing direct current (DC) microgrids, electrical energy can be harnessed from natural sources such as wind and solar radiation. Currently, in most countries, the national grids provide 110 V or 220 V alternating current (AC) for low-voltage applications required in households [6].
An AC must either be generated directly in its AC form, or alternatively it can also be converted to DC using an inverter system. The electronic components of inverters and rectifiers are expensive when considered for use in manipulating voltages in EMSs. When a DC grid is considered, DC generation is directly connected to the grid. Grid loads can be fed from this DC source and the need for converting AC to DC diminishes.
This study deals with the generation of DC, maintenance and management of a DC microgrid for the different agents and eradication of the expensive process involved in the conversion of AC to DC. Energy management of the grid is one of the key points to be observed in these microgrids for managing the loads and the storage units within the system.

Objectives of the research
This study aims at exploring an energy charge sharing strategy for an islanded DC microgrid. The system will be charged by solar energy. During the day, the grid will supply electrical energy to grid users. The software must be designed to simulate changes in the irradiance level of the sun. The irradiance adjustment can be used to simulate clouds and natural events that will diminish irradiance levels as the weather changes and also to simulate night-time, when there is no sun.
To record and store all the load user consumption figures and allow the system respond to the selected prescribed load shedding algorithms, function block logic is designed on the Matlab platform. It is envisaged that power measurement points will be installed on the bus system in order to provide load management functionality.
To determine the occurrence of load switching, sensing and control units act on command signals sent to and received from the energy management system (EMS). The system will add all the charge measurements received by the generation units. As load is applied to the respective load-points, the system will detect this load value, subtract it from the total charge load value and decide when each user will be disconnected from the system. Photovoltaic panels are used to generate electrical energy. The battery bank stores surplus electrical energy. The energy management system consists of measurement components and control components that act and execute functions as agents. The control philosophy will revolve around the agents to operate the charge share control objectives. Agents form a part of the system and work in coordination combining the overall system components. Environmental inputs, system control and execution of the software model environment will determine the microgrid load shedding procedure.
The physical location of the control agents should be determined by the system design. The power sizing per house unit per day needs to be estimated in order to obtain the total system power demand and the required system capacity. The system capacity needs to be calculated to determine the size of the batteries that will be included in the software model.
The software model should be accessible to change any parameter within the microgrid. It is vital to prepare a working platform of the microgrid on Simulink in order to support future research developments. The software model is designed to be flexible to allow user inputs to change the dynamics and control within the microgrid and to allow the grid to react to these adjusted parameters. Figure 1 shows a 13.5 kW photovoltaic system in Makueni County in Kenya [7]. This generation unit was designed and build to provide water and electricity to the local community. It must be noted that the DC-generating PV array shown in Figure 1 is located centrally in the village. Solar panels are used for conversion of solar energy into electrical energy. Microgrids seldom have long transmission lines to supply power to other towns and areas far from the point of generation.

Energy management systems and methods
Testing of energy management systems in established microgrids is very limited because of the low number of such installations; however, Raji et al. has found that testing can be done with software-simulated models, using direct measurements collected from a few devices. Configurations in different geographical locations are not the same due to the huge differences in culture, climate and wealth of different regions. These differences determine the setting up of software simulators.
The EMSs of microgrids contain hardware and software protocols to form the operational platform of these control systems. Control and monitoring is carried out using an automated agent technology with a multi-agent system (MAS) [8]. Multi-agent systems take intelligent decisions on behalf of the user, instead of the more conventional supervisory control and data acquisition (SCADA), which is not flexible and requires regular monitoring and human intervention [8].
Load scheduling of MASs was presented by Logenthiran et al. [9]. Load scheduling is a means of optimizing microgrid operation efficiency by observing load recordings and paying particular attention to reducing the peak sections. Reducing peak load consumption during the day can result in an extended energy use during the night, as the surplus energy available when peak usage is reduced, And stored for use at night. Different ways of integrating renewable resources with the community are available for microgrid layouts. Smart meters and smart stations form two essential parts whereby communication techniques share data in control architecture. Smart meters capture user power consumption and these figures are communicated to smart stations. Smart stations are linked to the aforementioned control architectures [10].
Jian et al. [11] presented a multi-agent-based control framework, stating that new types of power supplying modes have a promising future in the design of such frameworks. Their study demonstrated a software model segregated into three layers of operation; these layers include main grid, microgrid and component level agents. Coordination control represents a more efficient load control and charging due to the effective communication database among the three layers of operation.
Li et al. [12] state that these grids are attracting considerable attention owing to the increasing prevalence of DC home appliances and distributed energy resources. This study thus prompts us to consider a 48 V DC bus as the grid bus voltage level of choice.
Chaouachi et al. [13] explained that artificial intelligence techniques in cooperation with linear programming-based multi-objective optimization systems are being tested. Energy management in these systems aims to minimize the operational cost and the environmental impact of a microgrid. In order to manage future loads, these systems also take into account the load demands of operational variables.
In a different study by [14], Chaouachi et al. claimed that the results obtained from their control methods are also useful to extend battery charge and discharge cycles on a scheduled basis. These methods were obtained using software models and weather forecasting data. The results were used for comparing actual and predicted weather profiles several days ahead. These systems can hereby determine how load shedding can be controlled in future. Efficiency of these microgrid operations is strongly dependent on the battery scheduling process, which in turn is influenced by software systems programmed to anticipate weather conditions. Stluka et al. [15] stated that forecasting will mostly be based on a short-term forecasting concept. Stable cloud patterns lead to better predictions of future weather patterns, whereas unstable cloud formations make such predictions more difficult. Taking account of the predicted weather conditions, the system will consider the current state-of-charge of the storage units and determine the corresponding amount of energy to be allocated for consumption. The energy management system algorithm will reduce the distribution allowance to the loads and conserve energy if less charging is necessitated in future; this facilitates in extending the energy storage buffer of the system.
A different load-scheduled control strategy has been studied by Michaelson et al. [16]. Predicted generation is combined with predicted load. Past load patterns are available from load recordings made at the specific site. Automatic load shedding can be scheduled when the system can calculate during which future period the grid will be under severe strain. This would occur due to overloading or the unavailability of energy if the SOC of the batteries is too low. Future prediction of the SOC trajectory is achieved by this power management strategy.
Polycarpou [17] supports the idea that smart grids enable consumers to decide when they would use power from the grid. Microgrid philosophy is perhaps not a new concept, as it has been in use since the establishment of electricity grids. However, the control strategy is new and hence has been highlighted in this study. Modern control systems have resulted in smart microgrids to the extent wherein these grids can easily shift loads based on the differing needs and the desired outcomes.
As described by Ramesh et al. [18], Arduino-controller-based systems have been incorporated in actual microgrid installations; this type of system is described as an MAS. Arduino is a microcontroller that is programmed by an open-source software to fit the requirements of any programmer. Furthermore, many other types of microcontrollers are used to perform monitoring and control of microgrid systems. To build a central control system, external power modules are inserted into the I/O slots. The unit acts as a programmable logic controller (PLC) and can be expanded to control and manage systems accordingly.
Palma-Behnke et al. [19] explained that smart grids are characterized by a two-way flow of electricity and information. These smart grids are capable of monitoring every aspect from power plants to customer preferences as well as individual appliances. Real-time deliverable information is acquired and enables the near-instantaneous balance of supply and demand at the device level. Real-time information can operate at different intervals as long as it is located near the source of energy and the areas of supply delivery.
Meiqin et al. [20] have explained the three different levels of the EMS of a microgrid. These areas form a pyramid structure with linking layers between them. The top layer forms the local control level, including the communication control, and status agents. The SCADA platform is located at the central level. All the server agents and recording facilities are connected to the SCADA system. Level three is the system control level, wherein the system operator agents control the system. Grid status and switching between islanded mode and grid-connected mode is set here.
Boynuegri et al. [21] defined a load-shifting algorithm for home energy management (HEM) whereby the centre of control is dependent on the SOC of the batteries. By introducing these peak-shaving and load-shifting techniques, a 25% saving was evident from these simulation results. A study of battery capacity was conducted to compare battery sizing when batteries are put under charge and discharge conditions. Energy was also supplied to the main grid from this battery system. Microgrid battery systems should not be over-or undersized. Oversized battery systems do not get sufficient consumption drainage, and undersized systems deplete rapidly depending on the amount of energy drawn from the battery system. From an evaluation done by Yen-Haw et al. [22], it was shown that systems should be sized by battery efficiency and power supply generators.
Intelligent load management functions were studied by Kennedy et al. [23]. They focussed on approaching load management through a load-shedding scheme. They proposed an intelligent load shedder (ILS) principle that works together with a static transfer switch (STS). The STS operates as the PCC between the grid supply and the user loads. Loads are systematically removed from the grid to allow the grid sources to carry the remainder of loads.
According to Hajimohamadi et al. [24], proper system controllers in the primary, secondary and emergency levels of microgrids ensure stable operation during load shedding. These controllers prevent the system from breaking down to the level of a complete blackout; they assist in shedding load in a controlled manner. Similar to the conventional systems, isolated microgrids are also affected by different events such as tripping generators, imbalance between generation and consumption and power quality issues. All loads are not simultaneously disconnected; non-critical loads are disconnected first and then the software program will prepare for load shedding of power consumers.
From the above-mentioned studies and taking account of all the cited references, it is evident that the focus is on load control techniques and battery charge methods. These systems are linked together through various communication protocol methods that act as the nerve structure of the system. Due to the limited charge capacity that is available from the batteries at sunset, focus can be directed towards load-shedding control techniques around the SOC values of the batteries.
The conclusions from the above-mentioned studies serve as a motivation to incorporate Stokvel philosophy in the load control so as to develop a reserve share concept proposed by [25].

Agent-based technology
Agents are responsible for information flow within the system. The term 'agent' is characterized by the meaning of autonomy. [34] identified agent technology consisting of networks within a microgrid system of multi-agent modules or components which together form MASs. These networks of agents are used in the control of wind turbines and solar arrays. In addition, they are responsible for directing communication in the decision-making processes and executing actions.
Artificial intelligence (AI) is a research topic; MAS forms a subsection of distributed AI. The goal of an MAS is to disassemble a large complicated system that consists of software or hardware into multiple interactions and subsystems which can be easily managed. Microgrids are gradually providing a new method for developed countries to solve problems relating to the national grid. With the intensification of the global energy crisis, the microgrid will become an important development in this sector.
The United States first proposed the concept of a microgrid. In 2002, the Consortium for Electric Reliability Technology Solutions (CERTS) stepped forward to define the concept and structure of such a system [26].
The flow chart for the EMS considered in the paper is shown below.

Microgrid communications
As microgrids expand, measurement points become more decentralized. Due to increased difficulty in capturing data over a larger distance, communication protocols are being heavily relied upon for assisting with this problem. Advanced communication technologies such as optical internet protocol (IP) networks, band-pass limiter (BPL) carrier and broadband wireless network technology are used [27]. It is very important to have as many measurement points as possible in order for the microgrid to provide flexibility in the supply of high quality. The uploading speed of data from monitoring should be high, in order to react to issues and to allow real-time control between the microgrid and its energy sources. Hernandez et al. [28] indicated that the smart distribution network requires periodic fast measurements and estimations of network security as well as real-time information from network components.
Xinhua et al. [27] presented three categories of communication namely knowledge interchange format, knowledge query and manipulation language and FIPA agent communication language. FIPA is a body for developing and setting computer software standards. In recent years, the extensible mark-up language (XML) has become an acceptable language for agent communication [29]. XML is a language used to describe data.
Multi-agent architectures are divided into two coordination categories: centralized multiagent coordination and de-centralized coordination. Figure 2 illustrates that coordinators are situated at the head of the architecture. They are responsible for communication between other agents. Within the architecture, the main representatives of agent coordinators are the mediator and the facilitator. The mediator agent makes decisions on lower-level situations. It is involved with message interpretation and task decomposition. A program that handles coordination between communication agents is called the facilitator. Based on their content, routing of messages is controlled and control of multiagent activities is regulated as well [30].   Figure 3 shows the de-decentralized coordination as an agent working in conjunction with linked agents; this type of coordination can be defined as autonomous. An agent operating in a de-centralized coordination setup is not controlled by software or a person; it communicates directly with other agents in the system by regularly scanning the status and tasks performed by other agents and executing its own tasks by associated motives. Communication is present between all the agents as shown in Figure 3. Communications to other networks are also possible by these agents.

Control methods
Considering continuity of supply to islanded microgrid loads and national grid loads, it is important that the power to loads is not interrupted during transitioning of the microgrid onto, or off the national grid. Developing a new interface technology is constantly undertaken to handle transitions between these modes. Currently, there are three typical control methods as explained by [27], namely plug-and-play technologies, power electronic devices and controlbased multi-agent technology. All three methods have progressed technologically to differing degrees, and it is understood that they will mature and grow with the application of sustained development in this field [27].

Multi-agent modelling and implementation
In order to build a complex agent system in a simplified manner, open-source platforms are used by developers. Hernandez et al. used the JADE platform for their study.
JADE facilitates the development of multi-agent peer-to-peer applications. Parameters of this system aim at the optimal use of locally distributed resources, feeding of local loads and operational simplicity. Direct support of plug-and-play can be used by the JADE-based platform.
Jimeno et al. [31] referred to a demand profile of the grid. This is the map and baseline prediction load graph that is used for the load reference. The profile indicates the power demand (in kW) versus time of the day. In coupled microgrids, it is vital to use this baseline as a reference when energy transfer and power flow are to be controlled. The demand profile was used as a reference to control how and when the grid sources should be adjusted to the load. Costs to run the individual source units were also monitored as load demands changed.
The system makes decisions around cost and executes accordingly in order to use the most affordable option to generate energy; the system makes adjustments where needed.

Agents in the energy management systems
Schedule trackers are used to allocate set points to distributed energy resource (DER) gateways. Schedules are calculated by observing the recorded data. The microgrid operator agent is used to optimize the operation of the microgrid by taking into account the information provided by the agents in the local controllers. DER operator agents are used to provide information to the microgrid level operator and also to act accordingly while receiving signals from it.

System design for rural settlement
The design of a three-house islanded microgrid is used in this study to serve as an example of the charge share concept. When a small microgrid system has been successfully designed, a multiplication factor can be applied to allow for an increase in the number of houses and the corresponding increase in total load that would be required for such a macroconsumer design. Solar irradiance profiles for the Western Cape, South Africa, have been dealt by [30].
Software development packages such as Matlab are available into which the grid design parameters can be inserted. These design packages then calculate the number of solar panels to be used and the size of each unit and also determine the battery size. The designer can also enter weather and day-time parameters to monitor the microgrid as a whole.

User load demand
The case study example given below provides the times and load averages used to determine the system generation units. First, the size (kW) and duration (h) of load consumption need to be established before the system generation units can be designed.
Example: A rural house is assumed to have an average load of 1 kW. The duration of load consumption is set to 3 h (between 05:00 and 08:00) in the morning, 2 h (between 12:00 and 14:00) during lunchtime and 5 h (between 18:00 and 23:00) in the night.

Battery sizing
To determine the battery size for a house unit, a few design specifications need to be confirmed before calculations are done. Daily energy demand needs to be considered. The duration of load supply per day and the number of days the system would be capable to provide energy to the load must be determined; this is known as the autonomy of the system. Based on the example mentioned above, an average power consumption of 1 kW sustained for 10 h, yields an average daily energy requirement of 10 kW h.
The average daily energy requirement must be multiplied by a factor of 1.2-1.5 to allow for power losses due to increases in temperature and spike [32]. This factor also allows for decreasing performance when the temperature increases. Multiplying the required 10 kW h by the 1.5 loss factor will give a required total battery energy rating of 15 kW h for 1 day.

Autonomy of the system
It must also be decided how many days' worth of energy must be stored in the battery bank.
Generally, system designs allow for an autonomy range of 2-5 days. In the case of the example, an autonomy capacity of 2 days will be taken into account. The total battery energy of 15 kW h is multiplied by two and results in 30 kW h, which then gives system autonomy of 2 days.

Battery bank capacity
Lastly, the minimum battery capacity (in ampere-hours) must be calculated. To prevent an SOC below 50% for the batteries, the total battery energy should be double the required energy rating inclusive of the loss factor and the system autonomy. By multiplying the 30 kW h by two to give 60 kW h, the total battery energy capacity requirements were determined.
The capacity rating of a battery was determined by dividing its energy output by the battery voltage. A voltage of 48 V DC was chosen for the microgrid; hence, 48 V batteries are required. Therefore, a total battery energy rating of 60 kW h will have a required capacity of 1250 A h. This battery capacity will be sufficient to enable a fully loaded battery to run expected loads for 2 days, at 10 h a day, without recharging. For a 1-day system autonomy, battery capacity of 625 A h is required.

Sizing PV panels to meet system battery requirements
This section describes how PV panels are chosen for a system to meet the battery requirements. System designs can vary with panel voltage ratings. Common voltages to choose from are 12 V, 24 V and 48 V. These panels can be configured such that the optimum design is achieved.
A solar PV panel with specifications as shown in Table 1 was chosen for this investigation.
Maximum power voltage indicates that this panel will provide 47.5 V, which is suitable for a 48 V microgrid bus system.    To estimate the size of the solar array, the system power requirements must first be determined, followed by the number of hours per day the system will be required to supply and meet the load demand. Many guidelines in the industry enable the PV designer to plan and build such a system.
The following example explains the method used for sizing the PV panels of a system for 1day autonomy on 1 house unit.
In December, during the summer months, the average daily sunlight is 11.1 h, while the shortest daily average of 5.7 h occurs in July. First, the daily battery capacity requirements are taken from Section 4.5. In this case, the 625 A h unit is considered. Then the sun hours that are available for a day must be determined. Note that the month with the shortest average daily sunshine hours be considered; this will ensure that the system will receive an adequate charge in winter.
To obtain the total current rating required from the PV array, the 1-day autonomy 625 A h value is divided by the shortest average daily sunlight which gives 110 A.
Next the number of solar panels required needs to be calculated. Take the current rating required from the array and divide it by the current rating of the panel. The result is 14.7 units and is rounded up to 15 panels.
The 15 PV units will be connected in parallel so that the total current will be 110, 6 A under peak conditions. The 15 panels as calculated meet the requirements of one house; for three houses and array of 45 panels all in parallel would therefore be needed.

MAS algorithm development
To describe the different aspects within the system as well as functionality, the Matlab software model was developed in subcomponents. The different function blocks fit together in order to merge the different area types. The model is divided into physical power circuits and signal circuits.
Power circuits form part of the generation and delivery of electric power to the storage batteries and grid loads. These types of power circuits also include the switching devices, load components as well as the photovoltaic generation blocks.
The second programming block consists of lines identified as part of the signals and does not represent physical lines. These circuits function in response to the result or output of the calculations. Programming blocks include calculation blocks that consist of analog and digital signals. The logic is combined to simulate and execute the algorithms as shown in Figure 5.

Scenario A
The first model, Scenario A, represents a basic user profile. The irradiance boost constant was selected as 45 to simulate the incorporation of 45 PV panels for grid generation. An SOC of 100%, representing a fully charged battery, was selected, while a battery capacity rating of 2000 A h was chosen. To validate that the system mathematics are functional, the loads and durations were made the same for all three users. Each user used 1000 W continuous power for a full day. The expected result should reflect equal energy division between all users. Table  2 indicates the initial parameters for setup to Scenario A.

Scenario B
In

Results and discussion of the graphs
This section contains all the graphs and data recordings taken from the Matlab model scope measuring blocks.

Scenario A: results and discussion
The input setup prior to the simulation run for Scenario A was given earlier. Figure 6 shows that the battery SOC was 100% at the start of the simulation. The user loads were set up to be the same for this test and drew a combined total current of 60 A. The battery voltage started at 56 V and reduced by 2 V when the load started to consume battery energy. For this scenario, the user loads were set up to draw power continuously throughout the 24-h period of the  simulation. A gradual decline in the SOC was noted from 00:00 h until 08:48 h when SOC reached the 70% limit for charging. The charging parameters were set up to start charging at 70%. Battery current dropped to negative 180 A when battery charging was initiated. The SOC increased to 100% from 08:48 to 11:54 due to charging. The battery voltage increased back to 55 V when the battery had been charged to 100%.
Battery charging stopped at the 100% SOC level at 12:00 h. Figure 6 shows that the user load consumption increased while charging stopped, due to the rise in the bus voltage when the battery SOC reached 100%. As shown in Figure 6, the battery SOC decreased gradually after 12:00 h; a 2-3 V drop is noted when the SOC is decreased due to user energy consumption. Point A represents the point when the reserve share logic is activated in the simulation model. Without solar radiation, charging is not possible after 18:00 h; load control is activated beyond this time. Point B in Figure 6 shows all the load consumptions for the day at 18:00 h. All user loads were confirmed to have consumed the same power with all three consumption graphs tracking on top of each other. Point B also indicates that all users had consumed 21 kW h from 00:00 h until 18:00 h. Charge reserve share energy was continuously calculated and reflected as shown in Figure 7. The procedure described above was used to calculate the percentages of electrical energy that were allowed at the given battery SOC. The full battery at start-up time, 00:00, held 76 kW h of usable energy which represented 80% of its SOC. Each user was allocated a third of this starting total, which was 25.3 kW h. The energy values that were allocated to each user were the same because the energy consumption of each user during the day from 00:00 h to 18:00 h was identical; hence the trend lines as shown in Figure 7 run on top of each other.
If the change in energy allocation in Figure 7 is compared to the battery SOC in Figure 6, it will be observed that the change in allocation of energy to each of the three users was directly related to the change in battery SOC. Point C at 18:00 h in Figure 8 shows the point at which the reserve share logic was activated. As shown in Figure 8, each user unit was allowed a 19.3 kW h energy portion from the remaining battery SOC at 18:00 h.
Usable battery energy of 76 kW h is calculated where 20% SOC was subtracted from the full battery range of 96 kW h. The algorithm divided the reserve share energy, equally between the three users, each receiving a 33.3% energy share. This test confirmed that the reserve share logic and formula is functional with equal results of charge share when equal load consumption values were presented.

Scenario B: results and discussion
In Scenario B, variable load changes were introduced to the system and the energy consumption changed to accommodate as described below. The following parameters have been applied to this set up: • The SOC limit protection was set to disconnect user loads on 20% and enable load control on 60%.
• The battery charge control limits were set at 48 V and 55 V.
• Charging of the battery was set to trigger when the SOC dropped to 70%.
As shown in Figure 9, the battery SOC starts to perform on the preset value of 65% and reaches 100% at 12:00 H. When charging starts at 04:15 h, the current declines from a value of +50 A to a value of −220 A at 12:00 h when charging stops. Positive battery current spikes (in Figure 9) At Point A in Figure 9, the battery SOC is 90% at 18:00 h. Points B, D and C in Figure 10 show the respective cumulative energy consumption for each user at this time. User 1 has two constant loads, 500 W and 800 W, respectively. The 800 W load is demanded intermittently and the 500 W load is required for the full 24-h period. User 2 starts to consume energy at 18:00 h. User 3 consumed energy once in the morning at 04:00 h and then again at 18:00 h.  Figure 11 indicates the charge values calculated throughout the day. As shown in Figure 10, User 1 at Point B was the biggest energy user. If we look at the red line that indicates User 1 in Figure 11, then it is evident that the charge share algorithm allowed the least amount of stored energy to this user. In the case of Users 2 and 3, the same amount of charge was allowed up to 04:15 h.
Points G, E and F show the respective charge share values for Users 1, 2 and 3 at 18:00 h. At 18:00 h, the charge share algorithm stopped calculating the charge energy portions and only allowed the remaining portion energies to be deducted. This may explain why all the trend lines show a declining slope from 18:00 h onwards.
The lines show decreasing charge stress values when the loads are still consuming energy after 18:00 h and will change to horizontal lines when the loads are switched off inside the houses.  It is positively identified that User 1 used the most energy during the day and was allowed the smallest portion of battery SOC at 18:00 h. User 2 was allowed 50% of the remaining charge because no power was consumed during the day. User 3 received 42.42% of the remaining SOC and was recorded as the medium user for the day with a consumption of 5 kW h before 18:00 h.
This test proves the functionality of the charge share algorithm with variable load profiles operating on the microgrid. The biggest user of the day was allowed the smallest portion of remaining SOC energy at night, whereas the smallest power user was allowed the biggest share of available energy at night.

Conclusions
An energy reserve share concept was introduced by the development of a control algorithm on the Matlab software platform. The model has been developed in such a way that the Matlab simulation user can interact with the model via the model parameters. The slower real-time speed of model simulation also allows the user to see how parameters change while control processing is performed.
Two scenarios were set up to test if the developed algorithm is functional and to verify that mathematically the charge share formula executes grid control correctly. The purpose of the algorithm is to facilitate the allocation of electric energy among the grid users at 18:00 h, to allow the use of energy up to 24:00 h. Battery SOC and user energy consumption during the day are the determining factors for apportioning the available stored energy among the users.
Scenario A showed a result where equal energy from the remaining SOC was shared between the grid users. Scenario B was setup with variable load changes over a 24-h period. In Scenario B, the allocation of stored energy was done in accordance with the users' energy consumption between 00:00 h and 18:00 h. Users with a high amount of energy consumption before 18:00 h were allocated a smaller portion of energy from the available stored energy, while users of a low amount of energy (small power users) were allocated a larger portion of energy from the remaining available energy stored.
Islanded MAS grids are affected by a limited energy storage capacity. By using this concept for allocating stored energy for rural-electric applications, electric energy can be divided among multiple users in accordance with their daily use and the remaining amount of available energy stored in the battery.

Author details
Arno Vosloo and Atanda K. Raji * *Address all correspondence to: rajia@cput.ac.za Cape Peninsula University of Technology, Cape Town, South Africa