@@ -85,18 +85,18 @@ def __init__( # pylint: disable=too-many-arguments
8585
8686 self ._system_bounds : dict [frozenset [int ], SystemBounds ] = {}
8787 self ._bound_tracker_tasks : dict [frozenset [int ], asyncio .Task [None ]] = {}
88- self ._non_shifting_subscriptions : dict [
88+ self ._set_power_subscriptions : dict [
8989 frozenset [int ], dict [int , Sender [_Report ]]
9090 ] = {}
91- self ._shifting_subscriptions : dict [
91+ self ._set_op_power_subscriptions : dict [
9292 frozenset [int ], dict [int , Sender [_Report ]]
9393 ] = {}
9494 self ._distribution_results : dict [frozenset [int ], power_distributing .Result ] = {}
9595
96- self ._non_shifting_group : BaseAlgorithm = Matryoshka (
96+ self ._set_power_group : BaseAlgorithm = Matryoshka (
9797 max_proposal_age = timedelta (seconds = 60.0 )
9898 )
99- self ._shifting_group : BaseAlgorithm = Matryoshka (
99+ self ._set_op_power_group : BaseAlgorithm = Matryoshka (
100100 max_proposal_age = timedelta (seconds = 60.0 )
101101 )
102102
@@ -113,25 +113,25 @@ async def _send_reports(self, component_ids: frozenset[int]) -> None:
113113 if bounds is None :
114114 _logger .warning ("PowerManagingActor: No bounds for %s" , component_ids )
115115 return
116- for priority , sender in self ._shifting_subscriptions .get (
116+ for priority , sender in self ._set_op_power_subscriptions .get (
117117 component_ids , {}
118118 ).items ():
119- status = self ._shifting_group .get_status (
119+ status = self ._set_op_power_group .get_status (
120120 component_ids ,
121121 priority ,
122122 bounds ,
123123 self ._distribution_results .get (component_ids ),
124124 )
125125 await sender .send (status )
126- for priority , sender in self ._non_shifting_subscriptions .get (
126+ for priority , sender in self ._set_power_subscriptions .get (
127127 component_ids , {}
128128 ).items ():
129- status = self ._non_shifting_group .get_status (
129+ status = self ._set_power_group .get_status (
130130 component_ids ,
131131 priority ,
132132 self ._calculate_shifted_bounds (
133133 bounds ,
134- self ._shifting_group .get_target_power (component_ids ),
134+ self ._set_op_power_group .get_target_power (component_ids ),
135135 ),
136136 self ._distribution_results .get (component_ids ),
137137 )
@@ -209,34 +209,34 @@ def _add_system_bounds_tracker(self, component_ids: frozenset[int]) -> None:
209209 )
210210
211211 def _calculate_shifted_bounds (
212- self , bounds : SystemBounds , target_power : Power | None
212+ self , bounds : SystemBounds , op_power : Power | None
213213 ) -> SystemBounds :
214- """Calculate the shifted bounds corresponding to shifting group's target power.
214+ """Calculate the shifted bounds shifted by the operating point power.
215215
216216 Any value regular actors choose within these bounds can be shifted by the
217- shifting power and still remain within the actual system bounds.
217+ operating point power and still remain within the actual system bounds.
218218
219- | system bounds | shifting | shifted |
220- | | target power | bounds |
221- |---------------+-------------- +------------|
222- | -100 to 100 | 70 | -170 to 30 |
223- | -100 to 100 | -50 | -50 to 150 |
219+ | system bounds | operating | shifted |
220+ | | point power | bounds |
221+ |---------------+-------------+------------|
222+ | -100 to 100 | 70 | -170 to 30 |
223+ | -100 to 100 | -50 | -50 to 150 |
224224
225225 Args:
226226 bounds: The bounds to calculate the remaining bounds from.
227- target_power : The target power to apply .
227+ op_power : The operating point power to shift by .
228228
229229 Returns:
230230 The remaining bounds.
231231 """
232- if target_power is None :
232+ if op_power is None :
233233 return bounds
234234
235235 inclusion_bounds : Bounds [Power ] | None = None
236236 if bounds .inclusion_bounds is not None :
237237 inclusion_bounds = Bounds (
238- bounds .inclusion_bounds .lower - target_power ,
239- bounds .inclusion_bounds .upper - target_power ,
238+ bounds .inclusion_bounds .lower - op_power ,
239+ bounds .inclusion_bounds .upper - op_power ,
240240 )
241241 return SystemBounds (
242242 timestamp = bounds .timestamp ,
@@ -252,8 +252,7 @@ def _calculate_target_power(
252252 ) -> Power | None :
253253 """Calculate the target power for a set of components.
254254
255- This is the power from the non-shifting group, shifted by the power from the
256- shifting group.
255+ This is the target power, shifted by the operating point power.
257256
258257 Args:
259258 component_ids: The component IDs for which to calculate the target power.
@@ -267,14 +266,14 @@ def _calculate_target_power(
267266 tgt_power_shift : Power | None = None
268267 tgt_power_no_shift : Power | None = None
269268 if proposal is not None :
270- if proposal .in_shifting_group :
271- tgt_power_shift = self ._shifting_group .calculate_target_power (
269+ if proposal .set_operating_point :
270+ tgt_power_shift = self ._set_op_power_group .calculate_target_power (
272271 component_ids ,
273272 proposal ,
274273 self ._system_bounds [component_ids ],
275274 must_send ,
276275 )
277- tgt_power_no_shift = self ._non_shifting_group .calculate_target_power (
276+ tgt_power_no_shift = self ._set_power_group .calculate_target_power (
278277 component_ids ,
279278 None ,
280279 self ._calculate_shifted_bounds (
@@ -283,13 +282,13 @@ def _calculate_target_power(
283282 must_send ,
284283 )
285284 else :
286- tgt_power_no_shift = self ._non_shifting_group .calculate_target_power (
285+ tgt_power_no_shift = self ._set_power_group .calculate_target_power (
287286 component_ids ,
288287 proposal ,
289288 self ._system_bounds [component_ids ],
290289 must_send ,
291290 )
292- tgt_power_shift = self ._shifting_group .calculate_target_power (
291+ tgt_power_shift = self ._set_op_power_group .calculate_target_power (
293292 component_ids ,
294293 None ,
295294 self ._calculate_shifted_bounds (
@@ -298,13 +297,13 @@ def _calculate_target_power(
298297 must_send ,
299298 )
300299 else :
301- tgt_power_no_shift = self ._non_shifting_group .calculate_target_power (
300+ tgt_power_no_shift = self ._set_power_group .calculate_target_power (
302301 component_ids ,
303302 None ,
304303 self ._system_bounds [component_ids ],
305304 must_send ,
306305 )
307- tgt_power_shift = self ._shifting_group .calculate_target_power (
306+ tgt_power_shift = self ._set_op_power_group .calculate_target_power (
308307 component_ids ,
309308 None ,
310309 self ._calculate_shifted_bounds (
@@ -378,12 +377,12 @@ async def _run(self) -> None:
378377 sub = selected .message
379378 component_ids = sub .component_ids
380379 priority = sub .priority
381- in_shifting_group = sub .in_shifting_group
380+ set_operating_point = sub .set_operating_point
382381
383382 subs_set = (
384- self ._shifting_subscriptions
385- if in_shifting_group
386- else self ._non_shifting_subscriptions
383+ self ._set_op_power_subscriptions
384+ if set_operating_point
385+ else self ._set_power_subscriptions
387386 )
388387
389388 if component_ids not in subs_set :
@@ -427,7 +426,9 @@ async def _run(self) -> None:
427426 await self ._send_reports (frozenset (result .request .component_ids ))
428427
429428 elif selected_from (selected , drop_old_proposals_timer ):
430- self ._non_shifting_group .drop_old_proposals (
429+ self ._set_power_group .drop_old_proposals (
430+ asyncio .get_event_loop ().time ()
431+ )
432+ self ._set_op_power_group .drop_old_proposals (
431433 asyncio .get_event_loop ().time ()
432434 )
433- self ._shifting_group .drop_old_proposals (asyncio .get_event_loop ().time ())
0 commit comments