An energy community typically consists of multiple independent residents, each trying to maximise their own benefit. Each resident can own multiple electrical devices, which build a cooperative team. To reflect such a cooperative environment on the individual tenant levels and competing interests among those teams, a decentralized approach is best suited. This way the tenant does not depend on a central player and the decision on whether the BEV shall be charged directly after arrival or with the generated PV remains an individual choice. Furthermore, with full decentralization on the communication layer, the multi agent approach is more resilient and new agents can easily be integrated in the running system. The 2-level system approach is visualised in Fig. 2b.
In the community we define three different available electrical energy sources:
-
Privately owned PV within a team i.e. Internal Photovoltaic Energy (IPV)
-
Public PV or private PV from other teams i.e. External Photovoltaic Energy (EPV)
-
Electricity from the Grid i.e. Grid Energy (GE)
IPV is considered to be virtually free and gets the highest priority of consumption, with EPV coming in second, which has its own cost but is still cheaper than the price for GE.
System state and actions
An agents considers various user inputs such as, departure time, minimum State of Charge (SOC), which acts as an emergency buffer, and target SOC, representing the user expected SOC at the set departure time. Additionally, the user can choose from “Operation mode 1: maximum SOC”, “Operation mode 2: cost optimised” or “Operation mode 3: performance optimised” sections and a discharge enabled flag. The required user input can be given using a mobile app or a touch panel in proximity to the charging point. In case some or all information is missing for the current charging process, historical and default values are taken.
Apart from the user inputs, all agents communicate their energy forecast/plan for each timestep within the planning horizon. Furthermore, the state of the BEV and the Electric vehicle supply equipment (EVSE), containing the information about the current SOC and the current power flow, is communicated. Initially, the maximum battery capacity and the maximum charging and discharging power is communicated when ever an electric vehicle arrives at the charging point. In this context we assume that the EVSE and BEV can communicate the needed information using ISO15118 protocol.
Based on the given input information the algorithm communicates to the EVSE whether to charge, discharge or turn off the charging and how high the power flow shall be. The input state and action space is summarized in Fig. 2a.
Fair energy division
To guarantee a fair division of the available electricity, strict billing rules apply. The billing algorithm is publicly known and stored in a smart contract in an open distributed ledger. Every 15 minutes the contract gets executed and distributes the three energy sources in a fair way (see Fig. 1).
In the first step production and consumption are matched internally. In step two, the production surplus of teams with an excess production (A & B) are summed up forming the EPV. The teams with a consumption surplus (C & D) get equal shares of the excess generation, while the remaining consumption is settled by grid energy (Step 3). Finally, according to the energy flows, grid and PV tokens are distributed (step 4). If after the first distribution of EPV (Step 3) a team is fully satisfied, the remaining excess energy is again distributed between all other non-satisfied teams. This loop continuous until all EPV is distributed or the demand of all teams is covered, in which case the remaining PV energy is fed into the grid. Using this billing strategy it is guaranteed that each team profits equally from the available PV plants.
Since the billing mechanism is publicly known, before going into the decision making, each agent first analyzes the communicated energy demand and production of the competing teams and the agents within its own team to evaluate its share of IPV, EPV and GE for each time step in the planning horizon. Due to its complexity, the algorithmic implementation is not described in here, instead the simple example as visualized in Fig 1 gives an idea of how the agents energy share calculation works.
Decision making
With the knowledge of the expected future energy shares the utilisation of electricity is first optimised at the team level following a cooperative approach, i.e agents decide to change their consumption to accomplish a cheaper overall electricity bill for the team. After the internal team optimisation, on the second level the teams compete over the remaining EPV by readjusting their consumption goals to target a global system optimum. The general control process of a controllable BEV agent is visualised in Fig. 2c.
The decision making algorithm consists of a Moving Horizon Control (MHC) and MPC based control. Depending on the selected charging modes and the current SOC the agent chooses the respective charging algorithm. Until the minimum SOC, full power is utilised to charge with priority. Subsequently the EV is charged according to the selected mode until the target SOC is reached. After the user target is satisfied the operation mode switches to a more economical mode, from SOC to performance and from performance to cost, to only charge with surplus PV energy. These operations are performed in conjunction to discharging, which is enabled separately by the user. The controller is designed to discharge energy only to its internal team members provided that its target SOC can still be met by future PV energy before the departure time.
Mathematical model BEV
The electrical model of the electric vehicle is determined as per equation.
$$ x^{t+1} \equiv x^{t}+ \frac{\Delta t \cdot P^{t} \cdot \eta}{E_{tot}} \quad \forall t \in T $$
(1)
with xt being the battery SOC of the BEV at timestep t of the overall forecast horizon T. Etot is the maximum capacity of the battery, Pt is the current power and η represents the charging efficiency.
$$ E^{t+1}_{dem} = E^{t}_{dem} - P^{t} \cdot \Delta t $$
(2)
where \(E^{t}_{dem}\) represent the amount of energy still required to achieve the next SOC milestone (Minimum, target or full SOC). The BEV mathematical model is subjected to the hard constraints for power limits of the EVSE and the battery capacity as mentioned in (3):
$$ P^{min} \leq |P_{t}| \leq P^{max} \quad \land \quad 0 \leq x^{t} \leq 1 \quad \forall t \in T $$
(3)
Operation mode 1: maximum SOC
The SOC optimised mode can be imagined to be close to uncontrolled charging i.e. the EV charges with maximum power. This mode is used when the user does not want to participate in the program and when the EV battery SOC is below the minimum SOC
The objective function in SOC optimised mode is given by:
$$\begin{array}{@{}rcl@{}} \begin{aligned} &\hspace{50pt} \underset{\left\{x^{t}, P^{t}\right\}_{t \in T}}{\text{minimize}} \quad \sum_{t} -x^{t} \in T \\ &\text{subject to:} \quad x_{0} = x_{\text{init}} \quad (\text{\ref{2eq:evmodel}}), (\text{\ref{3eq:energychange}}), (\text{\ref{eq:constraints}}) \end{aligned} \end{array} $$
(4)
For the maximum SOC control (1) and (2) are repeated in a loop until the energy demand is zero or the target SOC is reached.
$$ \left(E^{t}_{dem} \neq 0 \lor x^{t} \neq X\right) \to P^{t} = P^{max} $$
(5)
where Pmax is the maximum power limit of the EVSE and X is the next milestone SOC. The objective of max SOC is only fulfilled if there is no discharging and hence no discharging takes place in this mode.
Operation mode 2: cost optimised
Cost optimised mode uses IPV as much as possible and only moves to other sources if IPV is not sufficient. Since this mode differentiates between IPV and EPV, it is relevant for users with personal PV rooftop solar plants. The objective function in this mode is given by:
$$ \begin{aligned} &\hspace{30pt} \underset{\left\{x^{t}, P^{t}\right\}_{t \in T}} {\text{minimize}} \quad \sum_{t,Q} E^{t}_{Q} \cdot cost^{t}_{Q} \in T \\ &\text{subject to:} \quad x_{0} = x_{\text{init}} \quad (1), (2), (3) \end{aligned} $$
(6)
Q in (6) represents the forecast data of each electrical power source which in this case is given by (7). The cost factor in (6) represents the priority of energy source in terms of their cost.
$$ Q = {\{Internal\;{PV}, \; External\;{PV}, \; Grid\;Power}\} $$
(7)
The BEV agent is designed to only utilise the power according to the fixed cost optimal priority. Hence the controller first distributes the Internal PV throughout the control horizon according to the availability in corresponding time-steps. Equations 1 and (2) are repeated in a loop until \(E^{t}_{dem}\) is fulfilled.
$$ \left(E^{t}_{dem} \neq 0 \lor x^{t} \neq X\right) \to P^{t} = P^{t}_{{IPV}} $$
(8)
If \(E^{t}_{dem}\) is not fulfilled by just Internal PV, the controller distributes the External PV energy on top of the already distributed IPV to fulfil the remaining demand.
$$ \left(E^{t}_{dem} \neq 0 \lor x^{t} \neq X\right) \to P^{t} = P^{t}_{{IPV}} + P^{t}_{{EPV}} $$
(9)
If even after (9) the \(E^{t}_{dem}\) is still not met, then the grid energy distribution is calculated using (10) and (11).
$$ E^{t, left}_{dem} = E^{t}_{dem} - E^{t, in}_{dem} - E^{t, ex}_{dem} $$
(10)
\(E^{t, left}_{dem}\) is the total energy that the controller still needs to fulfil the total demand of energy from BEV. Since a BEV can be parked way longer than the control horizon, the controller delays the grid energy utilisation towards the end of BEV departure. Therefore it uses (11) to calculate the grid energy it needs to utilise in the current control step.
$$ E^{t}_{grid} = E^{t, left}_{dem} -\left(T^{depart} - T^{control}_{last}\right) \cdot P^{max} $$
(11)
where \(T^{control}_{last}\) is the last timestamp of the control horizon. Grid energy, being an expensive but unlimited resource, is distributed from the other end of the control horizon. Eq. 12 is repeated in a reverse loop until the overall demand is met.
$$ \left(E^{t}_{dem} \neq 0 \lor x^{t} \neq X \lor |E^{t}_{grid}| \ne 0\right) \to P^{t} = P^{max} $$
(12)
Operation mode 3: performance optimised
In the performance optimised mode the agent tries to keep the battery SOC at maximum level at all times while keeping the cost to the minimum. Therefore it operates in between the Cost and SOC optimised modes. The objective function in this mode is the same as given in (6) for the Cost optimised mode but the controller achieves better performance by strategically modifying the input values. It uses the Total Photovoltaic Energy (TPV) instead of differentiating between IPV and EPV. Since equations and the decision making procedure for the performance optimised mode are almost the same as in the cost optimised version, they are not repeated in this section, but instead the modifications are mentioned in brief. Replacing Internal PV and External PV by Total PV in (7) the forecast data is modified. Eq. 8 is not needed anymore, instead in Eq. 9\(P^{t}_{IPV}\) + \(P^{t}_{EPV}\) is replaced by \(P^{t}_{TPV}\). In Eq. 10\(E^{t, in}_{dem}\) - \(E^{t, ex}_{dem}\) are replaced by \(E^{t, total}_{dem}\) while Eqs. 11 und 12 remain unchanged.