# LoRa Enabled Smart Inverters for Microgrid Scenarios with Widespread Elements
## 5 LoRa Enabled Smart Inverters
### Experimental Testbed  
To experimentally evaluate the aforementioned implementation, a Danfoss 2.2 kW inverter was utilized. This inverter was included in a four inverter setup in which all of them are controlled by a dSPACE (DS1006) real-time platform. On the DC side, the inverter was connected to a programmable/bidirectional DC source (REGATRON) and on the AC side it was connected to the stiff-grid through a safety transformer. A photo of the power system part of the experimental setup highlighting the different elements is provided in Figure 9. The experiments were conducted in CROM AC-MG laboratory in Aalborg university [77]. The inverter type is grid-feeding [78], and the control algorithm has been uploaded to the dSPACE platform. The details of the control structure is illustrated in Figure 10. The aim is to prove the inverter is able to receive remotely generated power references and regulate its power levels accordingly. In this sense, power references were transmitted to the inverter by a personal computer, and subsequently, measurements were sent back and recorded. By comparing these two trends, the capability of the inverters to follow the power references that are relayed through the communication system was presented. Figure 9: Photo of the experimental setup. An illustration of the LoRa based communication system that is designed to fulfill the aforementioned goal has been prepared in Figure 11. Here, the role and specifications of the devices are listed as follows:  
Inverter and controller, which consisted of a Danfoss 2.2 kW bidirectional power converter and a dSPACE (DS1006) real-time control platform. A grid-feeding algorithm, prepared in Matlab/Simulink, was uploaded to the dSPACE unit to control the inverter. This class of inverters can regulate their output active and reactive power measurements by receiving external references, and an in-detail explanation of the control schema is out of the scope of this research [78]. This configuration can emulate a DG, load, or an ESS. LoRa Node A. This node that was created by coding a Pycom/Lopy4 micropython enabled microcontroller was connected to the dSPACE unit by serial communication. This was achieved by using a MAX3232 adapter to convert the microcontroller UART logical signals to RS232 protocol levels. The details of this integration are illustrated in Figure 12. The duty of this device was to receive power references, remotely generated, by LoRa and transmit them to the inverter. Besides, it was responsible for transmitting the inverters power measurements by LoRa to the other receiving end. In order to establish meaningful interconnection between this microcontroller and the aforementioned dSPACE unit, data conversion is required. In this case, the inverter power measurements were converted from their 32-bit float representations to an array of four Hex bytes to be able to be transmitted through the serial channel. Figure 11: LoRaWAN enabled smart inverter experimental testbed configuration. Figure 10: The control structure of grid-feeding inverter. These converted bytes are arranged and transmitted using the little-endian ordering. Needless to say, opposite conversions are required when references are relayed from the microcontroller to the dSPACE unit and subsequently the inverter control structure. Examples of the explained data conversion scheme are presented in Figure 13.  
Based on the explanations provided above, the microcontroller is acting as both a LoRa transceiver and a UART device. The configurations are listed in Table 3. It should be noted that, since several tests are conducted for different SFs and transmission powers, their values are not included in Table 3.
3. LoRa Node B. This node was also created on a Pycom/Lopy device. It was coded to receive power references from a Matlab based profile generator by message queuing telemetry transport (MQTT) protocol, extract the payload, perform data conversion as illustrated in Figure 13, create LoRa frames, and transmit them to node A by LoRa.