Approach to an Emulation Model to Evaluate the Behavior and Impact of Microgrids in Isolated Communities †

: In microgrid projects, social ownership involves aspects beyond their operation that may compromise the sustainability of the system. For this reason, the development of analysis methods to assess the feasibility and impact during the design stages of these solutions is of growing interest. Recent studies have proposed methods that allow an individual analysis of technological components and social behaviors. However, a complete evaluation of the performance and the impact of these projects should allow the simultaneous evaluation of the behavior of these subsystems, allowing the analysis of their interactions and effects in a dynamic way. Accordingly, this paper presents simulation and emulation models to evaluate the impact of a microgrid in isolated communities. These models contemplate sublevels that consider the energetic, automation and computational aspects in the microgrids and a multi-agent system (MAS) that is used to study the environmental and economic impact of the microgrid through the evolution of certain indicators. The socio-technological interdependence in the operation of the isolated microgrid is analyzed through the integration of the microgrid emulation platform with the MAS. Our approach includes a comprehensive study of the performance of these projects in speciﬁc communities, in order to contribute to the design and implementation, considering the technological, economic, environmental, and social impacts.


Introduction
The increasing energy demand, associated with the continuous economic development, has inspired the development of new energy systems, such as the microgrid, that integrate multiple energy sources and are reconfigured quickly to respond to changes in its operation.
Nevertheless, the implementations on non-interconnected zones can be expensive, without advantages, logistically difficult, requiring extensive development times, and affecting the community from several socio-economic and environmental perspectives [1][2][3]. This is due to the absence of analyses of these variables that could compromise the innovation and sustainability of these solutions [4]. Therefore, there is a need for these systems to satisfy requirements associated with aspects technical, economic, social, and environmental sustainability [5][6][7][8][9][10][11].
Generally, it is hypothesized that a society that does not have access to electricity could be benefit from the implementation of a solution that provides this resource, but as mentioned above, this is not always true. Long-term benefits are not always evident in these projects. There are isolated communities in which, due to cultural reasons, may reject technology or external influence [12]; or communities in which, due to their lifestyle and history, these technologies are not well received and used [13].
Likewise, there may be cases in which the community takes ownership of the technology, but over time it creates problems. These problems can be the loss of some customs and indigenous knowledge due to the acquisition of external knowledge; environmental contamination due to changes in economic practices; conflicts due to corruption in the administrative management of energy; decay of the electrical system due to non-investment in the maintenance of the energy infrastructure or investment in logistics itself. These and many other reasons can affect a community, either positively or negatively the implementation of a project. In [14] this problem is shown, where technological solutions are developed to satisfy communities needs when what is being sought is the sustainability of development.
Given the complexity derived from the development and appropriation of these types of projects, diverse evaluation and design methods have emerged to increase their viability; which allows the execution of analysis during the design, adjustment of parameters, such as the selection and sizing of the components, the dynamics of service charges, the planning and management of the network, etc. [15]. Other approaches have planned designs, taking into account socio-economic sustainability [4], focusing on minimizing payment for each residence, or the environmental effects of these projects [16] or as shown in [17,18] where the aim is to improve the trading strategy in the electricity market through stochastic optimization models. In general, rigorous quantitative evaluations are a poor benchmark for detecting the principal driver of microgrid benefits. Likewise, it is unclear if the different business models and technologies that indicate the potential of these projects to attract financing large-scale developments [19].
Meanwhile, in [20] two case studies were presented. Here a methodology evaluates the techno-economic and environmental performance in these scenarios, where three carbon taxes were imposed. The imposition of carbon taxes showed that any effect on the electricity cost from the microgrid or its optimal configuration, but the cost of electricity from the conventional network increased between 7% and 33% since its carbon emissions were five times higher than those of the microgrid. For the future, it is proposed to apply the methodology in other countries with isolated communities. An informed decision would help decision makers in the generation of future energy policies, which requires an assessment that integrates technical, economic, and environmental perspectives.
Similarly, in [21] the development of microgrids are discussed in relation to the costs and benefits of generation, transmission and distribution of a conventional interconnected grid. This relationship is classified from different points of view such as, environmental which considers avoided environmental damage; economic which is mainly related to increased employment; deferral of transmission and distribution investment costs; and greater access to a rugged and highly reliable power supply. In the social level, shortcomings due to the lack of available relevant data and research on economic models of microgrid are discussed. Israeli electricity market was the context where the cost and benefits was measured. The analysis shows that the current state of the microgrid technologies can be a viable and profitable option supplementary to generation from power plants that require new investments in transmission and distribution infrastructure. However, when local economic benefits are not considered, net benefits decrease annually. The work concludes with future research directions, emphasizing the integration of engineering analysis, scenario simulation, flexibility, and quantifying of the social/equitable effects of the microgrid.
A review focused on comparing the economic and environmental impacts of gridconnected and off-grid systems is presented in [22]. From the economic point of view, it shows a wide variation in grid extension costs as a dependence of distance, location, population size and load requirements. The authors emphasize that it is essential to understand the needs of the target community. In [3] a techno-economic analysis on the implementation of hybrid systems is performed. There are challenges in these implementations, but their application is becoming more achievable due to progress in their infrastructure and cost decreases. In addition, a study was conducted in [23] that allowed to know the economic and environmental impacts from a microgrid, which takes into account minimization of interruptions, the grid can be reconfigured to supply electricity to the right customers.
Similarly in [24] an assessment of the reliability, economic and environmental benefits of renewable energy resources in a microgrid system is achieved. This study was proposed for utilities in the financial planning of sustainable energy projects in locations where there are limitations to access electricity due to technical and financial barriers. This research demonstrates that the number of people without access to electricity can be considerably decreased with the implementation of distributed renewable energy resources, coupled with improved technologies and reduced costs of microgrid components.
The review of the current state of the development of microgrids indicates that the analyzes in the design of these projects are limited to evaluating and validating the technical and financial viability of the project; when in reality this type of solution has a great sociotechnological interdependence [12]. As a contribution to solve this problem, planning tools and optimal service have been proposed. However, there is still a lack of analysis tools that articulate or integrate both models and variables between the social and the technological, to analyze the effects of social-technological interdependence, taking into account a socially broader agenda than the technological models existing in the traditional economy.
Thus, a complete evaluation of the performance and the impact of these projects should allow the simultaneous evaluation of the behavior of these subsystems, allowing the analysis of their interactions and effects in a dynamic way. For just as the microgrid can affect the economy and the environment of a community, the changing demands of the community will affect the behavior of the microgrid, which in turn reverts to impacts on the community itself, such as contributing to or limiting its economic growth, benefiting or harming the quality of its products and services, etc.
As this is such a broad and far-reaching topic, this project presents the first steps in this direction. In particular, simulation and emulation models are presented to evaluate different scenarios of the effect of a microgrid on remote communities. The microgrid models presented integrate computational, energy, and automation sub-levels. To analyze the evolution of the indices associated with the impact of a microgrid on the environmental and economic aspects of the community, a MAS integrated with the microgrid emulation platform has been used to analyze the socio-technological interdependence in the operation of an isolated microgrid. This study aims to contribute to decision making in the design and implementation of these systems based on the holistic study of the performance of such projects combining technological, social, environmental, and economic aspects in specific populations.
The general framework of this document was oriented to the development of a model that integrated the technological component of a microgrid, from simulation models and an approach to an emulation platform, with the social, economic, and environmental component that a non-interconnected area may have. The simulation models related to the energy system are developed from the integration of different generation sources that can supply the demand of a particular region, designing in such a way the electrical system to guarantee the correct performance of the energy supply. In parallel, a simulation platform was developed on Netlogo to analyze the socio-technological interdependence in the operation of an isolated microgrid from a simulation based on agents, where the economic and environmental features of implementing microgrids to supply the energy demand of communities situated in non-interconnected areas were considered, generating indices that allow penalizing the generation of energy from a generation source. Both platforms are integrated with each other, where the microgrid allows to provide the energy resource for the daily activities of the society and in this way to observe the economic behavior and the socio-environmental impact that is had in the region when these energy systems are integrated, and in turn the Netlogo platform generates indexes that penalize the energy system, where it seeks to find ways to supply the energy demand taking into account these penalties. This will make it possible to evaluate different factors that may affect the success of these developments.
The outline of this paper is as follows. Section 2 presents the modeling and a simulation of the analyzed microgrid is presented. In Section 3 the considerations needed to implement the emulation platform of the microgrid are shown. Simulation models to evaluate the impact on a community are presented in Section 4. Finally, conclusions and future work are presented.

Microgrid Modeling
This section introduces the microgrid model utilized. It consists of three power generation sources: photovoltaic, biodiesel and diesel. Each of them are connected to a single-phase DC/AC inverter, which generates a signal that is connected to a point of common coupling (PCC) using a transmission line, as shown in Figure 1.  There is a model predictive controller, of the dynamic matrix control (DMC) type, which receives the measurement of the energy injected into the load and establishes the reference levels to the inverters. Finally, a linear programming algorithm defines the references to the DMC algorithm in order to minimize a cost function that includes indices related to environmental and economic impacts on the community that is supplied with energy by the microgrid.
The synchronization between the inverters is done by defining one Voltage Source Inverter (VSI) whilst the other two are defined as Current Source Inverter (CSI).
Due the importance of the VSI for the microgrid operation, the diesel source is selected for this inverter. So the continuous operation of this inverter can be guaranteed in the absence of system failures. The following sections describe the different levels of the microgrid.

Power Generation Models
In this work, three sources of generation were considered: biodiesel, photovoltaic, and diesel.

Photovoltaic Panel Model
The photovoltaic panel model used is detailed in [25]. To model the electrical component of the hybrid solar module module (PV/T), the equivalent circuit of a photovoltaic cell was analyzed ( Figure 2). Figure 2. Electrical circuit of a photovoltaic cell.
The series resistance R s , represents the resistances to passage of current in the semiconductor material, the network metal, the contacts and the current collector bus; the parallel resistor R sh , called shunt resistor, represents the non-ideal behavior of the semiconductor. Equation (1) describes the behavior of the output current of the cell.
where I is cell output current, I ph is photocurrent generated, I d is diode current, I sh is parallel resistor leakage current, N p is number of photovoltaic modules connected in parallel, and R sh is parallel resistance and R s is series resistance. R sh and R s are parameters of the photovoltaic module that are not generally provided by manufacturers. To approximate these parameters we used the equations proposed in [26].
To simulate the behavior of the solar cell were used the parameters of a PVT-M PREMIUM module [27].

Diesel Engine Model
The proposal made in [28] was used to represent the dynamics of the diesel engine. From the perspective of a control system, a diesel engine can be described as a speed feedback system. Given a reference by the operator, the engine governor, which functions as a sensor as well, recognizes the gap between the actual and desired speed, and regulates the fuel feed to maintain the engine speed at the specified value. The fuel actuator system is often represented as a first-order phase-lag network, with a gain K 2 and a time constant τ 2 . The Equation (2) shows the dynamics of this actuator and considers the current control constant K 3 . The output of the actuator is the fuel flow φ(s) and the input current is I(s).
φ(s) is transformed as mechanical torque T(s) with a time delay τ 1 and the engine torque constant K 1 , detailed in the Equation (3).
A flywheel shows the dynamic effects of the engine inertia, the angular velocity of a flywheel ω w , the viscous coefficient of friction rho, and the loaded alternator. This model includes an integrator with the flywheel acceleration constant J that is used to filter a major part of the effects of perturbations and noise. An integrator was added between the reference signal re f and the engine actuator needed to remove the steady state error. The schematic of the system is shown in Figure 3 [28].  The complete parameter values for the diesel engine system are shown Table 1 [29]. Table 1. System parameters of a typical diesel engine [29].

Biodiesel Generator Model
The biodiesel generator model focused on representing the generation dynamics. In this case, the proposal described in [30] was used. This model comprehends a microturbine coupled to a permanent magnet synchronous generator.

Microgrid Control Levels
This work implements two levels of control. The first level, called primary control, has a proportional-resonant control algorithm for each inverter associated with a generation source [31]. The second level, known as secondary control, is a DMC Model Predictive Control which sets the references to the first level controllers to achieve the target references on the load.
Additionally, a linear programming optimization algorithm establishes the references to the secondary control to minimize a cost function that considers aspects of the influence of the microgrid on the community where it is installed. Each one is detailed below.

Inverter Control
The inverter model is presented in Figure 4. The input signal D is generated by a PWM, which is used by the modulation system to control each of the four transistors of a complete bridge. As the signal generated by the inverter is square it is necessary to connect a low-pass filter to obtain a smooth sinusoidal, which was implemented by means of an inductance and a capacitance. Figure 4. Full bridge inverter connected to an LC filter and a resistive load [31].
Because the inverters must be synchronized in order to control the inverter current it is necessary not only to measure the output current but also to measure the grid voltage which is common for all inverters. Since the current can be determined by knowing the power and voltage then it is possible to demanded amounts of power more easily for a DC/AC inverter.
A resonant controller was selected for implementation of the current control loop because the limitations associated to the PID controllers to completely eliminate the steadystate error in inverters. While to determine the current reference the instantaneous power theory was used (Equation (4)).
Due to the implemented system being single-phase, to implement the instantaneous power calculation it was necessary to realize a simplification. In a balanced and symmetric three-phase system the components in alpha and beta are two sinusoidal whose angle is 90°t o each other, in this way the voltage measured as the component in alpha is established and the component in beta is generated artificially by offsetting 90°the measured voltage [32].
Then Equation (4) is used to establish the reference of active and reactive power to be injected in the electrical network and the voltage measured is also used to calculate the current. In this way, the phase of the current is synchronized with the voltage of the network according to the amount of active and reactive power desired ( Figure 5). For the implementation of the voltage control loop, it is necessary that one of the converters establishes the main voltage, so that the converters operating as a controlled current source can make their respective calculation of the reference current. Since the proposed system is an isolated system, the voltage reference can be arbitrary in the sense that it should not be synchronized with any other signal. In this case, a 60 Hz sinusoidal was established.
Voltage control was implemented by using the same current control scheme presented in the previous section. Figure 6 shows the control scheme used for the VSI.  Figure 7 presents the second level control model for the proposed microgrid. At this level, the system composed of two distributed generation units (DG) is analyzed, one from photovoltaic panels and the other from biodiesel (in this case the same idea is extended to the three sources of generation). Each generation unit is connected through a common coupling point (PCC) through an inverter and an filter [33]. The blocks "Control DG1" and "Control DG2" are the control systems for each of the inverters connected to their respective generation source, whose function is to regulate the voltage and frequency in the load.

Control Strategy of Second Level
Load DMC re f re f bio,pan Figure 7. Second level control model of an isolated system with two generators connected in parallel [33].
A DMC model predictive control (DMC-MPC) algorithm receives the desired power references and adjusts the PQ values for each of the inverters, which are established as a reference for the primary control loops of each CSI. A linear programming optimization algorithm establishes the optimum configuration of active and reactive power to minimize a cost function relating to the environmental impacts, generation costs of each source, etc. These values are set as references in the MPC.
The continuous state space representation of the system is: A linear model of the system is determined by using fundamental laws of electrical systems as follows:ẋ The input signals are the signals coming from the output of the H bridge of each inverter respectively. The outputs are transmitted through a communications network to the inverters. The system parameters are the resistive, inductive, and capacitive elements used in the output filters of each generator (R 1,2,3 , L 1,2,3 , and C 1,2,3 ). Resistive and inductive elements (R 4,5,6 , L 4,5,6 ) were used to model the transmission line from each inverter to the load. Finally, the elements in the load are R, L, C, and R L . Table 2 presents the parameters used for the simulation. Table 2. System parameters.

Parameter Symbol Value
Resistance of the output filter of the biomass, renewable, and diesel generator inverter (respectively).
Inductance of the output filter of the biomass, renewable, and diesel generator inverter (respectively).
Capacitance of the output filter of the biomass, renewable, and diesel generator inverter (respectively). The control action is obtained by solving the following optimization problem (7).
The objective function is used to find the optimal values of the control actions U 1,2 that allows us to reduce the error in steady state. These values are the references for the CSI controllers and restricting these references to ±I 1,2 , which represent the minimum and maximum output current values that each generator can supply. The signal r is the reference and the parameter H p indicates the prediction window that was set to 3.

Economic Optimization
The approach is as follows: • P load = P renewables + P non−renewables , where P is the power. • Economic and environmental costs of renewable energy generators after being installed were despised. • Cost function (generators with non-renewables sources): F cA = A 1 P Gen 1 + A 2 P Gen 2 + · · · + A n P Gen n F cB = B 1 P Gen 1 + B 2 P Gen 2 + · · · + B n P Gen n . . . F cX = X 1 P Gen 1 + X 2 P Gen 2 + · · · + X n P Gen n • Considering two generators, diesel and biodiesel: There are the following cases:

Simulation Results
The system proposed also considers the interchange of data between controllers by means of communication networks and the calculation time of the algorithms implemented in each processor according to a kernel with task priority policy. The simulation of this microgrid with demand profiles is performed using matlab and simulink. The implemented scheme is shown in Figure 8. Behavior of the system under normal operating conditions is presented in Figure 9.

Biodiesel Generator Rectifier Inverter
Controller

Solar Panel DC-DC Inverter
Controller

Diesel Generator Rectifier Inverter
Controller  As it can be seen that the voltage signal remains at the rms value (120V RMS ) and frequency defined (60 Hz). The model obtained allows the evaluation of the system's power generation performance and the analysis of possible situations arising in the performance of the computational architecture supported by the application, such as cyber-attacks affecting the control strategies.

Microgrid Emulation
In order to obtain a model that is closer to reality, the microgrid model was emulated. A Raspberry Pi-Arduino Due architecture was used to implement the nodes of the system. A fixed-priority based task scheduler was used by each of the processors. Schedulability tests based on processor utilization factor were used to evaluate compliance with real-time constraints. In addition, a computational demand analysis of the algorithms for generator emulation was performed. For the PV power emulation model, given the recursion of the model, the Newton-Raphson numerical method was used, which allows solving the equation numerically guaranteeing a fast convergence in the solution. The emulation of the module was executed in a periodic task with a period of 10 ms, on a FreeRTOS system running on a CorteX M3 microcontroller. The computation time demanded by the task was 1.4 ms, so the required CPU utilization percentage equals 14%. The diesel engine emulation was executed as a periodic task with a period of 10 ms, on a FreeRTOS system running on a CorteX M3 microcontroller. The task computation time demanded by the task was 132 µs, so the required CPU utilization percentage is 1.32%. In either scenario, it is possible to ensure real time deadlines.
For the implementation and emulation of microgrids different communication protocols have been used to fulfill the requirements at different levels of the solution. In Table 3 different standards reported in the implementation of microgrids can be seen [34,35]. In this work the nodes were integrated through an Ethernet network. The MPC and linear programming optimization algorithms were implemented in Matlab and an OPC server was used to exchange the information. Results of the emulation are presented in Figure 10. Both the generator currents and the load voltage have a frequency of 60 Hz, which is the frequency of the reference signal. Likewise, the voltage at the load is generated in a scaled way by the Arduino reaching the value of 120V RMS , which is expected. The current of each of the generators reaches the values required to obtain the desired power in the load.

Analysis of the Impact of the Microgrid in a Community
Due to the characteristics of the problem addressed it was analyzed as a complex systems. A complex system is an entity in which its parts display properties dependent on the interaction with the whole; its behavior cannot be explained by the individual analysis of the properties of its parts, since a subtracted part does not maintain the properties it acquires when it is integrated into the system.
Social systems are a complex network that is based on connected entities, such as a network of relationships between the different positions of a company, the migration network of a country, the network of friends of a university, the economic network of a city, the network for the dissemination of a disease, etc.
Different models have been used to represent social behavior, among them those based on agents which allow to generate a global behavior that is normally considered non-linear from individuals with limited information about their environment. In this project a MAS was used for the analysis of social behavior, where each component can be managed by an autonomous and interconnected agent [36]. In MAS, an agent is understood to be the unit that has the ability to communicate and affect both adjacent agents and the environment in which they are. In some cases the environment itself is considered as an agent. These types of models allow endorsing each agent with multiple behaviors such as predictive models, flexible non-linear responses, defined behavior programs, and many other characteristics, which by communicating with each other manage to create a system as complex and autonomous as may be required.
In the literature, there are works looking for grid stability controls related to photovoltaic systems [37], decision-making management of energy sources upon variability of the resource (such as solar or wind) [38], microgrid management [39], social behavior projections for photovoltaic systems adoption in neighborhoods [40,41], applications that include fuzzy neural networks for sizing photovoltaic systems with batteries [42], and many other examples showing the utility of MAS currently. As well, these MAS representations have made it possible to represent behaviors in many contexts, including social [41,[43][44][45].
As a methodological approach to the solution, the analysis of a specific case is presented to determine the most important factors in the project. A general model is developed for this context. The selected case was a community of Bahia Málaga, an area not integrated to the mainstream power grid, located in the west of Valle del Cauca, Colombia. It has a dense rainforest, which is considered a natural reserve park known as the Uramba National Natural Park.
A comprehensive study of the conditions in the region of La Plata is presented in [46]. The geographical distribution of the area can be seen in Figure 11 which is composed of small islands. La Plata being the largest island has a population of 70 families, all of them Afro-descendant.

Impact and Interaction Models
This section analyzes the economic and environmental impacts considered, from the implementation of energy supply projects to communities in non-interconnected areas.

Impacts on the Economy of a Community
In [44] the development of a community of agents was proposed, where the livelihood comes from the acquisition of sugar. The interaction between agents was carried out through the establishment of rules concerning the collection of sugar, the generation of deals or trade, and the accumulation of capital which is then recognized as wealth. The rules of behavior of the agents are set so that they always seek a position where they can obtain the greatest benefits, and that is where the greatest. The model considers the condition of avoiding spatial positions where there is already an agent. This recreates the conditions of marginality, opportunity, and inequality of profits, which are issues that identify cause/effect relationships in a society.
In this way, the cost of the benefit will be stalwartly related to both the amount of resources collected by each agent and the full benefit attained. This approximates neoclassical theory in economics. Using the Cobb-Douglas functional form, the relationship between accumulation and consumption can be obtained, expanding the model defined in the aforementioned paragraph (Equation (11)).
For a state where more than one resource is used, for example not only sugar but also pepper, and allowing the accumulation or wealth, this conduct could be modeled by (11); where W is a function to define the wealth of an agent versus the amount of resource accumulated w i (be it sugar or pepper), and the consumption rate m i respectively. The subscripts i refer to the resource and m T represents the total sum of the consumption rates of each resource m T = m 1 + m 2 .
This equation can then be extended to as many resources as are being consumed, giving the possibility of obtaining a state of wealth of the agents based on the economical neoclassic theory. For the case of only one resource, this equation is reduced to the verification of the existence of the resource, and the lasting time of the resource is given by the relation w/m.
In energy systems, the foremost economic aspect pursued is the cost of providing that an amount of energy. To do this, it is proposed to define the profits that each resource would produce in the following way.
The profits pro, described in (12), are amassed as the equivalent variable w that Epstein introduced [44]. The consumption of these profits will depend on the expenses accumulated by each agent. Expenditures are reflected in the variable m. The parameters q r , val qr , and cost c refer to the resource quantity, the value per resource quantity, and the cost of the recollected resource, respectively.
The function cost c is shown in (13), where e (m) is a function dependent of q r . This function relates the costs necessary to use and acquire a benefit from a given resource and is defined by the context. This could include the environmental costs, energy costs, supplies costs, etc [14]. In this way, the unit price is affected by these variable costs. The parameter P is the price.
Subsequently, the wealth accumulation of the agents can be calculated as the average accumulation (total wealth average, Wealth average ) of the population, which is the average wealth index, as shown in Equation (14).
4.1.2. Impacts on the Environment Associated with the Use of Resources In an area where there is a shared and used resource, there is the possibility that the resource could be mismanaged and therefore depleted. In [48], this event was described as the tragedy of the commons. This seems like an inevitable eventuality facing the growing population using these resources. This theory has been widely debated and is used to study effects such as long-term overuse of resources and the effects of increasing population. In [14,49], Equation (15) was used to analyze the dynamics of a resource that is renewed or regenerated over time.
Where R(k) is the amount of existing resources, U(k) is the entire usage of the resource by all users at the instant k. The quantity of regeneration of the resource is characterized by r, and K being always superior to zero, is the storage capacity or resource concentration of the medium, so if U(k) = 0, the medium will always tend to the value of K.
According to the above, a dynamic of behavior of the environment can be obtained that also interacts with the habitants. Then, the use of the resource can be appropriated by several users, in our case agents, the use is proposed as the sum of all the parties involved.
Given the possibility that each agent, under its own characteristics and conditions, seeks to increase profits, u(k) can be modeled with greater complexity if more detail is desired in the micro-behaviors, being able to determine when the resource can run the risk of destruction due to abuse of consumption.

Impacts on the Environment Associated with Emissions of Particles into the Air
One of the factors most closely related to the development of energy projects in noninterconnected areas is related to the effects of some types of generators on air quality. Considering the environmental effects, Resolution 2254 of 2017 is taken into account, on which the Ministry of Environment and Sustainable Development of Colombia adopts the ambient air quality standard. The maximum permissible levels of pollutants in ambient air according to this resolution are presented in Table 4.
Pollutants PM 10 y PM 2.5 refer to suspended particulate matter (PM, particulated matter), which for the PM 10 are those particles whose diameter is between 2.5 µm and 10 µm, and for the PM 2.5 are those particles whose diameter is less than 2.5 µm, the latter being the most harmful to health. In first paragraph of the aforementioned Article 2, they clarify that for July 2018 the maximum permissible PM 10 y PM 2.5 for an exposure time of 24 hours changes to 75 µg/m 3 and 35 µg/m 3 respectively.
Diffusion of gases in the atmosphere is typically considered in environmental modeling. One of the best known is the Gaussian plume model, which is a standard approximation for studying the transport of pollutants through the air. Equation (17) [51], indicates concentration levels of particulate matter as a function of space (x, y, z), where U is the wind speed, Q is the emission flow rate of the pollutant, H is the effective plume height and dispersion parameters (or diffusion coefficients), σ y y σ z are standard deviations that varies with distance from the source and atmospheric stability, and they are what determine the behavior of the model. Table 5 shows how σ y y σ z can be calculated according to the most used approximations and atmospheric stability, which is defined by classes. Where class A, B, and C are unstable atmospheric stabilities. Class A being the most unstable and C the least unstable, class D is neutral stability, class E is slightly stable, and class F is moderately stable. Table 5. Coefficients of the dispersion parameters by Gaussian plume [51]. σ y (x) = R y x r y σ z (x) = R z x r z σ y (x) = e I y +J y lnx+K y (lnx) 2 σ z (x) = e I z +J z lnx+K z (lnx) 2 The effective plume height also depends of the atmospheric conditions. This height has to do with the distance H to which the column of particulate material rises from the ground, taking into account the height of the chimney h s . The difference ∆H, between the total height and the chimney height, it is taken as described in (19), where x is the distance from the chimney,ū is the wind speed, and the parameters E, a y b are constants that are defined in Table 6, for which it is necessary to define an algorithm for selecting the coefficients according to the atmospheric conditions, which are numerous and some are also described in Table 6.

Source
Equation (20) describes the calculation to obtain the buoyancy parameter F, necessary for the calculation of the parameter E as can be seen in Table 6. Equation (21) describes the calculation of the final lift distance of the plume, which is the distance on the axis x at which the particulate material reaches the maximum height that is H. From the above, it is possible to obtain a simplified decision algorithm to determine the form it finally takes, ∆H ( Figure 12). For this, it is first necessary to calculate the buoyancy parameter F and the final lift distance of the plume X f . Using (20) and (21), it is only necessary to define the parameters described in Table 6 for the case that works.  With the previously described models, properly interconnected, a social behavior based on complex systems can be initially proposed, in which each individual belonging to the community generates a contribution that is interconnected with its environment (environment in which it operates) and with other agents, as well as with the microgrid for energy distribution.

Definition of Economic Cost-Benefit in Relation to the Selected Energy Sources
Each source has a cost of use in the community, either economic, environmental or social. Each source has a collection rate that results from economic costs per source of generation that are presented in [52] and shown in Table 7. Concerning the constraint of usage of the natural biomass resource in zones similar to this one, the supply from biomass that influences the coast from the sea will be considered for usage and stock. The use of this energy source will be penalized as the storage is depleted. Continuing with the analysis of the effects of the energy sources on the community, the definition of the benefits is next. Given the context, expressed in priorities in Table 8 [46], the modeling of preservation of fish quality is used, being the main economic activity and highest priority for the community. This model is then related to the power generation as in the energy needed to preserve the longest its quality.  [46].

Request Priority
To refrigerate and maintain the cold chain of harvested seafood (piangua, fish, and shellfish) High To use school computers during the day Medium To develop study days at night Medium To transform wood Low To have and keep food and/or drinks that require refrigeration for several days Low For the preservation of fish quality, models presented in [53] are considered. An exponential regression was applied to estimate the mathematical behavior of a particular fish degradation (Figure 13). Using the obtained function, described in (22), it is possible to determine how long the fish would last in storage at a given storage temperature.
Hrs degrad = 24(9.851e −0.204Temp• C ) (22) Additionally, in [53] a relative spoilage rate curve for fish was presented, showing accumulative effects in consideration of the storing fish temperatures. Fish spoilage can be assumed as a straight line with a slope that changes only with storage temperature. If the quality of the fish is set as shown in Table 9, Equation (23) can be obtained.
The selling price of fish may be affected depending on its quality. This is shown in (24).
When the quality index is at its maximum, the fish is sold at its maximum price P max . As this index decays, the price P decreases proportionally.
In this way, and limiting the analysis for testing purposes of this project, the cost-benefit of energy in the economic activity of the community was defined based on the previous definitions.

Definition of the Socio-Economic and Environmental Effects of the Community
This section deals directly with the effects on society, such as the behavior of economic activity, the dispersion of polluting gases or particulate matter, and the dynamics of the resource.
Regarding economic activity, it is useful to define the overall state of wealth, or capital, of a community as the average of gathered resources (14). In this way, the resource is reflected in monetary terms in the community. In this case, the capital per family unit, or residence, will be discussed. The Bahía Málaga community has an estimated of 70 houses, the average wealth is calculated on the basis of this number. Since fishing is the principal economic activity of this community, three types of roles were established for the community simulation: fisherman, seller, and other.
The authors of [14] proposed a dynamic to explain behaviors in social justice and poverty. In this definition, a simulation is created considering a random income, fixed expenses, and savings resultant from the accumulation of what is left after expenses. These savings are what is called wealth. The community behavior was built from this model.
Income, in this case, is determined by the fishing activity. The economy of the fisherman depends on the quantity of fish acquire, which is a random variable as in [14], the quantity sold, and the quality of the fish when it is sold.
Nevertheless, not all agents are fishermen and a random income was defined for the other one individuals as proposed in [14]. As for the expenses of all agents, a fixed value was established independently of their activity and an expense associated with the payment of energy, which can be either fixed or variable depending on the case. These cases are described in Section 4.1. The common fixed expense is a reference to expenses on healthcare, education, contingencies, etc. In this case, the fish was defined as the unique resource for the community akin to the model presented in [44]. The behavior of non-fisher agents was limited to wait for specific hours to buy the fish.
In the environmental outcomes, the effects related to air quality and deforestation arising from the supply of some energy sources have been chosen. The agents implicated in these models will be the current vegetation mass and the area surrounding. Concretely, the assessment of air quality considers particulate contaminants released into the air and carbon dioxide from energy sources.
Considering the chosen sources, only the emission of CO 2 and the suspended particles produced by using diesel fuel was studied. For air quality analysis, an index related to the maximum particle concentration was generated.
Meanwhile, biodiesel generation being biomass-based will consume the surrounding vegetation once the biomass reserves are exhausted. There are two ways in which this reserve is feed. The first one is with the biomass that reaches the coasts, which is assumed to be collected once every day, making about 1 ton per month as defined in the aforementioned studies of the region. The second method of replenishing the biomass reservoir, which is expected to be prevented, is when the reservoir is depleted, at that time a tree is cut down and it is removed from the environment. In this scenario, only wetlands will be considered. In this specific region of Colombia, the mangroves are found inside of a protected area that is preserved. Because tree felling is not a constant practice but occurs whenever it is required, the resource utilization factor U(k) is removed from (15), remaining as shown in (25).
The tragedy of the commons model shows that when K ) − U(k) < 1; therefore, the resource will be extinguished [14]. In this project, this conclusion cannot be used since U(k) is not constant. To determine a penalty index β for biomass consumption, Equation (26) was proposed, which defines 1 as an ideal β index, negative effects on the environment occur above 1. This index is function of K, being the maximum carrying capacity of the environment and R(k) the amount of resource at a specified time.

Implementation of Models to Analyze the Social Impact Indexes of the Microgrid
There are many tools for the simulation of agent-based models (ABM). In [38] a comparative study of the most widely used ones, was presented. Netlogo, which has been used in several sociological studies, was selected from between the existing options.
Firstly, the total energy requirement of the community is calculated on an hourly basis. For this purpose were considered the electrical devices defined in [16]. The usage of such appliances during diverse hours of the day was determined by a probabilistic model. In this way, the multiple electrical devices that are available in the home will contemplate the variability of use of the typical conduct of the zone. With this, it is possible to establish demand profiles for determining time slots according to probabilities. Thus, each house activates the consumption of some elements independently from all the others, each one having distinctive but statistically similar comportment.
Since the economic activity is associated with the energy supply, a bill is generated for each household every hour. The bill b hr considers the percentage contribution of each energy supply (diesel D, biodiesel B, and photovoltaic S generators) hourly, allowing to calculate the respective charge, as shown in (27).
Similarly, every hour the stored fish quality index in each house is calculated. The fishes for consumption are assumed to be in a refrigerator with a minimum temperature of 5°C, and the fishes in sale are stored with a minimum temperature of 0°C. With these temperature values, the freshness index is calculated according to Equation (22) and (23). When a house does not have energy service, the immediate change to room temperature is assumed and the calculation is continued with this new value.
Finally, through the Davis meteorological station the values of temperature, wind direction, wind speed, and irradiance are acquired. The performance of photovoltaic generation will be influenced by irradiation and temperature variations, while variations in wind speed and direction will affect the penalty applied to the diesel generator supply in terms of the concentration of particulate material emitted into the environment.
The simulation model considers different modes of functioning. In Offline mode, it allows the execution without the need to connect to any external digital system. It consists of a simulation that considers three sources that supply the demand of the community, changing the importance of biomass or diesel (on-grid), as well as the form in which the supply is treated from a sole power supply that is operating during certain hours (off-grid). Online operation, which is realized by integrating the platform to an external digital system that emulates the power generation that provides energy to the community. The initial point of development of the model in the Netlogo platform consisted of developing the agent that models the environment on which the rest of the agents will act. Initially, the map of one of the areas of Bahía Málaga was obtained through Google Maps, then the bitmap was imported and in this way the geographic space was established. Later, houses were integrated into this map. and trees in the green areas, boats in the blue areas, and the movement of people to the green area was limited, as shown in Figure 14. For the organization and creation of all the agents, the following premises were followed:

•
In this environment, each pixel is called a "patch", and the following characteristics are used for each patch: Only the last feature is added for the use of this project, the rest are features predetermined by Netlogo. • To be able to approximate the distances and areas of the environment, it is found with the help of Google Maps that each pixel is approximately equivalent to 13.5 m × 13.5 m. • Trees are created on green patches and houses are created on green patches without trees, 70 in this case. The following characteristics are used for each house: who: number that identifies this agent. -color: color that is defined to the agent. -energyBillHome-hour: bill/charge for energy consumed in that hour. -energyBillHome-day: invoice/charge for energy consumed so far of the day. -offuGridPago: variable that is set to "true" when simulating in offGrid mode. -plantaEnergy: variable that is activated in "true" for fishermen's houses to which an independent power plant is assigned. -energy: variable that is activated in "1" indicating the availability of energy in the house. This variable changes to "0" when they do not have the capacity to pay for energy or when the generation hours are not in "offGrid" mode. During the non-generation hours of the "offGrid" mode, only those with an independent plant may have this variable at "1". In addition to these variables, the consumption values of each of the electronic components that they may have at home are included.

•
Once the houses are created, the population is created, given that we only have information about the number of houses in the area, we randomly create from two to eight people per house. The following characteristics are used for each person: who: number that identifies this agent. busy: variable that is set to "true" when it is performing a specific activity, so it cannot be assigned another simultaneous activity.
• Only 15 people are given the role of fisherman. • The house assigned to a fisherman will have a blue color differentiating it from the other houses. • A total of 20% of the fishermen houses, in this case three, are assigned an independent power plant. • Each fisherman's house is assigned a boat that will have the nearest blue patch as its port. • For fishing, fish are created as they are caught; this is for the purpose of keeping track of the freshness of the fish on an individual basis. Therefore, the fish are also agents and are killed or eliminated when their freshness index reaches 1 or less. lost: variable that is set to "true" when the agent constantly hits an area that is not valid for moving forward. -count: count of the number of times it has hit an invalid area to move forward. -exploring: variable that is set to "true" when the agent is given a specific location to reach. -rotation: variable to determine the rotation direction of the agent. -aux-var: auxiliary variable to store a direction to which the agent was pointing at some previous moment.
Each described agent (patch, houses, people, fish, and boats) will be governed according to the following behaviors. • The mobility behavior of the "person" and "boat" agents is limited to choosing a random direction and advancing a distance proportional to the passage of time, i.e., an advance distance is approximated for each simulation step. Taking into account that each patch is approached at 13 square meters initially, both people and ships, a speed of 1 m/s is set.
-For people, the forward movement is only valid if and only if the target patch is green, otherwise it continues to rotate until a valid space is found.

-
People avoid high pollution zones.

-
For ships the movement is similar to that of people, the only valid patches are those of blue color, in addition to having a condition to stop from time to time.

-
When the boats stop, they have a 70% chance of catching 0 to 3 fish.

-
The boats will only be moving when they are fishing hours. The boat only starts its movement when the related agent/owner arrives at the respective dock.
• People start moving at 3:00 a.m. and at 11:00 p.m. they will be returning to their homes. • At 3:00 a.m. a fish consumption is considered in each house simulating breakfast time. • At 4:00 a.m. the fishing activities begin, starting with arriving at the port of the boats. • At 6:00 a.m. the biomass arriving from the coast is collected. Being 1 ton per month, 33 kg per day. • At 8:00 a.m., each household checks the freshness index of the stored fish and discards those with an index equal to or less than 1. • At 9:00 a.m. each household checks the number of fish they have and determines if they are buying fish; if so, they buy one fish for each person for three meals, covering lunch, dinner and breakfast the following day. The purchase is made from the nearest vendor who has the number of fish they require. • At 10:00 a.m., and following the model proposed by Passino in [14], an expense is generated for each house, proportional to the number of people living in it. • At 11:00 a.m. all fishing boats stop fishing and start returning to their respective docks. • At 12:00 p.m., with the boats already at the dock, the fishermen deposit the fish at the fish store in their respective homes. In addition, the consumption of fish for lunch is generated. • At 2:00 p.m. the fishermen go out fishing again. • At 3:00 p.m. the fishermen return from fishing.
• At 4:00 p.m., with the boats already at the dock, the fishermen deposit the fish at the fish store in their respective homes. • At 5:00 p.m., and following the model proposed by Passino in [14], a random monetary income from 0 to 3 is generated for each house, multiplying the random result by the number of members living in the house. • At 6:00 p. m., if the simulation is running in "offGrid" mode, the power supply from the Diesel plant is turned on. • At 8:00 p.m., a fish consumption per dinner is generated. • At 10:00 p.m., if the simulation is running in "offGrid" mode, the power supply from the diesel plant is turned off. • At 11:00 p.m. all "person" agents return to their respective homes.
The final interface implemented in Netlogo is presented in Figure 15.

Particulate Material Dispersion Model
Starting with the particulate material dispersion model (Table 10) making use of the data reported in [54] and with which the buoyancy parameter F, the final elevation distance of the plume can be calculated X f . The Gaussian plume dispersion described by (17) produces the outcome downwind. To include the wind direction, required in the calculation of the pollutant concentration of each patch, a simple rotation matrix is applied, Equation (30), and it is moved according to the position in which the source of contamination is located, in this case the diesel generator, Equations (28) and (29). As indicated, the patches have their position (x, y) by default relative to the center of the map, so the transfer of the point of origin of contamination must be done with respect to the center of the map. Equations (31) and (32) describe the rotation and translation of each patch.
With the positions shifted to the diesel generator position and with the rotation in the downwind direction, the dispersion model that is desired for the project is obtained, the results of which are presented in Figure 16. For the calculation of the emission flow of the particulate material, the emission factors obtained from [54] were used.
Given that the emission factors depend on the kilograms of diesel used, and the model receives as a parameter the power instructions delivered by each of the sources, a conversion factor was sought that relates the kilograms of diesel per Wh generated by the source and is presented in (33). This factor was obtained from the data presented in Table 11 [55].
This is the factor of conversion from Wh to kg of diesel fuel. This new value is multiplied by an emission factor according to Table 11, getting the flow Q in kg/s of particulate material emitted by the diesel generation source.
Considering that the result of the concentration levels of the particulate matter, (17), is obtained in kg/m 3 , and according to Resolution 2254 of 2017 of Colombia, the concentration values are expected in the order of micrograms (µg), the resulting value of this equation is multiplied by 1E9 to get readings on µg/m 3 , allowing analysis for contaminants PM 10 , NO 2 and CO.
In addition to the interface of the dispersion of the particulate matter in the map of the region, there is a graph showing the change in the generation of carbon dioxide (CO 2 ) generated by the diesel generator, Figure 17.  Figure 18 shows the conceptual dynamics that the economic model follows. It is worth emphasizing that due to the lack of community data, this model is a first approach to the real behavior of the community. To observe the results of this dynamic, a graph was developed that shows the economic balance of the community in general (left side in Figure 19), which starts from a zero balance and begins to count expenses and income of all transactions made by the houses, and the calculation of the average wealth index of the population is performed. Equation (14) was implemented which gives an index of the average wealth of the population. Additionally, a histogram is implemented to analyze the distribution of wealth in the population (right side in Figure 19). The capital owned by the 10% of the houses with the highest capital in the community is calculated, as well as the percentage of the total capital of the community that this amount of capital implies. These indicators are related to the effects of economic inequality in a developing population.

Environmental Resource Consumption Effects Model
Concerning the dynamics of consumption and regeneration of the biomass resource, Figure 20 reflects the proportion of biomass available in the area. Right next to this, the values in kg of these percentage are shown along with the indicator β. The development of this is done from Equations (25) and (26).

Integration of the Microgrid Emulation Model and the Social Impact Index Evaluation Models
The emulation of the microgrid and the models in Netlogo were connected using the OPC protocol and serial communication, the latter since Netlogo does not support the OPC protocol, Matlab software is used as an intermediary. The scheme is shown in Figure 21. Given that the emulation models are executed in real time, there is a synchronization inconvenience since the simulation of the components implemented in Netlogo has to advance much faster, for these results mostly require simulated hours or days to observe relevant results. Consequently, the communication or update of values is executed after the moment in which the emulation reaches a stationary state. This is the period in which the simulation models in Netlogo execute changes of resource and demand setpoints. This period is a characteristic constant of the transients in the emulated system and is configured before running the simulation. Considering the data obtained from the Davis station, which corresponds to the simulated 1 hour step.

Analysis of the Case of the Bahía Málaga Community
To present the use of the developed models, the analysis of the implementation of an energy solution for the Bahía Málaga community was implemented as a case study. As this is a complex system, it is not possible to establish an expected operating condition, since its variability and complexity, therefore the analysis is performed on multiple executions to show divergent or convergent behaviors.
As initial conditions, we have a population with a random geographic distribution and a money capital modeled through a normal distribution with a mean of COP 900, 000. In this way, it is intended that each simulation eliminates the bias of data or actions not considered, thus avoiding outcomes that are adjusted by an initial status but that are obtained beneath statistically close behavior.
The outcomes corresponding to 12 hours of simulation are presented in Figure 22, as can be seen, the different sources of energy generation contribute to the total generation. The energy dispatch control implemented in the emulation platform allows distributing the total contribution between the three sources, regulating the economic cost of the community due to energy consumption. If the resulting average collection is observed, this value up to midday is only COP 1900.
On the other hand, looking at the values of kilograms of CO 2 and particulate matter concentration, the microgrid model deployed on the emulated platform offers a risk to the region's air quality, especially during hours of low wind speed.
As mentioned above, the platform has different operating modes. The difference of each operation mode lies in the energy system model used to supply the demand of the community. Table 12 offerings a collection of the outcomes obtained in the diverse modes. The first two rows correspond to the Offline mode combined with off-grid. In these cases an economic balance was obtained in apparent growth, according to the trend of the balance indicator, the biomass reserves are accumulating, the accumulated kilograms of CO 2 are 130 Kg for 8 days. A minority among the fishermen obtain a capital in savings that exceeds up to three times the average and there is also a high quantity of fish discarded due to decomposition. The following rows, with the exception of the last one, reflect the Offline mode in combination with on-grid, where the biomass source priority is varied over biodiesel, and vice versa, as well as the number of days simulated. For example, it was observed that in the case where biomass is given priority over biodiesel, the economic balance decreases in a regulated manner, according to the trend of the indicator. While the amount of fish discarded by decomposition was reduced by more than seven to nine times with respect to the simulations presented in the off-grid mode. There is no generation of kilograms of CO 2 by power generation. In addition, there is a subtle consumption of biomass from the medium with slight recovery. Finally, in the Online mode in the last row, which was presented.
No further tests were performed, as several of the analysis provided by the platform need several days of simulation to make conclusive evaluations.

Conclusions and Future Work
In this work simulation and emulation models were presented which integrate three different sublevels of an isolated microgrid: computational, energy, and automation. These models enable the integrated study of the performance of these systems, as well as the effects in their operation in the computational support. This integration is something new in this proposal, because in addition to enabling the analysis of electrical parameters in the microgrid, it is possible to evaluate the effects that computational support can generate on its performance. Something that is not presented in recent works in this type of systems and that due to their dynamics must be considered.
Moreover, a simulation model was developed to analyze the social effects caused by microgrid projects. This allows analyzing indices of socio-technological interdependence in the operation of an isolated microgrid. The analysis considers the environmental and economic aspects of microgrid implementations supplying energy to non-interconnected communities.
As a case study the analysis of the impacts of different microgrid configurations was realized in the context of a community in the Bahía Málaga region. Although the analysis of economic inequality was not a goal of this project, the simulation model developed allows evaluating the influence of different cases on the wealth distribution, as well as to determine what characteristics share in common the most or least benefited individuals. Then, the simulation model can be used to evaluate regulatory policies for the use of energy that contributing to a greater benefit to the community.
Although the results obtained provide a glimpse of the possibility of arriving at a model that allows a general analysis of the performance and impacts generated by microgrid projects in isolated communities, several challenges still need to be addressed to achieve this goal, and future work will focus on: • Facilitating the reconfiguration of the simulation model developed to analyze the social effects caused by microgrid projects in order to extend its scalability. • Expanding the computational capabilities of the emulation system so as to facilitate the processing of scenarios with longer evaluation intervals than those of the current system, which are limited to a few hours. Funding: This research received no external funding.
Data Availability Statement: Not applicable.

Conflicts of Interest:
The authors declare no conflict of interest.

Abbreviations
The following abbreviations have been used in this manuscript: ABM