I believe you can more or less copy the implementation from “Simulator.EssSymmetric.Reacting” → openems/io.openems.edge.simulator/src/io/openems/edge/simulator/ess/symmetric/reacting/SimulatorEssSymmetricReactingImpl.java at develop · OpenEMS/openems · GitHub
You should not use the data from _sum because this would stop working as soon as you have multiple batteries or ESSs.
Regards,
Stefan