-
Notifications
You must be signed in to change notification settings - Fork 116
Qcells, Solax active battery control #3360
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+261
−13
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
a0759dc
Qcells active battery control (#3244)
Xoffroad dc69a35
Qcells active battery control (#3306)
Xoffroad 4f3b90e
Qcells active battery control - some fixes (#3314)
Xoffroad 00d593d
fix: align QCells Mode 1 battery control with openWB semantics and ti…
Xoffroad 9aecbdd
fix: switch QCells remote control to Enabled Battery Control (mode 12…
Xoffroad 0a4553d
Implement active battery control via SolaX Remote Control Mode 4 in t…
Xoffroad File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| from types import SimpleNamespace | ||
|
|
||
| from modules.devices.qcells.qcells import bat | ||
| from modules.devices.qcells.qcells.config import QCellsBatSetup | ||
|
|
||
|
|
||
| def _create_qcells_bat() -> bat.QCellsBat: | ||
| return bat.QCellsBat(QCellsBatSetup(), modbus_id=1, client=SimpleNamespace()) | ||
|
|
||
|
|
||
| def test_get_mode4_push_power_stop_is_zero() -> None: | ||
| qcells_bat = _create_qcells_bat() | ||
| assert qcells_bat._get_mode4_push_power(0) == 0 | ||
|
|
||
|
|
||
| def test_get_mode4_push_power_discharge_is_positive() -> None: | ||
| qcells_bat = _create_qcells_bat() | ||
| # openWB discharge limit is negative -> mode4 push power must be positive | ||
| assert qcells_bat._get_mode4_push_power(-700) == 700 | ||
|
|
||
|
|
||
| def test_get_mode4_push_power_charge_is_negative() -> None: | ||
| qcells_bat = _create_qcells_bat() | ||
| # openWB charge limit is positive -> mode4 push power must be negative | ||
| assert qcells_bat._get_mode4_push_power(1000) == -1000 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| from types import SimpleNamespace | ||
|
|
||
| from modules.devices.solax.solax import bat | ||
| from modules.devices.solax.solax.config import Solax, SolaxBatSetup, SolaxConfiguration | ||
| from modules.devices.solax.solax.version import SolaxVersion | ||
|
|
||
|
|
||
| def _create_solax_bat(version: SolaxVersion) -> bat.SolaxBat: | ||
| config = SolaxConfiguration(version=version) | ||
| device_config = Solax(configuration=config) | ||
| return bat.SolaxBat(SolaxBatSetup(), device_config=device_config, client=SimpleNamespace()) | ||
|
|
||
|
|
||
| def test_get_mode4_push_power_stop_is_zero() -> None: | ||
| solax_bat = _create_solax_bat(SolaxVersion.G3) | ||
| assert solax_bat._get_mode4_push_power(0) == 0 | ||
|
|
||
|
|
||
| def test_get_mode4_push_power_discharge_is_positive() -> None: | ||
| solax_bat = _create_solax_bat(SolaxVersion.G3) | ||
| assert solax_bat._get_mode4_push_power(-700) == 700 | ||
|
|
||
|
|
||
| def test_get_mode4_push_power_charge_is_negative() -> None: | ||
| solax_bat = _create_solax_bat(SolaxVersion.G3) | ||
| assert solax_bat._get_mode4_push_power(1000) == -1000 | ||
|
|
||
|
|
||
| def test_power_limit_controllable_true_for_g3() -> None: | ||
| solax_bat = _create_solax_bat(SolaxVersion.G3) | ||
| assert solax_bat.power_limit_controllable() is True | ||
|
|
||
|
|
||
| def test_power_limit_controllable_false_for_g2() -> None: | ||
| solax_bat = _create_solax_bat(SolaxVersion.G2) | ||
| assert solax_bat.power_limit_controllable() is False | ||
|
|
||
|
|
||
| def test_power_limit_controllable_false_for_g4() -> None: | ||
| solax_bat = _create_solax_bat(SolaxVersion.G4) | ||
| assert solax_bat.power_limit_controllable() is False |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nicht unbedingt erforderlich.