## 4 Methodology and Prototype Implementation
### Overall Prototype Concept  
Given the general methodology, now the actual implementation is described independently of the SMGW. Figure 4 shows a schematic overview of the system landscape of the implemented prototype. In our prototype, the EMS uses a heuristic to solve an optimization problem with respect to global incentives in the form of a time-variable electricity tariff, and restrictions received from the aEMP. We decided to consider an EV charging station, since EVs are one major source of flexibility, and are becoming increasingly popular. They are also explicitly named in SS 14a of the German \begin{table}
\begin{tabular}{l l} \hline \hline
**Criteria** & **Description** \\ \hline Successful configuration & Requests for a WAN, HAN and proxy profile are sent to and accepted by the SMGW. The profiles can be extracted from the SMGW. \\ Successful communication & Encrypted channels via TLS, or SOCKSv5 for HKS3, are established according to TR-03109 and messages are sent from EMS to aEMP and vice versa. \\ Successful steering by aEMP & the grid state and the time-variable electricity prices are transmitted by the aEMP \\ Successful control by EMS & using the MQTT protocol and are received by the EMS. A topic change in the message broker is done. \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Criteria determining whether the prototype works as intended. Energy Industry Act (\"Energiewirtschaftsgesetz,\" EnWG) to be considered as consumption devices that can be controlled in a grid-supportive manner. In order to allow the decentralized EMS and the aEMP to communicate with each other, the bidirectional transparent data tunnel provided by the intermediary SMGW is used. Hence, to realize the transmission of the incentives or restrictions, first of all, the communication has to be implemented in a way complying with all the requirements outlined in the previous section. This includes the configuration of the SMGW via the GWA, and the setup of all components in the prototype. Moreover, communication needs to comply with the rules of the SM-PKI. With respect to DSM, we combined two different approaches for the exploitation of flexibility (cf. [34]). Firstly, by implementing quota-based DSM measures, there is no need for generating and communicating a model for flexibility. A quota, in the context of DSM, restricts the maximum consumption (or feed in) to a specified power level (cf. [27; 35]). The exact usable power is derived from the traffic light phase given by the smart grid traffic light concept. Secondly, a dynamic electricity tariff is implemented to allow an indirect exploitation of flexibility. Taking a time-of-use electricity tariff into consideration, the EMS determines an economically optimal charging strategy. Both the exact restriction of consumption and the time-variable electricity prices are provided by the aEMP. The charging strategy is determined, taking into consideration the time period available for charging, the requested energy, and the maximally available charging capacity. Requested energy and the time frame of availability are inputs that can be set by the consumer for each charging session via a web interface. The charging station integrated into the prototype is a KeContact P30 c-series from Keba AG. We implemented the prototype and tested the interactions between all components; i.e., EV, charging station, EMS, SMGW, aEMP, consumer interface, and SMGW administrator. Furthermore, we tested multiple SMGW products from different manufacturers. The GWA software was developed by Robotron Datenbank-Software GmbH, and provided as a service running on their own servers. The EMS and the server of the aEMP are implemented as parts of the prototype presented in this paper. Each of these two systems ran on a dedicated Raspberry Pi 3b+. The prototype has been tested with a Smart EQ fortwo and a Tesla Model 3. To be able to evaluate the prototype with different devices, our prototype setup includes a total of seven SMGWs from five different manufacturers.