Qcells active battery control#3244
Qcells active battery control#3244Xoffroad wants to merge 3 commits intoopenWB:feature_bat_controlfrom
Conversation
|
Neues Feld entfernt und auf die Nutzung von max_charge_power und max_discharge_power umgebaut. |
seaspotter
left a comment
There was a problem hiding this comment.
Mir sei nochmal der Kommentar erlaubt, dass du damit ja im Prinzip jetzt keine zusätzliche Sicherheitsebene einbaust sondern die bereits vorhandene und funktionierende duplizierst und damit ist sie eigentlich unnötig.
Denn schon in der Regelung in ttps://github.com/openWB/core/blob/f3983a443e8f331c1399aeb428f189872185f2ef/packages/control/bat_all.py ist ja sichergestellt das zum einen wenn keine Max Lade-Entladeleistung definiert ist, eine Warnung kommt und zudem das der übergebene power_limit Wert ans Batteriemodul niemals über der Lade- oder der Entladeleistung liegt. Meines Erachtens ist das damit unötig.
In anderen Modulen hat sich zudem power_value etabliert, clamped als Wert ist nicht wirklich sprechend.
| if max_discharge <= 0: | ||
| log.warning("Maximale Entladeleistung ist nicht konfiguriert (0W). " | ||
| "Bitte unter Ladeeinstellungen > Speichersteuerung konfigurieren.") | ||
| clamped = int(min(abs(power_limit), max_discharge)) |
There was a problem hiding this comment.
| clamped = int(min(abs(power_limit), max_discharge)) | |
| power_value = int(power_limit) * -1 |
| if max_discharge <= 0: | ||
| log.warning("Maximale Entladeleistung ist nicht konfiguriert (0W). " | ||
| "Bitte unter Ladeeinstellungen > Speichersteuerung konfigurieren.") |
There was a problem hiding this comment.
| if max_discharge <= 0: | |
| log.warning("Maximale Entladeleistung ist nicht konfiguriert (0W). " | |
| "Bitte unter Ladeeinstellungen > Speichersteuerung konfigurieren.") |
| log.warning("Maximale Entladeleistung ist nicht konfiguriert (0W). " | ||
| "Bitte unter Ladeeinstellungen > Speichersteuerung konfigurieren.") | ||
| clamped = int(min(abs(power_limit), max_discharge)) | ||
| log.debug(f"Aktive Batteriesteuerung. Batterie wird mit {clamped} W entladen") |
There was a problem hiding this comment.
| log.debug(f"Aktive Batteriesteuerung. Batterie wird mit {clamped} W entladen") | |
| log.debug(f"Aktive Batteriesteuerung. Batterie wird mit {power_value} W entladen") |
| if self.last_mode != 'discharge': | ||
| self.last_mode = 'discharge' | ||
| # Solax Mode 8: positiver Push Power Wert = Entladung | ||
| self._write_mode8(push_power=clamped, unit=unit) |
There was a problem hiding this comment.
| self._write_mode8(push_power=clamped, unit=unit) | |
| self._write_mode8(power_value, unit=unit) |
| # Solax Mode 8: positiver Push Power Wert = Entladung | ||
| self._write_mode8(push_power=clamped, unit=unit) | ||
|
|
||
| def _write_mode8(self, push_power: int, unit: int) -> None: |
There was a problem hiding this comment.
| def _write_mode8(self, push_power: int, unit: int) -> None: | |
| def _write_mode8(self, power_value: int, unit: int) -> None: |
| elif power_limit == 0: | ||
| log.debug("Aktive Batteriesteuerung. Batterie wird gestoppt (kein Entladen)") | ||
| if self.last_mode != 'stop': | ||
| self._write_mode8(push_power=0, unit=unit) |
There was a problem hiding this comment.
| self._write_mode8(push_power=0, unit=unit) | |
| self._write_mode8(power_value=0, unit=unit) |
| import logging | ||
| from typing import TypedDict, Any, Optional | ||
|
|
||
| from control import data |
There was a problem hiding this comment.
| from control import data |
| bat_get = data.data.bat_data[f"bat{self.component_config.id}"].data.get | ||
| max_charge = bat_get.max_charge_power | ||
| max_discharge = bat_get.max_discharge_power |
There was a problem hiding this comment.
| bat_get = data.data.bat_data[f"bat{self.component_config.id}"].data.get | |
| max_charge = bat_get.max_charge_power | |
| max_discharge = bat_get.max_discharge_power |
| log.debug(f"QCells set_power_limit: power_limit={power_limit}, " | ||
| f"max_charge={max_charge}W, max_discharge={max_discharge}W, last_mode={self.last_mode}") |
There was a problem hiding this comment.
| log.debug(f"QCells set_power_limit: power_limit={power_limit}, " | |
| f"max_charge={max_charge}W, max_discharge={max_discharge}W, last_mode={self.last_mode}") | |
| log.debug(f"QCells set_power_limit: power_limit={power_limit}, " | |
| f"last_mode={self.last_mode}") |
| log.warning("Maximale Ladeleistung ist nicht konfiguriert (0W). " | ||
| "Bitte unter Ladeeinstellungen > Speichersteuerung konfigurieren.") | ||
| clamped = int(min(power_limit, max_charge)) | ||
| log.debug(f"Aktive Batteriesteuerung. Batterie wird mit {clamped} W geladen") |
There was a problem hiding this comment.
| log.debug(f"Aktive Batteriesteuerung. Batterie wird mit {clamped} W geladen") | |
| log.debug(f"Aktive Batteriesteuerung. Batterie wird mit {power_value} W geladen") |
adding active battery control for qcells and new field for overload security