Hi Tane,
Sorry for the delayed response. To explain what is happening, I'll briefly detail some of the processes going on when energy is requested from the battery.
- If the battery is allowed to discharge during the time period in question, an energy balance is performed, considering the PV energy, and electric load. The battery power required to discharge is computed as [P_battery = P_load - P_pv]. So if for instance, the PV array is producing 20 kW, and you have an electric load of 25 kW, the battery should discharge 5 kW.
- But, the way the capacity and voltage model are setup, the battery voltage changes as energy is discharged from the battery, such that at a constant current level, the power from the battery is slightly less or more than requested. Essentially, a constant current discharge occurs over the hour, starting at V1 (voltage 1) and ending at V2( voltage 2). The total power discharged is thus: P = 0.5I*(V1 + V2), which is different from the power requested.
- Grid power is assumed to fill any deficit from the battery, such that in our example about, if the battery was requested to discharge 5 kW, but only discharge 4.99 kW, the grid is assumed to need to discharge 0.01 kW.
This results in the spike you see.
I agree that this is not necessarily desirable behavior. I will work on adding in additional feedback mechanisms that tailor the battery discharge to be exactly the requested amount so these kinds of spikes do not occur. In the meantime, you could simply remove them, provided they are small. If you're modeling an offgrid system, you could set the utility rates equal to 0, such that it doesn't matter if power is purchased from the grid, thus removing any economic anomalies associated with this behavior.
Thanks,
Nick