コード例 #1
0
def clear_status_rec(prefix: str):
    """
    - clear all status PVs for 'recovering from pressurized system' process (5*10^-2 ~ 1*10^-8)
    - clear all status PVs for 'Off Process'
    """
    process_on = ProcessOn(prefix=prefix)
    process_off = ProcessOff(prefix=prefix)

    process_on.activate_all_status()
    process_off.clear_all_fv_status()
コード例 #2
0
def clear_status_off(prefix: str):
    """
    - clear all status PVs for 'On Process'
    - clear all status PVs for 'Recovery Process'
    """
    _logger.info("clear_status_off")
    process_on = ProcessOn(prefix=prefix)
    process_recovery = ProcessRecovery(prefix=prefix)

    process_on.clear_all_status()
    process_recovery.set_all_clear()
コード例 #3
0
ファイル: process_off.py プロジェクト: lnls-sirius/pydm-opi
    def __init__(self, prefix: str):
        if not prefix:
            raise ValueError(f"parameter prefix cannot be empty {prefix}")
        self.prefix = prefix
        self._tick = 0.5

        self.process_on = ProcessOn(prefix=prefix)
        self.process_off = ProcessOff(prefix=prefix)
        self.bbb = BBB(prefix=prefix)
        self.turbovac = Turbovac(prefix=prefix)
        self.acp = ACP(prefix=prefix)
        self.system = System(prefix=prefix)
コード例 #4
0
    def __init__(self, prefix: str):
        if not prefix:
            raise ValueError(f"parameter prefix cannot be empty {prefix}")
        self.prefix = prefix

        self._tick = 0.5

        # Create TURBOVAC PVs
        self.turbovac = Turbovac(prefix=prefix)

        # Create beaglebone PVs
        self.bbb = BBB(prefix=prefix)

        # Create ACP PVs
        self.acp = ACP(prefix=prefix)

        # Create process recovery status PVs
        self.process_recovery = ProcessRecovery(prefix=prefix)

        # Create process ON status PVs
        self.process_on = ProcessOn(prefix=prefix)
コード例 #5
0
class Initialization:
    def __init__(self, prefix: str):
        if not prefix:
            raise ValueError(f"parameter prefix cannot be empty {prefix}")
        self.prefix = prefix

        self._tick = 0.5

        # Create TURBOVAC PVs
        self.turbovac = Turbovac(prefix=prefix)

        # Create beaglebone PVs
        self.bbb = BBB(prefix=prefix)

        # Create ACP PVs
        self.acp = ACP(prefix=prefix)

        # Create process recovery status PVs
        self.process_recovery = ProcessRecovery(prefix=prefix)

        # Create process ON status PVs
        self.process_on = ProcessOn(prefix=prefix)

    def run(self):
        """if pressure is between 0.05 and 1*10**-8, trigger "process_recovery" script"""
        if (self.bbb.pressure_pv.value < 0.05) & (
            self.bbb.pressure_pv.value > 10**-8
        ):
            self._stage_1()
            self._stage_2()
            self._stage_3()
            self._stage_4()
            self._stage_5()

    def _stage_1(self):
        _logger.info("stage1")
        self.process_recovery.status1_pv.value = 1

        # turn ACP15 pump ON and wait 30 s
        self.acp.on_off_pv.value = 1

        # set ACP15 speed to maximum (6000 rpm)
        self.acp.speed_rpm.value = 6000

        # wait until pump receives command to turn on
        while self.acp.on_off_pv.value == 0:
            time.sleep(self._tick)

        time.sleep(30)

    def _stage_2(self):
        _logger.info("stage2")
        # open pre-vacuum valve
        self.bbb.pre_vacuum_valve_sw_pv.value = 1

        # wait gate valve receives command to open
        while self.bbb.pre_vacuum_valve_sw_pv.value == 0:
            time.sleep(self._tick)

        # update status
        self.process_recovery.status2_pv.value = 1

    def _stage_3(self):
        _logger.info("stage3")
        # turn TURBOVAC pump ON
        self.turbovac.pzd1_sp_tevl_pv.value = 1
        self.turbovac.pzd1_sp_zrvl_pv.value = 1

        # wait until pump receives command to turn on
        while (self.turbovac.pzd1_sp_zrvl_pv.value == 0) & (
            self.turbovac.pzd1_sp_tevl_pv.value == 0
        ):
            time.sleep(self._tick)

        self.process_recovery.status3_pv.value = 1

    def _stage_4(self):
        _logger.info(f"stage4, wait until {self.turbovac.pzd2_rb_pv}<1200")
        # wait TURBOVAC pump reaches 1200 Hz
        self.turbovac.pzd2_sp_pv.value = 1200
        self.turbovac.pzd1_sp_sxvl_pv.value = 1

        while self.turbovac.pzd2_rb_pv.value < 1200:
            time.sleep(self._tick)

        self.turbovac.pzd1_sp_sxvl_pv.value = 0

        self.process_recovery.status4_pv.value = 1

    def _stage_5(self):
        _logger.info("stage5")
        # open gate valve (VAT)
        self.bbb.gate_valve_sw_pv.value = 1

        # read gate valve (VAT) status to check if it is really open
        loop = True
        while loop:
            Lo = self.bbb.valve_open_pv.value
            Lg = self.bbb.valve_closed_pv.value
            if Lo & (not Lg):
                loop = False
            time.sleep(self._tick)

        self.process_recovery.status5_pv.value = 1
        self.process_on.activate_all_status()
コード例 #6
0
ファイル: process_off.py プロジェクト: lnls-sirius/pydm-opi
class ProcessOffAction:
    def __init__(self, prefix: str):
        if not prefix:
            raise ValueError(f"parameter prefix cannot be empty {prefix}")
        self.prefix = prefix
        self._tick = 0.5

        self.process_on = ProcessOn(prefix=prefix)
        self.process_off = ProcessOff(prefix=prefix)
        self.bbb = BBB(prefix=prefix)
        self.turbovac = Turbovac(prefix=prefix)
        self.acp = ACP(prefix=prefix)
        self.system = System(prefix=prefix)

    def run(self):
        self._clear_pvs()
        self._stage_1()
        self._stage_2()
        self._stage_3()
        self._stage_4()
        self._stage_5()
        self._stage_6()

    def _clear_pvs(self):
        """clear all status PVs"""
        _logger.info("clear_pvs")
        self.process_off.clear_all_fv_status()
        self.process_on.clear_all_status()

    def _stage_1(self):
        _logger.info("stage1")
        # close pre-vacuum valve (and keeps gate valve open)
        self.turbovac.pre_vacuum_valve_sw_pv.value = 0

        # wait until valve receives command to open
        while self.turbovac.pre_vacuum_valve_sw_pv.value:
            time.sleep(self._tick)

        self.process_off.off_fv_status1_pv.value = 1

    def _stage_2(self):
        _logger.info("stage2")
        # change venting valve to manual control
        self.turbovac.ak_sp_pv.value = 0
        self.turbovac.pnu_sp_pv.value = 134
        self.turbovac.ind_sp_pv.value = 2
        self.turbovac.pwe_sp_pv.value = 18
        self.turbovac.ak_sp_pv.value = 7

        # turn TURBOVAC and ACP15 pumps OFF
        self.turbovac.pzd1_sp_zrvl_pv.value = 0
        self.acp.on_off_pv.value = 0

        # wait until pump receives command to turn off
        while self.acp.on_off_pv.value:
            time.sleep(self._tick)

        self.process_off.off_fv_status2_pv.value = 1

    def _stage_3(self):
        """wait until TURBOVAC frequency decrease to 600 Hz"""
        _logger.info("stage3")
        while self.turbovac.pzd2_rb_pv.value > self.system.off_frequency_pv.value:
            time.sleep(self._tick)

        self.process_off.off_fv_status3_pv.value = 1

    def _stage_4(self):
        _logger.info("stage4")
        # open X203 valve (TURBOVAC venting valve)
        self.turbovac.venting_valve_sw_pv.value = 1

        # update UI checkbox status
        self.turbovac.venting_valve_ui_pv_rval.value = 1

        # wait until venting valve receives command to close
        while self.turbovac.venting_valve_sw_pv.value == 0:
            time.sleep(self._tick)

        self.process_off.off_fv_status4_pv.value = 1

    def _check_bbb_less_than_off_pressure(self) -> bool:
        bbb_off_pressure = (self.system.off_pressure_base_pv.value *
                            10**self.system.off_pressure_exp_pv.value)
        return self.bbb.pressure_pv.value < bbb_off_pressure

    def _stage_5(self):
        _logger.info("stage5")
        while self._check_bbb_less_than_off_pressure():
            time.sleep(self._tick)

        self.process_off.off_fv_status5_pv.value = 1

    def _stage_6(self):
        """Stage 6:"""
        _logger.info("stage6")

        # close all the valves (gate valve is already closed)
        self.bbb.gate_valve_sw_pv.value = 0
        self.turbovac.venting_valve_sw_pv.value = 0  # close X203
        self.bbb.gate_valve_ui_pv.value = 0
        self.turbovac.venting_valve_ui_pv_rval.value = 0  # close X203

        # wait until venting valve receives command to close
        while self.bbb.gate_valve_sw_pv.value:
            time.sleep(self._tick)

        self.process_off.off_fv_status6_pv.value = 1

        # complement value of PV to launch "Process Finished" window
        self.process_off.toggle()
コード例 #7
0
ファイル: process_on.py プロジェクト: lnls-sirius/pydm-opi
class ProcessOnAction:
    def __init__(self, prefix: str):
        if not prefix:
            raise ValueError(f"parameter prefix cannot be empty {prefix}")
        self.prefix = prefix
        self._tick = 0.5

        self.process_on = ProcessOn(prefix=self.prefix)
        self.process_off = ProcessOff(prefix=self.prefix)
        self.turbovc = Turbovac(prefix=self.prefix)
        self.bbb = BBB(prefix=self.prefix)
        self.acp = ACP(prefix=self.prefix)
        self.system = System(prefix=self.prefix)

    def run(self):
        self._clear_status()
        self._stage_1()
        self._stage_2()
        self._stage_3()
        self._stage_4()
        self._stage_5()

    def _clear_status(self):
        _logger.info("Clear status")
        # clear all status PVs
        self.process_on.clear_all_status()
        self.process_off.clear_all_fv_status()

    def _stage_1(self):
        """wait TURBOVAC pump stops completely"""
        _logger.info("Stage 1")
        self.process_on.status1_pv.value = 1

        while self.turbovc.pzd2_rb_pv.value != 0:
            time.sleep(self._tick)

    def _stage_2(self):
        """Stage 2:"""
        _logger.info("Stage 2")
        # open gate valve (VAT) and the pre-vacuum valve
        self.bbb.gate_valve_sw_pv.value = 1
        self.bbb.pre_vacuum_valve_sw_pv.value = 1

        # update UI checkbox status
        # epics.caput(GATE_VALVE_UI, 1)
        # epics.caput(PRE_VACUUM_VALVE_UI, 1)

        # ---------------------------------------
        # wait gate valve receives command to open
        while self.bbb.pre_vacuum_valve_sw_pv.value == 0:
            time.sleep(self._tick)

        # read gate valve (VAT) status to check if it is really open
        loop = True
        while loop:
            Lo = self.bbb.valve_open_pv.value
            Lg = self.bbb.valve_closed_pv.value

            if Lo & (not (Lg)):
                loop = False
            time.sleep(self._tick)

        self.process_on.status2_pv.value = 1

    def _stage_3(self):
        """Stage 3:"""
        _logger.info("Stage 3")
        # turn ACP15 pump ON
        self.acp.on_off_pv.value = 1
        # wait until pump receives command to turn on
        while self.acp.on_off_pv.value == 0:
            time.sleep(self._tick)

        self.process_on.status3_pv.value = 1

    def check_pressure_limits(self) -> bool:
        """Is pressure under 5*(10^-2) Torr"""
        return self.bbb.pressure_pv.value > (
            self.system.on_pressure_base_pv.value *
            10**self.system.on_pressure_exp_pv.value)

    def _stage_4(self):
        """Stage 4: read the pressure and proceed when its value is under 5*(10^-2) Torr"""
        _logger.info("Stage 4")
        while self.check_pressure_limits():
            time.sleep(self._tick)

        self.process_on.status4_pv.value = 1

    def _stage_5(self):
        """Stage 5:"""
        _logger.info("Stage 5")
        # turn TURBOVAC pump ON
        self.turbovc.pzd1_sp_tevl_pv.value = 1
        self.turbovc.pzd1_sp_zrvl_pv.value = 1

        # wait until pump receives command to turn on
        while (self.turbovc.pzd1_sp_tevl_pv.value
               == 0) & (self.turbovc.pzd1_sp_zrvl_pv.value == 0):
            time.sleep(self._tick)

        self.process_on.status5_pv.value = 1

        # complement value of PV to launch "Process Finished" window
        self.process_on.toggle()