This circuit simulates a PV Inverter (Controlled current source right) regulated such that no current is put in to the grid (left).
This works independently of the load (switch in the middle).
If the inverter is cutted off (switch right, solar current pumped into ground), the grid will serve the loads.