Skip to content

Commit

Permalink
Feature: use VE.Direct "network total DC power"
Browse files Browse the repository at this point in the history
1. makes the DPL use the power generated by all connected charge
   controllers for calculations based on solar passthrough.
2. makes the network total DC power appear as "MPPT Total Power" in the
   live view at the top.
3. shows the network total DC power in the VE.Direct live data card.
  • Loading branch information
schlimmchen committed Apr 3, 2024
1 parent 6b8c93d commit 21cdc69
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/VictronMppt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,17 @@ int32_t VictronMpptClass::getPowerOutputWatts() const

for (const auto& upController : _controllers) {
if (!upController->isDataValid()) { continue; }

// if any charge controller is part of a VE.Smart network, and if the
// charge controller is connected in a way that allows to send
// requests, we should have the "network total DC input power"
// available. if so, to estimate the output power, we multiply by
// the calculated efficiency of the connected charge controller.
auto networkPower = upController->getData().NetworkTotalDcInputPowerMilliWatts;
if (networkPower.first > 0) {
return static_cast<int32_t>(networkPower.second / 1000.0 * upController->getData().E / 100);
}

sum += upController->getData().P;
}

Expand All @@ -152,6 +163,15 @@ int32_t VictronMpptClass::getPanelPowerWatts() const

for (const auto& upController : _controllers) {
if (!upController->isDataValid()) { continue; }

// if any charge controller is part of a VE.Smart network, and if the
// charge controller is connected in a way that allows to send
// requests, we should have the "network total DC input power" available.
auto networkPower = upController->getData().NetworkTotalDcInputPowerMilliWatts;
if (networkPower.first > 0) {
return static_cast<int32_t>(networkPower.second / 1000.0);
}

sum += upController->getData().PPV;
}

Expand Down
5 changes: 5 additions & 0 deletions src/WebApi_ws_vedirect_live.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,11 @@ void WebApiWsVedirectLiveClass::populateJson(const JsonObject &root, const VeDir
output["E"]["d"] = 1;

const JsonObject &input = values.createNestedObject("input");
if (mpptData.NetworkTotalDcInputPowerMilliWatts.first > 0) {
input["NetworkPower"]["v"] = mpptData.NetworkTotalDcInputPowerMilliWatts.second / 1000.0;
input["NetworkPower"]["u"] = "W";
input["NetworkPower"]["d"] = "0";
}
input["PPV"]["v"] = mpptData.PPV;
input["PPV"]["u"] = "W";
input["PPV"]["d"] = 0;
Expand Down
1 change: 1 addition & 0 deletions webapp/src/locales/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@
},
"section_input": "Eingang (Solarpanele)",
"input": {
"NetworkPower": "VE.Smart Netzwerk Gesamtleistung",
"PPV": "Leistung",
"VPV": "Spannung",
"IPV": "Strom (berechnet)",
Expand Down
1 change: 1 addition & 0 deletions webapp/src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@
},
"section_input": "Input (Solar Panels)",
"input": {
"NetworkPower": "VE.Smart network total power",
"PPV": "Power",
"VPV": "Voltage",
"IPV": "Current (calculated)",
Expand Down
1 change: 1 addition & 0 deletions webapp/src/locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@
},
"section_input": "Input (Solar Panels)",
"input": {
"NetworkPower": "VE.Smart network total power",
"PPV": "Power",
"VPV": "Voltage",
"IPV": "Current (calculated)",
Expand Down

0 comments on commit 21cdc69

Please sign in to comment.