OpenEVSE / openevse_esp32_firmware

OpenEVSE V4 WiFi gateway using ESP32
155 stars 107 forks source link

Did for current shaper not working under certain circumstances #784

Closed jeremypoulter closed 5 months ago

jeremypoulter commented 6 months ago

fix #762

github-actions[bot] commented 6 months ago

Test Results

36 tests  ±0   36 :white_check_mark: ±0   0s :stopwatch: ±0s  1 suites ±0    0 :zzz: ±0   1 files   ±0    0 :x: ±0 

Results for commit 94ced454. ± Comparison against base commit e09e53ac.

KipK commented 6 months ago

This was there to prevent negative calculation when live_pwr > max_pwr. As in this case, evse should stop anyway.

I'm pretty sure the 73 issue is not caused by this. However I couldn't reproduce it here.

zerodur12 commented 6 months ago

I test the build openevse_wifi_v1 on my EVSE with 8.2.3.T2 firmware. Every thing work well the current regulation work again to target max_pwr (set to 8400W), I also test a change in max_pwr value during the charge (around 20h in the figure below) and the regulation follow the new max_pwr value without problem. @KipK if you need to prevent negative calculation of the max_cur from any value of live_pwr >> max_pwr, it seems better to force the result of current calculation to be greather than 0 than making live_pwr = max_pwr, if live_pwr is saturated to any fix value it is like opening the close loop with no mesure any more of live_pwr (from my point of view) image

graememk commented 6 months ago

Removing that check has allowed my install to load balance as expected.

On the latest release build (5.0.2), The EVSE could sit at full speed and still be a few kW over the set limit.

The negative Value in the max_pwr - live_pwr is key to the operation of the load balancing

max_pwr = 8000, live_pwr = 10000, voltage = 230, getAmps() = 32

_max_cur = ((max_pwr - livepwr) / evse.getVoltage()) + evse.getAmps();

_max_cur = ((8000 - 10000) / 230) + 32 _max_cur = (-2000/230) + 32 _max_cur = (-8.7) + 32 _max_cur = 23.3A

Possibly a check on _max_cur to prevent that from going negative, If the reduction was more than 32 amps _max_cur would go negative. (or rollover?)

Ran a test: It goes negative, Charging stops image

KipK commented 5 months ago

Thanks for the test. The saturation prevention was there just in case negative value could mess-up something. Seeing it works ok, there''s no need to keep it. I have no clue why it fixes your issue btw. But if it does... :)

graememk commented 5 months ago

In an abundance of caution, Should the _max_cur be checked for negatives before being returned, it does work, as is but it could be a precaution. If less than 0, _max_cur =0;