diff --git a/python/lsst/ts/vent/controller/config.py b/python/lsst/ts/vent/controller/config.py index 1e0a609..8c4d8e1 100644 --- a/python/lsst/ts/vent/controller/config.py +++ b/python/lsst/ts/vent/controller/config.py @@ -30,7 +30,7 @@ class Config: device_id = 1 """The default modbus device ID for the variable frequency drive.""" - max_freq = 50.0 + max_freq = 25.0 """Default maximum frequency for the dome fans.""" megaind_bus = 1 diff --git a/python/lsst/ts/vent/controller/controller.py b/python/lsst/ts/vent/controller/controller.py index c1d23d8..3f57428 100644 --- a/python/lsst/ts/vent/controller/controller.py +++ b/python/lsst/ts/vent/controller/controller.py @@ -200,6 +200,14 @@ async def get_fan_frequency(self) -> float: output_frequency *= 0.1 # RFR register holds frequency in units of 0.1 Hz return output_frequency + def get_max_frequency(self) -> float: + """Returns the maximum allowed frequency. + + Calls to `set_fan_frequency` may not have an argument exceeding + this value. + """ + return self.config.max_freq + async def set_fan_frequency(self, frequency: float) -> None: """Sets the target frequency for the dome exhaust fan. The frequency must be between zero and MAX_FREQ. diff --git a/python/lsst/ts/vent/controller/dispatcher.py b/python/lsst/ts/vent/controller/dispatcher.py index e9cbc60..be61c16 100644 --- a/python/lsst/ts/vent/controller/dispatcher.py +++ b/python/lsst/ts/vent/controller/dispatcher.py @@ -89,6 +89,7 @@ def __init__( self.dispatch_dict: Final[dict[str, list[type]]] = { "close_vent_gate": [int, int, int, int], "open_vent_gate": [int, int, int, int], + "get_fan_drive_max_frequency": [], "reset_extraction_fan_drive": [], "set_extraction_fan_drive_freq": [float], "set_extraction_fan_manual_control_mode": [bool], @@ -164,12 +165,13 @@ async def read_and_dispatch(self) -> None: # Convert the arguments to their expected type. args = [cast_string_to_type(t, arg) for t, arg in zip(types, args)] # Call the method with the specified arguments. - await getattr(self, command)(*args) + return_value = await getattr(self, command)(*args) # Send back a success response. await self.respond( json.dumps( dict( command=command, + return_value=return_value, error=0, exception_name="", message="", @@ -211,6 +213,9 @@ async def open_vent_gate( if gate != -1: raise ValueError(f"Invalid vent ({gate}) must be between 0 and 3.") + async def get_fan_drive_max_frequency(self) -> float: + return self.controller.get_max_frequency() + async def reset_extraction_fan_drive(self) -> None: await self.controller.vfd_fault_reset()