Skip to content

Commit

Permalink
README.md, evse.cpp, glcd.cpp: Modify Maxcircuit (for subpanel config…
Browse files Browse the repository at this point in the history
…) so that enabling Loadbalancing is no longer necessary to have MaxCircuit limit the subpanel current.
  • Loading branch information
dingo35 committed Nov 29, 2022
1 parent c182ef3 commit 8a671c6
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ Feel free to use this repository to build it yourself or to use the latest on fr
| |
[washer breaker 16A] [smartevse breaker 16A]

In this example you configure Mains to 25A, MaxCircuit to 16A; the charger will limit itself so that neither the 25A mains nor the 16A from the subpanel will be exceeded...
In this example you configure Mains to 25A, MaxCircuit to 16A; the charger will limit itself so that neither the 25A mains nor the 16A from the subpanel will be
exceeded...
Note that for this functionality you will need to be in Smart or Solar mode; it is no longer necessary to enable Load Balancing for this function.

* Added wifi-debugging: if compiled in, you can debug SmartEVSE device by telnetting to it over your wifi connection
* Small code optimisations, fixed some small bugs
Expand Down
12 changes: 8 additions & 4 deletions SmartEVSE-3/src/evse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,8 @@ char IsCurrentAvailable(void) {

if (ActiveEVSE > NR_EVSES) ActiveEVSE = NR_EVSES;
// When load balancing is active, and we are the Master, the Circuit option limits the max total current
if (LoadBl == 1) {
// Also, when not in Normal Mode, if MaxCircuit is set, it will limit the total current (subpanel configuration)
if (LoadBl == 1 || (LoadBl == 0 && Mode != MODE_NORMAL && MaxCircuit )) {
if ((ActiveEVSE * (MinCurrent * 10)) > (MaxCircuit * 10) - Baseload_EV) {
return 0; // Not enough current available!, return with error
}
Expand Down Expand Up @@ -789,18 +790,20 @@ void CalcBalancedCurrent(char mod) {
setSolarStopTimer(0);
}
}
// When Load balancing = Master, Limit total current of all EVSEs to MaxCircuit

// When Load balancing = Master, Limit total current of all EVSEs to MaxCircuit
// Also, when not in Normal Mode, if MaxCircuit is set, it will limit the total current (subpanel configuration)
Baseload_EV = Imeasured_EV - TotalCurrent; // Calculate Baseload (load without any active EVSE)
if (Baseload_EV < 0) Baseload_EV = 0;
if (LoadBl == 1 && (IsetBalanced > (MaxCircuit * 10) - Baseload_EV) ) IsetBalanced = MaxCircuit * 10 - Baseload_EV;
if ((LoadBl == 1 || (LoadBl == 0 && Mode != MODE_NORMAL && MaxCircuit)) && (IsetBalanced > (MaxCircuit * 10) - Baseload_EV) ) IsetBalanced = MaxCircuit * 10 - Baseload_EV;


Baseload = Imeasured - TotalCurrent; // Calculate Baseload (load without any active EVSE)
if (Baseload < 0) Baseload = 0;

if (Mode == MODE_NORMAL) // Normal Mode
{
if (LoadBl == 1) IsetBalanced = MaxCircuit * 10 - Baseload_EV; // Load Balancing = Master? MaxCircuit is max current for all active EVSE's
if (LoadBl == 1) IsetBalanced = MaxCircuit * 10 - Baseload_EV; // Load Balancing = Master? MaxCircuit is max current for all active EVSE's; subpanel option not valid in Normal Mode
else IsetBalanced = ChargeCurrent; // No Load Balancing in Normal Mode. Set current to ChargeCurrent (fix: v2.05)
}

Expand Down Expand Up @@ -1332,6 +1335,7 @@ void UpdateCurrentData(void) {


// Load Balancing mode: Smart/Master or Disabled
// not needed for subpanel mode
if (Mode && LoadBl < 2) {
// Calculate dynamic charge current for connected EVSE's
CalcBalancedCurrent(0);
Expand Down
6 changes: 4 additions & 2 deletions SmartEVSE-3/src/glcd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -866,8 +866,10 @@ uint8_t getMenuItems (void) {
if (Mode && (LoadBl < 2 || LoadBl == 1)) { // ? Mode Smart/Solar or LoadBl Master?
MenuItems[m++] = MENU_MIN; // - Minimal current the EV is happy with (A) (Mode:Smart/Solar or LoadBl:Master)
}
if (LoadBl == 1) { // ? Load balancing Master?
MenuItems[m++] = MENU_CIRCUIT; // - Max current of the EVSE circuit (A) (LoadBl:Master)
if (LoadBl == 1 || (LoadBl == 0 && Mode != MODE_NORMAL)) { // ? Load balancing Master?
// Also, when not in Normal Mode, MaxCircuit will limit
// the total current (subpanel configuration)
MenuItems[m++] = MENU_CIRCUIT; // - Max current of the EVSE circuit (A)
}
MenuItems[m++] = MENU_MAX; // Max Charge current (A)
MenuItems[m++] = MENU_SWITCH; // External Switch on SW (0:Disable / 1:Access / 2:Smart-Solar)
Expand Down

0 comments on commit 8a671c6

Please sign in to comment.