## 3 Results  
Results of an exemplary optimisation are shown in Figure 6, where PV, load, and grid supply price scenarios are plotted, as well as planned BESS and EV power, the resulting SOCs, and the resulting grid residual power. This exemplary optimisation was carried out in a system that had been assembled as described above. The summary power of the storage units (EVs and BESSs) is plausible and scheduled as expected. Charging is scheduled when prices are low (e.g., EV-charging from the grid in the hours 37-40) or when excess PV energy is available (e.g., EV-charging from PV in the hours 11-17). Discharging is scheduled when prices are high (e.g., in the hours 6-9 and 19-25). However, the allocation of the total power to the individual storage units seems erratic as it shows randomly appearing on-off behaviour. This is especially visible during the discharging of the BESSs in the hours 19-26 and 43-48. The summarised BESS power during these hours is equal to the power demand of the load, while the two units are alternately operated at their maximum discharge power. The erratic behaviour is also visible during charging of the EVs. The summary power follows the PV scenario power after hour 11, while the allocation to the units is random. This solution of the optimal control problem is indeed erratic since multiple optimal solutions exist, which is a common characteristic of LPs. Multiple optimal solutions can occur when a hyperplane of the constraint polytope is perpendicular to the cost vector. Translated to the application, two sources for the occurrence of multiple optimal solutions were identified. First, for the economic optimisation under the given cost function, it does not matter _which_ storage unit is charged or discharged, as long as the summary power is scheduled optimally, SOC limits of the EVs and BESSs are considered, and the threshold SOCs of the EVs are reached. There is no mechanism in the cost function that governs the allocation of charging or discharging among the units. Figure 5: Flow chart of the scalable MPC implementation on PLC and EC. Initial configuration steps by the commissioning staff are highlighted green. Cyclic behaviour of the control components is highlighted blue. Dashed lines mark field-bus communication. Figure 6: Results of an exemplary optimisation. The number of modular components (PVs, BESSs, and EVs) is two per category. The predicted PV power of the two plants is depicted in (**a**,**b**). Subplot (**c**) shows the predicted power demand \(P_{l}\). The charging power (blue) and discharging power (orange) of the two BESSs are shown in subplot (**d**,**e**). Subplot (**f**) shows the summary charging power (blue) and discharging power (orange) of both BESSs. The resulting SOC is shown in (**g**,**h**). The grid supply price is plotted in (**i**). The background of all subplots is color-coded with the grid supply price (**i**), green meaning low prices, and red meaning high prices. The charging power (solid line) and availability (dashed line) of the EVs are plotted in (**j**,**k**). Subplot (**l**) shows the summary charging power of the EVs. The resulting SOCs are shown in (**m**,**n**). Finally, the grid residual power (supply: blue, feed-in: orange) is shown in subplot (**o**). Secondly, when excess renewable power is available during a longer time period, it does not matter _when_ the storage units are charged, because no grid power supply is used during these times, and dynamic supply prices, therefore, have no influence (the feed-in tariff is static). This becomes especially clear, when surplus renewable energy is fed into the grid in the hours 9-13, but the EVs are not charged yet. The computation time for the two main software modules in the EC (i.e., assembler and solver) was measured for energy systems containing one device per class up to six devices per class (a total number of 3-18 modular devices). The computation time of both software modules scales linearly with additional energy system components.