s2-python 0.4.1__py3-none-any.whl → 0.6.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. {s2_python-0.4.1.dist-info → s2_python-0.6.0.dist-info}/METADATA +17 -12
  2. s2_python-0.6.0.dist-info/RECORD +89 -0
  3. {s2_python-0.4.1.dist-info → s2_python-0.6.0.dist-info}/WHEEL +1 -1
  4. s2_python-0.6.0.dist-info/licenses/LICENSE +201 -0
  5. s2python/common/__init__.py +32 -0
  6. s2python/common/duration.py +3 -1
  7. s2python/common/handshake.py +2 -2
  8. s2python/common/handshake_response.py +2 -2
  9. s2python/common/instruction_status_update.py +3 -3
  10. s2python/common/number_range.py +5 -2
  11. s2python/common/power_forecast.py +3 -3
  12. s2python/common/power_forecast_element.py +28 -6
  13. s2python/common/power_forecast_value.py +1 -1
  14. s2python/common/power_measurement.py +27 -5
  15. s2python/common/power_range.py +4 -2
  16. s2python/common/power_value.py +1 -1
  17. s2python/common/reception_status.py +2 -2
  18. s2python/common/resource_manager_details.py +6 -6
  19. s2python/common/revoke_object.py +3 -3
  20. s2python/common/role.py +1 -1
  21. s2python/common/select_control_type.py +2 -2
  22. s2python/common/session_request.py +2 -2
  23. s2python/common/timer.py +3 -3
  24. s2python/common/transition.py +8 -8
  25. s2python/ddbc/__init__.py +21 -0
  26. s2python/ddbc/ddbc_actuator_description.py +30 -0
  27. s2python/ddbc/ddbc_actuator_status.py +22 -0
  28. s2python/ddbc/ddbc_average_demand_rate_forecast.py +28 -0
  29. s2python/ddbc/ddbc_average_demand_rate_forecast_element.py +21 -0
  30. s2python/ddbc/ddbc_instruction.py +19 -0
  31. s2python/ddbc/ddbc_operation_mode.py +26 -0
  32. s2python/ddbc/ddbc_system_description.py +29 -0
  33. s2python/ddbc/ddbc_timer_status.py +18 -0
  34. s2python/frbc/__init__.py +19 -3
  35. s2python/frbc/frbc_actuator_description.py +15 -9
  36. s2python/frbc/frbc_actuator_status.py +5 -5
  37. s2python/frbc/frbc_fill_level_target_profile.py +3 -3
  38. s2python/frbc/frbc_fill_level_target_profile_element.py +7 -6
  39. s2python/frbc/frbc_instruction.py +5 -5
  40. s2python/frbc/frbc_leakage_behaviour.py +3 -3
  41. s2python/frbc/frbc_leakage_behaviour_element.py +9 -6
  42. s2python/frbc/frbc_operation_mode.py +13 -6
  43. s2python/frbc/frbc_operation_mode_element.py +5 -5
  44. s2python/frbc/frbc_storage_description.py +2 -2
  45. s2python/frbc/frbc_storage_status.py +2 -2
  46. s2python/frbc/frbc_system_description.py +4 -4
  47. s2python/frbc/frbc_timer_status.py +4 -4
  48. s2python/frbc/frbc_usage_forecast.py +3 -3
  49. s2python/frbc/frbc_usage_forecast_element.py +2 -2
  50. s2python/generated/gen_s2.py +508 -543
  51. s2python/message.py +101 -6
  52. s2python/ombc/__init__.py +5 -0
  53. s2python/ombc/ombc_instruction.py +19 -0
  54. s2python/ombc/ombc_operation_mode.py +25 -0
  55. s2python/ombc/ombc_status.py +17 -0
  56. s2python/ombc/ombc_system_description.py +25 -0
  57. s2python/ombc/ombc_timer_status.py +17 -0
  58. s2python/pebc/__init__.py +21 -0
  59. s2python/pebc/pebc_allowed_limit_range.py +42 -0
  60. s2python/pebc/pebc_energy_constraint.py +25 -0
  61. s2python/pebc/pebc_instruction.py +27 -0
  62. s2python/pebc/pebc_power_constraints.py +77 -0
  63. s2python/pebc/pebc_power_envelope.py +23 -0
  64. s2python/pebc/pebc_power_envelope_element.py +16 -0
  65. s2python/ppbc/__init__.py +15 -6
  66. s2python/ppbc/ppbc_end_interruption_instruction.py +6 -8
  67. s2python/ppbc/ppbc_power_profile_definition.py +4 -6
  68. s2python/ppbc/ppbc_power_profile_status.py +2 -4
  69. s2python/ppbc/ppbc_power_sequence.py +6 -6
  70. s2python/ppbc/ppbc_power_sequence_container.py +5 -7
  71. s2python/ppbc/ppbc_power_sequence_container_status.py +7 -9
  72. s2python/ppbc/ppbc_power_sequence_element.py +3 -5
  73. s2python/ppbc/ppbc_schedule_instruction.py +6 -8
  74. s2python/ppbc/ppbc_start_interruption_instruction.py +6 -8
  75. s2python/s2_connection.py +93 -32
  76. s2python/s2_control_type.py +36 -0
  77. s2python/s2_parser.py +4 -0
  78. s2python/s2_validation_error.py +3 -1
  79. s2python/validate_values_mixin.py +29 -14
  80. s2_python-0.4.1.dist-info/RECORD +0 -66
  81. {s2_python-0.4.1.dist-info → s2_python-0.6.0.dist-info}/entry_points.txt +0 -0
  82. {s2_python-0.4.1.dist-info → s2_python-0.6.0.dist-info}/top_level.txt +0 -0
s2python/message.py CHANGED
@@ -1,33 +1,86 @@
1
1
  from typing import Union
2
2
 
3
3
  from s2python.frbc import (
4
+ FRBCActuatorDescription,
4
5
  FRBCActuatorStatus,
5
6
  FRBCFillLevelTargetProfile,
7
+ FRBCFillLevelTargetProfileElement,
6
8
  FRBCInstruction,
7
9
  FRBCLeakageBehaviour,
10
+ FRBCLeakageBehaviourElement,
11
+ FRBCOperationMode,
12
+ FRBCOperationModeElement,
13
+ FRBCStorageDescription,
8
14
  FRBCStorageStatus,
9
15
  FRBCSystemDescription,
10
16
  FRBCTimerStatus,
11
- FRBCUsageForecast
17
+ FRBCUsageForecast,
18
+ FRBCUsageForecastElement,
12
19
  )
13
20
  from s2python.ppbc import (
21
+ PPBCEndInterruptionInstruction,
22
+ PPBCPowerProfileDefinition,
23
+ PPBCPowerSequenceContainer,
24
+ PPBCPowerSequence,
25
+ PPBCPowerProfileStatus,
26
+ PPBCPowerSequenceContainerStatus,
27
+ PPBCPowerSequenceElement,
14
28
  PPBCScheduleInstruction,
29
+ PPBCStartInterruptionInstruction,
30
+ )
31
+ from s2python.ddbc import (
32
+ DDBCActuatorDescription,
33
+ DDBCActuatorStatus,
34
+ DDBCAverageDemandRateForecast,
35
+ DDBCAverageDemandRateForecastElement,
36
+ DDBCInstruction,
37
+ DDBCOperationMode,
38
+ DDBCSystemDescription,
39
+ DDBCTimerStatus,
40
+ )
41
+ from s2python.ombc import (
42
+ OMBCInstruction,
43
+ OMBCOperationMode,
44
+ OMBCTimerStatus,
45
+ OMBCStatus,
46
+ OMBCSystemDescription,
15
47
  )
16
48
 
49
+ from s2python.pebc import (
50
+ PEBCAllowedLimitRange,
51
+ PEBCEnergyConstraint,
52
+ PEBCInstruction,
53
+ PEBCPowerConstraints,
54
+ PEBCPowerEnvelope,
55
+ PEBCPowerEnvelopeElement,
56
+ )
17
57
  from s2python.common import (
58
+ Duration,
18
59
  Handshake,
19
60
  HandshakeResponse,
20
61
  InstructionStatusUpdate,
62
+ NumberRange,
21
63
  PowerForecast,
64
+ PowerForecastElement,
65
+ PowerForecastValue,
22
66
  PowerMeasurement,
67
+ PowerRange,
68
+ PowerValue,
23
69
  ReceptionStatus,
24
70
  ResourceManagerDetails,
25
71
  RevokeObject,
72
+ Role,
26
73
  SelectControlType,
27
- SessionRequest
74
+ SessionRequest,
75
+ Timer,
76
+ Transition,
28
77
  )
29
78
 
30
79
  S2Message = Union[
80
+ DDBCAverageDemandRateForecast,
81
+ DDBCInstruction,
82
+ DDBCSystemDescription,
83
+ DDBCTimerStatus,
31
84
  FRBCActuatorStatus,
32
85
  FRBCFillLevelTargetProfile,
33
86
  FRBCInstruction,
@@ -36,15 +89,57 @@ S2Message = Union[
36
89
  FRBCSystemDescription,
37
90
  FRBCTimerStatus,
38
91
  FRBCUsageForecast,
92
+ OMBCSystemDescription,
93
+ OMBCStatus,
94
+ OMBCTimerStatus,
95
+ OMBCInstruction,
96
+ PEBCPowerConstraints,
97
+ PPBCEndInterruptionInstruction,
98
+ PPBCPowerProfileDefinition,
99
+ PPBCPowerProfileStatus,
39
100
  PPBCScheduleInstruction,
101
+ PPBCStartInterruptionInstruction,
102
+ ResourceManagerDetails,
103
+ RevokeObject,
104
+ SelectControlType,
105
+ SessionRequest,
106
+ DDBCActuatorStatus,
107
+ PEBCEnergyConstraint,
108
+ PEBCInstruction,
40
109
  Handshake,
41
110
  HandshakeResponse,
42
111
  InstructionStatusUpdate,
43
112
  PowerForecast,
44
113
  PowerMeasurement,
45
114
  ReceptionStatus,
46
- ResourceManagerDetails,
47
- RevokeObject,
48
- SelectControlType,
49
- SessionRequest,
115
+ ]
116
+
117
+ S2MessageElement = Union[
118
+ DDBCActuatorDescription,
119
+ DDBCAverageDemandRateForecastElement,
120
+ DDBCOperationMode,
121
+ FRBCActuatorDescription,
122
+ FRBCFillLevelTargetProfileElement,
123
+ FRBCLeakageBehaviourElement,
124
+ FRBCOperationMode,
125
+ FRBCOperationModeElement,
126
+ FRBCStorageDescription,
127
+ FRBCUsageForecastElement,
128
+ OMBCOperationMode,
129
+ PEBCAllowedLimitRange,
130
+ PEBCPowerEnvelope,
131
+ PEBCPowerEnvelopeElement,
132
+ PPBCPowerSequenceContainer,
133
+ PPBCPowerSequence,
134
+ PPBCPowerSequenceContainerStatus,
135
+ PPBCPowerSequenceElement,
136
+ Duration,
137
+ NumberRange,
138
+ PowerForecastElement,
139
+ PowerForecastValue,
140
+ PowerRange,
141
+ PowerValue,
142
+ Role,
143
+ Timer,
144
+ Transition,
50
145
  ]
@@ -0,0 +1,5 @@
1
+ from s2python.ombc.ombc_instruction import OMBCInstruction
2
+ from s2python.ombc.ombc_operation_mode import OMBCOperationMode
3
+ from s2python.ombc.ombc_status import OMBCStatus
4
+ from s2python.ombc.ombc_system_description import OMBCSystemDescription
5
+ from s2python.ombc.ombc_timer_status import OMBCTimerStatus
@@ -0,0 +1,19 @@
1
+ import uuid
2
+
3
+ from s2python.generated.gen_s2 import OMBCInstruction as GenOMBCInstruction
4
+ from s2python.validate_values_mixin import (
5
+ catch_and_convert_exceptions,
6
+ S2MessageComponent,
7
+ )
8
+
9
+
10
+ @catch_and_convert_exceptions
11
+ class OMBCInstruction(GenOMBCInstruction, S2MessageComponent):
12
+ model_config = GenOMBCInstruction.model_config
13
+ model_config["validate_assignment"] = True
14
+
15
+ id: uuid.UUID = GenOMBCInstruction.model_fields["id"] # type: ignore[assignment]
16
+ message_id: uuid.UUID = GenOMBCInstruction.model_fields["message_id"] # type: ignore[assignment]
17
+ abnormal_condition: bool = GenOMBCInstruction.model_fields["abnormal_condition"] # type: ignore[assignment]
18
+ operation_mode_factor: float = GenOMBCInstruction.model_fields["operation_mode_factor"] # type: ignore[assignment]
19
+ operation_mode_id: uuid.UUID = GenOMBCInstruction.model_fields["operation_mode_id"] # type: ignore[assignment]
@@ -0,0 +1,25 @@
1
+ from typing import List
2
+ import uuid
3
+
4
+ from s2python.generated.gen_s2 import OMBCOperationMode as GenOMBCOperationMode
5
+ from s2python.common.power_range import PowerRange
6
+
7
+
8
+ from s2python.validate_values_mixin import (
9
+ catch_and_convert_exceptions,
10
+ S2MessageComponent,
11
+ )
12
+
13
+
14
+ @catch_and_convert_exceptions
15
+ class OMBCOperationMode(GenOMBCOperationMode, S2MessageComponent):
16
+ model_config = GenOMBCOperationMode.model_config
17
+ model_config["validate_assignment"] = True
18
+
19
+ id: uuid.UUID = GenOMBCOperationMode.model_fields["id"] # type: ignore[assignment]
20
+ power_ranges: List[PowerRange] = GenOMBCOperationMode.model_fields[
21
+ "power_ranges"
22
+ ] # type: ignore[assignment]
23
+ abnormal_condition_only: bool = GenOMBCOperationMode.model_fields[
24
+ "abnormal_condition_only"
25
+ ] # type: ignore[assignment]
@@ -0,0 +1,17 @@
1
+ import uuid
2
+
3
+ from s2python.generated.gen_s2 import OMBCStatus as GenOMBCStatus
4
+
5
+ from s2python.validate_values_mixin import (
6
+ catch_and_convert_exceptions,
7
+ S2MessageComponent,
8
+ )
9
+
10
+
11
+ @catch_and_convert_exceptions
12
+ class OMBCStatus(GenOMBCStatus, S2MessageComponent):
13
+ model_config = GenOMBCStatus.model_config
14
+ model_config["validate_assignment"] = True
15
+
16
+ message_id: uuid.UUID = GenOMBCStatus.model_fields["message_id"] # type: ignore[assignment]
17
+ operation_mode_factor: float = GenOMBCStatus.model_fields["operation_mode_factor"] # type: ignore[assignment]
@@ -0,0 +1,25 @@
1
+ from typing import List
2
+ import uuid
3
+
4
+ from s2python.generated.gen_s2 import OMBCSystemDescription as GenOMBCSystemDescription
5
+ from s2python.ombc.ombc_operation_mode import OMBCOperationMode
6
+ from s2python.common.transition import Transition
7
+ from s2python.common.timer import Timer
8
+
9
+ from s2python.validate_values_mixin import (
10
+ catch_and_convert_exceptions,
11
+ S2MessageComponent,
12
+ )
13
+
14
+
15
+ @catch_and_convert_exceptions
16
+ class OMBCSystemDescription(GenOMBCSystemDescription, S2MessageComponent):
17
+ model_config = GenOMBCSystemDescription.model_config
18
+ model_config["validate_assignment"] = True
19
+
20
+ message_id: uuid.UUID = GenOMBCSystemDescription.model_fields["message_id"] # type: ignore[assignment]
21
+ operation_modes: List[OMBCOperationMode] = GenOMBCSystemDescription.model_fields[
22
+ "operation_modes"
23
+ ] # type: ignore[assignment]
24
+ transitions: List[Transition] = GenOMBCSystemDescription.model_fields["transitions"] # type: ignore[assignment]
25
+ timers: List[Timer] = GenOMBCSystemDescription.model_fields["timers"] # type: ignore[assignment]
@@ -0,0 +1,17 @@
1
+ from uuid import UUID
2
+
3
+ from s2python.generated.gen_s2 import OMBCTimerStatus as GenOMBCTimerStatus
4
+
5
+ from s2python.validate_values_mixin import (
6
+ catch_and_convert_exceptions,
7
+ S2MessageComponent,
8
+ )
9
+
10
+
11
+ @catch_and_convert_exceptions
12
+ class OMBCTimerStatus(GenOMBCTimerStatus, S2MessageComponent):
13
+ model_config = GenOMBCTimerStatus.model_config
14
+ model_config["validate_assignment"] = True
15
+
16
+ message_id: UUID = GenOMBCTimerStatus.model_fields["message_id"] # type: ignore[assignment]
17
+ timer_id: UUID = GenOMBCTimerStatus.model_fields["timer_id"] # type: ignore[assignment]
@@ -0,0 +1,21 @@
1
+ from s2python.pebc.pebc_allowed_limit_range import PEBCAllowedLimitRange
2
+ from s2python.pebc.pebc_power_constraints import PEBCPowerConstraints
3
+ from s2python.pebc.pebc_power_envelope import PEBCPowerEnvelope
4
+ from s2python.pebc.pebc_power_envelope_element import PEBCPowerEnvelopeElement
5
+ from s2python.pebc.pebc_energy_constraint import PEBCEnergyConstraint
6
+ from s2python.generated.gen_s2 import (
7
+ PEBCPowerEnvelopeConsequenceType,
8
+ PEBCPowerEnvelopeLimitType,
9
+ )
10
+ from s2python.pebc.pebc_instruction import PEBCInstruction
11
+
12
+ __all__ = [
13
+ "PEBCAllowedLimitRange",
14
+ "PEBCPowerConstraints",
15
+ "PEBCPowerEnvelope",
16
+ "PEBCPowerEnvelopeElement",
17
+ "PEBCEnergyConstraint",
18
+ "PEBCPowerEnvelopeConsequenceType",
19
+ "PEBCPowerEnvelopeLimitType",
20
+ "PEBCInstruction",
21
+ ]
@@ -0,0 +1,42 @@
1
+ from typing_extensions import Self
2
+ from pydantic import model_validator
3
+ from s2python.generated.gen_s2 import (
4
+ PEBCAllowedLimitRange as GenPEBCAllowedLimitRange,
5
+ PEBCPowerEnvelopeLimitType as GenPEBCPowerEnvelopeLimitType,
6
+ )
7
+ from s2python.common import CommodityQuantity, NumberRange
8
+ from s2python.validate_values_mixin import (
9
+ catch_and_convert_exceptions,
10
+ S2MessageComponent,
11
+ )
12
+
13
+
14
+ @catch_and_convert_exceptions
15
+ class PEBCAllowedLimitRange(GenPEBCAllowedLimitRange, S2MessageComponent):
16
+ model_config = GenPEBCAllowedLimitRange.model_config
17
+ model_config["validate_assignment"] = True
18
+
19
+ commodity_quantity: CommodityQuantity = GenPEBCAllowedLimitRange.model_fields[
20
+ "commodity_quantity"
21
+ ] # type: ignore[assignment,reportIncompatibleVariableOverride]
22
+ limit_type: GenPEBCPowerEnvelopeLimitType = GenPEBCAllowedLimitRange.model_fields[
23
+ "limit_type"
24
+ ] # type: ignore[assignment,reportIncompatibleVariableOverride]
25
+ range_boundary: NumberRange = GenPEBCAllowedLimitRange.model_fields["range_boundary"] # type: ignore[assignment,reportIncompatibleVariableOverride]
26
+ abnormal_condition_only: bool = [
27
+ GenPEBCAllowedLimitRange.model_fields["abnormal_condition_only"] # type: ignore[assignment,reportIncompatibleVariableOverride]
28
+ ]
29
+
30
+ @model_validator(mode="after")
31
+ def validate_range_boundary(self) -> Self:
32
+ # According to the specification "There must be at least one PEBC.AllowedLimitRange for the UPPER_LIMIT
33
+ # and at least one AllowedLimitRange for the LOWER_LIMIT." However for something that produces energy
34
+ # end_of_range=-2000 and start_of_range=0 is valid. Therefore absolute value used here.
35
+ if abs(self.range_boundary.start_of_range) > abs(
36
+ self.range_boundary.end_of_range
37
+ ):
38
+ raise ValueError(
39
+ self,
40
+ "The start of the range must be smaller or equal than the end of the range.",
41
+ )
42
+ return self
@@ -0,0 +1,25 @@
1
+ import uuid
2
+
3
+ from s2python.generated.gen_s2 import (
4
+ PEBCEnergyConstraint as GenPEBCEnergyConstraint,
5
+ )
6
+ from s2python.common import CommodityQuantity
7
+ from s2python.validate_values_mixin import (
8
+ catch_and_convert_exceptions,
9
+ S2MessageComponent,
10
+ )
11
+
12
+
13
+ @catch_and_convert_exceptions
14
+ class PEBCEnergyConstraint(GenPEBCEnergyConstraint, S2MessageComponent):
15
+ model_config = GenPEBCEnergyConstraint.model_config
16
+ model_config["validate_assignment"] = True
17
+
18
+ message_id: uuid.UUID = GenPEBCEnergyConstraint.model_fields["message_id"] # type: ignore[assignment,reportIncompatibleVariableOverride]
19
+ id: uuid.UUID = GenPEBCEnergyConstraint.model_fields["id"] # type: ignore[assignment,reportIncompatibleVariableOverride]
20
+
21
+ upper_average_power: float = GenPEBCEnergyConstraint.model_fields["upper_average_power"] # type: ignore[assignment,reportIncompatibleVariableOverride]
22
+ lower_average_power: float = GenPEBCEnergyConstraint.model_fields["lower_average_power"] # type: ignore[assignment,reportIncompatibleVariableOverride]
23
+ commodity_quantity: CommodityQuantity = [
24
+ GenPEBCEnergyConstraint.model_fields["commodity_quantity"] # type: ignore[assignment,reportIncompatibleVariableOverride]
25
+ ]
@@ -0,0 +1,27 @@
1
+ import uuid
2
+ from typing import List
3
+
4
+ from s2python.generated.gen_s2 import (
5
+ PEBCInstruction as GenPEBCInstruction,
6
+ )
7
+ from s2python.pebc.pebc_power_envelope import PEBCPowerEnvelope
8
+ from s2python.validate_values_mixin import (
9
+ catch_and_convert_exceptions,
10
+ S2MessageComponent,
11
+ )
12
+
13
+
14
+ @catch_and_convert_exceptions
15
+ class PEBCInstruction(GenPEBCInstruction, S2MessageComponent):
16
+ model_config = GenPEBCInstruction.model_config
17
+ model_config["validate_assignment"] = True
18
+
19
+ message_id: uuid.UUID = GenPEBCInstruction.model_fields["message_id"] # type: ignore[assignment,reportIncompatibleVariableOverride]
20
+ id: uuid.UUID = GenPEBCInstruction.model_fields["id"] # type: ignore[assignment,reportIncompatibleVariableOverride]
21
+ power_constraints_id: uuid.UUID = [ # type: ignore[reportIncompatibleVariableOverride]
22
+ GenPEBCInstruction.model_fields["power_constraints_id"] # type: ignore[assignment]
23
+ ]
24
+ power_envelopes: List[PEBCPowerEnvelope] = [ # type: ignore[reportIncompatibleVariableOverride]
25
+ GenPEBCInstruction.model_fields["power_envelopes"] # type: ignore[assignment]
26
+ ]
27
+ abnormal_condition: bool = GenPEBCInstruction.model_fields["abnormal_condition"] # type: ignore[assignment,reportIncompatibleVariableOverride]
@@ -0,0 +1,77 @@
1
+ import uuid
2
+ from typing import List, Dict, Tuple
3
+ from typing_extensions import Self
4
+
5
+ from pydantic import model_validator
6
+
7
+ from s2python.common import CommodityQuantity
8
+ from s2python.generated.gen_s2 import (
9
+ PEBCPowerConstraints as GenPEBCPowerConstraints,
10
+ PEBCPowerEnvelopeConsequenceType as GenPEBCPowerEnvelopeConsequenceType,
11
+ PEBCPowerEnvelopeLimitType,
12
+ )
13
+ from s2python.pebc.pebc_allowed_limit_range import PEBCAllowedLimitRange
14
+ from s2python.validate_values_mixin import (
15
+ catch_and_convert_exceptions,
16
+ S2MessageComponent,
17
+ )
18
+
19
+
20
+ @catch_and_convert_exceptions
21
+ class PEBCPowerConstraints(GenPEBCPowerConstraints, S2MessageComponent):
22
+ model_config = GenPEBCPowerConstraints.model_config
23
+ model_config["validate_assignment"] = True
24
+
25
+ message_id: uuid.UUID = GenPEBCPowerConstraints.model_fields["message_id"] # type: ignore[assignment,reportIncompatibleVariableOverride]
26
+ id: uuid.UUID = GenPEBCPowerConstraints.model_fields["id"] # type: ignore[assignment,reportIncompatibleVariableOverride]
27
+ consequence_type: GenPEBCPowerEnvelopeConsequenceType = GenPEBCPowerConstraints.model_fields[ # type: ignore[reportIncompatibleVariableOverride]
28
+ "consequence_type"
29
+ ] # type: ignore[assignment]
30
+ allowed_limit_ranges: List[PEBCAllowedLimitRange] = GenPEBCPowerConstraints.model_fields[ # type: ignore[reportIncompatibleVariableOverride]
31
+ "allowed_limit_ranges"
32
+ ] # type: ignore[assignment]
33
+
34
+ @model_validator(mode="after")
35
+ def validate_has_one_upper_one_lower_limit_range(self) -> Self:
36
+
37
+ commodity_type_ranges: Dict[CommodityQuantity, Tuple[bool, bool]] = {}
38
+
39
+ for limit_range in self.allowed_limit_ranges:
40
+ current: Tuple[bool, bool] = commodity_type_ranges.get(
41
+ limit_range.commodity_quantity, (False, False)
42
+ )
43
+
44
+ if limit_range.limit_type == PEBCPowerEnvelopeLimitType.UPPER_LIMIT:
45
+ current = (
46
+ True,
47
+ current[1],
48
+ )
49
+
50
+ if limit_range.limit_type == PEBCPowerEnvelopeLimitType.LOWER_LIMIT:
51
+ current = (
52
+ current[0],
53
+ True,
54
+ )
55
+
56
+ commodity_type_ranges[limit_range.commodity_quantity] = current
57
+
58
+ valid = True
59
+
60
+ for upper, lower in commodity_type_ranges.values():
61
+ valid = valid and upper and lower
62
+
63
+ if not valid:
64
+ raise ValueError(
65
+ self,
66
+ "There shall be at least one PEBC.AllowedLimitRange for the UPPER_LIMIT and at least one AllowedLimitRange for the LOWER_LIMIT.",
67
+ )
68
+
69
+ return self
70
+
71
+ @model_validator(mode="after")
72
+ def validate_valid_until_after_valid_from(self) -> Self:
73
+ if self.valid_until is not None and self.valid_until < self.valid_from:
74
+ raise ValueError(
75
+ self, "valid_until cannot be set to a value that is before valid_from."
76
+ )
77
+ return self
@@ -0,0 +1,23 @@
1
+ from typing import List
2
+ from s2python.generated.gen_s2 import (
3
+ PEBCPowerEnvelope as GenPEBCPowerEnvelope,
4
+ )
5
+ from s2python.pebc.pebc_power_envelope_element import PEBCPowerEnvelopeElement
6
+ from s2python.common import CommodityQuantity
7
+ from s2python.validate_values_mixin import (
8
+ catch_and_convert_exceptions,
9
+ S2MessageComponent,
10
+ )
11
+
12
+
13
+ @catch_and_convert_exceptions
14
+ class PEBCPowerEnvelope(GenPEBCPowerEnvelope, S2MessageComponent):
15
+ model_config = GenPEBCPowerEnvelope.model_config
16
+ model_config["validate_assignment"] = True
17
+
18
+ commodity_quantity: CommodityQuantity = GenPEBCPowerEnvelope.model_fields[ # type: ignore[reportIncompatibleVariableOverride]
19
+ "commodity_quantity"
20
+ ] # type: ignore[assignment]
21
+ power_envelope_elements: List[PEBCPowerEnvelopeElement] = GenPEBCPowerEnvelope.model_fields[ # type: ignore[assignment,reportIncompatibleVariableOverride]
22
+ "power_envelope_elements"
23
+ ] # type: ignore[assignment]
@@ -0,0 +1,16 @@
1
+ from s2python.generated.gen_s2 import (
2
+ PEBCPowerEnvelopeElement as GenPEBCPowerEnvelopeElement,
3
+ )
4
+ from s2python.validate_values_mixin import (
5
+ catch_and_convert_exceptions,
6
+ S2MessageComponent,
7
+ )
8
+
9
+
10
+ @catch_and_convert_exceptions
11
+ class PEBCPowerEnvelopeElement(GenPEBCPowerEnvelopeElement, S2MessageComponent):
12
+ model_config = GenPEBCPowerEnvelopeElement.model_config
13
+ model_config["validate_assignment"] = True
14
+
15
+ lower_limit: float = GenPEBCPowerEnvelopeElement.model_fields["lower_limit"] # type: ignore[assignment,reportIncompatibleVariableOverride]
16
+ upper_limit: float = GenPEBCPowerEnvelopeElement.model_fields["upper_limit"] # type: ignore[assignment,reportIncompatibleVariableOverride]
s2python/ppbc/__init__.py CHANGED
@@ -1,12 +1,21 @@
1
1
  from s2python.ppbc.ppbc_schedule_instruction import PPBCScheduleInstruction
2
- from s2python.ppbc.ppbc_end_interruption_instruction import (
3
- PPBCEndInterruptionInstruction,
4
- )
2
+ from s2python.ppbc.ppbc_end_interruption_instruction import PPBCEndInterruptionInstruction
5
3
  from s2python.ppbc.ppbc_power_profile_definition import PPBCPowerProfileDefinition
6
4
  from s2python.ppbc.ppbc_power_sequence_container import PPBCPowerSequenceContainer
7
5
  from s2python.ppbc.ppbc_power_sequence import PPBCPowerSequence
8
6
  from s2python.ppbc.ppbc_power_profile_status import PPBCPowerProfileStatus
9
- from s2python.ppbc.ppbc_power_sequence_container_status import (
10
- PPBCPowerSequenceContainerStatus,
11
- )
7
+ from s2python.ppbc.ppbc_power_sequence_container_status import PPBCPowerSequenceContainerStatus
12
8
  from s2python.ppbc.ppbc_power_sequence_element import PPBCPowerSequenceElement
9
+ from s2python.ppbc.ppbc_start_interruption_instruction import PPBCStartInterruptionInstruction
10
+
11
+ __all__ = [
12
+ "PPBCScheduleInstruction",
13
+ "PPBCEndInterruptionInstruction",
14
+ "PPBCPowerProfileDefinition",
15
+ "PPBCPowerSequenceContainer",
16
+ "PPBCPowerSequence",
17
+ "PPBCPowerProfileStatus",
18
+ "PPBCPowerSequenceContainerStatus",
19
+ "PPBCPowerSequenceElement",
20
+ "PPBCStartInterruptionInstruction",
21
+ ]
@@ -11,22 +11,20 @@ from s2python.validate_values_mixin import (
11
11
 
12
12
 
13
13
  @catch_and_convert_exceptions
14
- class PPBCEndInterruptionInstruction(
15
- GenPPBCEndInterruptionInstruction, S2MessageComponent["PPBCEndInterruptionInstruction"]
16
- ):
14
+ class PPBCEndInterruptionInstruction(GenPPBCEndInterruptionInstruction, S2MessageComponent):
17
15
  model_config = GenPPBCEndInterruptionInstruction.model_config
18
16
  model_config["validate_assignment"] = True
19
17
 
20
- id: uuid.UUID = GenPPBCEndInterruptionInstruction.model_fields["id"] # type: ignore[assignment]
21
- power_profile_id: uuid.UUID = GenPPBCEndInterruptionInstruction.model_fields[
18
+ id: uuid.UUID = GenPPBCEndInterruptionInstruction.model_fields["id"] # type: ignore[assignment,reportIncompatibleVariableOverride]
19
+ power_profile_id: uuid.UUID = GenPPBCEndInterruptionInstruction.model_fields[ # type: ignore[reportIncompatibleVariableOverride]
22
20
  "power_profile_id"
23
21
  ] # type: ignore[assignment]
24
- sequence_container_id: uuid.UUID = GenPPBCEndInterruptionInstruction.model_fields[
22
+ sequence_container_id: uuid.UUID = GenPPBCEndInterruptionInstruction.model_fields[ # type: ignore[reportIncompatibleVariableOverride]
25
23
  "sequence_container_id"
26
24
  ] # type: ignore[assignment]
27
- power_sequence_id: uuid.UUID = GenPPBCEndInterruptionInstruction.model_fields[
25
+ power_sequence_id: uuid.UUID = GenPPBCEndInterruptionInstruction.model_fields[ # type: ignore[reportIncompatibleVariableOverride]
28
26
  "power_sequence_id"
29
27
  ] # type: ignore[assignment]
30
- abnormal_condition: bool = GenPPBCEndInterruptionInstruction.model_fields[
28
+ abnormal_condition: bool = GenPPBCEndInterruptionInstruction.model_fields[ # type: ignore[reportIncompatibleVariableOverride]
31
29
  "abnormal_condition"
32
30
  ] # type: ignore[assignment]
@@ -14,14 +14,12 @@ from s2python.ppbc.ppbc_power_sequence_container import PPBCPowerSequenceContain
14
14
 
15
15
 
16
16
  @catch_and_convert_exceptions
17
- class PPBCPowerProfileDefinition(
18
- GenPPBCPowerProfileDefinition, S2MessageComponent["PPBCPowerProfileDefinition"]
19
- ):
17
+ class PPBCPowerProfileDefinition(GenPPBCPowerProfileDefinition, S2MessageComponent):
20
18
  model_config = GenPPBCPowerProfileDefinition.model_config
21
19
  model_config["validate_assignment"] = True
22
20
 
23
- message_id: uuid.UUID = GenPPBCPowerProfileDefinition.model_fields["message_id"] # type: ignore[assignment]
24
- id: uuid.UUID = GenPPBCPowerProfileDefinition.model_fields["id"] # type: ignore[assignment]
25
- power_sequences_containers: List[PPBCPowerSequenceContainer] = (
21
+ message_id: uuid.UUID = GenPPBCPowerProfileDefinition.model_fields["message_id"] # type: ignore[assignment,reportIncompatibleVariableOverride]
22
+ id: uuid.UUID = GenPPBCPowerProfileDefinition.model_fields["id"] # type: ignore[assignment,reportIncompatibleVariableOverride]
23
+ power_sequences_containers: List[PPBCPowerSequenceContainer] = ( # type: ignore[reportIncompatibleVariableOverride]
26
24
  GenPPBCPowerProfileDefinition.model_fields["power_sequences_containers"] # type: ignore[assignment]
27
25
  )
@@ -15,12 +15,10 @@ from s2python.ppbc.ppbc_power_sequence_container_status import (
15
15
 
16
16
 
17
17
  @catch_and_convert_exceptions
18
- class PPBCPowerProfileStatus(
19
- GenPPBCPowerProfileStatus, S2MessageComponent["PPBCPowerProfileStatus"]
20
- ):
18
+ class PPBCPowerProfileStatus(GenPPBCPowerProfileStatus, S2MessageComponent):
21
19
  model_config = GenPPBCPowerProfileStatus.model_config
22
20
  model_config["validate_assignment"] = True
23
21
 
24
- sequence_container_status: List[PPBCPowerSequenceContainerStatus] = (
22
+ sequence_container_status: List[PPBCPowerSequenceContainerStatus] = ( # type: ignore[reportIncompatibleVariableOverride]
25
23
  GenPPBCPowerProfileStatus.model_fields["sequence_container_status"] # type: ignore[assignment]
26
24
  )
@@ -15,16 +15,16 @@ from s2python.common import Duration
15
15
 
16
16
 
17
17
  @catch_and_convert_exceptions
18
- class PPBCPowerSequence(GenPPBCPowerSequence, S2MessageComponent["PPBCPowerSequence"]):
18
+ class PPBCPowerSequence(GenPPBCPowerSequence, S2MessageComponent):
19
19
  model_config = GenPPBCPowerSequence.model_config
20
20
  model_config["validate_assignment"] = True
21
21
 
22
- id: uuid.UUID = GenPPBCPowerSequence.model_fields["id"] # type: ignore[assignment]
23
- elements: List[PPBCPowerSequenceElement] = GenPPBCPowerSequence.model_fields[
22
+ id: uuid.UUID = GenPPBCPowerSequence.model_fields["id"] # type: ignore[assignment,reportIncompatibleVariableOverride]
23
+ elements: List[PPBCPowerSequenceElement] = GenPPBCPowerSequence.model_fields[ # type: ignore[reportIncompatibleVariableOverride]
24
24
  "elements"
25
25
  ] # type: ignore[assignment]
26
- is_interruptible: bool = GenPPBCPowerSequence.model_fields["is_interruptible"] # type: ignore[assignment]
27
- max_pause_before: Duration = GenPPBCPowerSequence.model_fields["max_pause_before"] # type: ignore[assignment]
26
+ is_interruptible: bool = GenPPBCPowerSequence.model_fields["is_interruptible"] # type: ignore[assignment,reportIncompatibleVariableOverride]
27
+ max_pause_before: Duration = GenPPBCPowerSequence.model_fields["max_pause_before"] # type: ignore[assignment,reportIncompatibleVariableOverride]
28
28
  abnormal_condition_only: bool = GenPPBCPowerSequence.model_fields[
29
29
  "abnormal_condition_only"
30
- ] # type: ignore[assignment]
30
+ ] # type: ignore[assignment,reportIncompatibleVariableOverride]
@@ -15,13 +15,11 @@ from s2python.ppbc.ppbc_power_sequence import PPBCPowerSequence
15
15
 
16
16
 
17
17
  @catch_and_convert_exceptions
18
- class PPBCPowerSequenceContainer(
19
- GenPPBCPowerSequenceContainer, S2MessageComponent["PPBCPowerSequenceContainer"]
20
- ):
18
+ class PPBCPowerSequenceContainer(GenPPBCPowerSequenceContainer, S2MessageComponent):
21
19
  model_config = GenPPBCPowerSequenceContainer.model_config
22
20
  model_config["validate_assignment"] = True
23
21
 
24
- id: uuid.UUID = GenPPBCPowerSequenceContainer.model_fields["id"] # type: ignore[assignment]
25
- power_sequences: List[PPBCPowerSequence] = (
26
- GenPPBCPowerSequenceContainer.model_fields["power_sequences"] # type: ignore[assignment]
27
- )
22
+ id: uuid.UUID = GenPPBCPowerSequenceContainer.model_fields["id"] # type: ignore[assignment,reportIncompatibleVariableOverride]
23
+ power_sequences: List[PPBCPowerSequence] = GenPPBCPowerSequenceContainer.model_fields[ # type: ignore[reportIncompatibleVariableOverride]
24
+ "power_sequences"
25
+ ] # type: ignore[assignment]