Пример #1
0
    def test_stop(self):
        # shift positions according to autohome
        decoder.apply_autohome(self.timeline, self.events[14] + 2)
        self.timeline[3] += 10000

        # motors reach probing position
        slice = decoder.from_to(self.timeline, self.events[14],
                                self.events[18])
        assert decoder.move_cumul_up(slice, 1) == 500
        assert decoder.move_cumul_up(slice, 2) == 500

        # define probing time
        probing_time = decoder.when_is_position_reached(
            self.timeline, 500, 500, 10000)
        assert probing_time != -1

        # z move down
        slice = decoder.from_to(self.timeline, probing_time, self.events[19])
        assert decoder.move_cumul_down(slice, 3) > 100
        assert decoder.move_cumul_up(slice, 3) == 0

        # z stopped and move 3mm up
        slice = decoder.from_to(self.timeline, self.events[19],
                                self.events[19] + 2)
        min_pos_time = decoder.when_is_lowest_position_reached(slice, 3)
        slice = decoder.from_to(self.timeline, min_pos_time, self.events[20])
        assert decoder.move_cumul_down(slice, 3) == 0
        assert decoder.move_cumul_up(slice, 3) == 300

        # no plasma before cut
        slice = decoder.from_to(self.timeline, min_pos_time, self.events[20])
        plasma_start = decoder.when_is_highest_position_reached(slice, 3)
        cut_start = self.events[20] + 200
        slice = decoder.from_to(self.timeline, 0, plasma_start)
        assert decoder.plasma_is_always(slice, 'off')

        # no move during piercing
        slice = decoder.from_to(self.timeline, plasma_start + 1, cut_start)
        assert decoder.move_cumul(slice, 1) == 0
        assert decoder.move_cumul(slice, 2) == 0
        assert decoder.move_cumul(slice, 3) == 0

        # plasma fired all along and z move enough with THC
        slice = decoder.from_to(self.timeline, plasma_start + 5,
                                self.events[21])
        assert decoder.plasma_is_always(slice, 'on')
        assert decoder.move_cumul(slice, 3) > 1000

        # no XY after stop
        slice = decoder.from_to(self.timeline, self.events[21] + 60,
                                decoder.end(self.timeline))
        assert decoder.move_cumul(slice, 1) == 0
        assert decoder.move_cumul(slice, 2) == 0
        assert decoder.plasma_is_always(slice, 'off')

        # final position
        assert decoder.get_position(self.timeline,
                                    decoder.end(self.timeline))[2] == 10000
Пример #2
0
    def test_M3_no_M5(self):
        # shift positions according to autohome
        decoder.apply_autohome(self.timeline, self.events[13] + 2)
        self.timeline[3] += 10000

        # motors reach probing position
        slice = decoder.from_to(self.timeline, self.events[13],
                                self.events[14])
        assert decoder.move_cumul_up(slice, 1) == 1000
        assert decoder.move_cumul_up(slice, 2) == 1000

        # define probing time
        probing_time = decoder.when_is_position_reached(
            self.timeline, 1000, 1000, 10000)
        assert probing_time != -1

        # z move down
        slice = decoder.from_to(self.timeline, probing_time, self.events[14])
        assert decoder.move_cumul_down(slice, 3) > 100
        assert decoder.move_cumul_up(slice, 3) == 0

        # z stopped and move 3mm up
        slice = decoder.from_to(self.timeline, self.events[14],
                                self.events[14] + 2)
        min_pos_time = decoder.when_is_lowest_position_reached(slice, 3)
        slice = decoder.from_to(self.timeline, min_pos_time, self.events[15])
        assert decoder.move_cumul_down(slice, 3) == 0
        assert decoder.move_cumul_up(slice, 3) == 300

        # no plasma before cut
        slice = decoder.from_to(self.timeline, min_pos_time, self.events[15])
        plasma_start = decoder.when_is_highest_position_reached(slice, 3)
        cut_start = self.events[15] + 200
        slice = decoder.from_to(self.timeline, 0, plasma_start)
        assert decoder.plasma_is_always(slice, 'off')

        # no move during piercing
        slice = decoder.from_to(self.timeline, plasma_start + 1, cut_start)
        assert decoder.move_cumul(slice, 1) == 0
        assert decoder.move_cumul(slice, 2) == 0
        assert decoder.move_cumul(slice, 3) == 0

        # reach intermediate positions
        slice = decoder.from_to(self.timeline, plasma_start,
                                decoder.end(self.timeline))
        assert decoder.when_is_position_reached(self.timeline, 3000, 1000,
                                                None) != -1
        assert decoder.when_is_position_reached(self.timeline, 3000, 3000,
                                                None) != -1

        # reach cutoff position
        slice = decoder.from_to(self.timeline, self.events[15],
                                decoder.end(self.timeline))
        plasma_stop = decoder.when_is_position_reached(slice, 0, 0, None)
        assert plasma_stop != -1

        # plasma fired all along and z move enough with THC
        slice = decoder.from_to(self.timeline, plasma_start + 5, plasma_stop)
        assert decoder.plasma_is_always(slice, 'on')
        assert decoder.move_cumul(slice, 3) > 4000

        # no plasma after cut off
        slice = decoder.from_to(self.timeline, plasma_stop + 80,
                                decoder.end(self.timeline))
        assert decoder.plasma_is_always(slice, 'off')

        # final position
        assert decoder.get_position(self.timeline,
                                    decoder.end(self.timeline)) == (0, 0,
                                                                    10000)
Пример #3
0
    def test_plasma_timeout(self):
        # shift positions according to autohome
        decoder.apply_autohome(self.timeline, self.events[12] + 2)
        self.timeline[3] += 10000

        # motors reach probing position
        slice = decoder.from_to(self.timeline, self.events[12],
                                self.events[13])
        assert decoder.move_cumul_up(slice, 1) == 1000
        assert decoder.move_cumul_up(slice, 2) == 1000

        # define probing time
        probing_time = decoder.when_is_position_reached(
            self.timeline, 1000, 1000, 10000)
        assert probing_time != -1

        # z move down
        slice = decoder.from_to(self.timeline, probing_time, self.events[13])
        assert decoder.move_cumul_down(slice, 3) > 100
        assert decoder.move_cumul_up(slice, 3) == 0

        # z stopped and move 3mm up
        slice = decoder.from_to(self.timeline, self.events[13],
                                self.events[13] + 2)
        min_pos_time = decoder.when_is_lowest_position_reached(slice, 3)
        slice = decoder.from_to(self.timeline, min_pos_time, self.events[14])
        assert decoder.move_cumul_down(slice, 3) == 0
        assert decoder.move_cumul_up(slice, 3) == 300

        # no plasma before cut
        slice = decoder.from_to(self.timeline, min_pos_time, self.events[14])
        plasma_start = decoder.when_is_highest_position_reached(slice, 3)
        plasma_stop = plasma_start + 1000
        slice = decoder.from_to(self.timeline, 0, plasma_start)
        assert decoder.plasma_is_always(slice, 'off')

        # no move during ignition try
        slice = decoder.from_to(self.timeline, plasma_start + 1, plasma_stop)
        assert decoder.move_cumul(slice, 1) == 0
        assert decoder.move_cumul(slice, 2) == 0
        assert decoder.move_cumul(slice, 3) == 0

        # plasma during 1 sec
        slice = decoder.from_to(self.timeline, plasma_start + 5,
                                plasma_stop - 5)
        assert decoder.plasma_is_always(slice, 'on')

        # plasma stop when timeout
        slice = decoder.from_to(self.timeline, plasma_start + 1000 + 5,
                                self.events[17])
        assert decoder.plasma_is_always(slice, 'off')

        # plasma restart on resume and z move enough with THC
        plasma_stop_2 = decoder.when_is_position_reached(
            self.timeline, 2000, 2000, None)
        assert plasma_stop_2 != -1
        slice = decoder.from_to(self.timeline, self.events[18], plasma_stop_2)
        assert decoder.plasma_is_always(slice, 'on')
        assert decoder.move_cumul(slice, 3) > 3000

        # no move during ignition
        cut_start = self.events[18] + 200
        slice = decoder.from_to(self.timeline, self.events[18], cut_start)
        assert decoder.move_cumul(slice, 1) == 0
        assert decoder.move_cumul(slice, 2) == 0
        assert decoder.move_cumul(slice, 3) == 0

        # plasma stop after cutoff
        slice = decoder.from_to(self.timeline, plasma_stop_2 + 2,
                                decoder.end(self.timeline))
        assert decoder.plasma_is_always(slice, 'off')

        # final position
        assert decoder.get_position(self.timeline,
                                    decoder.end(self.timeline)) == (0, 0,
                                                                    10000)
Пример #4
0
    def test_transfer_loss(self):
        # shift positions according to autohome
        decoder.apply_autohome(self.timeline, self.events[14] + 2)
        self.timeline[3] += 10000

        # motors reach probing position
        slice = decoder.from_to(self.timeline, self.events[14],
                                self.events[15])
        assert decoder.move_cumul_up(slice, 1) == 500
        assert decoder.move_cumul_up(slice, 2) == 500

        # define probing time
        probing_time = decoder.when_is_position_reached(
            self.timeline, 500, 500, 10000)
        assert probing_time != -1

        # z move down
        slice = decoder.from_to(self.timeline, probing_time, self.events[15])
        assert decoder.move_cumul_down(slice, 3) > 100
        assert decoder.move_cumul_up(slice, 3) == 0

        # z stopped and move 3mm up
        slice = decoder.from_to(self.timeline, self.events[15],
                                self.events[15] + 2)
        min_pos_time = decoder.when_is_lowest_position_reached(slice, 3)
        slice = decoder.from_to(self.timeline, min_pos_time, self.events[16])
        assert decoder.move_cumul_down(slice, 3) == 0
        assert decoder.move_cumul_up(slice, 3) == 300

        # no plasma before cut
        slice = decoder.from_to(self.timeline, min_pos_time, self.events[16])
        plasma_start = decoder.when_is_highest_position_reached(slice, 3)
        cut_start = self.events[16] + 200
        slice = decoder.from_to(self.timeline, 0, plasma_start)
        assert decoder.plasma_is_always(slice, 'off')

        # no move during piercing
        slice = decoder.from_to(self.timeline, plasma_start + 1, cut_start)
        assert decoder.move_cumul(slice, 1) == 0
        assert decoder.move_cumul(slice, 2) == 0
        assert decoder.move_cumul(slice, 3) == 0

        # plasma until transfer loss
        slice = decoder.from_to(self.timeline, plasma_start + 5,
                                self.events[17])
        assert decoder.plasma_is_always(slice, 'on')
        assert decoder.move_cumul(slice, 3) > 1000

        # plasma stop when transfer lost
        slice = decoder.from_to(self.timeline, self.events[17] + 2,
                                self.events[22])
        assert decoder.plasma_is_always(slice, 'off')

        paused = decoder.when_is_position_reached(self.timeline, 5000, 3000,
                                                  10000)
        assert paused != -1

        # define probing time
        probing_time_2 = decoder.when_is_position_reached(
            self.timeline, 4000, 6000, 10000)
        assert probing_time_2 != -1

        # z move down
        slice = decoder.from_to(self.timeline, probing_time_2, self.events[22])
        assert decoder.move_cumul_down(slice, 3) > 100
        assert decoder.move_cumul_up(slice, 3) == 0

        # z stopped and move 3mm up
        slice = decoder.from_to(self.timeline, self.events[22],
                                self.events[22] + 2)
        min_pos_time_2 = decoder.when_is_lowest_position_reached(slice, 3)
        slice = decoder.from_to(self.timeline, min_pos_time_2, self.events[23])
        assert decoder.move_cumul_down(slice, 3) == 0
        assert decoder.move_cumul_up(slice, 3) == 300

        # plasma restart on resume and z move enough with THC
        plasma_stop_2 = decoder.when_is_position_reached(
            self.timeline, 8000, 5000, None)
        assert plasma_stop_2 != -1
        slice = decoder.from_to(self.timeline, self.events[23], plasma_stop_2)
        assert decoder.plasma_is_always(slice, 'on')
        assert decoder.move_cumul(slice, 3) > 2000

        # no move during ignition
        cut_start_2 = self.events[23] + 200
        slice = decoder.from_to(self.timeline, self.events[23], cut_start_2)
        assert decoder.move_cumul(slice, 1) == 0
        assert decoder.move_cumul(slice, 2) == 0
        assert decoder.move_cumul(slice, 3) == 0

        # plasma stop after cutoff
        slice = decoder.from_to(self.timeline, plasma_stop_2 + 2,
                                decoder.end(self.timeline))
        assert decoder.plasma_is_always(slice, 'off')

        # final position
        assert decoder.get_position(self.timeline,
                                    decoder.end(self.timeline)) == (0, 0,
                                                                    10000)
Пример #5
0
    def test_pause(self):
        # shift positions according to autohome
        decoder.apply_autohome(self.timeline, self.events[14] + 2)
        self.timeline[3] += 10000

        # motors reach probing position
        slice = decoder.from_to(self.timeline, self.events[14],
                                self.events[18])
        assert decoder.move_cumul_up(slice, 1) == 500
        assert decoder.move_cumul_up(slice, 2) == 500

        # define probing time
        probing_time = decoder.when_is_position_reached(
            self.timeline, 500, 500, 10000)
        assert probing_time != -1

        # z move down
        slice = decoder.from_to(self.timeline, probing_time, self.events[18])
        assert decoder.move_cumul_down(slice, 3) > 100
        assert decoder.move_cumul_up(slice, 3) == 0

        # z stopped and move 3mm up
        slice = decoder.from_to(self.timeline, self.events[18],
                                self.events[18] + 2)
        min_pos_time = decoder.when_is_lowest_position_reached(slice, 3)
        slice = decoder.from_to(self.timeline, min_pos_time, self.events[19])
        assert decoder.move_cumul_down(slice, 3) == 0
        assert decoder.move_cumul_up(slice, 3) == 300

        # no plasma before cut
        slice = decoder.from_to(self.timeline, min_pos_time, self.events[19])
        plasma_start = decoder.when_is_highest_position_reached(slice, 3)
        cut_start = self.events[19] + 200
        slice = decoder.from_to(self.timeline, 0, plasma_start)
        assert decoder.plasma_is_always(slice, 'off')

        # no move during piercing
        slice = decoder.from_to(self.timeline, plasma_start + 1, cut_start)
        assert decoder.move_cumul(slice, 1) == 0
        assert decoder.move_cumul(slice, 2) == 0
        assert decoder.move_cumul(slice, 3) == 0

        # reach cutoff position
        plasma_stop = decoder.when_is_position_reached(self.timeline, 5000,
                                                       3000, None)
        assert plasma_stop != -1

        # plasma fired all along and z move enough with THC
        slice = decoder.from_to(self.timeline, plasma_start + 5, plasma_stop)
        assert decoder.plasma_is_always(slice, 'on')
        assert decoder.move_cumul(slice, 3) > 3000

        # wait for resume
        slice = decoder.from_to(self.timeline, plasma_stop, self.events[22])
        assert decoder.move_cumul(slice, 1) == 0
        assert decoder.move_cumul(slice, 2) == 0

        # z goes back to top
        slice = decoder.from_to(self.timeline, plasma_stop, self.events[22])
        assert decoder.max_pos(slice, 3) == 10000

        # define probing time
        probing_time = decoder.when_is_position_reached(
            self.timeline, 4000, 6000, 10000)
        assert probing_time != -1

        # z move down
        slice = decoder.from_to(self.timeline, probing_time, self.events[23])
        assert decoder.move_cumul_down(slice, 3) > 100
        assert decoder.move_cumul_up(slice, 3) == 0

        # z stopped and move 3mm up
        slice = decoder.from_to(self.timeline, self.events[23],
                                self.events[23] + 2)
        min_pos_time = decoder.when_is_lowest_position_reached(slice, 3)
        slice = decoder.from_to(self.timeline, min_pos_time, self.events[24])
        assert decoder.move_cumul_down(slice, 3) == 0
        assert decoder.move_cumul_up(slice, 3) == 300

        # no plasma before cut
        slice = decoder.from_to(self.timeline, min_pos_time, self.events[24])
        plasma_start = decoder.when_is_highest_position_reached(slice, 3)
        cut_start = self.events[24] + 200
        slice = decoder.from_to(self.timeline, self.events[21], plasma_start)
        assert decoder.plasma_is_always(slice, 'off')

        # no move during ignition
        cut_start = self.events[24] + 200
        slice = decoder.from_to(self.timeline, self.events[24], cut_start)
        assert decoder.move_cumul(slice, 1) == 0
        assert decoder.move_cumul(slice, 2) == 0
        assert decoder.move_cumul(slice, 3) == 0

        # plasma stop after cutoff
        slice = decoder.from_to(self.timeline, self.events[25],
                                decoder.end(self.timeline))
        assert decoder.plasma_is_always(slice, 'off')

        # final position
        assert decoder.get_position(self.timeline,
                                    decoder.end(self.timeline)) == (0, 0,
                                                                    10000)