Closedown

This commit is contained in:
boccioli_m
2015-06-23 11:59:26 +02:00
parent 9d9d0b1056
commit e269af3f63
7 changed files with 43 additions and 36 deletions

View File

@@ -35,7 +35,6 @@ public class TestingList extends Panel {
Task task = new Task() {
@Override
protected Object execute() throws Exception {
return true;
}
};
@@ -61,11 +60,11 @@ public class TestingList extends Panel {
Object deviceName = eval("DEVICE");
String sStatus = (status == true) ? TestStatus.SUCCESS.toString() : TestStatus.FAILURE.toString();
if (exception!=null){
SwingUtils.showMessage(getComponent(), "Error", String.valueOf(exception));
} else {
SwingUtils.showMessage(getComponent(), "onExecutedFile()", String.valueOf(result));
}
// if (exception!=null){
// SwingUtils.showMessage(getComponent(), "Error", String.valueOf(exception));
// } else {
// SwingUtils.showMessage(getComponent(), "onExecutedFile()", String.valueOf(result));
// }
if (ret != "" ) {
//SwingUtils.showMessage(getComponent(), "", ret.toString() + " - " + ret.getClass().getName());
@@ -233,7 +232,6 @@ public class TestingList extends Panel {
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
@@ -360,8 +358,6 @@ public class TestingList extends Panel {
add(jPanel1, java.awt.BorderLayout.NORTH);
}// </editor-fold>//GEN-END:initComponents
private void jButtonRunActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonRunActionPerformed
if(this.jButtonRun.getToolTipText().equals("Run selected tests")){
setButtonToStart();
@@ -421,7 +417,6 @@ public class TestingList extends Panel {
} catch (Exception ex){
SwingUtils.showException(this, ex);
}
}//GEN-LAST:event_jTable1MouseClicked
//oopen the log file using one of th default OS text reades
@@ -435,7 +430,8 @@ public class TestingList extends Panel {
try {
Runtime.getRuntime().exec(cmd);
} catch (IOException ex) {
SwingUtils.showMessage(this, "jButtonOpenLogActionPerformed()", "jButtonOpenLogActionPerformed() "+ ex.toString() + " \nPlease open the file manually. \nFile dir: "+TESTS_LOG_DEFAULT_DIR);
SwingUtils.showMessage(this, "jButtonOpenLogActionPerformed()", "jButtonOpenLogActionPerformed() "+ ex.toString() +
" \nPlease open the file manually. \nFile dir: "+TESTS_LOG_DEFAULT_DIR);
Logger.getLogger(TestingList.class.getName()).log(Level.SEVERE, null, ex);
}
}//GEN-LAST:event_jButtonOpenLogActionPerformed
@@ -502,7 +498,7 @@ public class TestingList extends Panel {
sLastResult = jTable1.getValueAt(row, COL.RESULT.ordinal()).toString();
sResultTime = jTable1.getValueAt(row, COL.TIME.ordinal()).toString();
mParameters = buildParametersMap(String.valueOf(jTable1.getValueAt(row, COL.TESTPARAMS.ordinal())));
//create map to pass to details panel
//create map for passing details to Details Panel
HashMap details = new HashMap();
details.put("deviceName", sDeviceName);
details.put("deviceDescription", sDeviceDescription);
@@ -528,7 +524,7 @@ public class TestingList extends Panel {
public int showResult(String deviceName, String testName, String res, String status) {
int rowD = -1;
String sTestName = testName;
logger.log(Level.SEVERE, "Looking for: deviceName: " + deviceName + "; testPath: "+testName+" in table.");
logger.log(Level.FINE, "Looking for: deviceName: " + deviceName + "; testPath: "+testName+" in table.");
//search for device name in table
for (int row = 0; row <= jTable1.getRowCount() - 1; row++) {
if (deviceName.equals(jTable1.getValueAt(row, COL.DEVICENAME.ordinal())) &&
@@ -542,15 +538,15 @@ public class TestingList extends Panel {
switch (status) {
case "Success":
icon = TestStatus.SUCCESS.Icon();
logger.log(Level.INFO, "Device: " + deviceName + "; Test: " + sTestName + "; Result: " + res + " (" + status + ")");
logger.log(Level.INFO, status + " - Device: " + deviceName + "; Test: " + sTestName + "; Result: " + res);
break;
case "Failure":
icon = TestStatus.FAILURE.Icon();
logger.log(Level.SEVERE, "Device: " + deviceName + "; Test: " + sTestName + "; Result: " + res + " (" + status + ")");
logger.log(Level.SEVERE, status + " - Device: " + deviceName + "; Test: " + sTestName + "; Result: " + res);
break;
case "Running":
icon = TestStatus.RUNNING.Icon();
logger.log(Level.INFO, "Running Test: " + sTestName + ".");
//logger.log(Level.INFO, "Running Test: " + sTestName + ".");
break;
}
if (rowD >= 0) {
@@ -560,7 +556,7 @@ public class TestingList extends Panel {
jTable1.setValueAt(status, rowD, COL.STATUS.ordinal());
}
else{
logger.log(Level.SEVERE, "Cant find Test: " + testName + " in table.");
logger.log(Level.SEVERE, "Cant find Test: " + testName + " in table.");
}
return rowD;
}
@@ -668,7 +664,9 @@ public class TestingList extends Panel {
args.put("status", false);
if(!mParameters.isEmpty()){
args.put("parameters", mParameters);
logger.log(Level.INFO,"Running tests with the following parameters: " + mParameters.toString());
logger.log(Level.INFO, "Running test '"+sTestName+"' with the following parameters: " + mParameters.toString());
} else {
logger.log(Level.INFO, "Running Test '" + sTestName + "'. No parameters found.");
}
runAsync(sTestPath, args);
} catch (Exception ex) {

View File

@@ -4,4 +4,4 @@ filename=Motor Test 3.xml
#optional parameters. Description is compulsory. Syntax:
#parameters=<parameter1Name>:<parameter1Value>:<Parameter 1 description>[;<parameter1Name>:<parameter1Value>:<Parameter 1 description>]
parameters=repeatTimes:3:Repeat M times;delayS:5:Pause delay [s]
parameters=repeatTimes:2:Repeat M times;delayS:5:Pause delay [s]

View File

@@ -19,12 +19,10 @@ except:
success = False
raise Exception('Could not retrieve testing parameters - ' + traceback.format_exc())
print "a"
#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, 3000.0], [3000, 20])
scan = ManualScan(['idX'], ['idMotorStatus', 'idLogicalPosition', 'idDiameter', 'idMotorPosition', 'idPotiRaw', 'idPotiProc', 'idBtvsRaw', 'idBtvsProc', 'idDiff01', 'idDiff02'] , [ 0.0], [ 3000.0], [20])
scan.start()
print "b"
#Creating channels: dimension 1
try:
#RegionPositioner idInkr
@@ -70,11 +68,10 @@ except:
success = False
raise Exception('Unable to create channel - ' + traceback.format_exc())
sys.exit()
print "c"
#remove limits
idLimitH.put(999999.9, timeout=None)
idLimitL.put(-999999.9, timeout=None)
print "d"
#Dimension 1
direction = 1.0;
startDefault = -100.0
@@ -85,11 +82,9 @@ idInkr.put(-100.0, timeout=None) # TODO: Set appropriate timeout
start = startDefault #idInkr.get()+direction
setpoint2 = end
count = 0
print "e" + str(loopTimes)
for setpoint1 in range(0, loopTimes):
print "f"
sleep( delaySeconds ) # Settling time
print "g"
#RegionPositioner idInkr
idInkr.put(setpoint2, timeout=None) # TODO: Set appropriate timeout
readback2 = idInkr.get()
@@ -127,7 +122,6 @@ for setpoint1 in range(0, loopTimes):
b = detector6
count = count + 1
idDiff01 = a-b
print "h"
if endH>0.0 :
#invert direction and swap start with end of translation
setpoint2 = start
@@ -142,7 +136,6 @@ for setpoint1 in range(0, loopTimes):
#set limits back
idLimitH.put(145.0, timeout=None)
idLimitL.put(0.0, timeout=None)
print "i"
#Closing channels
idInkr.close()
idMotorStatus.close()
@@ -153,7 +146,6 @@ idPotiRaw.close()
idPotiProc.close()
idBtvsRaw.close()
idBtvsProc.close()
print "l"
scan.end()
ret = 'Slide moved back and forth (' + str(count) + ' runs)'
status = True

View File

@@ -4,4 +4,4 @@ filename=Motor Test 3.xml
#optional parameters. Description is compulsory. Syntax:
#parameters=<parameter1Name>:<parameter1Value>:<Parameter 1 description>[;<parameter1Name>:<parameter1Value>:<Parameter 1 description>]
parameters=repeatTimes:3:Repeat N times;midPoint:41.0:Middle point A;spanFromMidPoint:11.0:Span around middle point B
parameters=repeatTimes:2:Repeat N times;midPoint:41.0:Middle point A;spanFromMidPoint:11.0:Span around middle point B

View File

@@ -13,9 +13,9 @@ status = False
try:
print "Running test with the following parameters:"
print parameters
middle = parameters["midPoint"]
loopTimes = parameters["repeatTimes"]
span = parameters["spanFromMidPoint"]
middle = int(parameters["midPoint"]["value"])
loopTimes = int(parameters["repeatTimes"]["value"])
span = int(parameters["spanFromMidPoint"]["value"])
except:
print "Could not retrieve testing parameters: ", sys.exc_info()[0]
ret = 'Could not retrieve testing parameters - ' + traceback.format_exc()

View File

@@ -1,3 +1,7 @@
name=Motor Test 3
description=Moves from CCW to CW as a series of discrete translations (C times) logs after each translation. When end switch is encountered change direction. Repeat N times
filename=Motor Test 3.xml
#optional parameters. Description is compulsory. Syntax:
#parameters=<parameter1Name>:<parameter1Value>:<Parameter 1 description>[;<parameter1Name>:<parameter1Value>:<Parameter 1 description>]
parameters=repeatTimes:2:Repeat M times;translation:2:Translation with

View File

@@ -7,6 +7,18 @@ import traceback
ret = 'Test failed'
status = False
#get parameters from the calling interface
try:
print "Running test with the following parameters:"
print parameters
loopTimes = int(parameters["repeatTimes"]["value"])
direction = int(parameters["translation"]["value"])
except:
print "Could not retrieve testing parameters: ", sys.exc_info()[0]
ret = 'Could not retrieve testing parameters - ' + traceback.format_exc()
success = False
raise Exception('Could not retrieve testing parameters - ' + traceback.format_exc())
#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, 3000.0], [3000, 20])
scan = ManualScan(['idX'], ['idMotorStatus', 'idLogicalPosition', 'idDiameter', 'idMotorPosition', 'idPotiRaw', 'idPotiProc', 'idBtvsRaw', 'idBtvsProc', 'idDiff01', 'idDiff02'] , [ 0.0], [ 3000.0], [20])
@@ -62,8 +74,9 @@ except:
idLimitH.put(999999.9, timeout=None)
idLimitL.put(-999999.9, timeout=None)
#Dimension 1
direction = 1.0;
if direction == 0.0 :
direction = 1.0
startDefault = -100.0
endDefault = 1000.0
end = endDefault
@@ -71,7 +84,7 @@ end = endDefault
idInkr.put(-100.0, timeout=None) # TODO: Set appropriate timeout
start = idInkr.get()+direction
countSteps = 0
loopTimes = 2
count = 0
for setpoint1 in range(0, loopTimes):
count = count + 1