53 lines
1.6 KiB
Python
53 lines
1.6 KiB
Python
"""PASSIVE + nabíjení z PV přebytku při současném exportu → nenulový nabíjecí proud."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import unittest
|
|
|
|
from services.control.setpoints import deye_battery_charge_discharge_amps
|
|
|
|
|
|
class PassivePvSurplusChargeAmpsTests(unittest.TestCase):
|
|
def test_passive_charge_while_exporting_grid_negative(self) -> None:
|
|
ch, dis = deye_battery_charge_discharge_amps(
|
|
lock_battery=False,
|
|
deye_mode="PASSIVE",
|
|
self_sustain_local_use=False,
|
|
bat_w=5000,
|
|
grid_w=-2000,
|
|
max_charge_a=100,
|
|
max_discharge_a=100,
|
|
)
|
|
self.assertGreater(ch, 0)
|
|
self.assertEqual(dis, 0)
|
|
|
|
def test_passive_zero_export_still_zero_charge_when_no_battery_charge(self) -> None:
|
|
ch, dis = deye_battery_charge_discharge_amps(
|
|
lock_battery=False,
|
|
deye_mode="PASSIVE",
|
|
self_sustain_local_use=False,
|
|
bat_w=0,
|
|
grid_w=-2000,
|
|
max_charge_a=100,
|
|
max_discharge_a=100,
|
|
)
|
|
self.assertEqual(ch, 0)
|
|
self.assertEqual(dis, 100)
|
|
|
|
def test_sell_unchanged(self) -> None:
|
|
ch, dis = deye_battery_charge_discharge_amps(
|
|
lock_battery=False,
|
|
deye_mode="SELL",
|
|
self_sustain_local_use=False,
|
|
bat_w=-3000,
|
|
grid_w=-2000,
|
|
max_charge_a=100,
|
|
max_discharge_a=80,
|
|
)
|
|
self.assertEqual(ch, 0)
|
|
self.assertEqual(dis, 80)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|