Skip to content

Commit

Permalink
Cell connected following testing in P38
Browse files Browse the repository at this point in the history
  • Loading branch information
barnettwilliam committed Jul 30, 2024
1 parent df603db commit 7af5a66
Showing 1 changed file with 48 additions and 22 deletions.
70 changes: 48 additions & 22 deletions src/dodal/devices/pressure_jump_cell.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,17 @@ class StopState(str, Enum):
CONTINUE = "CONTINUE"
STOP = "STOP"


class ValveControlRequest(str, Enum):
class FastValveControlRequest(str, Enum):
OPEN = "Open"
CLOSE = "Close"
RESET = "Reset"
ARM = "Arm"
DISARM = "Disarm"

class ValveControlRequest(str, Enum):
OPEN = "Open"
CLOSE = "Close"
RESET = "Reset"

class PumpMotorControlRequest(str, Enum):
ENABLE = "Enable"
Expand All @@ -47,14 +50,9 @@ class PumpMotorControlRequest(str, Enum):


class PumpMotorDirectionState(str, Enum):
ZERO = "0"
EMPTY = ""
FORWARD = "Forward"
REVERSE = "Reverse"
THREE = "3"
FOUR = "4"
FIVE = "5"
SIX = "6"
SEVEN = "7"


class ValveState(str, Enum):
Expand Down Expand Up @@ -100,9 +98,9 @@ def __init__(self, prefix: str, name: str = "") -> None:
)

with self.add_children_as_readables(ConfigSignal):
self.valves_open: DeviceVector[SignalR[bool]] = DeviceVector(
self.valves_open: DeviceVector[SignalR[int]] = DeviceVector(
{
i: epics_signal_rw(bool, f"{prefix}V{i}:OPENSEQ")
i: epics_signal_rw(int, f"{prefix}V{i}:OPENSEQ")
for i in [1, 3, 5, 6]
}
)
Expand All @@ -111,7 +109,16 @@ def __init__(self, prefix: str, name: str = "") -> None:
DeviceVector(
{
i: epics_signal_rw(ValveControlRequest, f"{prefix}V{i}:CON")
for i in [1, 3, 5, 6]
for i in [1, 3]
}
)
)

self.fast_valve_control: DeviceVector[SignalR[FastValveControlRequest]] = (
DeviceVector(
{
i: epics_signal_rw(FastValveControlRequest, f"{prefix}V{i}:CON")
for i in [ 5, 6]
}
)
)
Expand All @@ -132,12 +139,12 @@ def __init__(self, prefix: str, name: str = "") -> None:
self.pump_motor_direction = epics_signal_r(
PumpMotorDirectionState, prefix + "MTRDIR"
)
self.pump_speed_rbv = epics_signal_r(int, prefix + "MSPEED_RBV")
self.pump_speed_rbv = epics_signal_r(float, prefix + "MSPEED_RBV")

with self.add_children_as_readables(ConfigSignal):
self.pump_mode = epics_signal_rw(PumpState, prefix + "SP:AUTO")
self.pump_speed = epics_signal_rw(float, prefix + "MSPEED")
self.pump_move_forward = epics_signal_rw(bool, prefix + "M1:FORW")
self.pump_move_forward = epics_signal_rw(int, prefix + "M1:FORW")
self.pump_move_backward = epics_signal_rw(bool, prefix + "M1:BACKW")
self.pump_move_backward = epics_signal_rw(
PumpMotorControlRequest, prefix + "M1:CON"
Expand All @@ -148,15 +155,15 @@ def __init__(self, prefix: str, name: str = "") -> None:

class PressureTransducer(StandardReadable):
"""
todo does this do?
reads pressure
"""

def __init__(self, prefix: str, name: str = "", adc_prefix: str = "") -> None:
def __init__(self, prefix: str, number: int, name: str = "", adc_prefix: str = "" ) -> None:
with self.add_children_as_readables():
self.omron_pressure = epics_signal_r(float, prefix + "PP:PRES")
self.omron_voltage = epics_signal_r(float, prefix + "PP:RAW")
self.omron_pressure = epics_signal_r(float, f"{prefix}PP{number}:PRES")
self.omron_voltage = epics_signal_r(float, f"{prefix}PP{number}:RAW")
self.beckhoff_pressure = epics_signal_r(
float, prefix + "STATP:MeanValue_RBV"
float, f"{prefix}STATP{number}:MeanValue_RBV"
)
self.beckhoff_voltage = epics_signal_r(float, adc_prefix + "CH1")
# todo this channel might be liable to change
Expand All @@ -174,7 +181,7 @@ def __init__(self, prefix: str, name: str = "") -> None:
self.control_script_status = epics_signal_r(str, prefix + "CTRL:RESULT")
self.control_routine = epics_signal_r(str, prefix + "CTRL:METHOD")
self.control_state = epics_signal_r(str, prefix + "CTRL:STATE")
self.control_iteration = epics_signal_r(int, prefix + "CTRL:ITER")
self.control_iteration = epics_signal_r(float, prefix + "CTRL:ITER")

with self.add_children_as_readables(ConfigSignal):
self.control_stop = epics_signal_rw(StopState, prefix + "CTRL:STOP")
Expand All @@ -197,6 +204,22 @@ def __init__(self, prefix: str, name: str = "") -> None:
super().__init__(name)


# h_pressure_xray_cell: NotConnected:
# coros: NotConnected:
# pressure_transducer_1: NotConnected:
# omron_pressure: NotConnected: ca://-HPXC-01:PP1:PRES
# omron_voltage: NotConnected: ca://-HPXC-01:PP1:RAW
# beckhoff_pressure: NotConnected: ca://-HPXC-01:PP1:STATP:MeanValue_RBV
# pressure_transducer_2: NotConnected:
# omron_pressure: NotConnected: ca://-HPXC-01:PP2:PRES
# omron_voltage: NotConnected: ca://-HPXC-01:PP2:RAW
# beckhoff_pressure: NotConnected: ca://-HPXC-01:PP2:STATP:MeanValue_RBV
# pressure_transducer_3: NotConnected:
# omron_pressure: NotConnected: ca://-HPXC-01:PP3:PRES
# omron_voltage: NotConnected: ca://-HPXC-01:PP3:RAW
# beckhoff_pressure: NotConnected: ca://-HPXC-01:PP3:STATP:MeanValue_RBV


class PressureJumpCell(StandardReadable):
"""
High pressure X-ray cell, used to apply pressure or pressure jumps to a sample.
Expand All @@ -213,19 +236,22 @@ def __init__(
self.pump = Pump(f"{prefix}{cell_prefix}", name)

self.pressure_transducer_1 = PressureTransducer(
prefix + "PP1:",
prefix=f"{prefix}{cell_prefix}",
name="Pressure Transducer 1",
adc_prefix=f"{prefix}{adc_prefix}-01:",
number=1
)
self.pressure_transducer_2 = PressureTransducer(
prefix + "PP2:",
prefix=f"{prefix}{cell_prefix}",
name="Pressure Transducer 2",
adc_prefix=f"{prefix}{adc_prefix}-02:",
number=2
)
self.pressure_transducer_3 = PressureTransducer(
prefix + "PP3:",
prefix=f"{prefix}{cell_prefix}",
name="Pressure Transducer 3",
adc_prefix=f"{prefix}{adc_prefix}-01:",
number=3
)

self.controller = PressureJumpCellController(f"{prefix}{cell_prefix}", name)
Expand Down

0 comments on commit 7af5a66

Please sign in to comment.