How Smart Metering and Smart Charging may Help a Local Energy Community in Collective Self-Consumption in Presence of Electric Vehicles

: The 2018 / 2001 / EU renewable energy directive (RED II) underlined the strategic role of energy communities in the EU transition process towards sustainable and renewable energy. In line with the path traced by RED II, this paper proposes a solution that may help local energy communities in increasing self-consumption. The proposed solution is based on the combination of smart metering and smart charging. A set of smart meters returns the proﬁle of each member of the community with a time resolution of 5 s; the aggregator calculates the community proﬁle and regulates the charging of electric vehicles accordingly. An experimental test is performed on a local community composed of four users, where the ﬁrst is a consumer with a Nissan Leaf, whereas the remaining three users are prosumers with a photovoltaic generator mounted on the roof of their home. The results of the experimental test show the feasibility of the proposed solution and demonstrate its e ﬀ ectiveness in increasing self-consumption. The paper also calculates the subsidy that the community under investigation would receive if the current Italian incentive policies for renewables were extended to local energy communities; this subsidy is discussed in comparison with the subsidies that the three prosumers individually receive thanks to the net metering mechanism. This paper ends with an economic analysis and calculation of savings on bills when the four users create the local energy community and adopt the proposed combination of smart metering and smart charging.


Introduction
The 2018/2001/EU renewable energy directive (RED II), as part of the European Clean Energy Package, underlined the strategic role of energy communities [1] in helping the EU in the transition to sustainable and renewable energy [2]. Energy communities are a modern reorganization of local energy systems to integrate distributed energy resources [3]; such a reorganization needs a strategic approach that has to take into account an important activity regarding social acceptability [4], to involve common people and the policy makers in building energy communities [5,6]. Showing to ordinary people how desirable being part of an energy community is, thus abandoning the position of individuals who independently manage their own distributed generation [7], is a fundamental step. To this end, the economic benefits of the new business models for generating [8] and peer-to-peer exchanging energy [9] within the community are good levers. Energy communities, if local, better identify energy needs and better manage energy exchanges in urban neighborhoods [10] and municipalities [11,12] as well, especially when the energy community operates the electrical distribution grids [13].
In this context, this paper proposes a feasible solution to improve the self-consumption of a local energy community; the proposed solution is a combination of smart metering and smart charging which allows to control the charging of electric vehicles according to the energy production and consumption of a local energy community. A combination of smart metering and smart charging has never been proposed in the literature so far; smart metering and smart charging have been widely studied and discussed but separately. This paper aims to cover this gap, demonstrating the benefits of this combination with reference to a real case and an experimental test.
This paper is organized as follows. Section 2 presents the state of the art and related works on smart metering and smart charging. Section 3 illustrates the local energy community, the application of smart metering, the architecture of communication between community members and aggregator, and the application of the smart charging service. Section 4 presents the smart meter. Section 5 illustrates an experimental test and some energy and economic analysis which led to conclusions.

Smart Metering
Nowadays, smart electric meters are implemented in many countries; the main peculiarity of these meters is the high frequency and precision in measuring electricity consumption. Measurements are sent, automatically at regular time intervals or on request in near-real time, to the distributor or to a company in general that monitors smart meters. A better temporal resolution for measuring and sharing measures does not exist, it is the right compromise between representativeness and size of the set of measurements as a function of the available technology. Smart metering has distant roots. As early as 1992, so-called non-intrusive appliance load monitors were proposed and tested [14]; these were devices capable of estimating the number and the nature of household loads-the taxonomy [15]-on the basis of a 1-min measurement of the voltage and the current at the meter. From that moment on, refrigerators, ovens, stove burners and dish washers had a visible signature which was sent to the utility via a telephone line. Decoding power consumption into a transfer of information began a profound innovation because power engineering and communication engineering mutually combined in a new way. This combination allowed to discover the habits and the activities of people avoiding entering into their homes. The utility could have saved personal data and load signatures of customers in a large database where third parties could have saved money transactions for items purchased by the customers themselves [16]. Sharing this database with other parties operating in other sectors of the economy or politics would have been a foregone conclusion. This vision was disturbing enough to trigger the first concerns regarding data privacy, preserving privacy in data mining and safe computing in general. Since at the time and in subsequent years, a fundamental principle was established: when data are transferred or communicated between different parties, it is imperative that the parties do not know the identity of those who originated the data. By preventing identification, discrimination against people is prevented too. This principle also applies to smart metering since metering data are equated [17] to personal data [18]. Along this line, an American consumer protection advocate openly discussed whether the use of smart meters by the utility is an unreasonable act in violation of the Fourth Amendment of the United States Constitution [19]. Given the importance of data privacy, in 2009 the European Commission set up the so-called smart grid task force to advise on issues related to the data protection impact assessment for smart metering systems [20]. The task force's recommendations support newer techniques of encryption on chip (e.g., Trusted Platform Module chip) and newer protocols of direct anonymous attestation (e.g., Direct Anonymous Attestation protocols); TPM chips and DAA protocols allow the authentication of remote computers, according to the specifications of the Trusted Computing Group founded in 2003 by Compaq, Hewlett Packard, IBM, Intel and Microsoft to preserve the anonymity of the end user [21]. Assuming the correct use of technologies and taking into account the common European standards for the internal market of electricity and consumer protection [22], smart meters may provide a wide variety of benefits to a wide variety of actors, including end users, retailers and network operators. For example, smart metering deeply helps the end user to understand the link between their habits to consume energy and the energy consumption of each specific appliance; this link is a key to enable energy efficiency services such as peak shaving and load shifting, adopt time-of-use tariffs and increase self-consumption and savings on bills [23]. In addition, smart metering benefits retailers because it allows the elimination of the hated and expensive adjustment bills, especially if in combination with blockchain [24]. At the same time, retailers may offer new tariffs, perfectly customized for how the customer wishes, and apply discounts for weekly payments in place of typical bimonthly payments, and apply discounts for prepaid consumption [25]. Lastly, smart metering also benefits grid operators as it supports observability and control of the smart grid [26], monitoring power quality and generation from renewable sources, solving multiple daily checks such as the identification of the phase of end users' connection to the low-voltage network [27]. Grid operators can better manage the network and plan the investments, while reducing operating and maintenance costs.
The benefits of smart metering illustrated above are at the basis of the flourishing prospects for the smart meter market; analysts estimate that nearly 225 million smart electricity meters will be installed in the EU by 2024, thanks to government investments of about EUR 47 billion [28,29].
Finally, it is worth mentioning the current trend, which seems unstoppable, of the use of open source hardware as an instrument for measuring, managing and monitoring the energy scope [30][31][32][33].

Smart Charging
Nowadays, smart charging (V1G) and vehicle-to-grid (V2G) are two feasible technologies for integrating electric vehicles and the electric grid with each other in a smart way. V1G allows to control the power flow from the grid to the vehicle, adjusting the time-start and end of the charge-and the amperes. V2G goes beyond V1G as it also allows to reverse the power flow, therefore the electric vehicle is a programmable load and a programmable generator as well; so, V2G beats V1G since by implementing V2G, the achievable advantages are potentially greater than V1G. On the other hand, implementing V2G requires significant investments, greater than V1G; these significant investments are due to the fact that V1G and V2G impact battery-charge infrastructure in a very different way [34,35].
In general, an electric vehicle can be charged quickly at a charging station or slowly at home as illustrated in Figure 1; in the first case, the batteries are connected to the off-board charger of the charging station, whereas in the second case they are connected to the on-board charger. In general, both the off-board and the on-board chargers consist of a cascade of two electronic power converters, one AC/DC and one DC/DC (see labels 1, 4 and 2, 3 in Figure 1, respectively) with high power density and high efficiency. These converters are relatively cheap and structurally lean in the V1G case because they are unidirectional, though they are more expensive and structurally more sophisticated in V2G because they are bidirectional. Further, also firmware on microprocessors, the communication methods, number of sensors and certifications of converters appreciably differ moving from V1G to V2G. For example, the off-board charger typically converts the phase-to-phase AC voltage of grid cables in a DC voltage and the vehicle batteries are DC coupled to this charger directly; therefore, a V1G off-board charger may consist of a conventional diode rectifier in a cascade with a DC/DC buck/boost converter for power factor correction (PFC).
By contrast, the corresponding V2G charger may consist of a three-phase bidirectional AC/DC converter mounted with six insulated-gate bipolar transistors (IGBTs) [36]; if the battery voltage is lower than the voltage at the rectifier's terminals, then a single or interleaved bidirectional buck/boost DC/DC converter is further placed in the cascade [37]. Similar considerations apply to the on-board charger: it typically converts the phase-to-neutral AC voltage of the residential cable in a DC voltage. In V1G, there is a cascade of a diode rectifier and a DC/DC buck converter with power factor correction. In V2G, By contrast, the corresponding V2G charger may consist of a three-phase bidirectional AC/DC converter mounted with six insulated-gate bipolar transistors (IGBTs) [36]; if the battery voltage is lower than the voltage at the rectifier's terminals, then a single or interleaved bidirectional buck/boost DC/DC converter is further placed in the cascade [37]. Similar considerations apply to the on-board charger: it typically converts the phase-to-neutral AC voltage of the residential cable in a DC voltage. In V1G, there is a cascade of a diode rectifier and a DC/DC buck converter with power factor correction. In V2G, there are a full-bridge AC/DC boost converter and a half-bridge bidirectional DC/DC converter [38] or a bridgeless boost-type AC/AC converter in cascade to an interleaved DC/DC buck-type converter [39].
Given the different impact of V1G and V2G on the battery charging infrastructure and economics, today's investments are mainly aimed at supporting the massive deployment of electric vehicles and to ensure the extensive presence of charging points with one-way chargers. Therefore, due to technical potentials [40] and promising practices [41] of smart charging, V1G seems today to be ahead in the competition with V2G and it is preparing to become the most popular technology for coordinating the charging of a multitude of electric vehicles. The lack of coordination can cause the overloading of distribution transformers at substations or the voltage deviation at buses of distribution network [42]; in this sense, V1G may reduce the demand of chargers in commercial and industrial hosts in real time [43], according to centralized and decentralized smart-charging schemes [44] or heuristic approaches [45].
Coordinating the charging of many electric vehicles via V1G can also reduce the total costs of ownership [46]. For a single user, demand charge management via V1G can synchronize the charging to the over-generation of the roof-mounted photovoltaic plant so to maximize self-consumption [47]; similarly, V1G can apply a time-of-use tariff in order to reduce the electricity bill [48]. Similarly, demand charge management via V1G can coordinate the charging of electric vehicles in a car park [49,50] or in a narrow geographical border [51], applying machine learning methods [52,53], taking into account the users' preferences [54] or the batteries' state of health [55], thus limiting the demand during peak hours and, in general, providing valuable grid services to network operators. Given the different impact of V1G and V2G on the battery charging infrastructure and economics, today's investments are mainly aimed at supporting the massive deployment of electric vehicles and to ensure the extensive presence of charging points with one-way chargers. Therefore, due to technical potentials [40] and promising practices [41] of smart charging, V1G seems today to be ahead in the competition with V2G and it is preparing to become the most popular technology for coordinating the charging of a multitude of electric vehicles. The lack of coordination can cause the overloading of distribution transformers at substations or the voltage deviation at buses of distribution network [42]; in this sense, V1G may reduce the demand of chargers in commercial and industrial hosts in real time [43], according to centralized and decentralized smart-charging schemes [44] or heuristic approaches [45].
Coordinating the charging of many electric vehicles via V1G can also reduce the total costs of ownership [46]. For a single user, demand charge management via V1G can synchronize the charging to the over-generation of the roof-mounted photovoltaic plant so to maximize self-consumption [47]; similarly, V1G can apply a time-of-use tariff in order to reduce the electricity bill [48]. Similarly, demand charge management via V1G can coordinate the charging of electric vehicles in a car park [49,50] or in a narrow geographical border [51], applying machine learning methods [52,53], taking into account the users' preferences [54] or the batteries' state of health [55], thus limiting the demand during peak hours and, in general, providing valuable grid services to network operators. Figure 2 illustrates a local energy community composed of four families (four users in the next part of this paper); their residential homes are connected to the electricity distribution grid, downstream a unique medium-low-voltage substation. Each user has a photovoltaic plant mounted on the rooftop or an electric vehicle. Figure 2b illustrates one user or prosumer with detail. The smart meter is installed just behind the meter and measures the power flow with high temporal resolution. It also measures the power flow of the photovoltaic generator and to the electric vehicle. For the latter, a smart charging service is available, therefore, in general, it is possible to start/stop the charging and adjust the power for small or large steps. The smart charging service is provided by an aggregator that supervises the power flows at meters thanks to a continuous communication with the smart meters.  Figure 2 illustrates a local energy community composed of four families (four users in the next part of this paper); their residential homes are connected to the electricity distribution grid, downstream a unique medium-low-voltage substation. Each user has a photovoltaic plant mounted on the rooftop or an electric vehicle. Figure 2b illustrates one user or prosumer with detail. The smart meter is installed just behind the meter and measures the power flow with high temporal resolution. It also measures the power flow of the photovoltaic generator and to the electric vehicle. For the latter, a smart charging service is available, therefore, in general, it is possible to start/stop the charging and adjust the power for small or large steps. The smart charging service is provided by an aggregator that supervises the power flows at meters thanks to a continuous communication with the smart meters.

The Communication Architecture
The data flow scheme for communication between the aggregator and the smart meters is illustrated in Figure 3: the aggregator is at the top of the diagram, the smart meters at the bottom, a database is placed between them. This diagram shows an important assumption, i.e., the aggregator and smart meters do not communicate directly with each other, the database acts as an interface between them. This assumption inevitably influences the operation of both the aggregator and the smart meters as illustrated below. Each smart meter measures voltages and currents, processes the measurements, performs calculations and then saves the numerical results both on a local memory and on the database. Similarly, the aggregator gets from the database the numerical results saved by the smart meters, processes these results, performs calculations and saves the new results on the same database. Since the aggregator also implements decision-making processes, some of the new results are commands that the aggregator must send to the smart meters and that the smart meters must implement. Since a direct communication between the aggregator and smart meters is not allowed, a cyclic read/write procedure such as the one illustrated in Figure 4 is implemented. This figure illustrates how to send a command for the i-th smart meter and how to receive its answer. The aggregator sends the command setting the value of a given variable, specific for the i-th smart meter,

The Communication Architecture
The data flow scheme for communication between the aggregator and the smart meters is illustrated in Figure 3: the aggregator is at the top of the diagram, the smart meters at the bottom, a database is placed between them. This diagram shows an important assumption, i.e., the aggregator and smart meters do not communicate directly with each other, the database acts as an interface between them. This assumption inevitably influences the operation of both the aggregator and the smart meters as illustrated below. Each smart meter measures voltages and currents, processes the measurements, performs calculations and then saves the numerical results both on a local memory and on the database. Similarly, the aggregator gets from the database the numerical results saved by the smart meters, processes these results, performs calculations and saves the new results on the same database. Since the aggregator also implements decision-making processes, some of the new results are commands that the aggregator must send to the smart meters and that the smart meters must implement. Since a direct communication between the aggregator and smart meters is not allowed, a cyclic read/write procedure such as the one illustrated in Figure 4 is implemented. This figure illustrates how to send a command for the i-th smart meter and how to receive its answer. The aggregator sends the command setting the value of a given variable, specific for the i-th smart meter, namely Asked_for_a_Service (ASi); this variable belongs to the database and the i-th smart meter frequently reads this variable. Similarly, the i-th smart meter answers the aggregator setting the value of a further given variable, namely Response_for_a_Service (RSi); this variable belongs to the database and the aggregator frequently reads this variable. This read/write sequence repeats, according to pre-established cadences which avoid simultaneous accesses and overlapping.
Energies 2020, 13, x FOR PEER REVIEW 6 of 19 namely Asked_for_a_Service (ASi); this variable belongs to the database and the i-th smart meter frequently reads this variable. Similarly, the i-th smart meter answers the aggregator setting the value of a further given variable, namely Response_for_a_Service (RSi); this variable belongs to the database and the aggregator frequently reads this variable. This read/write sequence repeats, according to pre-established cadences which avoid simultaneous accesses and overlapping.

The Smart Charging Service
The aggregator is mounted with a special routine that calculates the community profile every 5 s by adding the measurements saved on the database by the smart meters; a positive sum corresponds to a collective over-generation, a negative sum to a collective under-generation. In case of collective over-generation, the routine compares the community collective profile with a desired threshold; if the profile exceeds the threshold and continues to grow for a desired time, e.g., 30 s, then the aggregator sets the variable Asi to a new value: The i-th smart meter reads ASi every 5 s; in order to increase the imported power, it enables the charge of the batteries of the electric vehicle. To this end, the smart meter closes a normally open contact so as to power the 230Vac-50Hz coil of a contactor relay which, in turn, closes the electrical circuit that powers the 230Vac-16A plug to which the electric vehicle is connected.
Before enabling the charge, the smart meter performs a check for a potential overload: the smart meter calculates the difference between the power currently imported by the grid and the contractual power. Assuming that such a difference is higher-or equal-to the power for charging the batteries, the smart meter enables the charge and sets the value of the variable RSi to a new value: Otherwise, the smart meter will provide one of the following answers: These alternative answers are self-explanatory in fact: the first, overload, means that the overload check failed, while the second answer, unavailable, means that the electric vehicle is not present.

The Smart Meter Enabling the Smart Charging
Figures 5 and 6 illustrate how the smart meter of this paper enables smart charging. In Figure 5, the aggregator permanently communicates with all smart meters, therefore it is aware of power flows

The Smart Charging Service
The aggregator is mounted with a special routine that calculates the community profile every 5 s by adding the measurements saved on the database by the smart meters; a positive sum corresponds to a collective over-generation, a negative sum to a collective under-generation. In case of collective over-generation, the routine compares the community collective profile with a desired threshold; if the profile exceeds the threshold and continues to grow for a desired time, e.g., 30 s, then the aggregator sets the variable Asi to a new value: The i-th smart meter reads ASi every 5 s; in order to increase the imported power, it enables the charge of the batteries of the electric vehicle. To this end, the smart meter closes a normally open contact so as to power the 230Vac-50Hz coil of a contactor relay which, in turn, closes the electrical circuit that powers the 230Vac-16A plug to which the electric vehicle is connected.
Before enabling the charge, the smart meter performs a check for a potential overload: the smart meter calculates the difference between the power currently imported by the grid and the contractual power. Assuming that such a difference is higher-or equal-to the power for charging the batteries, the smart meter enables the charge and sets the value of the variable RSi to a new value: Otherwise, the smart meter will provide one of the following answers: These alternative answers are self-explanatory in fact: the first, overload, means that the overload check failed, while the second answer, unavailable, means that the electric vehicle is not present.

The Smart Meter Enabling the Smart Charging
Figures 5 and 6 illustrate how the smart meter of this paper enables smart charging. In Figure 5, the aggregator permanently communicates with all smart meters, therefore it is aware of power flows at users' meters; based on this information, the aggregator manages the smart charging service, establishing which vehicles can be recharged. The smart meter measures the meter's power flow but it is also enables the smart charging service as it receives and implements the decisions of the aggregator; in this sense, the smart meter communicates to electric vehicle supply equipment (EVSE) so that batteries' charging begins.
Energies 2020, 13, x FOR PEER REVIEW 7 of 19 at users' meters; based on this information, the aggregator manages the smart charging service, establishing which vehicles can be recharged. The smart meter measures the meter's power flow but it is also enables the smart charging service as it receives and implements the decisions of the aggregator; in this sense, the smart meter communicates to electric vehicle supply equipment (EVSE) so that batteries' charging begins. Figure 6 illustrates the connecting schema for the smart meter of this paper: rapid installations and minimal changes to the existing wiring are the basis of this schema. The smart meter is installed in the home switchboard and it calculates the power flow measuring the voltage and the current at the switchboard input. In addition, the smart meter also measures the current of two main distribution lines, that is, the line that supplies the EVSE and the line that connects the photovoltaic system to the grid.

The Smart Meter
The smart meter of this paper is illustrated in Figure 7a; it is composed of two printed circuits where the first is mainly devoted to signals processing whereas the second to power conditioning. The upper printed circuit processes the signals that correspond to the measured voltages and currents, calculates temporal averages, connects to the internet and processes the rules for controlling the output ports, as will be described later. The lower printed circuit supplies power to all circuits and to some external auxiliary devices; it also transduces voltages and currents measurements into signals, ensuring protection, isolation and filtering.
On the bottom left corner, a pair of terminals receive the 230 Vac-50 Hz grid voltage supply; an AC/DC converter straightens this grid voltage and returns a stable 5 Vdc voltage to power the smart meter's components and auxiliaries up to a power of 15 W. The second pair of terminals connect directly to the bus for the phase-neutral voltage detection. On the bottom right corner, three pairs of terminals receive the output of three open core toroidal current transformers for the line current measurements, such as illustrated in Figure 7b.
As for the voltage/current measurement and power calculations, the smart meter of this paper has been designed for a high-performance, high-frequency and accurate measurement, together with a streamlined connection to a cloud database over the Internet. This smart meter has no operating system, the firmware stored in the microcontroller is the only software present. At the moment, the end user is not allowed to modify the firmware.
The smart meter samples the voltage and the three currents 100 times every 20 ms; this default frequency of 5 kHz can be increased if necessary. Three active powers are thus obtained every 20 ms and the time averages are calculated every 5 s. The average values are locally saved on an SD memory card, cyclically overwritten, and sent to a cloud database on the Amazon Web Service platform [56,57]. For this purpose, the smart meter is mounted with an ESP8266 chip to connect the local WiFi.    Figure 6 illustrates the connecting schema for the smart meter of this paper: rapid installations and minimal changes to the existing wiring are the basis of this schema. The smart meter is installed in the home switchboard and it calculates the power flow measuring the voltage and the current at the switchboard input. In addition, the smart meter also measures the current of two main distribution lines, that is, the line that supplies the EVSE and the line that connects the photovoltaic system to the grid.

The Smart Meter
The smart meter of this paper is illustrated in Figure 7a; it is composed of two printed circuits where the first is mainly devoted to signals processing whereas the second to power conditioning. The upper printed circuit processes the signals that correspond to the measured voltages and currents, calculates temporal averages, connects to the internet and processes the rules for controlling the output ports, as will be described later. The lower printed circuit supplies power to all circuits and to some external auxiliary devices; it also transduces voltages and currents measurements into signals, ensuring protection, isolation and filtering.   On the bottom left corner, a pair of terminals receive the 230 Vac-50 Hz grid voltage supply; an AC/DC converter straightens this grid voltage and returns a stable 5 Vdc voltage to power the smart meter's components and auxiliaries up to a power of 15 W. The second pair of terminals connect directly to the bus for the phase-neutral voltage detection. On the bottom right corner, three pairs of terminals receive the output of three open core toroidal current transformers for the line current measurements, such as illustrated in Figure 7b.
As for the voltage/current measurement and power calculations, the smart meter of this paper has been designed for a high-performance, high-frequency and accurate measurement, together with a streamlined connection to a cloud database over the Internet. This smart meter has no operating system, the firmware stored in the microcontroller is the only software present. At the moment, the end user is not allowed to modify the firmware.
The smart meter samples the voltage and the three currents 100 times every 20 ms; this default frequency of 5 kHz can be increased if necessary. Three active powers are thus obtained every 20 ms and the time averages are calculated every 5 s. The average values are locally saved on an SD memory card, cyclically overwritten, and sent to a cloud database on the Amazon Web Service platform [56,57]. For this purpose, the smart meter is mounted with an ESP8266 chip to connect the local WiFi.
Lastly, Figure 8 shows a Nissan Leaf during one of the many preliminary experiments carried out by the Laboratory of Electric Power Systems and Renewables (LASEER) at the University of Calabria.

The Experimental Test, Energetic and Economic Analysis
In this section, the local community of four residential users is presented first, along with two case studies and the experimental test performed on Saturday, 11 January 2020. Then, an energetic analysis discusses the improvement in self-consumption due to the smart meter implementing smart charging. This section ends presenting an economic analysis which shows the impact of being a community's member on subsidies and electric bills.

The Local Community
The community is made up of four members-User1, User2, User3 and User4-living in Southern Italy. As reported in Table 1, User1 is a consumer, does not have any photovoltaic generator

The Experimental Test, Energetic and Economic Analysis
In this section, the local community of four residential users is presented first, along with two case studies and the experimental test performed on Saturday, 11 January 2020. Then, an energetic analysis discusses the improvement in self-consumption due to the smart meter implementing smart charging. This section ends presenting an economic analysis which shows the impact of being a community's member on subsidies and electric bills.

The Local Community
The community is made up of four members-User1, User2, User3 and User4-living in Southern Italy. As reported in Table 1, User1 is a consumer, does not have any photovoltaic generator installed on the roof but owns a Nissan Leaf. The rated power of batteries of this 100% full electric vehicle is equal to 50 kW, whereas the rated capacity is equal to 40.0 kWh; the time for fully charging the batteries at User1 s home is about 16 h since the EVSE sets the power to 2.5 kW. The contractual power for User1 is 4.5 kW. The remaining three users-User2, User3 and User4-are prosumers since they have a photovoltaic generator on their roof; the peak power of these generators and the contractual powers are in the last three rows of Table 1. All users were mounted with a smart meter like the one illustrated in Figure 7 and described in Section 4 of this paper. Each smart meter can communicate with external devices, e.g., EVSEs, through a variety of wireless solutions and protocols; however, in the experimental test of this section, a wired communication was adopted. More precisely, the smart meter receives and sends data to the aggregator over the Internet via a local WiFi router, whereas it interacts with the EVSE via a general-purpose input/output port (GPIO port). By regulating the voltage of such a GPIO port in the range 0-3.3 V, a low-power relay turns on/off the power supply to the coil of a contactor which, in turn, turns on/off the power supply to the EVSE.

Two Case Studies: Case0 and Case1
Two cases are studied in this paper, namely Case0 and Case1. Case0 refers to the local community in the absence of the electric vehicle, while Case1 refers to the local community with the electric vehicle and the smart charging service provided by the aggregator. Both Case0 and Case1 are studied with reference to the collective profile or community profile, that is, the sum of users' profiles as measured by the smart meters.

Energetic Analysis: Case0, None Electric Vehicle, Bussiness as Usual
Users profiles for Case0 are plotted in Figure 9. The profile of User1 is zero or negative since User1 is a consumer, therefore it exclusively imports power from the electricity grid. The profiles of User2, User3 and User4 in Figure 9 are both positive and negative. Profiles are positive during the daytime from 09:00 a.m. to 15:00 p.m. (9)(10)(11)(12)(13)(14)(15) as the local generation exceeds the local demand; they export power to the electricity grid for the entire interval 9-15 with the exception of short time intervals (i.e., lunch-time) during which the use of domestic appliances determines the inversion of the power flow at the meter. turns on/off the power supply to the EVSE.

Two Case Studies: Case0 and Case1
Two cases are studied in this paper, namely Case0 and Case1. Case0 refers to the local community in the absence of the electric vehicle, while Case1 refers to the local community with the electric vehicle and the smart charging service provided by the aggregator. Both Case0 and Case1 are studied with reference to the collective profile or community profile, that is, the sum of users' profiles as measured by the smart meters.  The community profiles distinguishing generation and demand are plotted in the positive and negative quadrant of Figure 10, respectively. The community generation (in kW) is the sum of powers exported by each user to the electricity grid so that the community production (in kWh) is the energy corresponding to the community generation. Similarly, the community demand (in kW) is the sum of powers imported by each user from the electricity grid so that the community consumption (in kWh) is the energy corresponding to the community demand.

Energetic Analysis: Case0, None Electric Vehicle, Bussiness as Usual
Users profiles for Case0 are plotted in Figure 9. The profile of User1 is zero or negative since User1 is a consumer, therefore it exclusively imports power from the electricity grid. The profiles of User2, User3 and User4 in Figure 9 are both positive and negative. Profiles are positive during the daytime from 09:00 a.m. to 15:00 p.m. (9-15) as the local generation exceeds the local demand; they  The community production and the community consumption on Saturday 11 January 2020 are reported in the first and second column of Table 2. The daily production is equal to 20.51 kWh, and 91.56% is in the daytime 9-15 (18.78 kWh), whereas 8.46% is in the remaining part of the day (1.74 kWh). The daily community consumption is exactly in reverse, the most is out of daytime (23.31 kWh, 84.30%), whereas a small part is in daytime (4.34 kWh, 15.70%). Aware of the more formal definitions and precise metrics proposed in the literature [58,59], in this paper the term self-consumption is the share of energy produced and consumed over the day or a shorter time interval: production and consumption are asynchronous as for the net metering mechanism or synchronous. With that said, the daily consumption of Table 2 is greater than the daily production, therefore the community daily self-consumption is equal to 100% thanks to net metering. If net metering is abandoned and the synchronism between generation and demand is adopted, then the community daily self-consumption is no longer 100% but drops to 21.51% as in the last column of Table 2. This means that the community is able to self-consume only a fifth of its generation on its own; the community exports the remaining four fifths first and imports it again during the same day. The significant gap-from 100% to 21.51%-between self-consumption when calculated via net metering and when via the synchronism between production and consumption is mainly due to the absence of individual or distributed storage systems within the community.

Energetic Analysis: Case1, Smart Charging, Increasing Self Consumption
The smart charging service provided by the aggregator is a valid solution to increase community self-consumption as it increases energy consumption coinciding with energy production. For this purpose, the aggregator constantly monitors the users' power flows with a time resolution equal to 5 s. At 9:21 am, the community generation is 2.94 kW while the community demand is 0.27 kW; the difference is greater than a threshold set to 2.5 kW, that is, the power for charging the batteries at User1 s home. Since the difference stays higher than the threshold for one minute and more, the aggregator asks User1 s smart meter to increase the power imported by the grid. Indeed, in accordance with the procedure described in Section 2 of this paper, the aggregator sets the AS1 variable to "increase_imported_power". Consequently, User1 s smart meter immediately checks for a potential overload. Given that User1's power flow is 0.30 kW, the smart meter concludes that enabling the charge of batteries does not cause any overload, therefore it sets the RS1 variable equal to "Increased-Imported-Power" and enables the Nissan Leaf to charge.
The state of charge of the batteries of the Nissan Leaf is traced in Figure 11 with a black line; the grey line in the background traces the community profile. At 9:21 am, the state of charge is about 12%, and at 9:22 am, it starts to grow up to 14:15 p.m. when it is about 32%; the energy that charged the batteries is 9.37 kWh. During this five hours and half, the state of charge always increases with the exception of short time intervals; at lunchtime, for example, User2, User3 and User4 individually use a large part of their own generation, therefore the community profile drops below the reference threshold and User1 s smart meter stops charging the vehicle batteries.
aggregator asks User1′s smart meter to increase the power imported by the grid. Indeed, in accordance with the procedure described in Section II of this paper, the aggregator sets the AS1 variable to "increase_imported_power". Consequently, User1′s smart meter immediately checks for a potential overload. Given that User1's power flow is 0.30 kW, the smart meter concludes that enabling the charge of batteries does not cause any overload, therefore it sets the RS1 variable equal to "Increased-Imported-Power" and enables the Nissan Leaf to charge. The state of charge of the batteries of the Nissan Leaf is traced in Figure 11 with a black line; the grey line in the background traces the community profile. At 9:21 am, the state of charge is about 12%, and at 9:22 am, it starts to grow up to 14:15 p.m. when it is about 32%; the energy that charged the batteries is 9.37 kWh. During this five hours and half, the state of charge always increases with the exception of short time intervals; at lunchtime, for example, User2, User3 and User4 individually Thanks to the smart charging, the daily synchronous self-consumption increases by 45%, from 21.51% to 66.52%, as reported in Table 2; this laudable result is evidently due to the higher energy consumption (+ 33.88%) due to the charge of batteries during the daytime when the synchronous self-consumption increases by 49%, from 17.29% to 66.47%.

Economic Analysis: Operating as Individuals, Business as Usual
The current Italian policies support the exploitation of renewable sources via net metering mechanics and grants; as a consequence, User2, User3 and User4 receive subsidies, in euros, calculated as the sum of three contributions: where A = min (Production···National_Price; Consumption···Zonal_Price) (5) B = min (Production; Consumption)···Flat_Price (6) C = max (0; Production···National_Price − Consumption···Zonal_price) As an example, let us calculate the subsidy for User3 and for the day of the experimental test only. Addendum A is the minimum of two values, that is, the economic value of the energy exported to the grid and the economic value of the energy imported by the grid. The economic value of the exported energy is calculated with reference to the National_Price, that is, the price of purchasing electricity for the whole country as returned by the Italian electricity exchange. Similarly, the economic value of the imported energy is calculated with reference to the Zonal_Price, that is, the price for selling energy as returned by the electricity market. To perform the calculation, the authors adopted the average values for 2019: National_Price = 52.32/MWh, Zonal_Price = 52.88 EUR/MWh. Given that User3 produced 10.81 kWh and consumed 2.87 kWh (a ratio of about 3.8:1), addendum A is EUR 0.15.
Addendum B is the minimum of the exported energy and the imported energy, multiplied by a flat price, namely Flat_Price. Taking into account a residential customer, connected to the low-voltage network and an annual energy consumption greater than 1800 kWh, the average value of Flat_Price in 2019 was EUR 6317 c/kWh; therefore, addendum B is worth EUR 0.02.
Addendum C is the last contribution to the subsidy and it is different from zero if the economic value of the exported energy is greater than the economic value of the imported energy; the difference between these two economic values is a credit that User3 can apply next year or collect in the same year. So, addendum C is EUR 0.41.
The subsidies for all users are reported in Table 3; the sum of the subsidies is EUR 1.15. User3 receives the highest subsidy because of addendum C since its energy production visibly exceeds its consumption, unlike User2 and User4. In this respect, Figure 12 plots the algebraic sum of the values of a user profile over the day. The black line refers to User3; it is negative and slightly decreases during night-time, it intersects the zero axis only once at about 9:21 am, it goes up and will always remain in the positive quadrant of the figure until midnight when it is about 7.93 kWh. This latter value corresponds to User3 over-generation for the day. The dashed black line refers to User2 and the grey line to User4; both these lines cross the zero axis the first time in the late morning when they stay growing for a couple of hours; then, they decrease almost linearly and cross the zero axis again in the afternoon, staying decreasing until midnight. User2 and User4 account for an under-generation equal to 1.51 kWh and 5.29 kWh, respectively.   In summary, User3 is primarily a producer and receives EUR 0.41 (see addendum C) for the energy exported to the grid during the day. The unit price, paid to User3 for this energy, is 5.17c EUR/kWh, that is, a quarter of the unit price paid by User2 and User4 for the energy they imported from the electricity grid during the same day. This notation introduces the next paragraph where User1, User2, User3 and User4 operate as members of the local community instead of independent individuals.

Economic Analysis: Operating as Local Energy Community, Greater Subsidies
In the previous paragraph, User2, User3 and User4 operate as independent individuals; in this paragraph, they operate as members of a local energy community. Assuming that the current Italian incentive policies cover the local energy communities too, the subsidy that the community would receive is now calculated two times where the first excludes User1 whereas the second includes User1 again.
When User1 is temporally excluded, the subsidy the community receives is EUR 1.20 as reported in Table 3 in the Communityw/outUser1 row. This value is greater (+4.34%) than the sum (EUR 1.15) of the subsidies that User2, User3 and User4 individually receive, therefore it can be concluded that moving from individuals to community led to an advantage, that is, a greater subsidy.
When User1 participates to the community without the electric vehicle (see CommunityCase0 in Table 3) or with the electric vehicle recharged by smart charging (see CommunityCase1 row in Table 3), the subsidy the community receives is EUR 1.20, and it uncages. Therefore, it can be concluded that In summary, User3 is primarily a producer and receives EUR 0.41 (see addendum C) for the energy exported to the grid during the day. The unit price, paid to User3 for this energy, is 5.17c EUR/kWh, that is, a quarter of the unit price paid by User2 and User4 for the energy they imported from the electricity grid during the same day. This notation introduces the next paragraph where User1, User2, User3 and User4 operate as members of the local community instead of independent individuals.

Economic Analysis: Operating as Local Energy Community, Greater Subsidies
In the previous paragraph, User2, User3 and User4 operate as independent individuals; in this paragraph, they operate as members of a local energy community. Assuming that the current Italian incentive policies cover the local energy communities too, the subsidy that the community would receive is now calculated two times where the first excludes User1 whereas the second includes User1 again.
When User1 is temporally excluded, the subsidy the community receives is EUR 1.20 as reported in Table 3 in the Community w/outUser1 row. This value is greater (+4.34%) than the sum (EUR 1.15) of the subsidies that User2, User3 and User4 individually receive, therefore it can be concluded that moving from individuals to community led to an advantage, that is, a greater subsidy.
When User1 participates to the community without the electric vehicle (see Community Case0 in Table 3) or with the electric vehicle recharged by smart charging (see Community Case1 row in Table 3), Energies 2020, 13, 4163 14 of 18 the subsidy the community receives is EUR 1.20, and it uncages. Therefore, it can be concluded that the presence of User1, both with and without the electric vehicle, does not affect the community in terms of subsidies.

Economic Analysis: Operating as Local Energy Community, Lower Bills
The previous paragraph has shown that User1, with or without the electric vehicle, does not reduce the subsidy the community receives thanks to the photovoltaic generators installed on the roofs of User2, User 3 and User4's homes. This paragraph shows that User1, along with the smart charging of the electric vehicle, allows economic benefits to all members of the community. To this end, the last column of Table 3 reports the electricity bills of each user and the community when a fixed purchase price equal to 20 cEUR/kWh is considered.
The difference between the bills for User1 withEV and for User1 w/outEV is the cost that User1 pays for charging the Nissan Leaf: this cost is EUR 1.58. Similarly, the difference between the bills for Community Case1 and for Community Case0 is the cost that the community pays for charging the Nissan Leaf: this cost is just EUR 0.03. Charging the electric vehicle costs nothing if operated at the community level rather than at the individual level; this excellent saving is an economic benefit that User1, User2, User3 and User4 can decide on how to share with each other.

Future Works and Aims
In this paper, smart metering is in conjunction with smart charging to control the power flow from the grid to the electric vehicle, and to adjust the time-start and end-of the charge but not the amperes; the next paper will explore a feasible solution able to control the amperes as well, whereas a future paper will extend to V2G to analyze efforts, costs and benefits of power flow reversing in the framework of a local energy community such as the one considered in the present paper.
In this paper, the effectiveness of smart charging in increasing the self-consumption of the community and the issue of subsidies for generation from renewables are addressed considering one day; the next paper will cover a longer period, i.e., a year.

Conclusions
This paper presented a combination of smart metering and smart charging in order to help local energy communities in increasing self-consumption and achieving economic benefits.
A smart meter for residential applications has been presented in detail, in addition to the communication architecture between the smart meter and the aggregator via a cloud database, including a set of rules for a read/write procedure, useful for sending commands from the aggregator to the smart meter and receiving the respective replies.
Smart charging is a service managed by the aggregator and carried out by the smart meter via the local electric vehicle supply equipment. The aggregator receives measurements from the smart meters within a 5 s time resolution, it calculates the community profile by summing up the community members' profiles and regulates the charging of electric vehicles accordingly.
The paper presented a one-day experimental test on a local community made of four users in Southern Italy: the four users are a consumer with a Nissan Leaf and three prosumers with a photovoltaic generator on the roof. Moreover, two cases were studied, namely Case0 and Case1. Case0 refers to the local community in the absence of the electric vehicle, while Case1 refers to the local community with the electric vehicle and the smart charging service provided by the aggregator.
The results showed the feasibility of the proposed solution and demonstrated the effectiveness of combining smart metering and smart charging to increase the daily synchronous self-consumption of the community.
Without the proposed solution, i.e., the absence of the combination of smart metering and smart charging, the community self-consumes only a fifth of its generation; the community exports the remaining four fifths to the utility grid and imports it again during the last hours of the day. By adopting the proposed solution, the daily synchronous self-consumption increases by 45%.
The paper has shown how the state of charge of Nissan Leaf batteries varies during the experimental test; the state of charge increases for five hours and a half almost incessantly, with the sole exception at lunchtime when, for short time intervals, the prosumers use a large part of their own generation individually. Therefore, since the community profile drops below a reference threshold during lunchtime several times, the aggregator promptly reacts by sending a command to the smart meter, stopping and starting the charging of the vehicle batteries in about ten-twenty seconds.
The issue of subsidies for generation from renewables has also been addressed in the paper. Supposing the current Italian incentive policies for renewables were extended to local energy communities, the subsidy that such a community would receive has been calculated. For the one-day experimental test, this subsidy is about EUR 1.15, 4.34% higher than the sum of subsidies that the three prosumers would receive individually thanks to the net metering mechanism. Worth noting is that the presence of the pure consumer in the community did not affect the calculation of the community subsidy.
Lastly, since the combination of smart metering and smart charging increases the daily synchronous self-consumption of the community by 45%, and that subsidies would increase by 4.34% as well, this work has also evaluated the cost-effectiveness of such a proposed solution. To this end, the electricity bills were calculated with precision thanks to the high temporal resolution provided by the smart meter (i.e., 5 s). As a result, recharging the Nissan Leaf batteries from 12% to 32% costs EUR 1.58 when operated by the owner as an individual, whereas it costs nothing (EUR 0.03) when operated within the community context. This is an excellent economic benefit that community members could share with each other according to their own agreements.