-
Notifications
You must be signed in to change notification settings - Fork 2
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
feat: create FillRateBasedControlTUNES
#83
Conversation
…C control type to work only with TUNES RM (for now). Signed-off-by: Victor Garcia Reolid <victor@seita.nl>
Signed-off-by: Victor Garcia Reolid <victor@seita.nl>
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.
Start of a review, for our session tomorrow.
task = asyncio.create_task(self.send_storage_status(message)) | ||
self.background_tasks.add( | ||
task | ||
) # important to avoid a task disappearing mid-execution. | ||
task.add_done_callback(self.background_tasks.discard) |
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.
Note to self: candidate code block for refactoring.
async def send_storage_status(self, status: FRBCStorageStatus): | ||
raise NotImplementedError() | ||
|
||
async def send_actuator_status(self, status: FRBCActuatorStatus): | ||
raise NotImplementedError() | ||
|
||
async def send_leakage_behaviour(self, leakage_behaviour: FRBCLeakageBehaviour): | ||
raise NotImplementedError() | ||
|
||
async def send_usage_forecast(self, usage_forecast: FRBCUsageForecast): | ||
raise NotImplementedError() | ||
|
||
async def send_fill_level_target_profile( | ||
self, fill_level_target_profile: FRBCFillLevelTargetProfile | ||
): | ||
raise NotImplementedError() |
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.
Is it correct to say these are meant to be implemented in subclasses? (If so, note to self: add inline comments.)
"provides_power_measurement_types": ["ELECTRIC.POWER.3_PHASE_SYMMETRIC"], | ||
"message_type": "ResourceManagerDetails", | ||
}, | ||
"metadata": {"dt": "2023-01-01T00:00:00"}, |
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.
Pydantic is converting this to the datetime
specified in the S2Wrapper
class, right? I recommend adding a timezone offset explicitly, to avoid ambiguity. We can probably tell Pydantic that. Maybe also that this should be an ISO string.
tests/test_frbc_tunes.py
Outdated
@pytest.mark.asyncio | ||
async def test_trigger_schedule(cem_in_frbc_control_type): | ||
cem, fm_client = await cem_in_frbc_control_type | ||
# frbc = cem._control_types_handlers[cem.control_type] | ||
|
||
tasks = get_pending_tasks() | ||
|
||
assert tasks["trigger_schedule_task"]._state == "PENDING" | ||
await cem.close() | ||
|
||
tasks = get_pending_tasks() | ||
|
||
assert tasks["trigger_schedule_task"]._state == "PENDING" | ||
|
||
await cem.close() | ||
get_pending_tasks() |
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.
This test I don't understand.
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.
This test checks whether the task starts when the FRBC control type is selected.
Perhaps the task should actually stop when the CEM closes. But at least the RM doesn't get messages anymore after the CEM closes.
assert second_call[key] == second_call_expected[key] | ||
|
||
await cem.close() | ||
get_pending_tasks() |
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.
Why? Does this still test something?
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.
This might not be needed. Or it is, and it cleans up tasks. Let's check.
…TUNES/send-system-description-to-fm # Conflicts: # README.rst # src/flexmeasures_client/client.py
…TUNES/send-system-description-to-fm # Conflicts: # setup.cfg
…ption-to-fm' into feature/TUNES/send-system-description-to-fm
Signed-off-by: F.N. Claessen <felix@seita.nl>
Signed-off-by: F.N. Claessen <felix@seita.nl>
Signed-off-by: F.N. Claessen <felix@seita.nl>
…TUNES/send-system-description-to-fm # Conflicts: # README.rst
Signed-off-by: F.N. Claessen <felix@seita.nl>
Signed-off-by: F.N. Claessen <felix@seita.nl>
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.
Merging so we can move on with python-s2 compatibility.
This PR includes the following key features:
fill_level
to FM.fill_rate
to FM which relays the message to the sensor of the active operation mode (NES or THP charging).FRBC.UsageForecast
.FRBC.FillLevelTargetPorfile
to the sensorssoc_maxima
andsoc_minima
.