Use OpenEMS to manage a simulated microgrid

Another thing I would like to understand is how to implement a two-way communication between the simulator and OpenEMS. As for my understanding, the simulator should produce some values about energy production from its DERs, and send them to OpenEMS via the Modbus server. Then, OpenEMS should use those values, in conjunction with the load information from the consumers (it could be a CSV), to compute setpoints for each DER using some optimization algorithm, and send those setpoints back to the simulator which, eventually, should apply them so that we can see the results. Is this approach correct, and did you do anything similar?

I have done it in a very similar way, as I have integrated a BESS whose behaviour should be controlled by an OpenEMS algorithm. Here I also had a Modbus server, which was described by OpenEMS and an external script. The EMS always wrote my power specification to it and the Python script determined the current power from my model and the specification. In principle, every BESS that is integrated in OpenEMS does this. By simulating the storage system, however, you also have to subtract this power from your grid connection point so that it is correct.

My OpenEMS Component to connect the simulated BESS to OpenEMS is on a public repository, but I haven’t the time to switch it to the official Repo.