fix: watts_to_amps round() misto int() — 11 kW = 16 A (ne 15 A / -6%)
11000 W / (3x230) = 15.94 A; int() useklo na 15 A (~10.35 kW), round da spravnych 16 A (~11 kW). Strop 32 A drzi horni mez. 74 control testu zelenych. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -146,9 +146,11 @@ def _deye_reg178_verify_with_double_read(
|
|||||||
|
|
||||||
|
|
||||||
def watts_to_amps(power_w: int | None, phases: int = 3, voltage: int = 230) -> int:
|
def watts_to_amps(power_w: int | None, phases: int = 3, voltage: int = 230) -> int:
|
||||||
|
# round(), NE int(): 11 kW / (3×230) = 15.94 A → int useklo na 15 A (~10.35 kW,
|
||||||
|
# −6 % výkonu); round dá správných 16 A (~11 kW). Strop 32 A drží horní mez.
|
||||||
if not power_w or power_w <= 0:
|
if not power_w or power_w <= 0:
|
||||||
return 0
|
return 0
|
||||||
return min(32, max(0, int(power_w / (phases * voltage))))
|
return min(32, max(0, round(power_w / (phases * voltage))))
|
||||||
|
|
||||||
|
|
||||||
def battery_watts_to_amps(power_w: int, max_amps: int) -> int:
|
def battery_watts_to_amps(power_w: int, max_amps: int) -> int:
|
||||||
|
|||||||
Reference in New Issue
Block a user