예제 #1
0
    def state_1(self):
        global command, state, sensors, data, pp, tmp, hvgv, vv
        data = [timestamp_sensors, sensors[1], sensors[2], sensors[3], hvgv, vv, pp, tmp]
        out = "/media/pi/KINGSTON/VACUUM_CONTROLLER/LOG"
        print "STATE 1 : ESTABLISH VACUUM\n"

        LCD_DISPLAY.main("STATE 1")  # Display  LCD : STATE 1

        # Safety Check

        # Update command log
        state = "STATE 1"
        thread_command_write = DATA_ACQUISITION_BACKUP.CommandWrite(data, out)
        thread_command_write.start()
        # Start Data acquisition
        thread_physical_write = DATA_ACQUISITION_BACKUP.PhysicalWrite(data, out, state)
        thread_physical_write.start()

        ACTIONS.pp_on()
        start_time = time.time()

        while sensors[3] < sensors[1]:
            # Error log
            WAIT_ROUTINE.wait_routine(state)
            elapsed_time = time.time() - start_time
            if elapsed_time > (3600*5):  # Check if pp switch ON for more than 5 hours
                # Error log
                STATE_4.state_4()  # Go to STATE 4 : SAFE STATE

        ACTIONS.hvgv_on()
        start_time = time.time()

        while sensors[1] > 10^(-1):
            # Error log
            WAIT_ROUTINE.wait_routine(state)
            elapsed_time = time.time() - start_time
            if elapsed_time > (3600*5):  # Check if pp switch ON for more than 5 hours
                # Error log
                STATE_4.state_4()  # Go to STATE 4 : SAFE STATE

        ACTIONS.tmp_on()
        start_time = time.time()

        while sensors[2] > 10^(-4):
            # Error log
            WAIT_ROUTINE.wait_routine(state)
            elapsed_time = time.time() - start_time
            if elapsed_time > (3600*60):  # Check if pp switch ON for more than 60 hours
                # Error log
                STATE_4.state_4()  # Go to STATE 4 : SAFE STATE

        while sensors[2] > 10^(-5):
            WAIT_ROUTINE.wait_routine(state)

        STATE_2.state_2()  # Go to STATE 2 : Maintain Vacuum
예제 #2
0
    def state_0(self):
        global state, command, mode
        print "STATE 0 : VENTED CHAMBER\n"

        LCD_DISPLAY.main("STATE 0")  # Display  LCD : STATE 0

        # Update command log
        state = "STATE 0"
        command = "VC_vent"

        # Stop Data acquisition
        # Data acquisition automatically stopped when COMMAND = "STATE 0"

        while state == "STATE 0":
            while command == "VC_vacuum":  # Receive command
                if state == "STATE 1":
                    STATE_1.State1.state_1()
                elif mode == "LOCAL":
                    error = "Error 5521"  # Send error 5521 to chamber control
                    READ_ERROR_TXT.read_error_txt(error)
                    LOCAL.local()  # Exit Remote sequence
                    print "REMOTE MODE EXIT"