diff --git a/plugins/TestingList.java b/plugins/TestingList.java index 7cea556..c0f5115 100644 --- a/plugins/TestingList.java +++ b/plugins/TestingList.java @@ -37,6 +37,8 @@ import javax.swing.table.TableColumn; import javax.swing.table.TableColumnModel; import org.apache.commons.io.FilenameUtils; + + public class TestingList extends Panel { NetbeansPluginPanel testingList; @@ -111,6 +113,62 @@ public class TestingList extends Panel { } } + public enum COL { + CHECK (0), + TIME (1), + DEVICENAME (2), + DEVICEDESCR (3), + TESTSUITE (4), + TESTNAME (5), + RESULT (6), + STATUS (7), + ICON (8); + private int value; + + private COL(int value) { + this.value = value; + } + + public int index(){ + return (int) value; + } + + + + }; + +/* + public enum Column{ + PENNY(1) { + @Override + public String color() { + return "copper"; + } + }, NICKLE(5) { + @Override + public String color() { + return "bronze"; + } + }, DIME(10) { + @Override + public String color() { + return "silver"; + } + }, QUARTER(25) { + @Override + public String color() { + return "silver"; + } + }; + private int value; + + public abstract String color(); + + private Currency(int value) { + this.value = value; + } + } +*/ public class NetbeansPluginPanel extends MonitoredPanel { Logger logger = Logger.getLogger("TestsLog"); @@ -131,7 +189,7 @@ public class TestingList extends Panel { private final int COL_RESULT = 6; private final int COL_STATUS = 7; private final int COL_ICON = 8; - + private void initLogger() { try { FileHandler fh; @@ -459,7 +517,7 @@ public class TestingList extends Panel { sStatus = "Disabled"; icon = null; } - jTable1.setValueAt(bSelected, row, COL_CHECK); + jTable1.setValueAt(bSelected, row, COL.CHECK.index()); jTable1.setValueAt(icon, row, COL_ICON); jTable1.setValueAt(sStatus, row, COL_STATUS); } diff --git a/script/Motor Test 3.py b/script/Motor Test 3.py index e68de21..5792a11 100644 --- a/script/Motor Test 3.py +++ b/script/Motor Test 3.py @@ -6,7 +6,8 @@ ret = 'Test failed' status = False #TODO: Set the diplay names of positioners and detectors -scan = ManualScan(['idX', 'idInkr'], ['idMotorStatus', 'idLogicalPosition', 'idDiameter', 'idMotorPosition', 'idPotiRaw', 'idPotiProc', 'idBtvsRaw', 'idBtvsProc', 'idDiff01', 'idDiff02'] , [-0.5, 0.0], [4.0, 11.0], [3000, 20]) +#scan = ManualScan(['idX', 'idInkr'], ['idMotorStatus', 'idLogicalPosition', 'idDiameter', 'idMotorPosition', 'idPotiRaw', 'idPotiProc', 'idBtvsRaw', 'idBtvsProc', 'idDiff01', 'idDiff02'] , [-0.5, 0.0], [4.0, 3000.0], [3000, 20]) +scan = ManualScan(['idX'], ['idMotorStatus', 'idLogicalPosition', 'idDiameter', 'idMotorPosition', 'idPotiRaw', 'idPotiProc', 'idBtvsRaw', 'idBtvsProc', 'idDiff01', 'idDiff02'] , [ 0.0], [ 3000.0], [20]) scan.start() #Creating channels: dimension 1 @@ -19,13 +20,13 @@ try: idMotorStatus = Channel(DEVICE+':MOTOR.MSTA', type = 'd') #ScalarDetector idLogicalPosition #idLogicalPosition = Channel(DEVICE+':IST:2', type = 'd') - idLogicalPosition = Channel(DEVICE+':MOTOR.ATHM', type = 'd') + idLogicalPosition = Channel(DEVICE+':MOTOR.RVAL', type = 'd') #ScalarDetector idDiameter #idDiameter = Channel(DEVICE+':DIAM:2', type = 'd') idDiameter = Channel(DEVICE+':ENCODERoff', type = 'd') #ScalarDetector idMotorPosition #idMotorPosition = Channel(DEVICE+':IST1:2', type = 'd') - idMotorPosition = Channel(DEVICE+':MOTOR.RVAL', type = 'd') + idMotorPosition = Channel(DEVICE+':MOTOR.RBV', type = 'd') #ScalarDetector idPotiRaw #idPotiRaw = Channel(DEVICE+':POSA:1', type = 'd') idPotiRaw = Channel(DEVICE+':ENCODERraw', type = 'd') @@ -38,56 +39,98 @@ try: #ScalarDetector idBtvsProc #idBtvsProc = Channel(DEVICE+':IST3:2', type = 'd') idBtvsProc = Channel(DEVICE+':MOTOR.HLS', type = 'd') + #ScalarDetector idEndSwitchL + #idBtvsRaw = Channel(DEVICE+':IST3:1', type = 'd') + idEndSwitchL = Channel(DEVICE+':MOTOR.LLS', type = 'd') + #ScalarDetector idEndSwitchH + #idBtvsProc = Channel(DEVICE+':IST3:2', type = 'd') + idEndSwitchH = Channel(DEVICE+':MOTOR.HLS', type = 'd') + #high position limit + idLimitH = Channel(DEVICE+':MOTOR.HLM', type = 'd') + #low position limit + idLimitL = Channel(DEVICE+':MOTOR.LLM', type = 'd') except: print "Unexpected error:", sys.exc_info()[0] ret = 'Unable to create channel - ' + traceback.format_exc() success = False raise sys.exit() + +#remove limits +idLimitH.put(999999.9, timeout=None) +idLimitL.put(-999999.9, timeout=None) #Dimension 1 -#PseudoPositioner idX -for setpoint1 in range(0, 3): - readback1 = setpoint1 - sleep( 0.1 ) # Settling time +direction = 1.0; +startDefault = -100.0 +endDefault = 1000.0 +end = endDefault +#find position at Low end switch: it will be the starting point of the test +idInkr.put(-100.0, timeout=None) # TODO: Set appropriate timeout +start = idInkr.get()+direction + +for setpoint1 in range(0, 6): + sleep( 2 ) # Settling time #RegionPositioner idInkr - for setpoint2 in frange(40.0, 42.0, 1.0, True) + frange(11.0, 0.0, -1.0, True): - idInkr.put(setpoint2, timeout=None) # TODO: Set appropriate timeout - readback2 = idInkr.get() - if abs(readback2 - setpoint2) > 0.5 : # TODO: Check accuracy - ret = 'Actor idInkr could not be set to the value ' + str(setpoint2) + ' (current value: ' + str(readback2) + ')' - success = False - raise Exception(ret) - sleep( 0.2 ) # Settling time - #Detector idMotorStatus - detector1 = idMotorStatus.get() - #Detector idLogicalPosition - detector2 = idLogicalPosition.get() - #Detector idDiameter - detector3 = idDiameter.get() - #Detector idMotorPosition - detector4 = idMotorPosition.get() - #Detector idPotiRaw - detector5 = idPotiRaw.get() - #Detector idPotiProc - detector6 = idPotiProc.get() - #Detector idBtvsRaw - detector7 = idBtvsRaw.get() - #Detector idBtvsProc - detector8 = idBtvsProc.get() - #Manipulation idDiff02 - #Variable Mappings - a = detector4 - b = detector8 - count = setpoint1 - idDiff02 = a-b - #Manipulation idDiff01 - #Variable Mappings - a = detector4 - b = detector6 - count = setpoint1 - idDiff01 = a-b - scan.append ([setpoint1, setpoint2], [readback1, readback2], [detector1, detector2, detector3, detector4, detector5, detector6, detector7, detector8, idDiff02, idDiff01]) + for setpoint2 in frange(start, end, direction): + readback1 = setpoint1 + sleep( 0.1 ) # Settling time + idInkr.put(setpoint2, timeout=None) # TODO: Set appropriate timeout + readback2 = idInkr.get() + if abs(readback2 - setpoint2) > 1 : # TODO: Check accuracy + ret = 'Actor idInkr could not be set to the value ' + str(setpoint2) + ' (current value: ' + str(readback2) + ')' + success = False + raise Exception(ret) + #Detector idMotorStatus + detector1 = idMotorStatus.get() + #Detector idLogicalPosition + detector2 = idLogicalPosition.get() + #Detector idDiameter + detector3 = idDiameter.get() + #Detector idMotorPosition + detector4 = idMotorPosition.get() + #Detector idPotiRaw + detector5 = idPotiRaw.get() + #Detector idPotiProc + detector6 = idPotiProc.get() + #Detector idBtvsRaw + detector7 = idBtvsRaw.get() + #Detector idBtvsProc + detector8 = idBtvsProc.get() + #end switches + endH = idEndSwitchH.get() + endL = idEndSwitchL.get() + #Manipulation idDiff02 + #Variable Mappings + a = detector4 + b = detector8 + count = setpoint1 + idDiff02 = a-b + #Manipulation idDiff01 + #Variable Mappings + a = detector4 + b = detector6 + count = setpoint1 + idDiff01 = a-b + scan.append ([setpoint2], [readback2], [detector1, detector2, detector3, detector4, detector5, detector6, detector7, detector8, idDiff02, idDiff01]) + if endH>0.0 : + #invert direction and swap start with end of translation + end = startDefault + start = readback2 - direction + direction = -1.0 + print 'End H switch, changing direction to ' + str(direction) + break + if endL>0.0 : + #invert direction and swap start with end of translation + end = endDefault + start = readback2 - direction + direction = 1.0 + print 'End L switch, changing direction to ' + str(direction) + break + +#set limits back +idLimitH.put(145.0, timeout=None) +idLimitL.put(0.0, timeout=None) #Closing channels idInkr.close()