# HackuLoop - An open-science project to create open-source real-time Hardware-In-The-Loop micro-grid systems

Luiz Fernando Lavado Villa, Amalie Alchami, Arnaud Gaillard, Pierre Haessig, Mathieu Rossi, Jean Alinei, Clément Foucher

► To cite this version:

Luiz Fernando Lavado Villa, Amalie Alchami, Arnaud Gaillard, Pierre Haessig, Mathieu Rossi, et al.. HackuLoop - An open-science project to create open-source real-time Hardware-In-The-Loop micro-grid systems. Symposium de Genie Electrique, Jun 2025, Toulouse, France. hal-05222887

HAL Id: hal-05222887

https://laas.hal.science/hal-05222887v1

Submitted on 25 Aug 2025

HAL is a multi-disciplinary open access
archive for the deposit and dissemination of sci-
entific research documents, whether they are pub-
lished or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.

L'archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diffusion de documents
scientifiques de niveau recherche, publiés ou non,
émanant des établissements d'enseignement et de
recherche français ou étrangers, des laboratoires
publics ou privés.

<figure><img src="image_1.png" /></figure>

Distributed under a Creative Commons Attribution 4.0 International License
# HackuLoop - An open-science project to create open-source real-time Hardware-In-The-Loop micro-grid systems

Luiz VILLA, Amalie ALCHAMI, Arnaud Gaillard, Pierre Haessig, Mathieu Rossi, Jean Alinei, Clement Foucher
Université de Toulouse, LAAS-CNRS, Université de Technologie de Compiègne, Université de Technologie de Belfort-Montbéliard
FEMTO-ST, CentraleSupélec, IETR, Université d'Artois, LSEE, OwnTech Technologies

## ABSTRACT

This article documents the results of a hackathon focused on developing grid-forming and grid-following inverters. The event highlighted innovation and collaboration in the field of power electronics. This document provides an overview of the objectives, methodologies, and outcomes of the hackathon, along with lessons learned and future directions.

***Mots-clés – Power converters, Hackathons, reproducible science.***

## 1. INTRODUCTION

Real-time systems are crucial for testing and operating micro-grids effectively, as they enable accurate simulation and control of complex power dynamics. However, many available systems function as black boxes, presenting significant challenges when fine-tuning them for specific experimental setups. This limitation often hinders research progress and adaptability to new scenarios.

In response to this challenge, the HackuLoop project was initiated during a hackathon held at the JCGE conference in 2024. The project's primary aim is to provide modular building blocks for creating customizable and open-source simulation environments tailored to micro-grid applications. These blocks aim to bridge the gap between rigid proprietary solutions and the dynamic needs of research and experimentation.

This paper focuses on the development and implementation of the first building block: a single-phase inverter control system utilizing a SOGI (Second Order Generalized Integrator) [1] filter and d-q frame transformation with Park control. The system supports both grid-forming [2] and grid-following modes [3]. From this implementation, other micro-grid blocks will be built in the course of the project.

## 2. GRID-FORMING AND GRID-FOLLOWING CONTROL STRUCTURES

The control structure for grid-forming and grid-following inverters implemented in this project are shown in figures 1 and 2.

In contrast, the grid-following inverter incorporates a PID-based PLL (Phase Locked Loop) that locks onto the $V_q$ component of the SOGI and Park-transformed signal. This allows the system to synchronize seamlessly with the external grid. Figure 2 depicts the control block diagram for this setup.

They are composed of:

* SOGI[1] (Second Order Generalized Integrator) blocks: These processes the single-phase sine wave input to generate an $\alpha - \beta$ representation.

* PARK block: transforms the $\alpha - \beta$ into a d-q frame using a classic Park transformation, allowing control in the d-q domain.

<figure><img src="image_2.png" /><figcaption>Figure 1. Control structure for grid-forming inverter (based on [2]).</figcaption></figure>

<figure><img src="image_3.png" /><figcaption>Figure 2. Control structure for grid-following inverter (based on [3]).</figcaption></figure>

* CLARK block: transforms the system back to $\alpha - \beta$, where the $\alpha$ signal is utilized to generate the duty cycle for the inverter.

* PID block: a generic PID controller that can be spawned and calibrated to the specific part of the control loop.

The grid-forming inverter control structure employs a straightforward d-q control loop without additional synchronization components. The grid-following inverter control structure uses the $V_q$ resulting from the SOGI + PARK transform to trigger a PLL via the PID to synchronize with the grid forming inverter.

## 3. IMPLEMENTATION

The implementation of the system was done during the first hackathon of the series, taking place in Toulouse. The team used two TWIST boards [4] from the OwnTech Foundation to fast prototype a micro-grid.

The wiring diagram of the two boards is shown in figure 3 and the equivalent circuit is shown in figure 4.
<figure><img src="image_4.png" /><figcaption>Figure 3. Wiring diagram showcasing connections for each leg.</figcaption></figure>

<figure><img src="image_5.png" /><figcaption>Figure 4. Circuit diagram with both inverters connected to the same load.</figcaption></figure>

The calibration of the PIDs was done using the method in [5]. The current loop was first implemented, followed by the voltage loop. The parameters were first defined based on the size of the resistor (10Ω) for the grid forming inverter. It was then updated to the grid following inverter.

## 4. RESULTS

The grid forming converter is able to create a sinusoidal voltage on the output as shown in figure 5. However, this voltage has an important third and fifth harmonic content, which can be improved in future implementations.

<figure><img src="image_6.png" /><figcaption>Figure 5. View of the current measurement of the grid forming board.</figcaption></figure>

The grid following converter is able to synchronize and connect with the grid forming converter. However, it introduces a great amount of circulating currents, as seen by the harmonic content of the current measurements in both boards. The sum of the currents viewed by the output load is sinusoidal with a smaller harmonic content as seen in figure 5.

There was a point of operation that minimized this circulating currents, as seen in figure 7.

## 5. CONCLUSION

This paper shows how Hackathons can be a tool for creating reproducible hardware implementations that can drive

<figure><img src="image_7.png" /><figcaption>Figure 6. View of the current measurement of the grid forming (red) and following boards (green).</figcaption></figure>

<figure><img src="image_8.png" /><figcaption>Figure 7. The current from both boards with one point of operation that minimizes circulating currents.</figcaption></figure>

collaboration and research among scientific peers. In this work, the grid-forming and grid-following building block of a series of Hackathons on micro-grids was presented, with its main structure and results. The final paper will include a more thorough discussion on the impact of the points of operation on the circulating currents and share the online repository with all the source code of this implementation.

## 6. REFERENCES

[1] Yepes, Alejandro. (2011). Digital Resonant Current Controllers for Voltage Source Converters.

[2] H. Zhang, W. Xiang, W. Lin and J. Wen, "Grid Forming Converters in Renewable Energy Sources Dominated Power Grid: Control Strategy, Stability, Application, and Challenges," in Journal of Modern Power Systems and Clean Energy, Nov. 2021.

[3] https://imperix.com/doc/implementation/grid-following-inverter - accessed 11/02/2025

[4] https://github.com/owntech-foundation/TWIST - accessed 11/02/2025

[5] Skogestad, S., 2001, November. Probably the best simple PID tuning rules in the world. In AIChE Annual Meeting, Reno, Nevada (Vol. 77, p. 276h). Citeseer.