I'm trying to understand the Simulink example "Simplified Model of a Small Scale Micro-Grid" in order to build something similar. If it's included in your Simulink version you can access it by writing
power_microgrid in Matlab.
I get how they simulate the behaviour of the solar panels and the battery using a controlled current source, but my problem comes with the simulation of the houses.
The circuit is very similar to the one inside the battery and panels. I understand that this way they can change the power dissipated inside the resistor and simulate the loads of the house, but isn't the current source introducing "free" energy into the system, that can flow into the battery and charge it, or modify the voltage of the system?