Fix grid meter sign: positive reading is export
The assumption meter1_power positive = import was wrong. Evidence from the recorded data: sustained +2kW meter readings at high PV with a full battery in maximize-self-consumption mode (exports, not imports), and a single -2.5kW sample at 17:54 with only 600W PV - a kettle import, physically impossible as an export under the old assumption. house_load was inflated by adding export on top of production, which made PV and consumption look swapped. All derived flow fields follow the single METER_IMPORT_POSITIVE constant; tests now describe the observed kettle/export patterns.
This commit is contained in:
2 files changed
+9
-7
No files matched your search
@@ -86,10 +86,12 @@ storage_mode_map = [
|
|||||||
"Remote Control"
|
"Remote Control"
|
||||||
]
|
]
|
||||||
|
|
||||||
# Observed on the probed system: meter1_power positive = grid import,
|
# Observed on the probed system: meter1_power positive = grid EXPORT
|
||||||
|
# (verified against a full-battery self-consumption system: sustained +2kW
|
||||||
|
# readings at high PV were exports; a kettle appears as a negative spike).
|
||||||
# battery1_power positive = discharge. If day-one graphs disagree, flip here -
|
# battery1_power positive = discharge. If day-one graphs disagree, flip here -
|
||||||
# all derived flow fields (house_load, grid_import, ...) follow.
|
# all derived flow fields (house_load, grid_import, ...) follow.
|
||||||
METER_IMPORT_POSITIVE = True
|
METER_IMPORT_POSITIVE = False
|
||||||
BATTERY_DISCHARGE_POSITIVE = True
|
BATTERY_DISCHARGE_POSITIVE = True
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -210,8 +210,8 @@ class TestSolarData(unittest.TestCase):
|
|||||||
self.assertAlmostEqual(597.0, solarData.data['power_ac'])
|
self.assertAlmostEqual(597.0, solarData.data['power_ac'])
|
||||||
|
|
||||||
def testFlowsImport(self):
|
def testFlowsImport(self):
|
||||||
# probed live values: PV 861.2 W, grid +689.5 (import), battery idle
|
# kettle: PV 861.2 W, grid meter reads -689.5 (import), battery idle
|
||||||
solarData = SolarData(probe_data(power_ac=8612, m1_power=6895, b1_power=0.0))
|
solarData = SolarData(probe_data(power_ac=8612, m1_power=-6895, b1_power=0.0))
|
||||||
|
|
||||||
self.assertAlmostEqual(1550.7, solarData.data['house_load'])
|
self.assertAlmostEqual(1550.7, solarData.data['house_load'])
|
||||||
self.assertAlmostEqual(689.5, solarData.data['grid_import'])
|
self.assertAlmostEqual(689.5, solarData.data['grid_import'])
|
||||||
@@ -220,9 +220,9 @@ class TestSolarData(unittest.TestCase):
|
|||||||
self.assertAlmostEqual(0.0, solarData.data['battery_discharge'])
|
self.assertAlmostEqual(0.0, solarData.data['battery_discharge'])
|
||||||
self.assertAlmostEqual(861.2, solarData.data['solar_to_house'])
|
self.assertAlmostEqual(861.2, solarData.data['solar_to_house'])
|
||||||
|
|
||||||
def testFlowsSurplus(self):
|
def testFlowsExport(self):
|
||||||
# PV 5000, exporting 2000, charging battery with 1000
|
# observed afternoon: PV 5000, exporting 2000, charging battery with 1000
|
||||||
solarData = SolarData(probe_data(power_ac=50000, m1_power=-20000, b1_power=-1000.0))
|
solarData = SolarData(probe_data(power_ac=50000, m1_power=20000, b1_power=-1000.0))
|
||||||
|
|
||||||
self.assertAlmostEqual(2000.0, solarData.data['house_load'])
|
self.assertAlmostEqual(2000.0, solarData.data['house_load'])
|
||||||
self.assertAlmostEqual(0.0, solarData.data['grid_import'])
|
self.assertAlmostEqual(0.0, solarData.data['grid_import'])
|
||||||
|
|||||||
Reference in new issue
Block a user