Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions src/sorunlib/acu.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,3 +96,21 @@ def set_shutter(action):
acu = run.CLIENTS['acu']
resp = acu.set_shutter(action=action)
check_response(acu, resp)


def set_hvac(targets, values):
"""Turn the hvac system for the LAT on or off.

Args:
targets (list of str): List of devices to set. Valid targets include
'fans', 'boosters', 'heaters' or specific devices out of these
categories, such as 'Booster Yoke Traverse M Servo Space'.
values (int, float, str, or list): Values to set for each target.
If a value matches 'on' or 'off', it will turn the device on or off.
Otherwise, it will be interpreted as a 'setpoint' (i.e fan speed %).
If values is a scalar, broadcast to all targets.

"""
acu = run.CLIENTS['acu']
resp = acu.set_hvac(targets=targets, values=values)
check_response(acu, resp)
14 changes: 14 additions & 0 deletions tests/test_acu.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,17 @@ def test_set_scan_params(patch_clients_satp):
def test_set_shutter(patch_clients_satp, action):
acu.set_shutter(action=action)
acu.run.CLIENTS['acu'].set_shutter.assert_called_with(action=action)


@pytest.mark.parametrize(
"targets, values",
[
(["boosters", "fans"], ["on", "on"]),
(["boosters", "fans"], "off"),
(["fans"], 50),
Comment on lines +87 to +89

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this representative of actual targets? Or at they just dummy values for the test? The list isn't clear to me in the socs docs either, but from there I would have expected names like "Fan Yoke Traverse A Electronic Space".

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah they are actual targets that are treated a bit differently. See: https://github.com/simonsobs/socs/blob/4413b27a567feee21a9e331bc60497c8458448aa/socs/agents/acu/agent.py#L3643 where they are parsed.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, gotcha, can you list 'fans, boosters, and heaters' and valid targets in the docstring here?

],
)
def test_set_hvac(patch_clients_lat, targets, values):
acu.set_hvac(targets=targets, values=values)
acu.run.CLIENTS['acu'].set_hvac.assert_called_with(
targets=targets, values=values)
Loading