コード例 #1
0
ファイル: acq.py プロジェクト: KambaVVV/mdsplus
 def checkTrigger(self, arg1, arg2):
     from time import sleep
     from MDSplus.mdsExceptions import DevNOT_TRIGGERED
     state = self.getBoardState()
     if state == "ACQ32:0 ST_STOP" or (state == "ACQ32:4 ST_POSTPROCESS" and (arg1 == "auto" or arg2 == "auto")):
         return
     if arg1 != "auto" and arg2 != "auto":
         tries = 0
         while state == "ACQ32:4 ST_POSTPROCESS" and tries < 120:
             tries += 1
             sleep(1)
             state = self.getBoardState()
         if state != "ACQ32:0 ST_STOP":
             raise DevNOT_TRIGGERED()
コード例 #2
0
    def store(self):
        """ Store method for the aeon 3248 digitizer  """
        from MDSplus import Data
        from MDSplus import Range
        from MDSplus.mdsExceptions import DevBAD_NAME
        from MDSplus.mdsExceptions import DevNOT_TRIGGERED

        if self.debug:
            print("starting A3248 store")
        name = self.getString(self.name, DevBAD_NAME)
        status = Data.execute('AEON_CHECKTRIGGER("%s")' % (name, ))
        if not (status & 1):
            raise DevNOT_TRIGGERED("Module %s not triggered" % name)
        setup_vector = Data.execute('AEON_GETSETUP("%s")' % (name, ))
        status_reg = int(setup_vector[0])
        gain_reg = int(setup_vector[1])
        addr = int(setup_vector[2])
        if self.debug:
            print("get dt")
        dt = self.dts[int((status_reg >> 8) & 0xF)]
        pts = 32768
        if status_reg & 0x00F1:
            pts = (status_reg & 0xFF) * 128
        if self.debug:
            print("gain reg is %d" % gain_reg)
        gain_code = ((gain_reg >> 8) & 3)
        gain = (1 << gain_code)
        if self.debug:
            print("gain is %d" % gain)
        offset = gain_reg & 0xFF
        offset = int(offset)
        if self.debug:
            print("store clock record")
        if dt == 0:
            self.clock.record = self.ext_clock
        else:
            self.clock.record = Range(None, None, dt)

        for chan in range(4):
            self.storeChannel(name, chan, addr, pts, gain, offset)
        return 1
コード例 #3
0
ファイル: acq.py プロジェクト: KambaVVV/mdsplus
    def waitftp(self):
        import time
        from MDSplus.mdsExceptions import DevOFFLINE
        from MDSplus.mdsExceptions import DevNOT_TRIGGERED
        from MDSplus.mdsExceptions import DevIO_STUCK
        from MDSplus.mdsExceptions import DevTRIGGERED_NOT_STORED
        from MDSplus.mdsExceptions import DevUNKOWN_STATE

        """Wait for board to finish digitizing and storing the data"""
        state = self.getBoardState()
        tries = 0
        while (state == "ACQ32:4 ST_POSTPROCESS") and tries < self.max_tries:
            tries = tries + 1
            state = self.getBoardState()
            time.sleep(2)

        if state == 'off-line':
            raise DevOFFLINE()
        if state == "ACQ32:1 ST_ARM" or state == "ACQ32:2 ST_RUN":
            raise DevNOT_TRIGGERED()
        if state == "ACQ32:4 ST_POSTPROCESS":
            raise DevIO_STUCK()
        if state == "ACQ32:0 ST_STOP" or state == "Ready":
            for chan in range(int(self.active_chan.record), 0, -1):
                chan_node = self.__getattr__('input_%2.2d' % (chan,))
                if chan_node.on:
                    max_chan = chan_node
                    break

            if max_chan.rlength > 0:
                return 1
            else:
                print("Triggered, but data not stored !")
                raise DevTRIGGERED_NOT_STORED()
        else:
            print("ACQxxx UNKNOWN BOARD state /%s/" % (state,))
            raise DevUNKOWN_STATE()