Esempio n. 1
0
class Test(unittest.TestCase):
    motor = os.getenv("TESTEDMOTORAXIS")
    capv_lib.capvput(motor + '-DbgStrToLOG',
                     "Start " + os.path.basename(__file__)[0:20])
    saved_CNEN = capv_lib.capvget(motor + '.CNEN')
    saved_PwrAuto = capv_lib.capvget(motor + '-PwrAuto')

    # Jog, wait for start, power off, check error, reset error
    def test_TC_212(self):
        motor = self.motor
        tc_no = "TC-212-EnabledFailed"

        capv_lib.capvput(motor + '.CNEN', 0, wait=True)
        setValueOnSimulator(self, motor, tc_no, "bAmplifierLockedToBeOff",
                            AMPLIFIER_LOCKED_TO_BE_OFF_SILENT)
        capv_lib.capvput(motor + '-PwrAuto', 0)
        time.sleep(1.0)

        capv_lib.capvput(motor + '.CNEN', 1, wait=True)
        time.sleep(4.0)
        mstaErr = int(capv_lib.capvget(motor + '.MSTA', use_monitor=False))
        print('%s Error mstaErr=%s' % (tc_no, lib.getMSTAtext(mstaErr)))
        capv_lib.capvput(motor + '-ErrRst', 1)

        setValueOnSimulator(self, motor, tc_no, "bAmplifierLockedToBeOff", 0)

        mstaOKagain = int(capv_lib.capvget(motor + '.MSTA', use_monitor=False))
        bError = capv_lib.capvget(motor + '-Err', use_monitor=False)
        nErrorId = capv_lib.capvget(motor + '-ErrId', use_monitor=False)
        print(
            '%s Clean lib.MSTA_BIT_PROBLEM=%x mstaOKagain=%s bError=%d nErrorId=%d'
            % (tc_no, lib.MSTA_BIT_PROBLEM, lib.getMSTAtext(mstaOKagain),
               bError, nErrorId))

        capv_lib.capvput(motor + '.CNEN', self.saved_CNEN)
        capv_lib.capvput(motor + '-PwrAuto', self.saved_PwrAuto)

        self.assertNotEqual(0, mstaErr & lib.MSTA_BIT_PROBLEM,
                            'Error MSTA.Problem should be set)')
        self.assertEqual(0, mstaErr & lib.MSTA_BIT_SLIP_STALL,
                         'Error MSTA.Slip stall Error should not be set)')
        self.assertEqual(0, mstaErr & lib.MSTA_BIT_MOVING,
                         'Error MSTA.Moving)')

        self.assertEqual(0, mstaOKagain & lib.MSTA_BIT_MOVING,
                         'Clean MSTA.Moving)')
        self.assertEqual(0, bError, 'bError')
        self.assertEqual(0, nErrorId, 'nErrorId')
Esempio n. 2
0
    def test_TC_091(self):
        tc_no = "TC-091-Tweak"
        print('%s' % tc_no)
        motor = self.motor
        resetAxis(motor, tc_no)
        print('%s:%d .CNEN=1' % (tc_no, lineno()))
        lib.setCNENandWait(motor, tc_no, 1)

        oldRBV = capv_lib.capvget(motor + '.RBV', use_monitor=False)
        old_high_limit = capv_lib.capvget(motor + '.HLM')
        old_low_limit = capv_lib.capvget(motor + '.LLM')
        # Switch off soft limits
        lib.setSoftLimitsOff(motor)

        msta = int(capv_lib.capvget(motor + '.MSTA'))
        direction = 0
        if (msta & lib.MSTA_BIT_PLUS_LS):
            direction = -1
            destination = oldRBV - self.TweakValue
        else:
            direction = +1
            destination = oldRBV + self.TweakValue

        print('%s:%d Tweak the motor oldRBV=%f destination=%f' %
              (tc_no, lineno(), oldRBV, destination))

        capv_lib.capvput(motor + '.VAL', destination)

        ret1 = waitForStart(self, motor, tc_no, 0.4, direction, oldRBV)
        ret2 = waitForStop(self, motor, tc_no, 10.0, direction, oldRBV, self.TweakValue)
        msta = int(capv_lib.capvget(motor + '.MSTA'))

        print('%s STOP=1 start=%d stop=%d' % (tc_no, ret1, ret2))
        capv_lib.capvput(motor + '.STOP', 1)

        capv_lib.capvput(motor + '.LLM', old_low_limit)
        capv_lib.capvput(motor + '.HLM', old_high_limit)
        ReadBackValue = capv_lib.capvget(motor + '.RBV', use_monitor=False)
        print('%s destination=%d postion=%f' % (
            tc_no, destination, ReadBackValue))
        #self.assertEqual(True, ret1, 'waitForStart return True')
        self.assertEqual(True, ret2, 'waitForStop return True')
        maxdelta = self.TweakValue * 2
        print('%s destination=%f ReadBackValue=%f, maxdelta=%f' % (tc_no, destination, ReadBackValue, maxdelta))
        assert calcAlmostEqual(motor, tc_no, destination, ReadBackValue, maxdelta)
Esempio n. 3
0
    def test_TC_1335(self):
        motor = self.motor
        if (self.msta & lib.MSTA_BIT_HOMED):
            tc_no = "TC-1235-low-soft-limit Moveabs"
            print('%s' % tc_no)
            drvUseEGU = capv_lib.capvget(motor + '-DrvUseEGU-RB')
            if drvUseEGU == 1:
                mres = 1.0
            else:
                mres = capv_lib.capvget(motor + '.MRES')
            rbv = capv_lib.capvget(motor + '.RBV')

            jar = capv_lib.capvget(motor + '.JAR')
            capv_lib.capvput(motor + '-ACCS', jar / mres)

            jvel = capv_lib.capvget(motor + '.JVEL')
            capv_lib.capvput(motor + '-VELO', jvel / mres)

            destination = self.llm - 1
            timeout = lib.calcTimeOut(motor, destination, jvel)
            print('%s rbv=%f destination=%f timeout=%f' %
                  (tc_no, rbv, destination, timeout))

            res = capv_lib.capvput(motor + '-MoveAbs', (destination) / mres)
            #if (res == None):
            #    print('%s caput -Moveabs res=None' % (tc_no))
            #    self.assertNotEqual(res, None, 'caput -Moveabs retuned not None. PV not found ?')
            #else:
            #    print('%s caput -Moveabs res=%d' % (tc_no, res))
            #    self.assertEqual(res, 1, 'caput -Moveabs returned 1')

            done = lib.waitForStartAndDone(motor, tc_no, timeout)

            msta = int(capv_lib.capvget(motor + '.MSTA'))
            miss = int(capv_lib.capvget(motor + '.MISS'))
            success = lib.verifyPosition(motor, rbv)

            if (msta & lib.MSTA_BIT_PROBLEM):
                capv_lib.capvput(motor + '-ErrRst', 1)

            self.assertEqual(success, globals.SUCCESS,
                             'verifyPosition returned SUCCESS')
            self.assertEqual(0, msta & lib.MSTA_BIT_MINUS_LS,
                             'DLY Minus hard limit not reached Moveabs')
            self.assertEqual(0, msta & lib.MSTA_BIT_PLUS_LS,
                             'DLY Plus hard limit not reached Moveabs')
            self.assertEqual(0, miss, 'DLY MISS not set Moveabs')
    def test_TC_1318(self):
        motor = self.motor
        if (self.msta & lib.MSTA_BIT_HOMED):
            tc_no = "TC-1315-low-soft-limit JOGF DIR"
            print('%s' % tc_no)
            saved_DIR = capv_lib.capvget(motor + '.DIR')
            saved_FOFF = capv_lib.capvget(motor + '.FOFF')
            capv_lib.capvput(motor + '.FOFF', 1)
            capv_lib.capvput(motor + '.DIR', 1)
            done = lib.jogDirection(motor, tc_no, 1)

            lvio = int(capv_lib.capvget(motor + '.LVIO'))
            msta = int(capv_lib.capvget(motor + '.MSTA'))

            capv_lib.capvput(motor + '.DIR', saved_DIR)
            capv_lib.capvput(motor + '.FOFF', saved_FOFF)

            self.assertEqual(True, done, 'done should be True after jogDirection')
            self.assertEqual(0, msta & lib.MSTA_BIT_PROBLEM,  'No Error MSTA.Problem JOGF DIR')
            self.assertEqual(0, msta & lib.MSTA_BIT_MINUS_LS, 'Minus hard limit not reached JOGF DIR')
            self.assertEqual(0, msta & lib.MSTA_BIT_PLUS_LS,  'Plus hard limit not reached JOGR DIR')
Esempio n. 5
0
class Test(unittest.TestCase):
    motor = os.getenv("TESTEDMOTORAXIS")
    capv_lib.capvput(motor + '-DbgStrToLOG',
                     "Start " + os.path.basename(__file__)[0:20])

    # Set and readback Vel
    def test_TC_9301(self):
        motor = self.motor
        tc_no = "TC-9301"
        setAndReadBackParam(self, motor, tc_no, '-Vel-RB', 'fVelocity')

# Set and readback Acc

    def test_TC_9302(self):
        motor = self.motor
        tc_no = "TC-9302"
        setAndReadBackParam(self, motor, tc_no, '-Acc-RB', 'fAcceleration')

    # Set and readback high soft limit value
    def test_TC_9303(self):
        motor = self.motor
        tc_no = "TC-9303"
        setAndReadBackParam(self, motor, tc_no, '-CfgDHLM-RB',
                            'fHighSoftLimitPos')

    ## Set and readback high soft limit enable
    # Cant run those, PILS has no enable bit
    #def test_TC_9304(self):
    #    motor = self.motor
    #    tc_no = "TC-9304"
    #    setAndReadBackParam(self, motor, tc_no, '-CfgDHLM-En-RB', 'bEnableHighSoftLimit')

    # Set and readback low soft limit value
    def test_TC_9305(self):
        motor = self.motor
        tc_no = "TC-9305"
        setAndReadBackParam(self, motor, tc_no, '-CfgDLLM-RB',
                            'fLowSoftLimitPos')
Esempio n. 6
0
    def test_TC_404(self):
        tc_no = "TC-404-JOGR"
        print('%s' % tc_no)
        motor = self.motor
        if (self.msta & lib.MSTA_BIT_HOMED):
            accl = float(capv_lib.capvget(motor + '.ACCL'))
            jvel = float(capv_lib.capvget(motor + '.JVEL'))
            saved_JAR = float(capv_lib.capvget(motor + '.JAR'))
            used_JAR = jvel / (accl + 2.0)
            capv_lib.capvput(motor + '.JAR', used_JAR)
            capv_lib.capvput(motor + '.JOGR', 1, wait=True)
            resacc = self.getAcceleration(motor, tc_no)
            expacc = used_JAR
            capv_lib.capvput(motor + '.JAR', saved_JAR)
            print('%s JAR=%f expacc=%f resacc=%f' %
                  (tc_no, used_JAR, expacc, resacc))

            assert lib.calcAlmostEqual(self.motor, tc_no, expacc, resacc, 2)
    def test_TC_90010(self):
        tc_no = 90010
        encRel = 0
        capv_lib.capvput(self.motor + '-DbgStrToLOG', "Start " + str(tc_no))
        #vers = float(capv_lib.capvget(self.motor + '.VERS'))
        #print('%s vers=%g' %  (tc_no, vers))
        #self.assertEqual(0, 1, '1 != 0')
        testPassed = readBackParamVerify(self, self.motor, tc_no, '-DrvUseEGU-RB', 0)

        motorInitVeloAcc(self, self.motor, tc_no, encRel)
        mres = 0.1
        dir = 0
        off = 0.5
        setMresDirOff(self, self.motor, tc_no, mres, dir, off)
        motorInitLimitsNoC(self, self.motor, tc_no)
        if testPassed:
            capv_lib.capvput(self.motor + '-DbgStrToLOG', "Passed " + str(tc_no))
        else:
            capv_lib.capvput(self.motor + '-DbgStrToLOG', "Failed " + str(tc_no))
        assert (testPassed)
    def test_TC_1315(self):
        motor = self.motor
        if (self.msta & lib.MSTA_BIT_HOMED):
            tc_no = "TC-1315-low-soft-limit JOGR"
            print('%s' % tc_no)
            capv_lib.capvput(motor + '.DLY', 0.0)
            done = lib.jogDirection(motor, tc_no, 0)
            lvio = int(capv_lib.capvget(motor + '.LVIO'))
            msta = int(capv_lib.capvget(motor + '.MSTA'))
            miss = int(capv_lib.capvget(motor + '.MISS'))

            capv_lib.capvput(motor + '.DLY', self.saved_DLY)
            capv_lib.capvput(motor + '.JOGF', 0)
            resW = lib.waitForMipZero(motor, tc_no, self.saved_DLY)
            self.assertEqual(True, done,                      'ndly JOGF should be done after jogDirection')
            self.assertEqual(0, msta & lib.MSTA_BIT_PROBLEM,  'ndly JOGF should not give MSTA.Problem')
            self.assertEqual(0, msta & lib.MSTA_BIT_MINUS_LS, 'ndly JOGF should not reach LLS')
            self.assertEqual(0, msta & lib.MSTA_BIT_PLUS_LS,  'ndly JOGF should not reach HLS')
            self.assertEqual(0, miss,                         'ndly JOGF should not have MISS set')
            self.assertEqual(1, resW,                         'ndly JOGF should have MIP = 0')
            self.assertEqual(1, lvio,                         'ndly JOGF should have LVIO set')
def do_220_autopower(self, motor, tc_no, autopower):
    lib.setCNENandWait(motor, tc_no, 0)
    capv_lib.capvput(motor + '-PwrAuto', autopower, wait=True, timeout=globals.TIMEOUT)
    capv_lib.capvput(motor + '-PwrOnDly', PwrOnDly, wait=True, timeout=globals.TIMEOUT)
    capv_lib.capvput(motor + '-PwrOffDly', PwrOffDly, wait=True, timeout=globals.TIMEOUT)
    print('%s Enable move to LLM +10' % tc_no)
    destination = self.saved_LLM + 10 + 2*autopower
    done = lib.moveWait(motor, tc_no, destination)

    #Make sure drive is still enabled
    power1 = capv_lib.capvget(motor + '.CNEN', use_monitor=False)
    print('%s Check drive is still enabled power1=%d' % (tc_no, power1))


    time.sleep(PwrOnDly + PwrOffDly + 2.0)
    power2 = capv_lib.capvget(motor + '.CNEN', use_monitor=False)
    print('%s Wait 8s and check drive is now disabled power2=%d' % (tc_no, power2))
    restorePwrSettings(self, motor, tc_no, self.saved_PwrAuto, self.saved_PwrOnDly, self.saved_PwrOffDly)
    lib.setCNENandWait(motor, tc_no, self.saved_CNEN)

    self.assertEqual(1, done, 'moveWait should return done')
    assert(power1 == 1)
    assert(power2 == 0)
def motorInitLimitsWithC(self, motor, tc_no):
    capv_lib.capvput(motor + '-CfgDLLM-En', 0, wait=True)
    capv_lib.capvput(motor + '-CfgDHLM-En', 0, wait=True)
    capv_lib.capvput(motor + '-CfgDHLM', myCfgDHLM)
    capv_lib.capvput(motor + '-CfgDLLM', myCfgDLLM)
    capv_lib.capvput(motor + '-CfgDLLM-En', 1, wait=True)
    capv_lib.capvput(motor + '-CfgDHLM-En', 1, wait=True)

    capv_lib.capvput(motor + '.DHLM', myDHLM)
    capv_lib.capvput(motor + '.DLLM', myDLLM)
def restorePwrSettings(self, motor, tc_no, pwrAuto, pwrOnDly, pwrOffDly):
    capv_lib.capvput(motor + '-PwrAuto', pwrAuto)
    capv_lib.capvput(motor + '-PwrOnDly', pwrOnDly)
    capv_lib.capvput(motor + '-PwrOffDly', pwrOffDly)
 def test_TC_900999(self):
     if self.drvUseEGU_RB == 1:
         capv_lib.capvput(self.motor + '-DrvUseEGU', 1)
def motorInitVeloAcc(self, motor, tc_no, encRel):
    msta             = int(capv_lib.capvget(motor + '.MSTA'))
    assert (msta & lib.MSTA_BIT_HOMED) #, 'MSTA.homed (Axis has been homed)')

    # Prepare parameters for jogging and backlash
    capv_lib.capvput(motor + '.VELO', myVELO)
    capv_lib.capvput(motor + '.ACCL', myACCL)

    capv_lib.capvput(motor + '.JVEL', myJVEL)
    capv_lib.capvput(motor + '.JAR', myJAR)

    capv_lib.capvput(motor + '.BVEL', myBVEL)
    capv_lib.capvput(motor + '.BACC', myBACC)
    capv_lib.capvput(motor + '.BDST', myBDST)
    capv_lib.capvput(motor + '.UEIP', encRel)
    # Move the motor to 0, to avoid limit swicth activation
    capv_lib.capvput(motor + '.DVAL', myStartposDial)
    # Bit speed it up, by setting the position in the simulator
    lib.setValueOnSimulator(motor, tc_no, "fActPosition", myStartposDial)
    # and wait for the movement to finish
    ret3 = lib.waitForStop(motor, tc_no, 2.0)
 def test_TC_90000(self):
     tc_no = 90010
     capv_lib.capvput(self.motor + '-DbgStrToLOG', "Start " + str(tc_no))
     lib.motorInitAllForBDST(self.motor, 90000)
     capv_lib.capvput(self.motor + '-DbgStrToLOG', "End " + str(tc_no))
class Test(unittest.TestCase):
    motor = os.getenv("TESTEDMOTORAXIS")
    capv_lib.capvput(motor + '-DbgStrToLOG', "Start " + os.path.basename(__file__)[0:20])
    myPOSlow = lib.myPOSlow
    myPOSmid = lib.myPOSmid
    myPOShig = lib.myPOShig

    def test_TC_14400(self):
        lib.motorInitAllForBDST(self.motor, 14400)
        capv_lib.capvput(self.motor + '.FRAC', myFRAC)


    # motorRMOD_D = 0 # "Default"
    # position forward & backlash compensation, absolute
    def test_TC_14401(self):
        positionAndBacklash(self, self.motor, 14401, motorRMOD_D, use_abs, self.myPOSlow, self.myPOShig)

    # position forward & backlash compensation, relative
    def test_TC_14402(self):
        positionAndBacklash(self, self.motor, 14402, motorRMOD_D, use_rel, self.myPOSlow, self.myPOShig)

    # position backward & backlash compensation, absolute
    def test_TC_14403(self):
        positionAndBacklash(self, self.motor, 14403, motorRMOD_D, use_abs, self.myPOShig, self.myPOSlow)

    # position backward & backlash compensation, relative
    def test_TC_14404(self):
        positionAndBacklash(self, self.motor, 14404, motorRMOD_D, use_rel, self.myPOShig, self.myPOSlow)

    # position forward inside backlash range, absolute
    def test_TC_14405(self):
        positionAndBacklash(self, self.motor, 14405, motorRMOD_D, use_abs, self.myPOSmid, self.myPOSlow)

    # position forward inside backlash range, relative
    def test_TC_14406(self):
        positionAndBacklash(self, self.motor, 14406, motorRMOD_D, use_rel, self.myPOSmid, self.myPOSlow)

    # position forward inside backlash range, absolute
    def test_TC_14407(self):
        positionAndBacklash(self, self.motor, 14407, motorRMOD_D, use_abs, self.myPOSlow, self.myPOSmid)

    # position forward inside backlash range, relative
    def test_TC_14408(self):
        positionAndBacklash(self, self.motor, 14408, motorRMOD_D, use_rel, self.myPOSlow, self.myPOSmid)

    ###############################################################################
    # motorRMOD_A
    # position forward & backlash compensation, absolute
    def test_TC_14411(self):
        positionAndBacklash(self, self.motor, 14411, motorRMOD_A, use_abs, self.myPOSlow, self.myPOShig)

    # position forward & backlash compensation, relative
    def test_TC_14412(self):
        positionAndBacklash(self, self.motor, 14412, motorRMOD_A, use_rel, self.myPOSlow, self.myPOShig)

    # position backward & backlash compensation, absolute
    def test_TC_14413(self):
        positionAndBacklash(self, self.motor, 14413, motorRMOD_A, use_abs, self.myPOShig, self.myPOSlow)

    # position backward & backlash compensation, relative
    def test_TC_14414(self):
        positionAndBacklash(self, self.motor, 14414, motorRMOD_A, use_rel, self.myPOShig, self.myPOSlow)

    # position forward inside backlash range, absolute
    def test_TC_14415(self):
        positionAndBacklash(self, self.motor, 14415, motorRMOD_A, use_abs, self.myPOSmid, self.myPOSlow)

    # position forward inside backlash range, relative
    def test_TC_14416(self):
        positionAndBacklash(self, self.motor, 14416, motorRMOD_A, use_rel, self.myPOSmid, self.myPOSlow)

    # position forward inside backlash range, absolute
    def test_TC_14417(self):
        positionAndBacklash(self, self.motor, 14417, motorRMOD_A, use_abs, self.myPOSlow, self.myPOSmid)

    # position forward inside backlash range, relative
    def test_TC_14418(self):
        positionAndBacklash(self, self.motor, 14418, motorRMOD_A, use_rel, self.myPOSlow, self.myPOSmid)

    ###############################################################################
    # motorRMOD_G
    # position forward & backlash compensation, absolute
    def test_TC_14421(self):
        positionAndBacklash(self, self.motor, 14421, motorRMOD_G, use_abs, self.myPOSlow, self.myPOShig)

    # position forward & backlash compensation, relative
    def test_TC_14422(self):
        positionAndBacklash(self, self.motor, 14422, motorRMOD_G, use_rel, self.myPOSlow, self.myPOShig)

    # position backward & backlash compensation, absolute
    def test_TC_14423(self):
        positionAndBacklash(self, self.motor, 14423, motorRMOD_G, use_abs, self.myPOShig, self.myPOSlow)

    # position backward & backlash compensation, relative
    def test_TC_14424(self):
        positionAndBacklash(self, self.motor, 14424, motorRMOD_G, use_rel, self.myPOShig, self.myPOSlow)

    # position forward inside backlash range, absolute
    def test_TC_14425(self):
        positionAndBacklash(self, self.motor, 14425, motorRMOD_G, use_abs, self.myPOSmid, self.myPOSlow)

    # position forward inside backlash range, relative
    def test_TC_14426(self):
        positionAndBacklash(self, self.motor, 14426, motorRMOD_G, use_rel, self.myPOSmid, self.myPOSlow)

    # position forward inside backlash range, absolute
    def test_TC_14427(self):
        positionAndBacklash(self, self.motor, 14427, motorRMOD_G, use_abs, self.myPOSlow, self.myPOSmid)

    # position forward inside backlash range, relative
    def test_TC_14428(self):
        positionAndBacklash(self, self.motor, 14428, motorRMOD_G, use_rel, self.myPOSlow, self.myPOSmid)


    ###############################################################################
    # motorRMOD_I
    # position forward & backlash compensation, absolute
    def test_TC_14431(self):
        positionAndBacklash(self, self.motor, 14431, motorRMOD_I, use_abs, self.myPOSlow, self.myPOShig)

    # position forward & backlash compensation, relative
    def test_TC_14432(self):
        positionAndBacklash(self, self.motor, 14432, motorRMOD_I, use_rel, self.myPOSlow, self.myPOShig)

    # position backward & backlash compensation, absolute
    def test_TC_14433(self):
        positionAndBacklash(self, self.motor, 14433, motorRMOD_I, use_abs, self.myPOShig, self.myPOSlow)

    # position backward & backlash compensation, relative
    def test_TC_14434(self):
        positionAndBacklash(self, self.motor, 14434, motorRMOD_I, use_rel, self.myPOShig, self.myPOSlow)

    # position forward inside backlash range, absolute
    def test_TC_14435(self):
        positionAndBacklash(self, self.motor, 14435, motorRMOD_I, use_abs, self.myPOSmid, self.myPOSlow)

    # position forward inside backlash range, relative
    def test_TC_14436(self):
        positionAndBacklash(self, self.motor, 14436, motorRMOD_I, use_rel, self.myPOSmid, self.myPOSlow)

    # position forward inside backlash range, absolute
    def test_TC_14437(self):
        positionAndBacklash(self, self.motor, 14437, motorRMOD_I, use_abs, self.myPOSlow, self.myPOSmid)

    # position forward inside backlash range, relative
    def test_TC_14438(self):
        positionAndBacklash(self, self.motor, 14438, motorRMOD_I, use_rel, self.myPOSlow, self.myPOSmid)
def setLimit(self, motor, tc_no, field, value, expDHLM, expDLLM, expHLM, expLLM, expM3rhlm, expM3rllm):
    capv_lib.capvput(self.motor + '-DbgStrToLOG', "Start " + str(tc_no))
    oldDHLM = capv_lib.capvget(motor + '.DHLM', use_monitor=False)
    oldDLLM = capv_lib.capvget(motor + '.DLLM', use_monitor=False)

    capv_lib.capvput(motor + '.DHLM', oldDHLM)
    capv_lib.capvput(motor + '.DLLM', oldDLLM)
    capv_lib.capvput(motor + '.' + field, value)

    okDHLM = readBackParamVerify(self, motor, tc_no, '.DHLM', expDHLM)
    okDLLM = readBackParamVerify(self, motor, tc_no, '.DLLM', expDLLM)

    okHLM = readBackParamVerify(self, motor, tc_no, '.HLM', expHLM)
    okLLM = readBackParamVerify(self, motor, tc_no, '.LLM', expLLM)

    okM3rhlm = readBackParamVerify(self, motor, tc_no, '-M3RHLM', expM3rhlm)
    okM3rllm = readBackParamVerify(self, motor, tc_no, '-M3RLLM', expM3rllm)

    testPassed = okDHLM and okDLLM and okHLM and okLLM and okM3rhlm and okM3rllm
    if testPassed:
        capv_lib.capvput(self.motor + '-DbgStrToLOG', "Passed " + str(tc_no))
    else:
        capv_lib.capvput(self.motor + '-DbgStrToLOG', "Failed " + str(tc_no))
    assert (testPassed)
Esempio n. 17
0
    def setSoftLimitsOff(self, motor):
        """
        Switch off the soft limits
        """
        # switch off the controller soft limits
        try:
            capv_lib.capvput(motor + '-CfgDHLM-En', 0, wait=True, timeout=2)
            capv_lib.capvput(motor + '-CfgDLLM-En', 0, wait=True, timeout=2)
        finally:
            oldRBV = capv_lib.capvget(motor + '.RBV')

        wait_for_done = 1.0
        while wait_for_done > 0:
            if oldRBV > 0:
                capv_lib.capvput(motor + '.LLM', 0.0)
                capv_lib.capvput(motor + '.HLM', 0.0)
            else:
                capv_lib.capvput(motor + '.HLM', 0.0)
                capv_lib.capvput(motor + '.LLM', 0.0)

            llm = capv_lib.capvget(motor + '.LLM', use_monitor=False)
            hlm = capv_lib.capvget(motor + '.HLM', use_monitor=False)
            print('%s: setSoftLimitsOff llm=%f hlm=%f' % (motor, llm, hlm))
            if llm == 0.0 and hlm == 0.0:
                return
            time.sleep(polltime)
            wait_for_done -= polltime
 def test_TC_14400(self):
     lib.motorInitAllForBDST(self.motor, 14400)
     capv_lib.capvput(self.motor + '.FRAC', myFRAC)
def motorInitTC(tself, motor, tc_no, rmod, encRel):
    capv_lib.capvput(motor + '.RMOD', rmod)
    capv_lib.capvput(motor + '.UEIP', encRel)
class Test(unittest.TestCase):
    motor = os.getenv("TESTEDMOTORAXIS")
    capv_lib.capvput(motor + '-DbgStrToLOG',
                     "Start " + os.path.basename(__file__)[0:20])

    hlm = capv_lib.capvget(motor + '.HLM')
    llm = capv_lib.capvget(motor + '.LLM')

    per10_UserPosition = round((9 * llm + 1 * hlm) / 10)
    per20_UserPosition = round((8 * llm + 2 * hlm) / 10)
    msta = int(capv_lib.capvget(motor + '.MSTA'))
    accs = capv_lib.capvget(motor + '.ACCS')
    homedAndPwrAndACCS = (accs != None) and (msta & lib.MSTA_BIT_HOMED) and (
        msta & lib.MSTA_BIT_AMPON)

    # Assert that motor is homed and has the ACCS field
    def test_TC_411(self):
        motor = self.motor
        tc_no = "TC-411"
        if not (self.homedAndPwrAndACCS):
            self.assertNotEqual(self.msta & lib.MSTA_BIT_HOMED, 0,
                                'Axis has been homed')
            self.assertNotEqual(self.msta & lib.MSTA_BIT_AMPON, 0,
                                'Amplifier is on')
            self.assertNotEqual(self.accs, None, 'ACCS field in record')

    # 10% dialPosition
    def test_TC_412(self):
        tc_no = "TC-412-10-percent"
        print('%s' % tc_no)
        motor = self.motor
        if (self.msta & lib.MSTA_BIT_HOMED):
            ret = lib.move(self.motor, self.per10_UserPosition, 60)
            assert (ret == 0)

    def test_TC_41311(self):
        tc_no = "TC-41311"
        print('%s' % tc_no)
        motor = self.motor
        if (self.homedAndPwrAndACCS):
            #                                                   vbas, velo. accl, accs, expAccEGU
            check_VBAS_VELO_ACCL_ACCS_accEGU(self, motor, tc_no, 0, 6.0, 0.2,
                                             -1, 30)

    def test_TC_41312(self):
        tc_no = "TC-41312"
        print('%s' % tc_no)
        motor = self.motor
        if (self.homedAndPwrAndACCS):
            #                                                   vbas, velo. accl, accs, expAccEGU
            check_VBAS_VELO_ACCL_ACCS_accEGU(self, motor, tc_no, 1, 2.0, 0.2,
                                             -1, 5)

    def test_TC_41313(self):
        tc_no = "TC-41313"
        print('%s' % tc_no)
        motor = self.motor
        if (self.homedAndPwrAndACCS):
            #                                                   vbas, velo. accl, accs, expAccEGU
            check_VBAS_VELO_ACCL_ACCS_accEGU(self, motor, tc_no, 1, 2.0, 0.4,
                                             -1, 2.5)

    def test_TC_41314(self):
        tc_no = "TC-41314"
        print('%s' % tc_no)
        motor = self.motor
        if (self.homedAndPwrAndACCS):
            #                                                   vbas, velo. accl, accs, expAccEGU
            check_VBAS_VELO_ACCL_ACCS_accEGU(self, motor, tc_no, 4.0, 4.0, 0.5,
                                             -1, 8.0)

    def test_TC_41315(self):
        tc_no = "TC-41315"
        print('%s' % tc_no)
        motor = self.motor
        if (self.homedAndPwrAndACCS):
            #                                                   vbas, velo. accl, accs, expAccEGU
            check_VBAS_VELO_ACCL_ACCS_accEGU(self, motor, tc_no, 0.0, 8.0, 0.5,
                                             -1, 16.0)

    def test_TC_41316(self):
        tc_no = "TC-41316"
        print('%s' % tc_no)
        motor = self.motor
        if (self.homedAndPwrAndACCS):
            #                                                   vbas, velo. accl, accs, expAccEGU
            check_VBAS_VELO_ACCL_ACCS_accEGU(self, motor, tc_no, 0.0, 8.0,
                                             -1.0, 16.0, 16.0)

    # Keep ACCS and expAccEGU if velociy is changed
    def test_TC_41317(self):
        tc_no = "TC-41317"
        print('%s' % tc_no)
        motor = self.motor
        if (self.homedAndPwrAndACCS):
            #                                                   vbas, velo. accl, accs, expAccEGU
            check_VBAS_VELO_ACCL_ACCS_accEGU(self, motor, tc_no, 0.0, 4.0,
                                             -1.0, -1.0, 16.0)
Esempio n. 21
0
    def test_TC_502(self):
        motor = self.motor
        tc_no = "TC_502-10-percent-plus-1"
        print('%s' % tc_no)
        rbv = capv_lib.capvget(motor + '.RBV')
        saved_DLY = capv_lib.capvget(motor + '.DLY')
        saved_VELO = capv_lib.capvget(motor + '.VELO')
        saved_ACCL = capv_lib.capvget(motor + '.ACCL')

        capv_lib.capvput(motor + '.DLY', 5.2)
        capv_lib.capvput(motor + '.VELO', 1)
        capv_lib.capvput(motor + '.ACCL', 1)
        capv_lib.capvput(motor + '.VAL', rbv + 1.0, wait=False)

        time.sleep(4.0)
        movn1 = capv_lib.capvget(motor + '.MOVN')
        capv_lib.capvput(motor + '.STOP', 1)
        time.sleep(7.0)
        capv_lib.capvput(motor + '.SPMG', 0)
        capv_lib.capvput(motor + '.SPMG', 3)
        time.sleep(4.0)
        dmov = capv_lib.capvget(motor + '.DMOV')
        print('%s: movn1=%d dmov=%d' % (tc_no, movn1, dmov))
        capv_lib.capvput(motor + '.DLY', saved_DLY)
        capv_lib.capvput(motor + '.VELO', saved_VELO)
        capv_lib.capvput(motor + '.ACCL', saved_ACCL)
Esempio n. 22
0
class Test(unittest.TestCase):
    motor = os.getenv("TESTEDMOTORAXIS")
    capv_lib.capvput(motor + '-DbgStrToLOG',
                     "Start " + os.path.basename(__file__)[0:20])

    hlm = capv_lib.capvget(motor + '.HLM')
    llm = capv_lib.capvget(motor + '.LLM')
    jvel = capv_lib.capvget(motor + '.JVEL')

    margin = 1.1
    # motorRecord stops jogging 1 second before reaching HLM
    jog_start_pos = llm + jvel + margin

    msta = int(capv_lib.capvget(motor + '.MSTA'))

    print('llm=%f hlm=%f jog_start_pos=%f' % (llm, hlm, jog_start_pos))

    # Assert that motor is homed
    def test_TC_1331(self):
        motor = self.motor
        tc_no = "TC-1331"
        if not (self.msta & lib.MSTA_BIT_HOMED):
            self.assertNotEqual(0, self.msta & lib.MSTA_BIT_HOMED,
                                'MSTA.homed (Axis is not homed)')

    # per10 UserPosition
    def test_TC_1332(self):
        motor = self.motor
        if (self.msta & lib.MSTA_BIT_HOMED):
            tc_no = "TC-1332-10-percent-UserPosition"
            print('%s' % tc_no)
            done = lib.moveWait(motor, tc_no, self.jog_start_pos)
            UserPosition = capv_lib.capvget(motor + '.RBV', use_monitor=False)
            print('%s postion=%f jog_start_pos=%f done=%s' %
                  (tc_no, UserPosition, self.jog_start_pos, done))
            self.assertEqual(1, done, 'moveWait should return done')

    # Low soft limit in controller when using MoveVel
    def test_TC_1333(self):
        motor = self.motor
        if (self.msta & lib.MSTA_BIT_HOMED):
            tc_no = "TC-1333-low-soft-limit MoveVel"
            print('%s' % tc_no)

            jar = capv_lib.capvget(motor + '.JAR')
            capv_lib.capvput(motor + '-ACCS', jar)

            rbv = capv_lib.capvget(motor + '.RBV')
            destination = capv_lib.capvget(motor + '.LLM') - 1
            jvel = capv_lib.capvget(motor + '.JVEL')
            timeout = lib.calcTimeOut(motor, destination, jvel)
            print('%s rbv=%f destination=%f timeout=%f' %
                  (tc_no, rbv, destination, timeout))
            res = capv_lib.capvput(motor + '-MoveVel', 0 - jvel)
            # TODO: The -MoveVel PV is not always there ?
            # Investigations needed
            #if (res == None):
            #    print('%s caput -MoveVel res=None' % (tc_no))
            #    self.assertNotEqual(res, None, 'caput -MoveVel retuned not None. PV not found ?')
            #else:
            #    print('%s caput -MoveVel res=%d' % (tc_no, res))
            #    self.assertEqual(res, 1, 'caput -MoveVel returned 1')

            done = lib.waitForStartAndDone(motor, tc_no, timeout)

            msta = int(capv_lib.capvget(motor + '.MSTA'))
            miss = int(capv_lib.capvget(motor + '.MISS'))

            if (msta & lib.MSTA_BIT_PROBLEM):
                capv_lib.capvput(motor + '-ErrRst', 1)

            self.assertEqual(0, msta & lib.MSTA_BIT_MINUS_LS,
                             'DLY Minus hard limit not reached MoveVel')
            self.assertEqual(0, msta & lib.MSTA_BIT_PLUS_LS,
                             'DLY Plus hard limit not reached MoveVel')
            self.assertEqual(0, miss, 'DLY MISS not set MoveVel')

    # per10 UserPosition
    def test_TC_1334(self):
        motor = self.motor
        if (self.msta & lib.MSTA_BIT_HOMED):
            tc_no = "TC-1234-q0-percent-UserPosition"
            print('%s' % tc_no)
            done = lib.moveWait(motor, tc_no, self.jog_start_pos)
            UserPosition = capv_lib.capvget(motor + '.RBV', use_monitor=False)
            print('%s postion=%f jog_start_pos=%f done=%s' %
                  (tc_no, UserPosition, self.jog_start_pos, done))
            self.assertEqual(1, done, 'moveWait should return done')

    # Low soft limit in controller when using MoveAbs
    def test_TC_1335(self):
        motor = self.motor
        if (self.msta & lib.MSTA_BIT_HOMED):
            tc_no = "TC-1235-low-soft-limit Moveabs"
            print('%s' % tc_no)
            drvUseEGU = capv_lib.capvget(motor + '-DrvUseEGU-RB')
            if drvUseEGU == 1:
                mres = 1.0
            else:
                mres = capv_lib.capvget(motor + '.MRES')
            rbv = capv_lib.capvget(motor + '.RBV')

            jar = capv_lib.capvget(motor + '.JAR')
            capv_lib.capvput(motor + '-ACCS', jar / mres)

            jvel = capv_lib.capvget(motor + '.JVEL')
            capv_lib.capvput(motor + '-VELO', jvel / mres)

            destination = self.llm - 1
            timeout = lib.calcTimeOut(motor, destination, jvel)
            print('%s rbv=%f destination=%f timeout=%f' %
                  (tc_no, rbv, destination, timeout))

            res = capv_lib.capvput(motor + '-MoveAbs', (destination) / mres)
            #if (res == None):
            #    print('%s caput -Moveabs res=None' % (tc_no))
            #    self.assertNotEqual(res, None, 'caput -Moveabs retuned not None. PV not found ?')
            #else:
            #    print('%s caput -Moveabs res=%d' % (tc_no, res))
            #    self.assertEqual(res, 1, 'caput -Moveabs returned 1')

            done = lib.waitForStartAndDone(motor, tc_no, timeout)

            msta = int(capv_lib.capvget(motor + '.MSTA'))
            miss = int(capv_lib.capvget(motor + '.MISS'))
            success = lib.verifyPosition(motor, rbv)

            if (msta & lib.MSTA_BIT_PROBLEM):
                capv_lib.capvput(motor + '-ErrRst', 1)

            self.assertEqual(success, globals.SUCCESS,
                             'verifyPosition returned SUCCESS')
            self.assertEqual(0, msta & lib.MSTA_BIT_MINUS_LS,
                             'DLY Minus hard limit not reached Moveabs')
            self.assertEqual(0, msta & lib.MSTA_BIT_PLUS_LS,
                             'DLY Plus hard limit not reached Moveabs')
            self.assertEqual(0, miss, 'DLY MISS not set Moveabs')
Esempio n. 23
0
    def motorInitAllForBDST(self, motor, tc_no):
        self.setValueOnSimulator(motor, tc_no, "nAmplifierPercent", 100)
        self.setValueOnSimulator(motor, tc_no, "bAxisHomed", 1)
        self.setValueOnSimulator(motor, tc_no, "fLowHardLimitPos", -100)
        self.setValueOnSimulator(motor, tc_no, "fHighHardLimitPos", 100)
        self.setValueOnSimulator(motor, tc_no, "setMRES_23", 0)
        self.setValueOnSimulator(motor, tc_no, "setMRES_24", 0)

        capv_lib.capvput(motor + '-ErrRst', 1)
        # Prepare parameters for jogging and backlash
        self.setSoftLimitsOff(motor)
        capv_lib.capvput(motor + '.VELO', self.myVELO)
        capv_lib.capvput(motor + '.ACCL', self.myACCL)

        capv_lib.capvput(motor + '.JVEL', self.myJVEL)
        capv_lib.capvput(motor + '.JAR', self.myJAR)

        capv_lib.capvput(motor + '.BVEL', self.myBVEL)
        capv_lib.capvput(motor + '.BACC', self.myBACC)
        capv_lib.capvput(motor + '.BDST', self.myBDST)
        capv_lib.capvput(motor + '.FRAC', self.myFRAC)
        capv_lib.capvput(motor + '.RTRY', self.myRTRY)
        capv_lib.capvput(motor + '.RMOD', motorRMOD_D)
        capv_lib.capvput(motor + '.DLY', self.myDLY)
class Test(unittest.TestCase):
    hasROlimit = 0
    drvUseEGU_RB = None
    drvUseEGU = 0
    motor = os.getenv("TESTEDMOTORAXIS")
    capv_lib.capvput(motor + '-DbgStrToLOG', "Start " + os.path.basename(__file__)[0:20])
    vers = float(capv_lib.capvget(motor + '.VERS'))
    if vers >= 6.94 and vers <= 7.09 :
        hasROlimit = 1
        drvUseEGU_RB = capv_lib.capvget(motor + '-DrvUseEGU-RB')
        drvUseEGU = 0
        if drvUseEGU_RB == 1:
            capv_lib.capvput(motor + '-DrvUseEGU', drvUseEGU)
            #drvUseEGU = capv_lib.capvget(motor + '-DrvUseEGU-RB')

    def test_TC_90000(self):
        tc_no = 90010
        capv_lib.capvput(self.motor + '-DbgStrToLOG', "Start " + str(tc_no))
        lib.motorInitAllForBDST(self.motor, 90000)
        capv_lib.capvput(self.motor + '-DbgStrToLOG', "End " + str(tc_no))

    def test_TC_90010(self):
        tc_no = 90010
        encRel = 0
        capv_lib.capvput(self.motor + '-DbgStrToLOG', "Start " + str(tc_no))
        #vers = float(capv_lib.capvget(self.motor + '.VERS'))
        #print('%s vers=%g' %  (tc_no, vers))
        #self.assertEqual(0, 1, '1 != 0')
        testPassed = readBackParamVerify(self, self.motor, tc_no, '-DrvUseEGU-RB', 0)

        motorInitVeloAcc(self, self.motor, tc_no, encRel)
        mres = 0.1
        dir = 0
        off = 0.5
        setMresDirOff(self, self.motor, tc_no, mres, dir, off)
        motorInitLimitsNoC(self, self.motor, tc_no)
        if testPassed:
            capv_lib.capvput(self.motor + '-DbgStrToLOG', "Passed " + str(tc_no))
        else:
            capv_lib.capvput(self.motor + '-DbgStrToLOG', "Failed " + str(tc_no))
        assert (testPassed)

    def test_TC_90011(self):
        tc_no = 90011
        #setLimit(self, motor, tc_no,    field,  val, expDHLM, expDLLM, expHLM, expLLM, expM3rhlm, expM3rllm):
        setLimit(self, self.motor, tc_no, "DHLM", 4.1,  4.1,    -5.0,    4.6,    -4.5,   41.0,      -50.0)

    def test_TC_90012(self):
        tc_no = 90012
        #setLimit(self, motor, tc_no,    field,  val, expDHLM, expDLLM, expHLM, expLLM, expM3rhlm, expM3rllm):
        setLimit(self, self.motor, tc_no, "HLM",  4.7,  4.2,    -5.0,    4.7,    -4.5,   42.0,      -50.0)

    def test_TC_90013(self):
        tc_no = 90013
        #setLimit(self, motor, tc_no,    field,  val, expDHLM, expDLLM, expHLM, expLLM, expM3rhlm, expM3rllm):
        setLimit(self, self.motor, tc_no, "DLLM", -5.3, 4.2,     -5.3,    4.7,    -4.8,   42.0,      -53.0)

    def test_TC_90014(self):
        tc_no = 90014
        #setLimit(self, motor, tc_no,    field,  val, expDHLM, expDLLM, expHLM, expLLM, expM3rhlm, expM3rllm):
        setLimit(self, self.motor, tc_no, "LLM", -5.4, 4.2,     -5.9,    4.7,    -5.4,    42.0,      -59.0)

    ###################################################################################################################
    #Invert mres
    def test_TC_90020(self):
        tc_no = 90020
        capv_lib.capvput(self.motor + '-DbgStrToLOG', "Start " + str(tc_no))
        encRel = 0
        #                                       mres, dir,off, hlm, expHLM, expM3rhlm, expLLM, expM3rllm)
        motorInitVeloAcc(self, self.motor, tc_no, encRel)
        mres = -0.1
        dir = 0
        off = 0.5
        setMresDirOff(self, self.motor, tc_no, mres, dir, off)
        motorInitLimitsNoC(self, self.motor, tc_no)
        capv_lib.capvput(self.motor + '-DbgStrToLOG', "End " + str(tc_no))

    def test_TC_90021(self):
        tc_no = 90021
        #setLimit(self, motor, tc_no,    field,  val, expDHLM, expDLLM, expHLM, expLLM, expM3rhlm, expM3rllm):
        setLimit(self, self.motor, tc_no, "DHLM", 4.1,  4.1,    -5.0,    4.6,    -4.5,   50.0,      -41.0)


    def test_TC_90022(self):
        tc_no = 90022
        #setLimit(self, motor, tc_no,    field,  val, expDHLM, expDLLM, expHLM, expLLM, expM3rhlm, expM3rllm):
        setLimit(self, self.motor, tc_no, "HLM",  4.7,  4.2,    -5.0,    4.7,    -4.5,   50.0,      -42.0)


    def test_TC_90023(self):
        tc_no = 90023
        #setLimit(self, motor, tc_no,    field,  val, expDHLM, expDLLM, expHLM, expLLM, expM3rhlm, expM3rllm):
        setLimit(self, self.motor, tc_no, "DLLM", -5.3, 4.2,     -5.3,    4.7,    -4.8,   53.0,     -42.0)

    def test_TC_90024(self):
        tc_no = 90024
        #setLimit(self, motor, tc_no,    field,  val, expDHLM, expDLLM, expHLM, expLLM, expM3rhlm, expM3rllm):
        setLimit(self, self.motor, tc_no, "LLM", -5.4, 4.2,     -5.9,    4.7,    -5.4,    59.0,     -42.0)


    ###################################################################################################################
    #Invert dir
    def test_TC_90030(self):
        tc_no = 90030
        encRel = 0
        capv_lib.capvput(self.motor + '-DbgStrToLOG', "Start " + str(tc_no))
        #                                       mres, dir,off, hlm, expHLM, expM3rhlm, expLLM, expM3rllm)
        motorInitVeloAcc(self, self.motor, tc_no, encRel)
        mres = 0.1
        dir = 1
        off = 0.5
        setMresDirOff(self, self.motor, tc_no, mres, dir, off)
        motorInitLimitsNoC(self, self.motor, tc_no)
        capv_lib.capvput(self.motor + '-DbgStrToLOG', "End " + str(tc_no))

    def test_TC_90031(self):
        tc_no = 90031
        #setLimit(self, motor, tc_no,    field,  val, expDHLM, expDLLM, expHLM, expLLM, expM3rhlm, expM3rllm):
        setLimit(self, self.motor, tc_no, "DHLM", 4.1,  4.1,    -5.0,    5.5,    -3.6,   41.0,      -50.0)


    def test_TC_90032(self):
        tc_no = 90032
        #setLimit(self, motor, tc_no,    field,  val, expDHLM, expDLLM, expHLM, expLLM, expM3rhlm, expM3rllm):
        setLimit(self, self.motor, tc_no, "HLM",  4.7,  4.1,      -4.2,   4.7,    -3.6,   41.0,      -42.0)


    def test_TC_90033(self):
        tc_no = 90033
        #setLimit(self, motor, tc_no,    field,  val, expDHLM, expDLLM, expHLM, expLLM, expM3rhlm, expM3rllm):
        setLimit(self, self.motor, tc_no, "DLLM", -5.3, 4.1,     -5.3,    5.8,    -3.6,   41.0,     -53.0)

    def test_TC_90034(self):
        tc_no = 90034
        #setLimit(self, motor, tc_no,    field,  val, expDHLM, expDLLM, expHLM, expLLM, expM3rhlm, expM3rllm):
        setLimit(self, self.motor, tc_no, "LLM", -5.4, 5.9,     -5.3,    5.8,    -5.4,    59.0,     -53.0)

    ###################################################################################################################
    #Invert mres, invert dir
    def test_TC_90040(self):
        tc_no = 90040
        encRel = 0
        capv_lib.capvput(self.motor + '-DbgStrToLOG', "Start " + str(tc_no))
        #                                       mres, dir,off, hlm, expHLM, expM3rhlm, expLLM, expM3rllm)
        motorInitVeloAcc(self, self.motor, tc_no, encRel)
        mres = -0.1
        dir = 1
        off = 0.5
        setMresDirOff(self, self.motor, tc_no, mres, dir, off)
        motorInitLimitsNoC(self, self.motor, tc_no)
        capv_lib.capvput(self.motor + '-DbgStrToLOG', "End " + str(tc_no))

    def test_TC_90041(self):
        tc_no = 90041
        #setLimit(self, motor, tc_no,    field,  val, expDHLM, expDLLM, expHLM, expLLM, expM3rhlm, expM3rllm):
        setLimit(self, self.motor, tc_no, "DHLM", 4.1,  4.1,    -5.0,    5.5,    -3.6,    50.0,      -41.0)

    def test_TC_90042(self):
        tc_no = 90042
        #setLimit(self, motor, tc_no,    field,  val, expDHLM, expDLLM, expHLM, expLLM, expM3rhlm, expM3rllm):
        setLimit(self, self.motor, tc_no, "HLM",  4.7,  4.1,    -4.2,    4.7,    -3.6,    42.0,      -41.0)

    def test_TC_90043(self):
        tc_no = 90043
        #setLimit(self, motor, tc_no,    field,  val, expDHLM, expDLLM, expHLM, expLLM, expM3rhlm, expM3rllm):
        setLimit(self, self.motor, tc_no, "DLLM", -5.3, 4.1,     -5.3,    5.8,   -3.6,   53.0,      -41.0)

    def test_TC_90044(self):
        tc_no = 90044
        #setLimit(self, motor, tc_no,    field,  val, expDHLM, expDLLM, expHLM, expLLM, expM3rhlm, expM3rllm):
        setLimit(self, self.motor, tc_no, "LLM", -5.4, 5.9,     -5.3,    5.8,    -5.4,    53.0,      -59.0)


#########################################################################################################
# Test clipping
    def test_TC_90050(self):
        tc_no = 90050
        encRel = 0
        capv_lib.capvput(self.motor + '-DbgStrToLOG', "Start " + str(tc_no))

        print('%s vers=%g hasROlimit=%d' %  (tc_no, self.vers, self.hasROlimit))
        self.assertEqual(1, self.hasROlimit, 'motorRecord supports RO soft limits')

        #                                       mres, dir,off, hlm, expHLM, expM3rhlm, expLLM, expM3rllm)
        motorInitVeloAcc(self, self.motor, tc_no, encRel)
        mres = 0.1
        dir = 0
        off = 0.5
        setMresDirOff(self, self.motor, tc_no, mres, dir, off)
        motorInitLimitsWithC(self, self.motor, tc_no)
        capv_lib.capvput(self.motor + '-DbgStrToLOG', "End " + str(tc_no))

    def test_TC_90051(self):
        self.assertEqual(1, self.hasROlimit, 'motorRecord supports RO soft limits')
        tc_no = 90051
        #setLimit(self, motor, tc_no,    field,  val, expDHLM, expDLLM, expHLM, expLLM, expM3rhlm, expM3rllm):
        setLimit(self, self.motor, tc_no, "DHLM", 10,  0.6,    -0.7,     1.1,    -0.2,   6.0,      -7.0)

    def test_TC_90052(self):
        self.assertEqual(1, self.hasROlimit, 'motorRecord supports RO soft limits')
        tc_no = 90052
        #setLimit(self, motor, tc_no,    field,  val, expDHLM, expDLLM, expHLM, expLLM, expM3rhlm, expM3rllm):
        setLimit(self, self.motor, tc_no, "HLM",  10,  0.6,    -0.7,     1.1,    -0.2,   6.0,      -7.0)

    def test_TC_90053(self):
        self.assertEqual(1, self.hasROlimit, 'motorRecord supports RO soft limits')
        tc_no = 90053
        #setLimit(self, motor, tc_no,    field,  val, expDHLM, expDLLM, expHLM, expLLM, expM3rhlm, expM3rllm):
        setLimit(self, self.motor, tc_no, "DLLM", -10.0, 0.6,  -0.7,     1.1,    -0.2,   6.0,      -7.0)

    def test_TC_90054(self):
        self.assertEqual(1, self.hasROlimit, 'motorRecord supports RO soft limits')
        tc_no = 90054
        #setLimit(self, motor, tc_no,    field,  val, expDHLM, expDLLM, expHLM, expLLM, expM3rhlm, expM3rllm):
        setLimit(self, self.motor, tc_no, "LLM", -10.0,  0.6,   -0.7,     1.1,    -0.2,   6.0,      -7.0)

    #Invert mres
    def test_TC_90060(self):
        self.assertEqual(1, self.hasROlimit, 'motorRecord supports RO soft limits')
        tc_no = 90060
        capv_lib.capvput(self.motor + '-DbgStrToLOG', "Start " + str(tc_no))
        encRel = 0
        #                                       mres, dir,off, hlm, expHLM, expM3rhlm, expLLM, expM3rllm)
        motorInitVeloAcc(self, self.motor, tc_no, encRel)
        mres = -0.1
        dir = 0
        off = 0.5
        setMresDirOff(self, self.motor, tc_no, mres, dir, off)
        motorInitLimitsWithC(self, self.motor, tc_no)
        capv_lib.capvput(self.motor + '-DbgStrToLOG', "End " + str(tc_no))

    def test_TC_90061(self):
        self.assertEqual(1, self.hasROlimit, 'motorRecord supports RO soft limits')
        tc_no = 90061
        #setLimit(self, motor, tc_no,    field,  val, expDHLM, expDLLM, expHLM, expLLM, expM3rhlm, expM3rllm):
        setLimit(self, self.motor, tc_no, "DHLM", 10,  0.7,     -0.6,    1.2,    -0.1,    6.0,      -7.0)

    def test_TC_90062(self):
        self.assertEqual(1, self.hasROlimit, 'motorRecord supports RO soft limits')
        tc_no = 90062
        #setLimit(self, motor, tc_no,    field,  val, expDHLM, expDLLM, expHLM, expLLM, expM3rhlm, expM3rllm):
        setLimit(self, self.motor, tc_no, "HLM",  10,  0.7,     -0.6,    1.2,    -0.1,    6.0,      -7.0)

    def test_TC_90063(self):
        self.assertEqual(1, self.hasROlimit, 'motorRecord supports RO soft limits')
        tc_no = 90063
        #setLimit(self, motor, tc_no,    field,  val, expDHLM, expDLLM, expHLM, expLLM, expM3rhlm, expM3rllm):
        setLimit(self, self.motor, tc_no, "DLLM", -10.0, 0.7,    -0.6,    1.2,    -0.1,   6.0,      -7.0)

    def test_TC_90064(self):
        self.assertEqual(1, self.hasROlimit, 'motorRecord supports RO soft limits')
        tc_no = 90064
        #setLimit(self, motor, tc_no,    field,  val, expDHLM, expDLLM, expHLM, expLLM, expM3rhlm, expM3rllm):
        setLimit(self, self.motor, tc_no, "LLM", -10.0,  0.7,    -0.6,    1.2,    -0.1,   6.0,      -7.0)

    #Invert dir
    def test_TC_90070(self):
        self.assertEqual(1, self.hasROlimit, 'motorRecord supports RO soft limits')
        tc_no = 90070
        encRel = 0
        capv_lib.capvput(self.motor + '-DbgStrToLOG', "Start " + str(tc_no))
        #                                       mres, dir,off, hlm, expHLM, expM3rhlm, expLLM, expM3rllm)
        motorInitVeloAcc(self, self.motor, tc_no, encRel)
        mres = 0.1
        dir = 1
        off = 0.5
        setMresDirOff(self, self.motor, tc_no, mres, dir, off)
        motorInitLimitsWithC(self, self.motor, tc_no)
        capv_lib.capvput(self.motor + '-DbgStrToLOG', "End " + str(tc_no))

    def test_TC_90071(self):
        self.assertEqual(1, self.hasROlimit, 'motorRecord supports RO soft limits')
        tc_no = 90071
        #setLimit(self, motor, tc_no,    field,  val, expDHLM, expDLLM, expHLM, expLLM, expM3rhlm, expM3rllm):
        setLimit(self, self.motor, tc_no, "DHLM", 10,  0.6,     -0.7,     1.2,    -0.1,    6.0,      -7.0)

    def test_TC_90072(self):
        self.assertEqual(1, self.hasROlimit, 'motorRecord supports RO soft limits')
        tc_no = 90072
        #setLimit(self, motor, tc_no,    field,  val, expDHLM, expDLLM, expHLM, expLLM, expM3rhlm, expM3rllm):
        setLimit(self, self.motor, tc_no, "HLM",  10,   0.6,     -0.7,     1.2,     -0.1,    6.0,      -7.0)

    def test_TC_90073(self):
        self.assertEqual(1, self.hasROlimit, 'motorRecord supports RO soft limits')
        tc_no = 90073
        #setLimit(self, motor, tc_no,    field,  val, expDHLM, expDLLM, expHLM, expLLM, expM3rhlm, expM3rllm):
        setLimit(self, self.motor, tc_no, "DLLM", -10.0, 0.6,     -0.7,     1.2,     -0.1,    6.0,      -7.0)

    def test_TC_90074(self):
        self.assertEqual(1, self.hasROlimit, 'motorRecord supports RO soft limits')
        tc_no = 90074
        #setLimit(self, motor, tc_no,    field,  val, expDHLM, expDLLM, expHLM, expLLM, expM3rhlm, expM3rllm):
        setLimit(self, self.motor, tc_no, "LLM", -10.0,  0.6,     -0.7,     1.2,     -0.1,    6.0,      -7.0)

    #Invert MRES and dir
    def test_TC_90080(self):
        self.assertEqual(1, self.hasROlimit, 'motorRecord supports RO soft limits')
        tc_no = 90080
        capv_lib.capvput(self.motor + '-DbgStrToLOG', "Start " + str(tc_no))
        encRel = 0
        #                                       mres, dir,off, hlm, expHLM, expM3rhlm, expLLM, expM3rllm)
        motorInitVeloAcc(self, self.motor, tc_no, encRel)
        mres = -0.1
        dir = 1
        off = 0.5
        setMresDirOff(self, self.motor, tc_no, mres, dir, off)
        motorInitLimitsWithC(self, self.motor, tc_no)
        capv_lib.capvput(self.motor + '-DbgStrToLOG', "End " + str(tc_no))

    def test_TC_90081(self):
        self.assertEqual(1, self.hasROlimit, 'motorRecord supports RO soft limits')
        tc_no = 90081
        #setLimit(self, motor, tc_no,    field,  val, expDHLM, expDLLM, expHLM, expLLM, expM3rhlm, expM3rllm):
        setLimit(self, self.motor, tc_no, "DHLM", 10,  0.7,      -0.6,    1.1,    -0.2,   6.0,      -7.0)

    def test_TC_90082(self):
        self.assertEqual(1, self.hasROlimit, 'motorRecord supports RO soft limits')
        tc_no = 90082
        #setLimit(self, motor, tc_no,    field,  val, expDHLM, expDLLM, expHLM, expLLM, expM3rhlm, expM3rllm):
        setLimit(self, self.motor, tc_no, "HLM",  10,  0.7,     -0.6,    1.1,    -0.2,    6.0,      -7.0)

    def test_TC_90083(self):
        self.assertEqual(1, self.hasROlimit, 'motorRecord supports RO soft limits')
        tc_no = 90083
        #setLimit(self, motor, tc_no,    field,  val, expDHLM, expDLLM, expHLM, expLLM, expM3rhlm, expM3rllm):
        setLimit(self, self.motor, tc_no, "DLLM", -10, 0.7,     -0.6,    1.1,    -0.2,    6.0,      -7.0)

    def test_TC_90084(self):
        self.assertEqual(1, self.hasROlimit, 'motorRecord supports RO soft limits')
        tc_no = 90084
        #setLimit(self, motor, tc_no,    field,  val, expDHLM, expDLLM, expHLM, expLLM, expM3rhlm, expM3rllm):
        setLimit(self, self.motor, tc_no, "LLM", -10,  0.7,     -0.6,    1.1,    -0.2,    6.0,      -7.0)


    def test_TC_900999(self):
        if self.drvUseEGU_RB == 1:
            capv_lib.capvput(self.motor + '-DrvUseEGU', 1)
Esempio n. 25
0
    def setSoftLimitsOn(self, motor, low_limit, high_limit):
        """
        Set the soft limits
        """
        # switch on the controller soft limits
        try:
            capv_lib.capvput(motor + '-CfgDHLM',
                             high_limit,
                             wait=True,
                             timeout=2)
            capv_lib.capvput(motor + '-CfgDLLM',
                             low_limit,
                             wait=True,
                             timeout=2)
            capv_lib.capvput(motor + '-CfgDHLM-En', 1, wait=True, timeout=2)
            capv_lib.capvput(motor + '-CfgDLLM-En', 1, wait=True, timeout=2)
        finally:
            oldRBV = capv_lib.capvget(motor + '.RBV')

        if oldRBV < 0:
            capv_lib.capvput(motor + '.LLM', low_limit)
            capv_lib.capvput(motor + '.HLM', high_limit)
        else:
            capv_lib.capvput(motor + '.HLM', high_limit)
            capv_lib.capvput(motor + '.LLM', low_limit)
    def test_TC_9402(self):
        motor = self.motor
        tc_no = "TC-9402-EnabledFailed"

        capv_lib.capvput(motor + '.CNEN', 0, wait=True)
        setValueOnSimulator(self, motor, tc_no, "bAmplifierLockedToBeOff",
                            AMPLIFIER_LOCKED_TO_BE_OFF_SILENT)
        capv_lib.capvput(motor + '-PwrAuto', 0)
        time.sleep(1.0)

        capv_lib.capvput(motor + '.CNEN', 1, wait=True)
        time.sleep(4.0)
        mstaErr = int(capv_lib.capvget(motor + '.MSTA', use_monitor=False))
        print('%s Error mstaErr=%s' % (tc_no, lib.getMSTAtext(mstaErr)))
        capv_lib.capvput(motor + '-ErrRst',1)

        setValueOnSimulator(self, motor, tc_no, "bAmplifierLockedToBeOff", 0)

        mstaOKagain = int(capv_lib.capvget(motor + '.MSTA', use_monitor=False))
        bError   = capv_lib.capvget(motor + '-Err', use_monitor=False)
        nErrorId = capv_lib.capvget(motor + '-ErrId', use_monitor=False)
        print('%s Clean lib.MSTA_BIT_PROBLEM=%x mstaOKagain=%s bError=%d nErrorId=%d' % (tc_no, lib.MSTA_BIT_PROBLEM, lib.getMSTAtext(mstaOKagain), bError, nErrorId))

        capv_lib.capvput(motor + '.CNEN', self.saved_CNEN)
        capv_lib.capvput(motor + '-PwrAuto', self.saved_PwrAuto)

        self.assertNotEqual(0, mstaErr & lib.MSTA_BIT_PROBLEM, 'Error MSTA.Problem should be set)')
        self.assertEqual(0, mstaErr & lib.MSTA_BIT_SLIP_STALL, 'Error MSTA.Slip stall Error should not be set)')
        self.assertEqual(0, mstaErr & lib.MSTA_BIT_MOVING,     'Error MSTA.Moving)')

        self.assertEqual(0, mstaOKagain & lib.MSTA_BIT_MOVING,  'Clean MSTA.Moving)')
        self.assertEqual(0, bError,   'bError')
        self.assertEqual(0, nErrorId, 'nErrorId')
Esempio n. 27
0
class Test(unittest.TestCase):
    motor = os.getenv("TESTEDMOTORAXIS")
    capv_lib.capvput(motor + '-DbgStrToLOG',
                     "Start " + os.path.basename(__file__)[0:20])

    hlm = capv_lib.capvget(motor + '.HLM')
    llm = capv_lib.capvget(motor + '.LLM')

    per10_UserPosition = round((9 * llm + 1 * hlm) / 10)
    per20_UserPosition = round((8 * llm + 2 * hlm) / 10)
    msta = int(capv_lib.capvget(motor + '.MSTA'))

    def getAcceleration(self, motor, tc_no):
        print('%s: getAcceleration %s' % (tc_no, motor))
        res = capv_lib.capvget(motor + '-Acc-RB', use_monitor=False)
        return res

    # Assert that motor is homed
    def test_TC_401(self):
        motor = self.motor
        tc_no = "TC-401"
        if not (self.msta & lib.MSTA_BIT_HOMED):
            self.assertNotEqual(0, self.msta & lib.MSTA_BIT_HOMED,
                                'MSTA.homed (Axis is not homed)')

    # 10% dialPosition
    def test_TC_402(self):
        tc_no = "TC-402-10-percent"
        print('%s' % tc_no)
        motor = self.motor
        if (self.msta & lib.MSTA_BIT_HOMED):
            ret = lib.move(self.motor, self.per10_UserPosition, 60)
            assert (ret == 0)

    # 20% dialPosition
    def test_TC_403(self):
        tc_no = "TC-403-20-percent"
        print('%s' % tc_no)
        motor = self.motor
        if (self.msta & lib.MSTA_BIT_HOMED):
            saved_ACCL = float(capv_lib.capvget(motor + '.ACCL'))
            saved_VELO = float(capv_lib.capvget(motor + '.VELO'))
            used_ACCL = saved_ACCL + 1.0  # Make sure we have an acceleration != 0
            capv_lib.capvput(motor + '.ACCL', used_ACCL)
            ret = lib.move(self.motor, self.per20_UserPosition, 60)
            resacc = self.getAcceleration(motor, tc_no)
            expacc = saved_VELO / used_ACCL
            capv_lib.capvput(motor + '.ACCL', saved_ACCL)
            print('%s ACCL=%f expacc=%f resacc=%f' %
                  (tc_no, used_ACCL, expacc, resacc))
            assert lib.calcAlmostEqual(self.motor, tc_no, expacc, resacc, 2)
            assert (ret == 0)

    # JOGR
    def test_TC_404(self):
        tc_no = "TC-404-JOGR"
        print('%s' % tc_no)
        motor = self.motor
        if (self.msta & lib.MSTA_BIT_HOMED):
            accl = float(capv_lib.capvget(motor + '.ACCL'))
            jvel = float(capv_lib.capvget(motor + '.JVEL'))
            saved_JAR = float(capv_lib.capvget(motor + '.JAR'))
            used_JAR = jvel / (accl + 2.0)
            capv_lib.capvput(motor + '.JAR', used_JAR)
            capv_lib.capvput(motor + '.JOGR', 1, wait=True)
            resacc = self.getAcceleration(motor, tc_no)
            expacc = used_JAR
            capv_lib.capvput(motor + '.JAR', saved_JAR)
            print('%s JAR=%f expacc=%f resacc=%f' %
                  (tc_no, used_JAR, expacc, resacc))

            assert lib.calcAlmostEqual(self.motor, tc_no, expacc, resacc, 2)
Esempio n. 28
0
    def test_TC_2402(self):
        motor = self.motor
        tc_no = "2402-JOGF_stopped"
        print('%s' % tc_no)

        if (self.msta & lib.MSTA_BIT_HOMED):
            capv_lib.capvput(motor + '-DbgStrToLOG', "Start " + tc_no[0:20])
            capv_lib.capvput(motor + '.DLY', 0)
            destination = self.per10_UserPosition
            done = lib.moveWait(motor, tc_no, destination)
            UserPosition = capv_lib.capvget(motor + '.RBV', use_monitor=False)
            print('%s postion=%f per10_UserPosition=%f' %
                  (tc_no, UserPosition, self.per90_UserPosition))

            capv_lib.capvput(motor + '.JOGF', 1)
            ret2 = lib.waitForStart(motor, tc_no, 2.0)

            time.sleep(1)
            capv_lib.capvput(motor + '-Stop', 1)
            ret3 = lib.waitForStop(motor, tc_no, 2.0)

            val = capv_lib.capvget(motor + '.VAL')

            try:
                res4 = lib.verifyPosition(motor, val)
            except:
                e = sys.exc_info()
                print(str(e))
                res4 = globals.FAIL

            capv_lib.capvput(motor + '.DLY', self.saved_DLY)
            capv_lib.capvput(motor + '-DbgStrToLOG', "End " + tc_no[0:20])

            self.assertEqual(1, done, 'moveWait should return done')
            self.assertEqual(res4, globals.SUCCESS, 'VAL synched with RBV')
Esempio n. 29
0
def motorInitTC(tself, motor, tc_no, frac, encRel):
    capv_lib.capvput(motor + '.FRAC', frac)
    capv_lib.capvput(motor + '.UEIP', encRel)
    msta = int(capv_lib.capvget(motor + '.MSTA', use_monitor=False))
    print('%s:%d motorInitTC msta=%s' %
          (tc_no, lineno(), lib.getMSTAtext(msta)))
def setMresDirOff(self, motor, tc_no, mres, dir, off):
    capv_lib.capvput(motor + '.MRES', mres)
    capv_lib.capvput(motor + '.DIR',  dir)
    capv_lib.capvput(motor + '.OFF', off)