-
Notifications
You must be signed in to change notification settings - Fork 6
DDBC skeleton class implementation #69
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
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
e2ece00
Add DDBC actuator and operation mode classes
VladIftime a13c177
Add DDBC operation mode and actuator status classes
VladIftime e1339c4
Add additional DDBC classes to the initialization module
VladIftime 0d98dc7
Refactor DDBC classes for improved readability and consistency
VladIftime 8d5be28
Refactor gen_s2.py and fix cyclic import
VladIftime 65f06e3
Added the controll type to s2_control_type wrapper
VladIftime 2e62f42
Merge branch 'Dev-VladIftime-Kiflin-DDBC' of github.com:flexiblepower…
VladIftime e9bd703
Merge branch 'main' into Dev-VladIftime-Kiflin-DDBC
VladIftime 4a597bb
Fixed the new type of S2Message as union
VladIftime 9a16d74
Fixed lines too long
VladIftime 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| from s2python.ddbc.ddbc_actuator_description import DDBCActuatorDescription | ||
| from s2python.ddbc.ddbc_operation_mode import DDBCOperationMode | ||
| from s2python.ddbc.ddbc_instruction import DDBCInstruction | ||
| from s2python.ddbc.ddbc_actuator_status import DDBCActuatorStatus | ||
| from s2python.ddbc.ddbc_average_demand_rate_forecast_element import ( | ||
| DDBCAverageDemandRateForecastElement, | ||
| ) | ||
| from s2python.ddbc.ddbc_average_demand_rate_forecast import ( | ||
| DDBCAverageDemandRateForecast, | ||
| ) | ||
| from s2python.ddbc.ddbc_system_description import DDBCSystemDescription | ||
| from s2python.ddbc.ddbc_timer_status import DDBCTimerStatus |
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,30 @@ | ||
| from typing import List | ||
| import uuid | ||
|
|
||
| from s2python.generated.gen_s2 import ( | ||
| DDBCActuatorDescription as GenDDBCActuatorDescription, | ||
| ) | ||
| from s2python.generated.gen_s2 import Commodity | ||
| from s2python.ddbc.ddbc_operation_mode import DDBCOperationMode | ||
|
|
||
| from s2python.common.timer import Timer | ||
|
|
||
| from s2python.validate_values_mixin import ( | ||
| catch_and_convert_exceptions, | ||
| S2MessageComponent, | ||
| ) | ||
|
|
||
|
|
||
| @catch_and_convert_exceptions | ||
| class DDBCActuatorDescription(GenDDBCActuatorDescription, S2MessageComponent["DDBCActuatorDescription"]): | ||
| model_config = GenDDBCActuatorDescription.model_config | ||
| model_config["validate_assignment"] = True | ||
|
|
||
| id: uuid.UUID = GenDDBCActuatorDescription.model_fields["id"] # type: ignore[assignment] | ||
| supported_commodites: List[Commodity] = GenDDBCActuatorDescription.model_fields[ | ||
| "supported_commodites" | ||
| ] # type: ignore[assignment] | ||
| timers: List[Timer] = GenDDBCActuatorDescription.model_fields["timers"] # type: ignore[assignment] | ||
| operation_modes: List[DDBCOperationMode] = GenDDBCActuatorDescription.model_fields[ | ||
| "operation_modes" | ||
| ] # type: ignore[assignment] |
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,22 @@ | ||
| import uuid | ||
|
|
||
| from s2python.generated.gen_s2 import DDBCActuatorStatus as GenDDBCActuatorStatus | ||
| from s2python.validate_values_mixin import ( | ||
| catch_and_convert_exceptions, | ||
| S2MessageComponent, | ||
| ) | ||
|
|
||
|
|
||
| @catch_and_convert_exceptions | ||
| class DDBCActuatorStatus(GenDDBCActuatorStatus, S2MessageComponent["DDBCActuatorStatus"]): | ||
| model_config = GenDDBCActuatorStatus.model_config | ||
| model_config["validate_assignment"] = True | ||
|
|
||
| message_id: uuid.UUID = GenDDBCActuatorStatus.model_fields["message_id"] # type: ignore[assignment] | ||
| actuator_id: uuid.UUID = GenDDBCActuatorStatus.model_fields["actuator_id"] # type: ignore[assignment] | ||
| active_operation_mode_id: uuid.UUID = GenDDBCActuatorStatus.model_fields[ | ||
| "active_operation_mode_id" | ||
| ] # type: ignore[assignment] | ||
| operation_mode_factor: float = GenDDBCActuatorStatus.model_fields[ | ||
| "operation_mode_factor" | ||
| ] # type: ignore[assignment] |
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,30 @@ | ||
| from typing import List | ||
| import uuid | ||
|
|
||
| from s2python.generated.gen_s2 import ( | ||
| DDBCAverageDemandRateForecast as GenDDBCAverageDemandRateForecast, | ||
| ) | ||
| from s2python.ddbc.ddbc_average_demand_rate_forecast_element import ( | ||
| DDBCAverageDemandRateForecastElement, | ||
| ) | ||
|
|
||
| from s2python.validate_values_mixin import ( | ||
| catch_and_convert_exceptions, | ||
| S2MessageComponent, | ||
| ) | ||
|
|
||
|
|
||
| @catch_and_convert_exceptions | ||
| class DDBCAverageDemandRateForecast( | ||
| GenDDBCAverageDemandRateForecast, | ||
| S2MessageComponent["DDBCAverageDemandRateForecast"], | ||
| ): | ||
| model_config = GenDDBCAverageDemandRateForecast.model_config | ||
| model_config["validate_assignment"] = True | ||
|
|
||
| message_id: uuid.UUID = GenDDBCAverageDemandRateForecast.model_fields["message_id"] # type: ignore[assignment] | ||
| elements: List[ | ||
| DDBCAverageDemandRateForecastElement | ||
| ] = GenDDBCAverageDemandRateForecast.model_fields[ | ||
| "elements" | ||
| ] # type: ignore[assignment] |
21 changes: 21 additions & 0 deletions
21
src/s2python/ddbc/ddbc_average_demand_rate_forecast_element.py
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,21 @@ | ||
| from s2python.generated.gen_s2 import Duration | ||
|
|
||
| from s2python.generated.gen_s2 import ( | ||
| DDBCAverageDemandRateForecastElement as GenDDBCAverageDemandRateForecastElement, | ||
| ) | ||
|
|
||
| from s2python.validate_values_mixin import catch_and_convert_exceptions, S2MessageComponent | ||
|
|
||
|
|
||
| @catch_and_convert_exceptions | ||
| class DDBCAverageDemandRateForecastElement( | ||
| GenDDBCAverageDemandRateForecastElement, | ||
| S2MessageComponent["DDBCAverageDemandRateForecastElement"], | ||
| ): | ||
| model_config = GenDDBCAverageDemandRateForecastElement.model_config | ||
| model_config["validate_assignment"] = True | ||
|
|
||
| duration: Duration = GenDDBCAverageDemandRateForecastElement.model_fields["duration"] # type: ignore[assignment] | ||
| demand_rate_expected: float = GenDDBCAverageDemandRateForecastElement.model_fields[ | ||
| "demand_rate_expected" | ||
| ] # type: ignore[assignment] |
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,19 @@ | ||
| import uuid | ||
|
|
||
| from s2python.generated.gen_s2 import DDBCInstruction as GenDDBCInstruction | ||
| from s2python.validate_values_mixin import ( | ||
| catch_and_convert_exceptions, | ||
| S2MessageComponent, | ||
| ) | ||
|
|
||
|
|
||
| @catch_and_convert_exceptions | ||
| class DDBCInstruction(GenDDBCInstruction, S2MessageComponent["DDBCInstruction"]): | ||
| model_config = GenDDBCInstruction.model_config | ||
| model_config["validate_assignment"] = True | ||
|
|
||
| message_id: uuid.UUID = GenDDBCInstruction.model_fields["message_id"] # type: ignore[assignment] | ||
| actuator_id: uuid.UUID = GenDDBCInstruction.model_fields["actuator_id"] # type: ignore[assignment] | ||
| operation_mode_id: uuid.UUID = GenDDBCInstruction.model_fields["operation_mode_id"] # type: ignore[assignment] | ||
| operation_mode_factor: float = GenDDBCInstruction.model_fields["operation_mode_factor"] # type: ignore[assignment] | ||
| abnormal_condition: bool = GenDDBCInstruction.model_fields["abnormal_condition"] # type: ignore[assignment] |
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,26 @@ | ||
| from typing import List | ||
| import uuid | ||
|
|
||
| from s2python.generated.gen_s2 import DDBCOperationMode as GenDDBCOperationMode | ||
|
|
||
| from s2python.common.power_range import PowerRange | ||
| from s2python.common.number_range import NumberRange | ||
|
|
||
| from s2python.validate_values_mixin import ( | ||
| catch_and_convert_exceptions, | ||
| S2MessageComponent, | ||
| ) | ||
|
|
||
|
|
||
| @catch_and_convert_exceptions | ||
| class DDBCOperationMode(GenDDBCOperationMode, S2MessageComponent["DDBCOperationMode"]): | ||
| model_config = GenDDBCOperationMode.model_config | ||
| model_config["validate_assignment"] = True | ||
|
|
||
| # ? Id vs id | ||
| id: uuid.UUID = GenDDBCOperationMode.model_fields["Id"] # type: ignore[assignment] | ||
| power_ranges: List[PowerRange] = GenDDBCOperationMode.model_fields["power_ranges"] # type: ignore[assignment] | ||
| supply_ranges: List[NumberRange] = GenDDBCOperationMode.model_fields["supply_ranges"] # type: ignore[assignment] | ||
| abnormal_condition_only: bool = GenDDBCOperationMode.model_fields[ | ||
| "abnormal_condition_only" | ||
| ] # type: ignore[assignment] | ||
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,29 @@ | ||
| from typing import List | ||
| import uuid | ||
|
|
||
| from s2python.generated.gen_s2 import ( | ||
| DDBCSystemDescription as GenDDBCSystemDescription, | ||
| ) | ||
| from s2python.common.number_range import NumberRange | ||
| from s2python.ddbc.ddbc_actuator_description import DDBCActuatorDescription | ||
| from s2python.validate_values_mixin import ( | ||
| catch_and_convert_exceptions, | ||
| S2MessageComponent, | ||
| ) | ||
|
|
||
|
|
||
| @catch_and_convert_exceptions | ||
| class DDBCSystemDescription(GenDDBCSystemDescription, S2MessageComponent["DDBCSystemDescription"]): | ||
| model_config = GenDDBCSystemDescription.model_config | ||
| model_config["validate_assignment"] = True | ||
|
|
||
| message_id: uuid.UUID = GenDDBCSystemDescription.model_fields["message_id"] # type: ignore[assignment] | ||
| actuators: List[DDBCActuatorDescription] = GenDDBCSystemDescription.model_fields[ | ||
| "actuators" | ||
| ] # type: ignore[assignment] | ||
| present_demand_rate: NumberRange = GenDDBCSystemDescription.model_fields[ | ||
| "present_demand_rate" | ||
| ] # type: ignore[assignment] | ||
| provides_average_demand_rate_forecast: bool = GenDDBCSystemDescription.model_fields[ | ||
| "provides_average_demand_rate_forecast" | ||
| ] # type: ignore[assignment] |
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,18 @@ | ||
| import uuid | ||
|
|
||
| from s2python.generated.gen_s2 import DDBCTimerStatus as GenDDBCTimerStatus | ||
|
|
||
| from s2python.validate_values_mixin import ( | ||
| catch_and_convert_exceptions, | ||
| S2MessageComponent, | ||
| ) | ||
|
|
||
|
|
||
| @catch_and_convert_exceptions | ||
| class DDBCTimerStatus(GenDDBCTimerStatus, S2MessageComponent["DDBCTimerStatus"]): | ||
| model_config = GenDDBCTimerStatus.model_config | ||
| model_config["validate_assignment"] = True | ||
|
|
||
| message_id: uuid.UUID = GenDDBCTimerStatus.model_fields["message_id"] # type: ignore[assignment] | ||
| timer_id: uuid.UUID = GenDDBCTimerStatus.model_fields["timer_id"] # type: ignore[assignment] | ||
| actuator_id: uuid.UUID = GenDDBCTimerStatus.model_fields["actuator_id"] # type: ignore[assignment] |
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
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.
Uh oh!
There was an error while loading. Please reload this page.