diff --git a/src/dodal/devices/pressure_jump_cell.py b/src/dodal/devices/pressure_jump_cell.py index 50558e96db..4fcee8fce3 100644 --- a/src/dodal/devices/pressure_jump_cell.py +++ b/src/dodal/devices/pressure_jump_cell.py @@ -54,27 +54,30 @@ class PressureJumpCellPumpMotorDirection: class PressureJumpCellValveState: - FAULT = "Fault" - OPEN = "Open" - OPENING = "Opening" - CLOSED = "Closed" - CLOSING = "Closing" - NONE5 = "" - NONE6 = "" + FAULT = "Fault" + OPEN = "Open" + OPENING = "Opening" + CLOSED = "Closed" + CLOSING = "Closing" + NONE5 = "" + NONE6 = "" + class PressureJumpCellFastValveState: - FAULT = "Fault" - OPEN = "Open" - OPEN_ARMED = "Open Armed" - CLOSED = "Closed" - CLOSED_ARMED = "Closed Armed" - NONE5 = "Unused" - NONE6 = "" + FAULT = "Fault" + OPEN = "Open" + OPEN_ARMED = "Open Armed" + CLOSED = "Closed" + CLOSED_ARMED = "Closed Armed" + NONE5 = "Unused" + NONE6 = "" + class PressureJumpCellLimitSwitch: OFF = "Off" ON = "On" + class PressureJumpCell(StandardReadable): """ High pressure X-ray cell, used to apply pressure or pressure jumps to a sample. @@ -89,12 +92,20 @@ def __init__( ) -> None: with self.add_children_as_readables(): ## Valves ## - self.valve1_state = epics_signal_r(PressureJumpCellValveState, prefix + "V1:STA") + self.valve1_state = epics_signal_r( + PressureJumpCellValveState, prefix + "V1:STA" + ) # V2 - valve manual control - self.valve3_state = epics_signal_r(PressureJumpCellValveState, prefix + "V3:STA") + self.valve3_state = epics_signal_r( + PressureJumpCellValveState, prefix + "V3:STA" + ) # V4 - valve manual control - self.valve5_state = epics_signal_r(PressureJumpCellFastValveState, prefix + "V5:STA") - self.valve6_state = epics_signal_r(PressureJumpCellFastValveState, prefix + "V6:STA") + self.valve5_state = epics_signal_r( + PressureJumpCellFastValveState, prefix + "V5:STA" + ) + self.valve6_state = epics_signal_r( + PressureJumpCellFastValveState, prefix + "V6:STA" + ) # V7 - valve manual control # V8 - valve manual control @@ -103,8 +114,12 @@ def __init__( ## Pump ## self.pump_position = epics_signal_r(float, prefix + "POS") - self.pump_forward_limit = epics_signal_r(PressureJumpCellLimitSwitch, prefix + "D74IN1") - self.pump_backward_limit = epics_signal_r(PressureJumpCellLimitSwitch, prefix + "D74IN0") + self.pump_forward_limit = epics_signal_r( + PressureJumpCellLimitSwitch, prefix + "D74IN1" + ) + self.pump_backward_limit = epics_signal_r( + PressureJumpCellLimitSwitch, prefix + "D74IN0" + ) self.pump_motor_direction = epics_signal_r( PressureJumpCellPumpMotorDirection, prefix + "MTRDIR" ) diff --git a/tests/devices/unit_tests/test_pressure_jump_cell.py b/tests/devices/unit_tests/test_pressure_jump_cell.py index 208bb0391b..b71149397c 100644 --- a/tests/devices/unit_tests/test_pressure_jump_cell.py +++ b/tests/devices/unit_tests/test_pressure_jump_cell.py @@ -6,13 +6,14 @@ from dodal.devices.pressure_jump_cell import ( PressureJumpCell, PressureJumpCellBusyStatus, + PressureJumpCellFastValveState, + PressureJumpCellLimitSwitch, PressureJumpCellPumpMotorDirection, PressureJumpCellTimerState, PressureJumpCellValveState, - PressureJumpCellFastValveState, - PressureJumpCellLimitSwitch ) + @pytest.fixture async def pressurejumpcell() -> PressureJumpCell: async with DeviceCollector(mock=True): @@ -26,18 +27,25 @@ async def test_reading_pjumpcell_includes_read_fields( ): set_mock_value(pressurejumpcell.valve1_state, PressureJumpCellValveState.CLOSED) set_mock_value(pressurejumpcell.valve3_state, PressureJumpCellValveState.OPEN) - set_mock_value(pressurejumpcell.valve5_state, PressureJumpCellFastValveState.CLOSED_ARMED) - set_mock_value(pressurejumpcell.valve6_state, PressureJumpCellFastValveState.OPEN_ARMED) + set_mock_value( + pressurejumpcell.valve5_state, PressureJumpCellFastValveState.CLOSED_ARMED + ) + set_mock_value( + pressurejumpcell.valve6_state, PressureJumpCellFastValveState.OPEN_ARMED + ) set_mock_value(pressurejumpcell.cell_temperature, 12.3) - set_mock_value(pressurejumpcell.pump_position, 100) + set_mock_value(pressurejumpcell.pump_position, 100) set_mock_value(pressurejumpcell.pump_forward_limit, PressureJumpCellLimitSwitch.OFF) set_mock_value(pressurejumpcell.pump_backward_limit, PressureJumpCellLimitSwitch.ON) - set_mock_value(pressurejumpcell.pump_motor_direction, PressureJumpCellPumpMotorDirection.FORWARD) + set_mock_value( + pressurejumpcell.pump_motor_direction, + PressureJumpCellPumpMotorDirection.FORWARD, + ) set_mock_value(pressurejumpcell.pump_speed_rbv, 100) set_mock_value(pressurejumpcell.pressuretransducer1_omron_pressure, 1001) set_mock_value(pressurejumpcell.pressuretransducer1_omron_voltage, 2.51) set_mock_value(pressurejumpcell.pressuretransducer1_beckhoff_pressure, 1001.1) - set_mock_value(pressurejumpcell.pressuretransducer1_beckhoff_voltage, 2.51) + set_mock_value(pressurejumpcell.pressuretransducer1_beckhoff_voltage, 2.51) set_mock_value(pressurejumpcell.pressuretransducer2_omron_pressure, 1002) set_mock_value(pressurejumpcell.pressuretransducer2_omron_voltage, 2.52) set_mock_value(pressurejumpcell.pressuretransducer2_beckhoff_pressure, 1002.2) @@ -50,11 +58,10 @@ async def test_reading_pjumpcell_includes_read_fields( set_mock_value(pressurejumpcell.control_timer, PressureJumpCellTimerState.COUNTDOWN) set_mock_value(pressurejumpcell.control_counter, 123) set_mock_value(pressurejumpcell.control_script_status, "ABC") - set_mock_value(pressurejumpcell.control_routine, "CDE") + set_mock_value(pressurejumpcell.control_routine, "CDE") set_mock_value(pressurejumpcell.control_state, "EFG") set_mock_value(pressurejumpcell.control_iteration, 456) - await assert_reading( pressurejumpcell, { @@ -205,4 +212,3 @@ async def test_reading_pjumpcell_includes_read_fields( }, }, ) -