From 992bc2334fd5186fa5efea2a0cabbc4efbbab376 Mon Sep 17 00:00:00 2001 From: boccioli_m Date: Tue, 20 Mar 2018 14:07:34 +0100 Subject: [PATCH] Startup --- script/tests/devices/PO2DV-NCS-LS/.config | 4 + script/tests/devices/PO2DV-NCS-VHQ1/.config | 3 + script/tests/devices/PO2TC-NCS-RS/.config | 3 + script/tests/devices/Production/DMAF1/.config | 3 + .../devices/Production/PO2DV-NCS-VHQ1/.config | 3 + .../devices/Production/PO2TC-NCS-FIXL/.config | 3 + .../devices/Production/PO2TC-NCS-MWD/.config | 3 + .../devices/Production/PO2TC-NCS-SC21/.config | 3 + .../devices/Production/PO2TC-NCS-SC22/.config | 3 + .../devices/Production/PO2TC-NCS-SC23/.config | 3 + script/tests/devices/bx84/.config | 5 + script/tests/devices/bx84_2/.config | 5 + script/tests/devices/oldDev1/.config | 4 + script/tests/devices/oldDev2/.config | 4 + .../devices/AMA1/.config | 5 + .../devices/Gantry1/.config | 5 + .../devices/Gantry2/.config | 5 + .../devices/Gantry3/.config | 5 + .../devices/Optis/.config | 5 + .../devices/PIF/.config | 5 + .../devices/XMA0310/.config | 5 + .../devices/XMA0311/.config | 5 + .../devices/XMA0410/.config | 5 + .../devices/XMA1115/.config | 5 + .../devices/XMA1116/.config | 5 + .../devices/XMA1117/.config | 5 + .../devices/XMA1118/.config | 5 + .../devices/XMA1119/.config | 5 + .../devices/XMB0510/.config | 5 + .../devices/XMC0610/.config | 5 + .../devices/XMC2010/.config | 5 + .../devices/XMC2011/.config | 5 + .../devices/XMD0710/.config | 5 + .../devices/XMD0711/.config | 5 + .../devices/XMD0717/.config | 5 + .../devices/XME1310/.config | 5 + .../devices/XME1311/.config | 5 + .../devices/XME1410/.config | 5 + .../devices/XME1411/.config | 5 + .../devices/bis-BMA1/.config | 5 + .../devices/bis-BMC1/.config | 5 + .../devices/bis-BMD1/.config | 5 + .../devices/bis-BME1/.config | 5 + .../devices/newbx84/.config | 5 + .../devices/oldDev1/.config | 4 + .../devices/oldDev2/.config | 4 + .../New Structure Tests/new bx84 2/.config | 4 + .../New Structure Tests/new bx84 2/help.html | 15 ++ .../new bx84 2/new bx84 2.py | 174 ++++++++++++++ .../new structure monitor/.config | 4 + .../new structure monitor/help.html | 17 ++ .../new structure monitor.py | 174 ++++++++++++++ .../tests/Olt struct tests/oldtest/.config | 4 + .../tests/Olt struct tests/oldtest/help.html | 17 ++ .../tests/Olt struct tests/oldtest/oldtest.py | 174 ++++++++++++++ .../tests/Olt struct tests/oldtest2/.config | 4 + .../tests/Olt struct tests/oldtest2/help.html | 17 ++ .../Olt struct tests/oldtest2/oldtest2.py | 174 ++++++++++++++ .../Betriebsmode/.config | 4 + .../Betriebsmode/Betriebsmode.py | 171 ++++++++++++++ .../Betriebsmode/help.html | 19 ++ .../RPS Tests Diagnostic/Diagnostic/.config | 4 + .../Diagnostic/Diagnostic.py | 143 ++++++++++++ .../RPS Tests Diagnostic/Diagnostic/help.html | 19 ++ .../RPSlimits/.config | 4 + .../RPSlimits/RPSlimits.py | 191 +++++++++++++++ .../RPSlimits/help.html | 26 +++ script/tests/tests.properties | 2 +- .../Collimator Tests pro/Calibrate/.config | 12 + .../Calibrate/Calibrate.py | 139 +++++++++++ .../Calibrate/Calibrate.xml | 61 +++++ .../Collimator Tests pro/Drive Out/.config | 3 + .../Drive Out/Drive Out - Copy.py | 82 +++++++ .../Drive Out/Drive Out.py | 144 ++++++++++++ .../Drive Out/Drive Out.xml | 61 +++++ .../Monitor Movement/.config | 4 + .../Monitor Movement/Monitor Movement.py | 98 ++++++++ .../Monitor Movement/help.html | 12 + .../Collimator Tests pro/Motor Test 1/.config | 7 + .../Motor Test 1/Motor Test 1 - Copy.py | 154 ++++++++++++ .../Motor Test 1/Motor Test 1.py | 187 +++++++++++++++ .../Motor Test 1/Motor Test 1.py.bak | 178 ++++++++++++++ .../Motor Test 1/help.html | 14 ++ .../Collimator Tests pro/Motor Test 2/.config | 7 + .../Motor Test 2/Motor Test 2.py | 206 ++++++++++++++++ .../Motor Test 2/Motor Test 2.py.bak | 209 +++++++++++++++++ .../Motor Test 2/help.html | 16 ++ .../Collimator Tests pro/Motor Test 3/.config | 7 + .../Motor Test 3/Motor Test 3.py | 212 +++++++++++++++++ .../Motor Test 3/help.html | 13 ++ .../Collimator Tests pro/Move Ref 1/.config | 3 + .../Move Ref 1/Move Ref 1 - Copy.py | 90 +++++++ .../Move Ref 1/Move Ref 1.py | 144 ++++++++++++ .../Move Ref 1/Move Ref 1.xml | 61 +++++ .../Collimator Tests pro/Move Ref 1/help.html | 13 ++ .../Collimator Tests pro/Move Ref 2/.config | 3 + .../Move Ref 2/Move Ref 2.py | 144 ++++++++++++ .../Move Ref 2/Move Ref 2.xml | 61 +++++ .../Collimator Tests pro/Move Ref 2/help.html | 13 ++ .../tests/Collimator Tests pro/Stop/.config | 3 + .../tests/Collimator Tests pro/Stop/Stop.xml | 61 +++++ .../monitorAllParams/.config | 4 + .../monitorAllParams/help.html | 13 ++ .../monitorAllParams/monitorAllParams.py | 145 ++++++++++++ .../what is on damir test tool.txt | 8 + .../Calibrate test vme/.config | 12 + .../Calibrate test vme/Calibrate test vme.py | 136 +++++++++++ .../tests/Collimator Tests/Calibrate/.config | 12 + .../Collimator Tests/Calibrate/Calibrate.py | 79 +++++++ .../Collimator Tests/Calibrate/Calibrate.xml | 61 +++++ .../Collimator Tests/Check Status/.config | 5 + .../Check Status/Check Status.xml | 67 ++++++ .../tests/Collimator Tests/Drive Out/.config | 3 + .../Collimator Tests/Drive Out/Drive Out.py | 82 +++++++ .../Collimator Tests/Drive Out/Drive Out.xml | 61 +++++ .../Go to specific position/.config | 7 + .../Go to specific position.py | 162 +++++++++++++ .../Go to specific position/help.html | 16 ++ .../tests/Collimator Tests/Initialise/.config | 8 + .../Collimator Tests/Initialise/Initialise.py | 129 ++++++++++ .../Collimator Tests/Initialise/help.html | 14 ++ .../Collimator Tests/Motor Test 1/.config | 7 + .../Motor Test 1/Motor Test 1 - Copy.py | 154 ++++++++++++ .../Motor Test 1/Motor Test 1.py | 192 +++++++++++++++ .../Collimator Tests/Motor Test 1/help.html | 14 ++ .../Collimator Tests/Motor Test 2/.config | 7 + .../Motor Test 2/Motor Test 2.py | 211 +++++++++++++++++ .../Motor Test 3 100ms/.config | 3 + .../Motor Test 3 - with original pv.xml | 74 ++++++ .../Motor Test 3 100ms/Motor Test 3.xml | 74 ++++++ .../Motor Test 3 200ms/.config | 3 + .../Motor Test 3 - with original pv.xml | 74 ++++++ .../Motor Test 3 200ms/Motor Test 3.xml | 74 ++++++ .../Motor Test 3 500ms/.config | 3 + .../Motor Test 3 - with original pv.xml | 74 ++++++ .../Motor Test 3 500ms/Motor Test 3.xml | 74 ++++++ .../Collimator Tests/Motor Test 3/.config | 7 + .../Motor Test 3/Motor Test 3.py | 169 ++++++++++++++ .../tests/Collimator Tests/Move Ref 1/.config | 3 + .../Move Ref 1/Move Ref 1.xml | 61 +++++ .../tests/Collimator Tests/Move Ref 2/.config | 3 + .../Move Ref 2/Move Ref 2.xml | 61 +++++ .../tests/tests/Collimator Tests/Stop/.config | 3 + .../tests/Collimator Tests/Stop/Stop.xml | 61 +++++ .../Collimator Tests/Zig Zag Test/.config | 4 + .../Zig Zag Test/Zig Zag Test.xml | 35 +++ .../Collimator Tests/motor-slide/.config | 3 + .../motor-slide/motor-slide.py | 73 ++++++ .../tests/Display Tests/Display Test/.config | 6 + .../Display Test/Display Test.py | 90 +++++++ .../Display Test/Display Test.xml | 32 +++ .../Linear Slide Tests/Calibrate/.config | 8 + .../Calibrate-try-to-use-external-module.py | 125 ++++++++++ .../Linear Slide Tests/Calibrate/Calibrate.py | 136 +++++++++++ .../Linear Slide Tests/Calibrate/help.html | 14 ++ .../Check Linearity/.config | 4 + .../Check Linearity/Check Linearity - Copy.py | 162 +++++++++++++ .../Check Linearity/Check Linearity.py | 199 ++++++++++++++++ .../Check Linearity/help.html | 16 ++ .../tests/Old struct tests/oldtest/.config | 4 + .../tests/Old struct tests/oldtest/help.html | 17 ++ .../tests/Old struct tests/oldtest/oldtest.py | 174 ++++++++++++++ .../tests/Old struct tests/oldtest2/.config | 4 + .../tests/Old struct tests/oldtest2/help.html | 17 ++ .../Old struct tests/oldtest2/oldtest2.py | 174 ++++++++++++++ script/tests/tests/PS Tests/newTest/.config | 4 + script/tests/tests/PS Tests/newTest/help.html | 15 ++ .../tests/tests/PS Tests/newTest/newTest.py | 169 ++++++++++++++ .../tests/PS Tests/playground-pw84/.config | 4 + .../tests/PS Tests/playground-pw84/help.html | 15 ++ .../playground-pw84/playground-pw84.py | 130 +++++++++++ .../tests/PS Tests/power-supply-A/.config | 12 + ...-supply-A - Copy works with testcommons.py | 115 +++++++++ .../power-supply-A/power-supply-A - Copy.py | 124 ++++++++++ .../PS Tests/power-supply-A/power-supply-A.py | 117 ++++++++++ .../tests/PS Tests/power-supply-B/.config | 12 + .../power-supply-B/power-supply-B - Copy.py | 112 +++++++++ .../PS Tests/power-supply-B/power-supply-B.py | 113 +++++++++ .../tests/PS Tests/test without ioc 2/.config | 4 + .../PS Tests/test without ioc 2/help.html | 14 ++ .../test without ioc - Copy.py | 147 ++++++++++++ .../test without ioc 2/test without ioc 2.py | 154 ++++++++++++ .../tests/PS Tests/test without ioc 3/.config | 4 + .../PS Tests/test without ioc 3/help.html | 14 ++ .../test without ioc - Copy.py | 147 ++++++++++++ .../test without ioc 3/test without ioc 3.py | 154 ++++++++++++ .../tests/PS Tests/test without ioc/.config | 4 + .../tests/PS Tests/test without ioc/help.html | 14 ++ .../test without ioc - Copy.py | 147 ++++++++++++ .../test without ioc/test without ioc.py | 169 ++++++++++++++ .../Range Shifter Tests/Calibrate/.config | 8 + .../Calibrate/Calibrate.py | 143 ++++++++++++ .../Range Shifter Tests/Calibrate/help.html | 14 ++ .../Check Linearity/.config | 7 + .../Check Linearity/Check Linearity.py | 162 +++++++++++++ .../Check Linearity/help.html | 16 ++ .../Range Shifter Tests/Check Status/.config | 3 + .../Check Status/Check Status.xml | 55 +++++ .../Range Shifter Tests/Monitor All/.config | 7 + .../Monitor All/Monitor All - Copy.py | 196 ++++++++++++++++ .../Monitor All/Monitor All.py | 180 ++++++++++++++ .../Range Shifter Tests/Monitor All/help.html | 14 ++ script/tests/tests/sad/jtr/.config | 4 + script/tests/tests/sad/jtr/help.html | 16 ++ script/tests/tests/sad/jtr/jtr.py | 172 ++++++++++++++ script/tests/tests/sad/ltr/.config | 4 + script/tests/tests/sad/ltr/help.html | 16 ++ script/tests/tests/sad/ltr/ltr.py | 172 ++++++++++++++ script/tests/tests/sad/rightleft/.config | 4 + script/tests/tests/sad/rightleft/help.html | 21 ++ script/tests/tests/sad/rightleft/rightleft.py | 221 ++++++++++++++++++ script/tests/tests/sad/rpstry/.config | 4 + script/tests/tests/sad/rpstry/help.html | 21 ++ script/tests/tests/sad/rpstry/rpstry.py | 148 ++++++++++++ script/tests/tests/sad/sdd/.config | 4 + script/tests/tests/sad/sdd/help.html | 15 ++ script/tests/tests/sad/sdd/sdd.py | 149 ++++++++++++ 217 files changed, 11406 insertions(+), 1 deletion(-) create mode 100644 script/tests/devices/PO2DV-NCS-LS/.config create mode 100644 script/tests/devices/PO2DV-NCS-VHQ1/.config create mode 100644 script/tests/devices/PO2TC-NCS-RS/.config create mode 100644 script/tests/devices/Production/DMAF1/.config create mode 100644 script/tests/devices/Production/PO2DV-NCS-VHQ1/.config create mode 100644 script/tests/devices/Production/PO2TC-NCS-FIXL/.config create mode 100644 script/tests/devices/Production/PO2TC-NCS-MWD/.config create mode 100644 script/tests/devices/Production/PO2TC-NCS-SC21/.config create mode 100644 script/tests/devices/Production/PO2TC-NCS-SC22/.config create mode 100644 script/tests/devices/Production/PO2TC-NCS-SC23/.config create mode 100644 script/tests/devices/bx84/.config create mode 100644 script/tests/devices/bx84_2/.config create mode 100644 script/tests/devices/oldDev1/.config create mode 100644 script/tests/devices/oldDev2/.config create mode 100644 script/tests/new-structure-tests-devices/devices/AMA1/.config create mode 100644 script/tests/new-structure-tests-devices/devices/Gantry1/.config create mode 100644 script/tests/new-structure-tests-devices/devices/Gantry2/.config create mode 100644 script/tests/new-structure-tests-devices/devices/Gantry3/.config create mode 100644 script/tests/new-structure-tests-devices/devices/Optis/.config create mode 100644 script/tests/new-structure-tests-devices/devices/PIF/.config create mode 100644 script/tests/new-structure-tests-devices/devices/XMA0310/.config create mode 100644 script/tests/new-structure-tests-devices/devices/XMA0311/.config create mode 100644 script/tests/new-structure-tests-devices/devices/XMA0410/.config create mode 100644 script/tests/new-structure-tests-devices/devices/XMA1115/.config create mode 100644 script/tests/new-structure-tests-devices/devices/XMA1116/.config create mode 100644 script/tests/new-structure-tests-devices/devices/XMA1117/.config create mode 100644 script/tests/new-structure-tests-devices/devices/XMA1118/.config create mode 100644 script/tests/new-structure-tests-devices/devices/XMA1119/.config create mode 100644 script/tests/new-structure-tests-devices/devices/XMB0510/.config create mode 100644 script/tests/new-structure-tests-devices/devices/XMC0610/.config create mode 100644 script/tests/new-structure-tests-devices/devices/XMC2010/.config create mode 100644 script/tests/new-structure-tests-devices/devices/XMC2011/.config create mode 100644 script/tests/new-structure-tests-devices/devices/XMD0710/.config create mode 100644 script/tests/new-structure-tests-devices/devices/XMD0711/.config create mode 100644 script/tests/new-structure-tests-devices/devices/XMD0717/.config create mode 100644 script/tests/new-structure-tests-devices/devices/XME1310/.config create mode 100644 script/tests/new-structure-tests-devices/devices/XME1311/.config create mode 100644 script/tests/new-structure-tests-devices/devices/XME1410/.config create mode 100644 script/tests/new-structure-tests-devices/devices/XME1411/.config create mode 100644 script/tests/new-structure-tests-devices/devices/bis-BMA1/.config create mode 100644 script/tests/new-structure-tests-devices/devices/bis-BMC1/.config create mode 100644 script/tests/new-structure-tests-devices/devices/bis-BMD1/.config create mode 100644 script/tests/new-structure-tests-devices/devices/bis-BME1/.config create mode 100644 script/tests/new-structure-tests-devices/devices/newbx84/.config create mode 100644 script/tests/new-structure-tests-devices/devices/oldDev1/.config create mode 100644 script/tests/new-structure-tests-devices/devices/oldDev2/.config create mode 100644 script/tests/new-structure-tests-devices/tests/New Structure Tests/new bx84 2/.config create mode 100644 script/tests/new-structure-tests-devices/tests/New Structure Tests/new bx84 2/help.html create mode 100644 script/tests/new-structure-tests-devices/tests/New Structure Tests/new bx84 2/new bx84 2.py create mode 100644 script/tests/new-structure-tests-devices/tests/New Structure Tests/new structure monitor/.config create mode 100644 script/tests/new-structure-tests-devices/tests/New Structure Tests/new structure monitor/help.html create mode 100644 script/tests/new-structure-tests-devices/tests/New Structure Tests/new structure monitor/new structure monitor.py create mode 100644 script/tests/new-structure-tests-devices/tests/Olt struct tests/oldtest/.config create mode 100644 script/tests/new-structure-tests-devices/tests/Olt struct tests/oldtest/help.html create mode 100644 script/tests/new-structure-tests-devices/tests/Olt struct tests/oldtest/oldtest.py create mode 100644 script/tests/new-structure-tests-devices/tests/Olt struct tests/oldtest2/.config create mode 100644 script/tests/new-structure-tests-devices/tests/Olt struct tests/oldtest2/help.html create mode 100644 script/tests/new-structure-tests-devices/tests/Olt struct tests/oldtest2/oldtest2.py create mode 100644 script/tests/new-structure-tests-devices/tests/RPS Tests Betriebsmode/Betriebsmode/.config create mode 100644 script/tests/new-structure-tests-devices/tests/RPS Tests Betriebsmode/Betriebsmode/Betriebsmode.py create mode 100644 script/tests/new-structure-tests-devices/tests/RPS Tests Betriebsmode/Betriebsmode/help.html create mode 100644 script/tests/new-structure-tests-devices/tests/RPS Tests Diagnostic/Diagnostic/.config create mode 100644 script/tests/new-structure-tests-devices/tests/RPS Tests Diagnostic/Diagnostic/Diagnostic.py create mode 100644 script/tests/new-structure-tests-devices/tests/RPS Tests Diagnostic/Diagnostic/help.html create mode 100644 script/tests/new-structure-tests-devices/tests/RPS Tests Interlocklilmits/RPSlimits/.config create mode 100644 script/tests/new-structure-tests-devices/tests/RPS Tests Interlocklilmits/RPSlimits/RPSlimits.py create mode 100644 script/tests/new-structure-tests-devices/tests/RPS Tests Interlocklilmits/RPSlimits/help.html create mode 100644 script/tests/tests/Collimator Tests pro/Calibrate/.config create mode 100644 script/tests/tests/Collimator Tests pro/Calibrate/Calibrate.py create mode 100644 script/tests/tests/Collimator Tests pro/Calibrate/Calibrate.xml create mode 100644 script/tests/tests/Collimator Tests pro/Drive Out/.config create mode 100644 script/tests/tests/Collimator Tests pro/Drive Out/Drive Out - Copy.py create mode 100644 script/tests/tests/Collimator Tests pro/Drive Out/Drive Out.py create mode 100644 script/tests/tests/Collimator Tests pro/Drive Out/Drive Out.xml create mode 100644 script/tests/tests/Collimator Tests pro/Monitor Movement/.config create mode 100644 script/tests/tests/Collimator Tests pro/Monitor Movement/Monitor Movement.py create mode 100644 script/tests/tests/Collimator Tests pro/Monitor Movement/help.html create mode 100644 script/tests/tests/Collimator Tests pro/Motor Test 1/.config create mode 100644 script/tests/tests/Collimator Tests pro/Motor Test 1/Motor Test 1 - Copy.py create mode 100644 script/tests/tests/Collimator Tests pro/Motor Test 1/Motor Test 1.py create mode 100644 script/tests/tests/Collimator Tests pro/Motor Test 1/Motor Test 1.py.bak create mode 100644 script/tests/tests/Collimator Tests pro/Motor Test 1/help.html create mode 100644 script/tests/tests/Collimator Tests pro/Motor Test 2/.config create mode 100644 script/tests/tests/Collimator Tests pro/Motor Test 2/Motor Test 2.py create mode 100644 script/tests/tests/Collimator Tests pro/Motor Test 2/Motor Test 2.py.bak create mode 100644 script/tests/tests/Collimator Tests pro/Motor Test 2/help.html create mode 100644 script/tests/tests/Collimator Tests pro/Motor Test 3/.config create mode 100644 script/tests/tests/Collimator Tests pro/Motor Test 3/Motor Test 3.py create mode 100644 script/tests/tests/Collimator Tests pro/Motor Test 3/help.html create mode 100644 script/tests/tests/Collimator Tests pro/Move Ref 1/.config create mode 100644 script/tests/tests/Collimator Tests pro/Move Ref 1/Move Ref 1 - Copy.py create mode 100644 script/tests/tests/Collimator Tests pro/Move Ref 1/Move Ref 1.py create mode 100644 script/tests/tests/Collimator Tests pro/Move Ref 1/Move Ref 1.xml create mode 100644 script/tests/tests/Collimator Tests pro/Move Ref 1/help.html create mode 100644 script/tests/tests/Collimator Tests pro/Move Ref 2/.config create mode 100644 script/tests/tests/Collimator Tests pro/Move Ref 2/Move Ref 2.py create mode 100644 script/tests/tests/Collimator Tests pro/Move Ref 2/Move Ref 2.xml create mode 100644 script/tests/tests/Collimator Tests pro/Move Ref 2/help.html create mode 100644 script/tests/tests/Collimator Tests pro/Stop/.config create mode 100644 script/tests/tests/Collimator Tests pro/Stop/Stop.xml create mode 100644 script/tests/tests/Collimator Tests pro/monitorAllParams/.config create mode 100644 script/tests/tests/Collimator Tests pro/monitorAllParams/help.html create mode 100644 script/tests/tests/Collimator Tests pro/monitorAllParams/monitorAllParams.py create mode 100644 script/tests/tests/Collimator Tests pro/what is on damir test tool.txt create mode 100644 script/tests/tests/Collimator Tests/Calibrate test vme/.config create mode 100644 script/tests/tests/Collimator Tests/Calibrate test vme/Calibrate test vme.py create mode 100644 script/tests/tests/Collimator Tests/Calibrate/.config create mode 100644 script/tests/tests/Collimator Tests/Calibrate/Calibrate.py create mode 100644 script/tests/tests/Collimator Tests/Calibrate/Calibrate.xml create mode 100644 script/tests/tests/Collimator Tests/Check Status/.config create mode 100644 script/tests/tests/Collimator Tests/Check Status/Check Status.xml create mode 100644 script/tests/tests/Collimator Tests/Drive Out/.config create mode 100644 script/tests/tests/Collimator Tests/Drive Out/Drive Out.py create mode 100644 script/tests/tests/Collimator Tests/Drive Out/Drive Out.xml create mode 100644 script/tests/tests/Collimator Tests/Go to specific position/.config create mode 100644 script/tests/tests/Collimator Tests/Go to specific position/Go to specific position.py create mode 100644 script/tests/tests/Collimator Tests/Go to specific position/help.html create mode 100644 script/tests/tests/Collimator Tests/Initialise/.config create mode 100644 script/tests/tests/Collimator Tests/Initialise/Initialise.py create mode 100644 script/tests/tests/Collimator Tests/Initialise/help.html create mode 100644 script/tests/tests/Collimator Tests/Motor Test 1/.config create mode 100644 script/tests/tests/Collimator Tests/Motor Test 1/Motor Test 1 - Copy.py create mode 100644 script/tests/tests/Collimator Tests/Motor Test 1/Motor Test 1.py create mode 100644 script/tests/tests/Collimator Tests/Motor Test 1/help.html create mode 100644 script/tests/tests/Collimator Tests/Motor Test 2/.config create mode 100644 script/tests/tests/Collimator Tests/Motor Test 2/Motor Test 2.py create mode 100644 script/tests/tests/Collimator Tests/Motor Test 3 in several ms/Motor Test 3 100ms/.config create mode 100644 script/tests/tests/Collimator Tests/Motor Test 3 in several ms/Motor Test 3 100ms/Motor Test 3 - with original pv.xml create mode 100644 script/tests/tests/Collimator Tests/Motor Test 3 in several ms/Motor Test 3 100ms/Motor Test 3.xml create mode 100644 script/tests/tests/Collimator Tests/Motor Test 3 in several ms/Motor Test 3 200ms/.config create mode 100644 script/tests/tests/Collimator Tests/Motor Test 3 in several ms/Motor Test 3 200ms/Motor Test 3 - with original pv.xml create mode 100644 script/tests/tests/Collimator Tests/Motor Test 3 in several ms/Motor Test 3 200ms/Motor Test 3.xml create mode 100644 script/tests/tests/Collimator Tests/Motor Test 3 in several ms/Motor Test 3 500ms/.config create mode 100644 script/tests/tests/Collimator Tests/Motor Test 3 in several ms/Motor Test 3 500ms/Motor Test 3 - with original pv.xml create mode 100644 script/tests/tests/Collimator Tests/Motor Test 3 in several ms/Motor Test 3 500ms/Motor Test 3.xml create mode 100644 script/tests/tests/Collimator Tests/Motor Test 3/.config create mode 100644 script/tests/tests/Collimator Tests/Motor Test 3/Motor Test 3.py create mode 100644 script/tests/tests/Collimator Tests/Move Ref 1/.config create mode 100644 script/tests/tests/Collimator Tests/Move Ref 1/Move Ref 1.xml create mode 100644 script/tests/tests/Collimator Tests/Move Ref 2/.config create mode 100644 script/tests/tests/Collimator Tests/Move Ref 2/Move Ref 2.xml create mode 100644 script/tests/tests/Collimator Tests/Stop/.config create mode 100644 script/tests/tests/Collimator Tests/Stop/Stop.xml create mode 100644 script/tests/tests/Collimator Tests/Zig Zag Test/.config create mode 100644 script/tests/tests/Collimator Tests/Zig Zag Test/Zig Zag Test.xml create mode 100644 script/tests/tests/Collimator Tests/motor-slide/.config create mode 100644 script/tests/tests/Collimator Tests/motor-slide/motor-slide.py create mode 100644 script/tests/tests/Display Tests/Display Test/.config create mode 100644 script/tests/tests/Display Tests/Display Test/Display Test.py create mode 100644 script/tests/tests/Display Tests/Display Test/Display Test.xml create mode 100644 script/tests/tests/Linear Slide Tests/Calibrate/.config create mode 100644 script/tests/tests/Linear Slide Tests/Calibrate/Calibrate-try-to-use-external-module.py create mode 100644 script/tests/tests/Linear Slide Tests/Calibrate/Calibrate.py create mode 100644 script/tests/tests/Linear Slide Tests/Calibrate/help.html create mode 100644 script/tests/tests/Linear Slide Tests/Check Linearity/.config create mode 100644 script/tests/tests/Linear Slide Tests/Check Linearity/Check Linearity - Copy.py create mode 100644 script/tests/tests/Linear Slide Tests/Check Linearity/Check Linearity.py create mode 100644 script/tests/tests/Linear Slide Tests/Check Linearity/help.html create mode 100644 script/tests/tests/Old struct tests/oldtest/.config create mode 100644 script/tests/tests/Old struct tests/oldtest/help.html create mode 100644 script/tests/tests/Old struct tests/oldtest/oldtest.py create mode 100644 script/tests/tests/Old struct tests/oldtest2/.config create mode 100644 script/tests/tests/Old struct tests/oldtest2/help.html create mode 100644 script/tests/tests/Old struct tests/oldtest2/oldtest2.py create mode 100644 script/tests/tests/PS Tests/newTest/.config create mode 100644 script/tests/tests/PS Tests/newTest/help.html create mode 100644 script/tests/tests/PS Tests/newTest/newTest.py create mode 100644 script/tests/tests/PS Tests/playground-pw84/.config create mode 100644 script/tests/tests/PS Tests/playground-pw84/help.html create mode 100644 script/tests/tests/PS Tests/playground-pw84/playground-pw84.py create mode 100644 script/tests/tests/PS Tests/power-supply-A/.config create mode 100644 script/tests/tests/PS Tests/power-supply-A/power-supply-A - Copy works with testcommons.py create mode 100644 script/tests/tests/PS Tests/power-supply-A/power-supply-A - Copy.py create mode 100644 script/tests/tests/PS Tests/power-supply-A/power-supply-A.py create mode 100644 script/tests/tests/PS Tests/power-supply-B/.config create mode 100644 script/tests/tests/PS Tests/power-supply-B/power-supply-B - Copy.py create mode 100644 script/tests/tests/PS Tests/power-supply-B/power-supply-B.py create mode 100644 script/tests/tests/PS Tests/test without ioc 2/.config create mode 100644 script/tests/tests/PS Tests/test without ioc 2/help.html create mode 100644 script/tests/tests/PS Tests/test without ioc 2/test without ioc - Copy.py create mode 100644 script/tests/tests/PS Tests/test without ioc 2/test without ioc 2.py create mode 100644 script/tests/tests/PS Tests/test without ioc 3/.config create mode 100644 script/tests/tests/PS Tests/test without ioc 3/help.html create mode 100644 script/tests/tests/PS Tests/test without ioc 3/test without ioc - Copy.py create mode 100644 script/tests/tests/PS Tests/test without ioc 3/test without ioc 3.py create mode 100644 script/tests/tests/PS Tests/test without ioc/.config create mode 100644 script/tests/tests/PS Tests/test without ioc/help.html create mode 100644 script/tests/tests/PS Tests/test without ioc/test without ioc - Copy.py create mode 100644 script/tests/tests/PS Tests/test without ioc/test without ioc.py create mode 100644 script/tests/tests/Range Shifter Tests/Calibrate/.config create mode 100644 script/tests/tests/Range Shifter Tests/Calibrate/Calibrate.py create mode 100644 script/tests/tests/Range Shifter Tests/Calibrate/help.html create mode 100644 script/tests/tests/Range Shifter Tests/Check Linearity/.config create mode 100644 script/tests/tests/Range Shifter Tests/Check Linearity/Check Linearity.py create mode 100644 script/tests/tests/Range Shifter Tests/Check Linearity/help.html create mode 100644 script/tests/tests/Range Shifter Tests/Check Status/.config create mode 100644 script/tests/tests/Range Shifter Tests/Check Status/Check Status.xml create mode 100644 script/tests/tests/Range Shifter Tests/Monitor All/.config create mode 100644 script/tests/tests/Range Shifter Tests/Monitor All/Monitor All - Copy.py create mode 100644 script/tests/tests/Range Shifter Tests/Monitor All/Monitor All.py create mode 100644 script/tests/tests/Range Shifter Tests/Monitor All/help.html create mode 100644 script/tests/tests/sad/jtr/.config create mode 100644 script/tests/tests/sad/jtr/help.html create mode 100644 script/tests/tests/sad/jtr/jtr.py create mode 100644 script/tests/tests/sad/ltr/.config create mode 100644 script/tests/tests/sad/ltr/help.html create mode 100644 script/tests/tests/sad/ltr/ltr.py create mode 100644 script/tests/tests/sad/rightleft/.config create mode 100644 script/tests/tests/sad/rightleft/help.html create mode 100644 script/tests/tests/sad/rightleft/rightleft.py create mode 100644 script/tests/tests/sad/rpstry/.config create mode 100644 script/tests/tests/sad/rpstry/help.html create mode 100644 script/tests/tests/sad/rpstry/rpstry.py create mode 100644 script/tests/tests/sad/sdd/.config create mode 100644 script/tests/tests/sad/sdd/help.html create mode 100644 script/tests/tests/sad/sdd/sdd.py diff --git a/script/tests/devices/PO2DV-NCS-LS/.config b/script/tests/devices/PO2DV-NCS-LS/.config new file mode 100644 index 0000000..24fb82e --- /dev/null +++ b/script/tests/devices/PO2DV-NCS-LS/.config @@ -0,0 +1,4 @@ +name=PO2DV-NCS-LS +description=Optis 2 Linear Slide in test office setup +#tests=Collimator Tests +tests=Linear Slide Tests \ No newline at end of file diff --git a/script/tests/devices/PO2DV-NCS-VHQ1/.config b/script/tests/devices/PO2DV-NCS-VHQ1/.config new file mode 100644 index 0000000..efd82e9 --- /dev/null +++ b/script/tests/devices/PO2DV-NCS-VHQ1/.config @@ -0,0 +1,3 @@ +name=PO2DV-NCS-VHQ1 +description=Optis 2 Linear Slide in test office setup +tests=PS Tests diff --git a/script/tests/devices/PO2TC-NCS-RS/.config b/script/tests/devices/PO2TC-NCS-RS/.config new file mode 100644 index 0000000..48567a5 --- /dev/null +++ b/script/tests/devices/PO2TC-NCS-RS/.config @@ -0,0 +1,3 @@ +name=PO2TC-NCS-RS +description=RS& Range Shifter +tests=Range Shifter Tests diff --git a/script/tests/devices/Production/DMAF1/.config b/script/tests/devices/Production/DMAF1/.config new file mode 100644 index 0000000..b134802 --- /dev/null +++ b/script/tests/devices/Production/DMAF1/.config @@ -0,0 +1,3 @@ +name=PROF02&DMAF1 +description=Collimators +tests=Collimator Tests pro diff --git a/script/tests/devices/Production/PO2DV-NCS-VHQ1/.config b/script/tests/devices/Production/PO2DV-NCS-VHQ1/.config new file mode 100644 index 0000000..efd82e9 --- /dev/null +++ b/script/tests/devices/Production/PO2DV-NCS-VHQ1/.config @@ -0,0 +1,3 @@ +name=PO2DV-NCS-VHQ1 +description=Optis 2 Linear Slide in test office setup +tests=PS Tests diff --git a/script/tests/devices/Production/PO2TC-NCS-FIXL/.config b/script/tests/devices/Production/PO2TC-NCS-FIXL/.config new file mode 100644 index 0000000..3058e57 --- /dev/null +++ b/script/tests/devices/Production/PO2TC-NCS-FIXL/.config @@ -0,0 +1,3 @@ +name=PO2TC-NCS-FIXL +description=FIXL& Fixation Light +tests=Display Tests diff --git a/script/tests/devices/Production/PO2TC-NCS-MWD/.config b/script/tests/devices/Production/PO2TC-NCS-MWD/.config new file mode 100644 index 0000000..ba69bed --- /dev/null +++ b/script/tests/devices/Production/PO2TC-NCS-MWD/.config @@ -0,0 +1,3 @@ +name=PO2TC-NCS-MWD +description=MWD& Modulator Wheel Display +tests=Display Tests diff --git a/script/tests/devices/Production/PO2TC-NCS-SC21/.config b/script/tests/devices/Production/PO2TC-NCS-SC21/.config new file mode 100644 index 0000000..0f00694 --- /dev/null +++ b/script/tests/devices/Production/PO2TC-NCS-SC21/.config @@ -0,0 +1,3 @@ +name=PO2TC-NCS-SC21 +description=SC21& Scatter Foil 2.1 +tests=Linear Slide Tests diff --git a/script/tests/devices/Production/PO2TC-NCS-SC22/.config b/script/tests/devices/Production/PO2TC-NCS-SC22/.config new file mode 100644 index 0000000..4e36bf8 --- /dev/null +++ b/script/tests/devices/Production/PO2TC-NCS-SC22/.config @@ -0,0 +1,3 @@ +name=PO2TC-NCS-SC22 +description=SC21& Scatter Foil 2.2 +tests=Linear Slide Tests diff --git a/script/tests/devices/Production/PO2TC-NCS-SC23/.config b/script/tests/devices/Production/PO2TC-NCS-SC23/.config new file mode 100644 index 0000000..e80429e --- /dev/null +++ b/script/tests/devices/Production/PO2TC-NCS-SC23/.config @@ -0,0 +1,3 @@ +name=PO2TC-NCS-SC23 +description=SC23& Scatter Foil 2.3 +tests=Linear Slide Tests diff --git a/script/tests/devices/bx84/.config b/script/tests/devices/bx84/.config new file mode 100644 index 0000000..715eae5 --- /dev/null +++ b/script/tests/devices/bx84/.config @@ -0,0 +1,5 @@ +#Tue Oct 03 13&56&43 CEST 2017 +name=bx84 +tests=sad +description=simulation device in playground +parameters=delay&".2"&"delay between 2 steps";bla&"234"&"bla bla";setVal&"11"&"value to set";expectedVal&"18.1"&"expected returned value";mask&"2"&"bit mask"; diff --git a/script/tests/devices/bx84_2/.config b/script/tests/devices/bx84_2/.config new file mode 100644 index 0000000..406d46e --- /dev/null +++ b/script/tests/devices/bx84_2/.config @@ -0,0 +1,5 @@ +#Fri Oct 13 10:59:28 CEST 2017 +name=bx84_2 +tests=sad +parameters=a&IQCOM,$GNT3,1,DIA\:22&23;delay&.2&delay between 2 steps;bla&234&bla bla;setVal&21&value to set;expectedVal&18.1&expected returned value;mask&2&bit mask; +description=simulation device in playground diff --git a/script/tests/devices/oldDev1/.config b/script/tests/devices/oldDev1/.config new file mode 100644 index 0000000..59fc0b3 --- /dev/null +++ b/script/tests/devices/oldDev1/.config @@ -0,0 +1,4 @@ +#Tue Mar 20 13:51:16 CET 2018 +name=oldDev1 +tests=Old struct tests +description=o diff --git a/script/tests/devices/oldDev2/.config b/script/tests/devices/oldDev2/.config new file mode 100644 index 0000000..83c459e --- /dev/null +++ b/script/tests/devices/oldDev2/.config @@ -0,0 +1,4 @@ +#Tue Mar 20 13:51:21 CET 2018 +name=oldDev2 +tests=Old struct tests +description=o diff --git a/script/tests/new-structure-tests-devices/devices/AMA1/.config b/script/tests/new-structure-tests-devices/devices/AMA1/.config new file mode 100644 index 0000000..fc7fe9d --- /dev/null +++ b/script/tests/new-structure-tests-devices/devices/AMA1/.config @@ -0,0 +1,5 @@ +#Wed Oct 18 15:07:43 CEST 2017 +name=AMA1 +tests=RPS Tests Interlocklilmits +parameters=ilkInExpectedValS&"0x91DD"&"[hex] Interlock Input expected value for small values of magnet";magnetCh&"AMA1\:SOL\:1"&"Magnet epics channel";ilkInCh&"J102025\:REG\:R\:6"&"Interlock Input epics channel";ilkInExpectedValIni&"0x1DDD"&"[hex] Interlock Input expected initial value";ilkOutExpectedValL&"0x0000"&"[hex] Interlock Output expected value for large values of magnet";magnetEndVal&"50000"&"[int] magnet final value for scan sequence";ilkOutCh&"J102025\:REG\:R\:3"&"Interlock Output epics channel";ilkOutExpectedValIni&"0x0000"&"[hex] Interlock Output expected initial value";ilkOutExpectedValS&"0x000C"&"[hex] Interlock Output expected value for small values of magnet";magnetInitVal&"0"&"[int] magnet initial value for scan sequence";setGetDelay&"1"&"[s] delay between set and get";mode&"2,IQCOM,$GNT2,1,DIA"&"operating mode"; +description=Ablenkungsmagnet AMA1 diff --git a/script/tests/new-structure-tests-devices/devices/Gantry1/.config b/script/tests/new-structure-tests-devices/devices/Gantry1/.config new file mode 100644 index 0000000..53a0996 --- /dev/null +++ b/script/tests/new-structure-tests-devices/devices/Gantry1/.config @@ -0,0 +1,5 @@ +#Wed Oct 18 10:54:16 CEST 2017 +name=Gantry1 +tests=RPS Tests Betriebsmode +description=rps section till Gantry 1 +parameters=mode&"2,IQCOM,$GNT1,1,DIA"&"betriebsmode";expectedVal14&"0x0040"&"[hex] Expected value for channels 1-4";expectedVal58&"0x0000"&"[hex] Expected value for channels 5-8"; diff --git a/script/tests/new-structure-tests-devices/devices/Gantry2/.config b/script/tests/new-structure-tests-devices/devices/Gantry2/.config new file mode 100644 index 0000000..e1a8365 --- /dev/null +++ b/script/tests/new-structure-tests-devices/devices/Gantry2/.config @@ -0,0 +1,5 @@ +#Wed Oct 18 10:54:16 CEST 2017 +name=Gantry2 +tests=RPS Tests Betriebsmode +description=rps section till Gantry 2 +parameters=mode&"2,IQCOM,$GNT2,1,DIA"&"betriebsmode";expectedVal14&"0x0000"&"[hex] Expected value for channels 1-4";expectedVal58&"0x0004"&"[hex] Expected value for channels 5-8"; diff --git a/script/tests/new-structure-tests-devices/devices/Gantry3/.config b/script/tests/new-structure-tests-devices/devices/Gantry3/.config new file mode 100644 index 0000000..7c2fa77 --- /dev/null +++ b/script/tests/new-structure-tests-devices/devices/Gantry3/.config @@ -0,0 +1,5 @@ +#Wed Oct 18 10:54:16 CEST 2017 +name=Gantry3 +tests=RPS Tests Betriebsmode +description=rps section till Gantry 3 +parameters=mode&"2,IQCOM,$GNT3,1,DIA"&"betriebsmode";expectedVal14&"0x0400"&"[hex] Expected value for channels 1-4";expectedVal58&"0x0000"&"[hex] Expected value for channels 5-8"; diff --git a/script/tests/new-structure-tests-devices/devices/Optis/.config b/script/tests/new-structure-tests-devices/devices/Optis/.config new file mode 100644 index 0000000..99ea97c --- /dev/null +++ b/script/tests/new-structure-tests-devices/devices/Optis/.config @@ -0,0 +1,5 @@ +#Wed Oct 18 10:54:16 CEST 2017 +name=Optis +tests=RPS Tests Betriebsmode +description=rps section till Optis +parameters=mode&"2,IQCOM,$OPT,1,DIA"&"betriebsmode";expectedVal14&"0x4000"&"[hex] Expected value for channels 1-4";expectedVal58&"0x0000"&"[hex] Expected value for channels 5-8"; diff --git a/script/tests/new-structure-tests-devices/devices/PIF/.config b/script/tests/new-structure-tests-devices/devices/PIF/.config new file mode 100644 index 0000000..8c21914 --- /dev/null +++ b/script/tests/new-structure-tests-devices/devices/PIF/.config @@ -0,0 +1,5 @@ +#Wed Oct 18 10:54:16 CEST 2017 +name=PIF +tests=RPS Tests Betriebsmode +description=rps section till PIF +parameters=mode&"2,IQCOM,$PIF,1,DIA"&"betriebsmode";expectedVal14&"0x0400"&"[hex] Expected value for channels 1-4";expectedVal58&"0x0000"&"[hex] Expected value for channels 5-8"; diff --git a/script/tests/new-structure-tests-devices/devices/XMA0310/.config b/script/tests/new-structure-tests-devices/devices/XMA0310/.config new file mode 100644 index 0000000..60eb5e9 --- /dev/null +++ b/script/tests/new-structure-tests-devices/devices/XMA0310/.config @@ -0,0 +1,5 @@ +#Fri Oct 20 13:57:25 CEST 2017 +name=XMA0310 +tests=RPS Tests Diagnostic +parameters=rpsAttribute&"REG\:R\:5"&"RPS EPICS attribute";rpsModule&"J101030"&"RPS module EPICS channel name";expectedValue2&"0x0010"&"[hex] expected value 2";expectedValue1&"0x00D0"&"[hex] expected value 1"; +description=Diagnostic module diff --git a/script/tests/new-structure-tests-devices/devices/XMA0311/.config b/script/tests/new-structure-tests-devices/devices/XMA0311/.config new file mode 100644 index 0000000..24c2268 --- /dev/null +++ b/script/tests/new-structure-tests-devices/devices/XMA0311/.config @@ -0,0 +1,5 @@ +#Fri Oct 20 13:58:05 CEST 2017 +name=XMA0311 +tests=RPS Tests Diagnostic +parameters=rpsAttribute&"REG\:R\:5"&"RPS EPICS attribute";rpsModule&"J101030"&"RPS module EPICS channel name";expectedValue2&"0x0001"&"[hex] expected value 2";expectedValue1&"0x000D"&"[hex] expected value 1"; +description=Diagnostic module diff --git a/script/tests/new-structure-tests-devices/devices/XMA0410/.config b/script/tests/new-structure-tests-devices/devices/XMA0410/.config new file mode 100644 index 0000000..c07e7dd --- /dev/null +++ b/script/tests/new-structure-tests-devices/devices/XMA0410/.config @@ -0,0 +1,5 @@ +#Fri Oct 20 13:58:37 CEST 2017 +name=XMA0410 +tests=RPS Tests Diagnostic +parameters=rpsAttribute&"REG\:R\:7"&"RPS EPICS attribute";rpsModule&"J101046"&"RPS module EPICS channel name";expectedValue2&"0x0010"&"[hex] expected value 2";expectedValue1&"0x00D0"&"[hex] expected value 1"; +description=Diagnostic module diff --git a/script/tests/new-structure-tests-devices/devices/XMA1115/.config b/script/tests/new-structure-tests-devices/devices/XMA1115/.config new file mode 100644 index 0000000..958b3d6 --- /dev/null +++ b/script/tests/new-structure-tests-devices/devices/XMA1115/.config @@ -0,0 +1,5 @@ +#Fri Oct 20 13:53:14 CEST 2017 +name=XMA1115 +tests=RPS Tests Diagnostic +parameters=rpsAttribute&"REG\:R\:4"&"RPS EPICS attribute";rpsModule&"J102007"&"RPS module EPICS channel name";expectedValue2&"0x0100"&"[hex] expected value 2";expectedValue1&"0x0D00"&"[hex] expected value 1"; +description=Diagnostic module diff --git a/script/tests/new-structure-tests-devices/devices/XMA1116/.config b/script/tests/new-structure-tests-devices/devices/XMA1116/.config new file mode 100644 index 0000000..1f8c70d --- /dev/null +++ b/script/tests/new-structure-tests-devices/devices/XMA1116/.config @@ -0,0 +1,5 @@ +#Fri Oct 20 13:41:43 CEST 2017 +name=XMA1116 +tests=RPS Tests Diagnostic +parameters=rpsAttribute&"REG\:R\:4"&"RPS EPICS attribute";rpsModule&"J102007"&"RPS module EPICS channel name";expectedValue2&"0x0010"&"[hex] expected value 2";expectedValue1&"0x00D0"&"[hex] expected value 1"; +description=Diagnostic module diff --git a/script/tests/new-structure-tests-devices/devices/XMA1117/.config b/script/tests/new-structure-tests-devices/devices/XMA1117/.config new file mode 100644 index 0000000..1454885 --- /dev/null +++ b/script/tests/new-structure-tests-devices/devices/XMA1117/.config @@ -0,0 +1,5 @@ +#Fri Oct 20 13:53:44 CEST 2017 +name=XMA1117 +tests=RPS Tests Diagnostic +parameters=rpsAttribute&"REG\:R\:4"&"RPS EPICS attribute";rpsModule&"J102007"&"RPS module EPICS channel name";expectedValue2&"0x1000"&"[hex] expected value 2";expectedValue1&"0xD000"&"[hex] expected value 1"; +description=Diagnostic module diff --git a/script/tests/new-structure-tests-devices/devices/XMA1118/.config b/script/tests/new-structure-tests-devices/devices/XMA1118/.config new file mode 100644 index 0000000..04bc1ae --- /dev/null +++ b/script/tests/new-structure-tests-devices/devices/XMA1118/.config @@ -0,0 +1,5 @@ +#Fri Oct 20 13:40:33 CEST 2017 +name=XMA1118 +tests=RPS Tests Diagnostic +parameters=rpsAttribute&"REG\:R\:7"&"RPS EPICS attribute";rpsModule&"J102025"&"RPS module EPICS channel name";expectedValue2&"0x0010"&"[hex] expected value 2";expectedValue1&"0x00D0"&"[hex] expected value 1"; +description=Diagnostic module diff --git a/script/tests/new-structure-tests-devices/devices/XMA1119/.config b/script/tests/new-structure-tests-devices/devices/XMA1119/.config new file mode 100644 index 0000000..49addfb --- /dev/null +++ b/script/tests/new-structure-tests-devices/devices/XMA1119/.config @@ -0,0 +1,5 @@ +#Fri Oct 20 13:41:13 CEST 2017 +name=XMA1119 +tests=RPS Tests Diagnostic +parameters=rpsAttribute&"REG\:R\:4"&"RPS EPICS attribute";rpsModule&"J102007"&"RPS module EPICS channel name";expectedValue2&"0x0001"&"[hex] expected value 2";expectedValue1&"0x000D"&"[hex] expected value 1"; +description=Diagnostic module diff --git a/script/tests/new-structure-tests-devices/devices/XMB0510/.config b/script/tests/new-structure-tests-devices/devices/XMB0510/.config new file mode 100644 index 0000000..fdc4185 --- /dev/null +++ b/script/tests/new-structure-tests-devices/devices/XMB0510/.config @@ -0,0 +1,5 @@ +#Fri Oct 20 14:02:17 CEST 2017 +name=XMB0510 +tests=RPS Tests Diagnostic +parameters=rpsAttribute&"REG\:R\:5"&"RPS EPICS attribute";rpsModule&"J108053"&"RPS module EPICS channel name";expectedValue2&"0x0100"&"[hex] expected value 2";expectedValue1&"0x0D00"&"[hex] expected value 1"; +description=Diagnostic module diff --git a/script/tests/new-structure-tests-devices/devices/XMC0610/.config b/script/tests/new-structure-tests-devices/devices/XMC0610/.config new file mode 100644 index 0000000..bf9394b --- /dev/null +++ b/script/tests/new-structure-tests-devices/devices/XMC0610/.config @@ -0,0 +1,5 @@ +#Fri Oct 20 14:00:49 CEST 2017 +name=XMC0610 +tests=RPS Tests Diagnostic +parameters=rpsAttribute&"REG\:R\:5"&"RPS EPICS attribute";rpsModule&"J110060"&"RPS module EPICS channel name";expectedValue2&"0x0100"&"[hex] expected value 2";expectedValue1&"0x0D00"&"[hex] expected value 1"; +description=Diagnostic module diff --git a/script/tests/new-structure-tests-devices/devices/XMC2010/.config b/script/tests/new-structure-tests-devices/devices/XMC2010/.config new file mode 100644 index 0000000..2753f2e --- /dev/null +++ b/script/tests/new-structure-tests-devices/devices/XMC2010/.config @@ -0,0 +1,5 @@ +#Fri Oct 20 14:01:23 CEST 2017 +name=XMC2010 +tests=RPS Tests Diagnostic +parameters=rpsAttribute&"REG\:R\:5"&"RPS EPICS attribute";rpsModule&"J117065"&"RPS module EPICS channel name";expectedValue2&"0x0010"&"[hex] expected value 2";expectedValue1&"0x00D0"&"[hex] expected value 1"; +description=Diagnostic module diff --git a/script/tests/new-structure-tests-devices/devices/XMC2011/.config b/script/tests/new-structure-tests-devices/devices/XMC2011/.config new file mode 100644 index 0000000..3dc2824 --- /dev/null +++ b/script/tests/new-structure-tests-devices/devices/XMC2011/.config @@ -0,0 +1,5 @@ +#Fri Oct 20 14:01:52 CEST 2017 +name=XMC2011 +tests=RPS Tests Diagnostic +parameters=rpsAttribute&"REG\:R\:5"&"RPS EPICS attribute";rpsModule&"J117065"&"RPS module EPICS channel name";expectedValue2&"0x0100"&"[hex] expected value 2";expectedValue1&"0x0D00"&"[hex] expected value 1"; +description=Diagnostic module diff --git a/script/tests/new-structure-tests-devices/devices/XMD0710/.config b/script/tests/new-structure-tests-devices/devices/XMD0710/.config new file mode 100644 index 0000000..14e1a37 --- /dev/null +++ b/script/tests/new-structure-tests-devices/devices/XMD0710/.config @@ -0,0 +1,5 @@ +#Fri Oct 20 13:59:03 CEST 2017 +name=XMD0710 +tests=RPS Tests Diagnostic +parameters=rpsAttribute&"REG\:R\:5"&"RPS EPICS attribute";rpsModule&"J124081"&"RPS module EPICS channel name";expectedValue2&"0x0010"&"[hex] expected value 2";expectedValue1&"0x00D0"&"[hex] expected value 1"; +description=Diagnostic module diff --git a/script/tests/new-structure-tests-devices/devices/XMD0711/.config b/script/tests/new-structure-tests-devices/devices/XMD0711/.config new file mode 100644 index 0000000..c262689 --- /dev/null +++ b/script/tests/new-structure-tests-devices/devices/XMD0711/.config @@ -0,0 +1,5 @@ +#Fri Oct 20 13:59:41 CEST 2017 +name=XMD0711 +tests=RPS Tests Diagnostic +parameters=rpsAttribute&"REG\:R\:5"&"RPS EPICS attribute";rpsModule&"J124081"&"RPS module EPICS channel name";expectedValue2&"0x0100"&"[hex] expected value 2";expectedValue1&"0x0D00"&"[hex] expected value 1"; +description=Diagnostic module diff --git a/script/tests/new-structure-tests-devices/devices/XMD0717/.config b/script/tests/new-structure-tests-devices/devices/XMD0717/.config new file mode 100644 index 0000000..2c935f5 --- /dev/null +++ b/script/tests/new-structure-tests-devices/devices/XMD0717/.config @@ -0,0 +1,5 @@ +#Fri Oct 20 14:00:11 CEST 2017 +name=XMD0717 +tests=RPS Tests Diagnostic +parameters=rpsAttribute&"REG\:R\:4"&"RPS EPICS attribute";rpsModule&"J124092"&"RPS module EPICS channel name";expectedValue2&"0x0001"&"[hex] expected value 2";expectedValue1&"0x000D"&"[hex] expected value 1"; +description=Diagnostic module diff --git a/script/tests/new-structure-tests-devices/devices/XME1310/.config b/script/tests/new-structure-tests-devices/devices/XME1310/.config new file mode 100644 index 0000000..a66d3fc --- /dev/null +++ b/script/tests/new-structure-tests-devices/devices/XME1310/.config @@ -0,0 +1,5 @@ +#Fri Oct 20 13:54:46 CEST 2017 +name=XME1310 +tests=RPS Tests Diagnostic +parameters=rpsAttribute&"REG\:R\:6"&"RPS EPICS attribute";rpsModule&"J112009"&"RPS module EPICS channel name";expectedValue2&"0x0001"&"[hex] expected value 2";expectedValue1&"0x000D"&"[hex] expected value 1"; +description=Diagnostic module diff --git a/script/tests/new-structure-tests-devices/devices/XME1311/.config b/script/tests/new-structure-tests-devices/devices/XME1311/.config new file mode 100644 index 0000000..c42d1e2 --- /dev/null +++ b/script/tests/new-structure-tests-devices/devices/XME1311/.config @@ -0,0 +1,5 @@ +#Fri Oct 20 13:55:53 CEST 2017 +name=XME1311 +tests=RPS Tests Diagnostic +parameters=rpsAttribute&"REG\:R\:4"&"RPS EPICS attribute";rpsModule&"J112023"&"RPS module EPICS channel name";expectedValue2&"0x0100"&"[hex] expected value 2";expectedValue1&"0x0D00"&"[hex] expected value 1"; +description=Diagnostic module diff --git a/script/tests/new-structure-tests-devices/devices/XME1410/.config b/script/tests/new-structure-tests-devices/devices/XME1410/.config new file mode 100644 index 0000000..1d114f8 --- /dev/null +++ b/script/tests/new-structure-tests-devices/devices/XME1410/.config @@ -0,0 +1,5 @@ +#Fri Oct 20 13:56:25 CEST 2017 +name=XME1410 +tests=RPS Tests Diagnostic +parameters=rpsAttribute&"REG\:R\:5"&"RPS EPICS attribute";rpsModule&"J112023"&"RPS module EPICS channel name";expectedValue2&"0x0001"&"[hex] expected value 2";expectedValue1&"0x000D"&"[hex] expected value 1"; +description=Diagnostic module diff --git a/script/tests/new-structure-tests-devices/devices/XME1411/.config b/script/tests/new-structure-tests-devices/devices/XME1411/.config new file mode 100644 index 0000000..f874918 --- /dev/null +++ b/script/tests/new-structure-tests-devices/devices/XME1411/.config @@ -0,0 +1,5 @@ +#Fri Oct 20 13:56:53 CEST 2017 +name=XME1411 +tests=RPS Tests Diagnostic +parameters=rpsAttribute&"REG\:R\:5"&"RPS EPICS attribute";rpsModule&"J112023"&"RPS module EPICS channel name";expectedValue2&"0x0010"&"[hex] expected value 2";expectedValue1&"0x00D0"&"[hex] expected value 1"; +description=Diagnostic module diff --git a/script/tests/new-structure-tests-devices/devices/bis-BMA1/.config b/script/tests/new-structure-tests-devices/devices/bis-BMA1/.config new file mode 100644 index 0000000..9fbf4a2 --- /dev/null +++ b/script/tests/new-structure-tests-devices/devices/bis-BMA1/.config @@ -0,0 +1,5 @@ +#Wed Oct 18 10:54:10 CEST 2017 +name=bis-BMA1 +tests=RPS Tests Betriebsmode +parameters=mode&"2,IQCOM,$BMA1,1,DIAG"&"operating mode";expectedVal14&"0x0000"&"[hex] Expected value for channels 1-4";expectedVal58&"0x0000"&"[hex] Expected value for channels 5-8"; +description=rps section till BMA1 diff --git a/script/tests/new-structure-tests-devices/devices/bis-BMC1/.config b/script/tests/new-structure-tests-devices/devices/bis-BMC1/.config new file mode 100644 index 0000000..dd62c9f --- /dev/null +++ b/script/tests/new-structure-tests-devices/devices/bis-BMC1/.config @@ -0,0 +1,5 @@ +#Wed Oct 18 10:54:10 CEST 2017 +name=bis-BMC1 +tests=RPS Tests Betriebsmode +parameters=mode&"2,IQCOM,$BMC1,1,DIAG"&"operating mode";expectedVal14&"0x0000"&"[hex] Expected value for channels 1-4";expectedVal58&"0x0000"&"[hex] Expected value for channels 5-8"; +description=rps section till BMC1 diff --git a/script/tests/new-structure-tests-devices/devices/bis-BMD1/.config b/script/tests/new-structure-tests-devices/devices/bis-BMD1/.config new file mode 100644 index 0000000..163d7d8 --- /dev/null +++ b/script/tests/new-structure-tests-devices/devices/bis-BMD1/.config @@ -0,0 +1,5 @@ +#Wed Oct 18 10:54:16 CEST 2017 +name=bis-BMD1 +tests=RPS Tests Betriebsmode +description=rps section till BMD1 +parameters=mode&"2,IQCOM,$BMD1,1,DIA"&"betriebsmode";expectedVal14&"0x0000"&"[hex] Expected value for channels 1-4";expectedVal58&"0x0000"&"[hex] Expected value for channels 5-8"; diff --git a/script/tests/new-structure-tests-devices/devices/bis-BME1/.config b/script/tests/new-structure-tests-devices/devices/bis-BME1/.config new file mode 100644 index 0000000..6ae20bb --- /dev/null +++ b/script/tests/new-structure-tests-devices/devices/bis-BME1/.config @@ -0,0 +1,5 @@ +#Wed Oct 18 10:54:16 CEST 2017 +name=bis-BME1 +tests=RPS Tests Betriebsmode +description=rps section till BME1 +parameters=mode&"2,IQCOM,$BME1,1,DIA"&"betriebsmode";expectedVal14&"0x0000"&"[hex] Expected value for channels 1-4";expectedVal58&"0x0000"&"[hex] Expected value for channels 5-8"; diff --git a/script/tests/new-structure-tests-devices/devices/newbx84/.config b/script/tests/new-structure-tests-devices/devices/newbx84/.config new file mode 100644 index 0000000..927ba6b --- /dev/null +++ b/script/tests/new-structure-tests-devices/devices/newbx84/.config @@ -0,0 +1,5 @@ +#Tue Mar 20 09:48:39 CET 2018 +name=newbx84 +tests=New Structure Tests +parameters=par1&"1"&"override param 1";par3&"p3"&"device specific param"; +description=bx84 device for new testing list structure diff --git a/script/tests/new-structure-tests-devices/devices/oldDev1/.config b/script/tests/new-structure-tests-devices/devices/oldDev1/.config new file mode 100644 index 0000000..89800c9 --- /dev/null +++ b/script/tests/new-structure-tests-devices/devices/oldDev1/.config @@ -0,0 +1,4 @@ +#Tue Mar 20 13:51:16 CET 2018 +name=oldDev1 +tests=Olt struct tests +description=o diff --git a/script/tests/new-structure-tests-devices/devices/oldDev2/.config b/script/tests/new-structure-tests-devices/devices/oldDev2/.config new file mode 100644 index 0000000..01a943a --- /dev/null +++ b/script/tests/new-structure-tests-devices/devices/oldDev2/.config @@ -0,0 +1,4 @@ +#Tue Mar 20 13:51:21 CET 2018 +name=oldDev2 +tests=Olt struct tests +description=o diff --git a/script/tests/new-structure-tests-devices/tests/New Structure Tests/new bx84 2/.config b/script/tests/new-structure-tests-devices/tests/New Structure Tests/new bx84 2/.config new file mode 100644 index 0000000..d88084e --- /dev/null +++ b/script/tests/new-structure-tests-devices/tests/New Structure Tests/new bx84 2/.config @@ -0,0 +1,4 @@ +#Tue Mar 20 13:40:52 CET 2018 +name=new bx84 2 +parameters= +description=bla diff --git a/script/tests/new-structure-tests-devices/tests/New Structure Tests/new bx84 2/help.html b/script/tests/new-structure-tests-devices/tests/New Structure Tests/new bx84 2/help.html new file mode 100644 index 0000000..9b5aa70 --- /dev/null +++ b/script/tests/new-structure-tests-devices/tests/New Structure Tests/new bx84 2/help.html @@ -0,0 +1,15 @@ + + + +

Description

+bla +

Parameters

+ + +
+

Contact

+Marco Boccioli
+Tel. 3078 + + + diff --git a/script/tests/new-structure-tests-devices/tests/New Structure Tests/new bx84 2/new bx84 2.py b/script/tests/new-structure-tests-devices/tests/New Structure Tests/new bx84 2/new bx84 2.py new file mode 100644 index 0000000..e1adb8b --- /dev/null +++ b/script/tests/new-structure-tests-devices/tests/New Structure Tests/new bx84 2/new bx84 2.py @@ -0,0 +1,174 @@ +# Test name: new bx84 2 +# bla +# Copyright (c) 2015 Paul Scherrer Institute. All rights reserved. + +###### Init - DO NOT MODIFY THE CODE BELOW ###### +global sys, inspect, os, traceback +import sys, inspect, os, traceback + + +def startTest(testName, DEVICE, params): + """ + Main method running the test + """ + # by default, assume the test failed: + ret = 'Test failed' + status = False + # put the whole custom code under try/catch. + try: + # get the path of this script: + testPath = inspect.getfile(inspect.currentframe()) + # init the testing tool class: + test = TestingTool(testName, testPath, DEVICE, params) + +################ END OF Init ##################### +######### WRITE YOUR CODE HERE BELOW ############# + + """ + All the code in this section # WRITE YOUR CODE HERE BELOW # is just an example and can be modified/deleted. + It must be indented to the same level as this comment. + ----------------------------------- + GETTING INPUTS: + ----------------------------------- + If needed, the following methods are available: + + test.getPath() string, path of this test file + test.getName() string, name of this test + test.getDeviceName() string, device for which the test must run (typically it is the beginning of a process variable name) + test.getPlotName() string, name to be given to the plot when using setPlotTitle(). Example: scan.setPlotTitle(test.getPlotName()) + ----------------------------------- + GETTING TEST PARAMETERS: + ----------------------------------- + if you need to get parameters for the test, use: + + myParamValue = test.getParam('myParamName') + + the calls to getParam are added to the code automatically, one per parameter, when creating the new test. + NOTE: Casting may be necessary. + See the test config for the list of parameters specific to the test. + ----------------------------------- + SETTING OUTPUTS: + ----------------------------------- + When the test has ended (error or success), this method must be called in order to return to pshell: + + test.sendFeedback(ret,success) + + ret string, a text summarizing the result of the test. + success bool, True = test successful. False = test failed. + ----------------------------------- + LOG INFO: + ----------------------------------- + when some information must be shown on the log on pshell, use the following line: + test.log('text to log') + """ + + ########## Example (can be removed) ###### + + # print the list of parameters passed. If any error, stop and send feedback. + test.log("Example - Test name: " + test.getName()) + test.log("Example - Device name: " + test.getDeviceName() ) + try: + test.log("Running test with the following parameters:") + test.printParams() + # If present, use the parameters here below for your test script. + # These parameters were automatically generated: you might need to change the casting. + + except: + import traceback + # test failed, write the report into the variables ret and success and send feedback: + ret = 'Could not retrieve testing parameters - ' + traceback.format_exc() + success = False + test.sendFeedback(ret, success) + return + + # loop to read channels for a while and plot the channels values. + # initialise plot tab with 2 plots: pass here the axis names: + scan = ManualScan(['sample'], ['Status (MSTA)', 'Position (VAL)']) + # set plot name(tab title): + scan.setPlotTitle(test.getPlotName()) + # start plots. See further below how to add points to the plots (scan): + scan.start() + + # inject a sinus into the plot, as example + from math import sin + motor_msta = 0 + # take 100 samples of a sinus and a jigsaw plot them: + for sample in range(0, 100): + readback1 = sample #the x axis. + sleep(0.1) # settling time. + # get value (it is translated to a caget): + motor_msta = motor_msta + +1 + if motor_msta > 50: + motor_msta = 0 + # get value: + motor_val = sin(float(sample)/10.0)*10.0-10.0 + # add values to plot: + scan.append([readback1], [readback1], [motor_msta, motor_val]) + + # now try with data from real device: this part will most probably fail: correct the PV names with existing ones. + try: + # set up connection to channels. "type" of data can be "d" (= double), "l" (= long). + pv_motor_msta = Channel(test.getDeviceName() + ':IST:2' , type='d') + pv_motor_val = Channel(test.getDeviceName() + ':IST:1' , type='d') + pv_motor_com = Channel(test.getDeviceName() + ':COM:2' , type='d') + except: + import traceback + # prepare return information: return text: + ret = 'Unable to create channel - ' + traceback.format_exc() + # prepare return information: return success: + success = False + # send return information: + test.sendFeedback(ret, success) + return + # send a command to a channel (it is translated to a caput): uncomment this line below to try it + #pv_motor_com.put(1.0, timeout=None) # optionally, a timeout can be given. + # take 100 samples of the channels and plot them: + for sample in range(0, 100): + readback1 = sample #the x axis. + sleep(0.1) # settling time. + # get value (it is translated to a caget): + motor_msta = pv_motor_msta.get() + # get value: + motor_val = pv_motor_val.get() + # add values to plot: + scan.append([readback1], [readback1], [motor_msta, motor_val]) + + # Closing channels: all channels that were opened with Channel() must be closed before exit: + pv_motor_msta.close() + pv_motor_val.close() + pv_motor_com.close() + + # IMPORTANT: if the test was successful, write the report into the variables ret and success. + # for example, write the following: + ret = "Example - Test successful, here some detail: ..." + success = True + test.sendFeedback(ret, success) + # once the test is finished, no need to do anything. The code below yours will do the rest. + ################ End of Example ########## + +################ END OF YOUR CODE ################ +###### Final - DO NOT MODIFY THE CODE BELOW ###### + + # just in case the feedback was forgotten. + test.sendFeedback(ret, success) + except (KeyboardInterrupt): + # user stop error handler. + import traceback + ret = 'Test stopped by user.' + success = False + test.sendFeedback(ret, success) + except: + # generic error handler. + import traceback + ret = traceback.format_exc() + success = False + test.sendFeedback(ret, success) + + +# launch the test. +startTest(test, device, parameters) + +################ END OF Final #################### +#### IF NEEDED, ADD YOUR FUNCTIONS HERE BELOW #### +# Indent to end left +# def yourCustomFunction: diff --git a/script/tests/new-structure-tests-devices/tests/New Structure Tests/new structure monitor/.config b/script/tests/new-structure-tests-devices/tests/New Structure Tests/new structure monitor/.config new file mode 100644 index 0000000..455814d --- /dev/null +++ b/script/tests/new-structure-tests-devices/tests/New Structure Tests/new structure monitor/.config @@ -0,0 +1,4 @@ +#Tue Mar 20 09:47:18 CET 2018 +name=new structure monitor +parameters=par1&"1"&"param 1";par2&"p2"&"param 2"; +description=Buld new tests with new testing list structure diff --git a/script/tests/new-structure-tests-devices/tests/New Structure Tests/new structure monitor/help.html b/script/tests/new-structure-tests-devices/tests/New Structure Tests/new structure monitor/help.html new file mode 100644 index 0000000..bf018dc --- /dev/null +++ b/script/tests/new-structure-tests-devices/tests/New Structure Tests/new structure monitor/help.html @@ -0,0 +1,17 @@ + + + +

Description

+Buld new tests with new testing list structure +

Parameters

+ + + + +
par1 param 1
par2 param 2
+

Contact

+Marco Boccioli
+Tel. 3078 + + + diff --git a/script/tests/new-structure-tests-devices/tests/New Structure Tests/new structure monitor/new structure monitor.py b/script/tests/new-structure-tests-devices/tests/New Structure Tests/new structure monitor/new structure monitor.py new file mode 100644 index 0000000..4c160f1 --- /dev/null +++ b/script/tests/new-structure-tests-devices/tests/New Structure Tests/new structure monitor/new structure monitor.py @@ -0,0 +1,174 @@ +# Test name: new structure monitor +# Buld new tests with new testing list structure +# Copyright (c) 2015 Paul Scherrer Institute. All rights reserved. + +###### Init - DO NOT MODIFY THE CODE BELOW ###### +global sys, inspect, os, traceback +import sys, inspect, os, traceback + + +def startTest(testName, DEVICE, params): + """ + Main method running the test + """ + # by default, assume the test failed: + ret = 'Test failed' + status = False + # put the whole custom code under try/catch. + try: + # get the path of this script: + testPath = inspect.getfile(inspect.currentframe()) + # init the testing tool class: + test = TestingTool(testName, testPath, DEVICE, params) + +################ END OF Init ##################### +######### WRITE YOUR CODE HERE BELOW ############# + + """ + All the code in this section # WRITE YOUR CODE HERE BELOW # is just an example and can be modified/deleted. + It must be indented to the same level as this comment. + ----------------------------------- + GETTING INPUTS: + ----------------------------------- + If needed, the following methods are available: + + test.getPath() string, path of this test file + test.getName() string, name of this test + test.getDeviceName() string, device for which the test must run (typically it is the beginning of a process variable name) + test.getPlotName() string, name to be given to the plot when using setPlotTitle(). Example: scan.setPlotTitle(test.getPlotName()) + ----------------------------------- + GETTING TEST PARAMETERS: + ----------------------------------- + if you need to get parameters for the test, use: + + myParamValue = test.getParam('myParamName') + + the calls to getParam are added to the code automatically, one per parameter, when creating the new test. + NOTE: Casting may be necessary. + See the test config for the list of parameters specific to the test. + ----------------------------------- + SETTING OUTPUTS: + ----------------------------------- + When the test has ended (error or success), this method must be called in order to return to pshell: + + test.sendFeedback(ret,success) + + ret string, a text summarizing the result of the test. + success bool, True = test successful. False = test failed. + ----------------------------------- + LOG INFO: + ----------------------------------- + when some information must be shown on the log on pshell, use the following line: + test.log('text to log') + """ + + ########## Example (can be removed) ###### + + # print the list of parameters passed. If any error, stop and send feedback. + test.log("Example - Test name: " + test.getName()) + test.log("Example - Device name: " + test.getDeviceName() ) + try: + test.log("Running test with the following parameters:") + test.printParams() + # If present, use the parameters here below for your test script. + # These parameters were automatically generated: you might need to change the casting. + par1 = float(test.getParam('par1')) ; par2 = float(test.getParam('par2')) ; + except: + import traceback + # test failed, write the report into the variables ret and success and send feedback: + ret = 'Could not retrieve testing parameters - ' + traceback.format_exc() + success = False + test.sendFeedback(ret, success) + return + + # loop to read channels for a while and plot the channels values. + # initialise plot tab with 2 plots: pass here the axis names: + scan = ManualScan(['sample'], ['Status (MSTA)', 'Position (VAL)']) + # set plot name(tab title): + scan.setPlotTitle(test.getPlotName()) + # start plots. See further below how to add points to the plots (scan): + scan.start() + + # inject a sinus into the plot, as example + from math import sin + motor_msta = 0 + # take 100 samples of a sinus and a jigsaw plot them: + for sample in range(0, 100): + readback1 = sample #the x axis. + sleep(0.1) # settling time. + # get value (it is translated to a caget): + motor_msta = motor_msta + +1 + if motor_msta > 50: + motor_msta = 0 + # get value: + motor_val = sin(float(sample)/10.0)*10.0-10.0 + # add values to plot: + scan.append([readback1], [readback1], [motor_msta, motor_val]) + + # now try with data from real device: this part will most probably fail: correct the PV names with existing ones. + try: + # set up connection to channels. "type" of data can be "d" (= double), "l" (= long). + pv_motor_msta = Channel(test.getDeviceName() + ':IST:2' , type='d') + pv_motor_val = Channel(test.getDeviceName() + ':IST:1' , type='d') + pv_motor_com = Channel(test.getDeviceName() + ':COM:2' , type='d') + except: + import traceback + # prepare return information: return text: + ret = 'Unable to create channel - ' + traceback.format_exc() + # prepare return information: return success: + success = False + # send return information: + test.sendFeedback(ret, success) + return + # send a command to a channel (it is translated to a caput): uncomment this line below to try it + #pv_motor_com.put(1.0, timeout=None) # optionally, a timeout can be given. + # take 100 samples of the channels and plot them: + for sample in range(0, 100): + readback1 = sample #the x axis. + sleep(0.1) # settling time. + # get value (it is translated to a caget): + motor_msta = pv_motor_msta.get() + # get value: + motor_val = pv_motor_val.get() + # add values to plot: + scan.append([readback1], [readback1], [motor_msta, motor_val]) + + # Closing channels: all channels that were opened with Channel() must be closed before exit: + pv_motor_msta.close() + pv_motor_val.close() + pv_motor_com.close() + + # IMPORTANT: if the test was successful, write the report into the variables ret and success. + # for example, write the following: + ret = "Example - Test successful, here some detail: ..." + success = True + test.sendFeedback(ret, success) + # once the test is finished, no need to do anything. The code below yours will do the rest. + ################ End of Example ########## + +################ END OF YOUR CODE ################ +###### Final - DO NOT MODIFY THE CODE BELOW ###### + + # just in case the feedback was forgotten. + test.sendFeedback(ret, success) + except (KeyboardInterrupt): + # user stop error handler. + import traceback + ret = 'Test stopped by user.' + success = False + test.sendFeedback(ret, success) + except: + # generic error handler. + import traceback + ret = traceback.format_exc() + success = False + test.sendFeedback(ret, success) + + +# launch the test. +startTest(test, device, parameters) + +################ END OF Final #################### +#### IF NEEDED, ADD YOUR FUNCTIONS HERE BELOW #### +# Indent to end left +# def yourCustomFunction: diff --git a/script/tests/new-structure-tests-devices/tests/Olt struct tests/oldtest/.config b/script/tests/new-structure-tests-devices/tests/Olt struct tests/oldtest/.config new file mode 100644 index 0000000..30b4d87 --- /dev/null +++ b/script/tests/new-structure-tests-devices/tests/Olt struct tests/oldtest/.config @@ -0,0 +1,4 @@ +#Tue Mar 20 13:50:42 CET 2018 +name=oldtest +parameters=examplePar1\:2\:This is the parameter n.1 with unit [unit];examplePar2\:4.5\:This is the parameter n.2 with unit [unit]; +description=o diff --git a/script/tests/new-structure-tests-devices/tests/Olt struct tests/oldtest/help.html b/script/tests/new-structure-tests-devices/tests/Olt struct tests/oldtest/help.html new file mode 100644 index 0000000..df78fc5 --- /dev/null +++ b/script/tests/new-structure-tests-devices/tests/Olt struct tests/oldtest/help.html @@ -0,0 +1,17 @@ + + + +

Description

+o +

Parameters

+ + + + +
examplePar1 This is the parameter n.1 with unit [unit]
examplePar2 This is the parameter n.2 with unit [unit]
+

Contact

+Marco Boccioli
+Tel. 3078 + + + diff --git a/script/tests/new-structure-tests-devices/tests/Olt struct tests/oldtest/oldtest.py b/script/tests/new-structure-tests-devices/tests/Olt struct tests/oldtest/oldtest.py new file mode 100644 index 0000000..65b047c --- /dev/null +++ b/script/tests/new-structure-tests-devices/tests/Olt struct tests/oldtest/oldtest.py @@ -0,0 +1,174 @@ +# Test name: oldtest +# o +# Copyright (c) 2015 Paul Scherrer Institute. All rights reserved. + +###### Init - DO NOT MODIFY THE CODE BELOW ###### +global sys, inspect, os, traceback +import sys, inspect, os, traceback + + +def startTest(testName, DEVICE, params): + """ + Main method running the test + """ + # by default, assume the test failed: + ret = 'Test failed' + status = False + # put the whole custom code under try/catch. + try: + # get the path of this script: + testPath = inspect.getfile(inspect.currentframe()) + # init the testing tool class: + test = TestingTool(testName, testPath, DEVICE, params) + +################ END OF Init ##################### +######### WRITE YOUR CODE HERE BELOW ############# + + """ + All the code in this section # WRITE YOUR CODE HERE BELOW # is just an example and can be modified/deleted. + It must be indented to the same level as this comment. + ----------------------------------- + GETTING INPUTS: + ----------------------------------- + If needed, the following methods are available: + + test.getPath() string, path of this test file + test.getName() string, name of this test + test.getDeviceName() string, device for which the test must run (typically it is the beginning of a process variable name) + test.getPlotName() string, name to be given to the plot when using setPlotTitle(). Example: scan.setPlotTitle(test.getPlotName()) + ----------------------------------- + GETTING TEST PARAMETERS: + ----------------------------------- + if you need to get parameters for the test, use: + + myParamValue = test.getParam('myParamName') + + the calls to getParam are added to the code automatically, one per parameter, when creating the new test. + NOTE: Casting may be necessary. + See the test config for the list of parameters specific to the test. + ----------------------------------- + SETTING OUTPUTS: + ----------------------------------- + When the test has ended (error or success), this method must be called in order to return to pshell: + + test.sendFeedback(ret,success) + + ret string, a text summarizing the result of the test. + success bool, True = test successful. False = test failed. + ----------------------------------- + LOG INFO: + ----------------------------------- + when some information must be shown on the log on pshell, use the following line: + test.log('text to log') + """ + + ########## Example (can be removed) ###### + + # print the list of parameters passed. If any error, stop and send feedback. + test.log("Example - Test name: " + test.getName()) + test.log("Example - Device name: " + test.getDeviceName() ) + try: + test.log("Running test with the following parameters:") + test.printParams() + # If present, use the parameters here below for your test script. + # These parameters were automatically generated: you might need to change the casting. + examplePar1 = float(test.getParam('examplePar1')) ; examplePar2 = float(test.getParam('examplePar2')) ; + except: + import traceback + # test failed, write the report into the variables ret and success and send feedback: + ret = 'Could not retrieve testing parameters - ' + traceback.format_exc() + success = False + test.sendFeedback(ret, success) + return + + # loop to read channels for a while and plot the channels values. + # initialise plot tab with 2 plots: pass here the axis names: + scan = ManualScan(['sample'], ['Status (MSTA)', 'Position (VAL)']) + # set plot name(tab title): + scan.setPlotTitle(test.getPlotName()) + # start plots. See further below how to add points to the plots (scan): + scan.start() + + # inject a sinus into the plot, as example + from math import sin + motor_msta = 0 + # take 100 samples of a sinus and a jigsaw plot them: + for sample in range(0, 100): + readback1 = sample #the x axis. + sleep(0.1) # settling time. + # get value (it is translated to a caget): + motor_msta = motor_msta + +1 + if motor_msta > 50: + motor_msta = 0 + # get value: + motor_val = sin(float(sample)/10.0)*10.0-10.0 + # add values to plot: + scan.append([readback1], [readback1], [motor_msta, motor_val]) + + # now try with data from real device: this part will most probably fail: correct the PV names with existing ones. + try: + # set up connection to channels. "type" of data can be "d" (= double), "l" (= long). + pv_motor_msta = Channel(test.getDeviceName() + ':IST:2' , type='d') + pv_motor_val = Channel(test.getDeviceName() + ':IST:1' , type='d') + pv_motor_com = Channel(test.getDeviceName() + ':COM:2' , type='d') + except: + import traceback + # prepare return information: return text: + ret = 'Unable to create channel - ' + traceback.format_exc() + # prepare return information: return success: + success = False + # send return information: + test.sendFeedback(ret, success) + return + # send a command to a channel (it is translated to a caput): uncomment this line below to try it + #pv_motor_com.put(1.0, timeout=None) # optionally, a timeout can be given. + # take 100 samples of the channels and plot them: + for sample in range(0, 100): + readback1 = sample #the x axis. + sleep(0.1) # settling time. + # get value (it is translated to a caget): + motor_msta = pv_motor_msta.get() + # get value: + motor_val = pv_motor_val.get() + # add values to plot: + scan.append([readback1], [readback1], [motor_msta, motor_val]) + + # Closing channels: all channels that were opened with Channel() must be closed before exit: + pv_motor_msta.close() + pv_motor_val.close() + pv_motor_com.close() + + # IMPORTANT: if the test was successful, write the report into the variables ret and success. + # for example, write the following: + ret = "Example - Test successful, here some detail: ..." + success = True + test.sendFeedback(ret, success) + # once the test is finished, no need to do anything. The code below yours will do the rest. + ################ End of Example ########## + +################ END OF YOUR CODE ################ +###### Final - DO NOT MODIFY THE CODE BELOW ###### + + # just in case the feedback was forgotten. + test.sendFeedback(ret, success) + except (KeyboardInterrupt): + # user stop error handler. + import traceback + ret = 'Test stopped by user.' + success = False + test.sendFeedback(ret, success) + except: + # generic error handler. + import traceback + ret = traceback.format_exc() + success = False + test.sendFeedback(ret, success) + + +# launch the test. +startTest(test, device, parameters) + +################ END OF Final #################### +#### IF NEEDED, ADD YOUR FUNCTIONS HERE BELOW #### +# Indent to end left +# def yourCustomFunction: diff --git a/script/tests/new-structure-tests-devices/tests/Olt struct tests/oldtest2/.config b/script/tests/new-structure-tests-devices/tests/Olt struct tests/oldtest2/.config new file mode 100644 index 0000000..fc7a908 --- /dev/null +++ b/script/tests/new-structure-tests-devices/tests/Olt struct tests/oldtest2/.config @@ -0,0 +1,4 @@ +#Tue Mar 20 13:50:48 CET 2018 +name=oldtest2 +parameters=examplePar1\:2\:This is the parameter n.1 with unit [unit];examplePar2\:4.5\:This is the parameter n.2 with unit [unit]; +description=o diff --git a/script/tests/new-structure-tests-devices/tests/Olt struct tests/oldtest2/help.html b/script/tests/new-structure-tests-devices/tests/Olt struct tests/oldtest2/help.html new file mode 100644 index 0000000..df78fc5 --- /dev/null +++ b/script/tests/new-structure-tests-devices/tests/Olt struct tests/oldtest2/help.html @@ -0,0 +1,17 @@ + + + +

Description

+o +

Parameters

+ + + + +
examplePar1 This is the parameter n.1 with unit [unit]
examplePar2 This is the parameter n.2 with unit [unit]
+

Contact

+Marco Boccioli
+Tel. 3078 + + + diff --git a/script/tests/new-structure-tests-devices/tests/Olt struct tests/oldtest2/oldtest2.py b/script/tests/new-structure-tests-devices/tests/Olt struct tests/oldtest2/oldtest2.py new file mode 100644 index 0000000..00c0784 --- /dev/null +++ b/script/tests/new-structure-tests-devices/tests/Olt struct tests/oldtest2/oldtest2.py @@ -0,0 +1,174 @@ +# Test name: oldtest2 +# o +# Copyright (c) 2015 Paul Scherrer Institute. All rights reserved. + +###### Init - DO NOT MODIFY THE CODE BELOW ###### +global sys, inspect, os, traceback +import sys, inspect, os, traceback + + +def startTest(testName, DEVICE, params): + """ + Main method running the test + """ + # by default, assume the test failed: + ret = 'Test failed' + status = False + # put the whole custom code under try/catch. + try: + # get the path of this script: + testPath = inspect.getfile(inspect.currentframe()) + # init the testing tool class: + test = TestingTool(testName, testPath, DEVICE, params) + +################ END OF Init ##################### +######### WRITE YOUR CODE HERE BELOW ############# + + """ + All the code in this section # WRITE YOUR CODE HERE BELOW # is just an example and can be modified/deleted. + It must be indented to the same level as this comment. + ----------------------------------- + GETTING INPUTS: + ----------------------------------- + If needed, the following methods are available: + + test.getPath() string, path of this test file + test.getName() string, name of this test + test.getDeviceName() string, device for which the test must run (typically it is the beginning of a process variable name) + test.getPlotName() string, name to be given to the plot when using setPlotTitle(). Example: scan.setPlotTitle(test.getPlotName()) + ----------------------------------- + GETTING TEST PARAMETERS: + ----------------------------------- + if you need to get parameters for the test, use: + + myParamValue = test.getParam('myParamName') + + the calls to getParam are added to the code automatically, one per parameter, when creating the new test. + NOTE: Casting may be necessary. + See the test config for the list of parameters specific to the test. + ----------------------------------- + SETTING OUTPUTS: + ----------------------------------- + When the test has ended (error or success), this method must be called in order to return to pshell: + + test.sendFeedback(ret,success) + + ret string, a text summarizing the result of the test. + success bool, True = test successful. False = test failed. + ----------------------------------- + LOG INFO: + ----------------------------------- + when some information must be shown on the log on pshell, use the following line: + test.log('text to log') + """ + + ########## Example (can be removed) ###### + + # print the list of parameters passed. If any error, stop and send feedback. + test.log("Example - Test name: " + test.getName()) + test.log("Example - Device name: " + test.getDeviceName() ) + try: + test.log("Running test with the following parameters:") + test.printParams() + # If present, use the parameters here below for your test script. + # These parameters were automatically generated: you might need to change the casting. + examplePar1 = float(test.getParam('examplePar1')) ; examplePar2 = float(test.getParam('examplePar2')) ; + except: + import traceback + # test failed, write the report into the variables ret and success and send feedback: + ret = 'Could not retrieve testing parameters - ' + traceback.format_exc() + success = False + test.sendFeedback(ret, success) + return + + # loop to read channels for a while and plot the channels values. + # initialise plot tab with 2 plots: pass here the axis names: + scan = ManualScan(['sample'], ['Status (MSTA)', 'Position (VAL)']) + # set plot name(tab title): + scan.setPlotTitle(test.getPlotName()) + # start plots. See further below how to add points to the plots (scan): + scan.start() + + # inject a sinus into the plot, as example + from math import sin + motor_msta = 0 + # take 100 samples of a sinus and a jigsaw plot them: + for sample in range(0, 100): + readback1 = sample #the x axis. + sleep(0.1) # settling time. + # get value (it is translated to a caget): + motor_msta = motor_msta + +1 + if motor_msta > 50: + motor_msta = 0 + # get value: + motor_val = sin(float(sample)/10.0)*10.0-10.0 + # add values to plot: + scan.append([readback1], [readback1], [motor_msta, motor_val]) + + # now try with data from real device: this part will most probably fail: correct the PV names with existing ones. + try: + # set up connection to channels. "type" of data can be "d" (= double), "l" (= long). + pv_motor_msta = Channel(test.getDeviceName() + ':IST:2' , type='d') + pv_motor_val = Channel(test.getDeviceName() + ':IST:1' , type='d') + pv_motor_com = Channel(test.getDeviceName() + ':COM:2' , type='d') + except: + import traceback + # prepare return information: return text: + ret = 'Unable to create channel - ' + traceback.format_exc() + # prepare return information: return success: + success = False + # send return information: + test.sendFeedback(ret, success) + return + # send a command to a channel (it is translated to a caput): uncomment this line below to try it + #pv_motor_com.put(1.0, timeout=None) # optionally, a timeout can be given. + # take 100 samples of the channels and plot them: + for sample in range(0, 100): + readback1 = sample #the x axis. + sleep(0.1) # settling time. + # get value (it is translated to a caget): + motor_msta = pv_motor_msta.get() + # get value: + motor_val = pv_motor_val.get() + # add values to plot: + scan.append([readback1], [readback1], [motor_msta, motor_val]) + + # Closing channels: all channels that were opened with Channel() must be closed before exit: + pv_motor_msta.close() + pv_motor_val.close() + pv_motor_com.close() + + # IMPORTANT: if the test was successful, write the report into the variables ret and success. + # for example, write the following: + ret = "Example - Test successful, here some detail: ..." + success = True + test.sendFeedback(ret, success) + # once the test is finished, no need to do anything. The code below yours will do the rest. + ################ End of Example ########## + +################ END OF YOUR CODE ################ +###### Final - DO NOT MODIFY THE CODE BELOW ###### + + # just in case the feedback was forgotten. + test.sendFeedback(ret, success) + except (KeyboardInterrupt): + # user stop error handler. + import traceback + ret = 'Test stopped by user.' + success = False + test.sendFeedback(ret, success) + except: + # generic error handler. + import traceback + ret = traceback.format_exc() + success = False + test.sendFeedback(ret, success) + + +# launch the test. +startTest(test, device, parameters) + +################ END OF Final #################### +#### IF NEEDED, ADD YOUR FUNCTIONS HERE BELOW #### +# Indent to end left +# def yourCustomFunction: diff --git a/script/tests/new-structure-tests-devices/tests/RPS Tests Betriebsmode/Betriebsmode/.config b/script/tests/new-structure-tests-devices/tests/RPS Tests Betriebsmode/Betriebsmode/.config new file mode 100644 index 0000000..390438b --- /dev/null +++ b/script/tests/new-structure-tests-devices/tests/RPS Tests Betriebsmode/Betriebsmode/.config @@ -0,0 +1,4 @@ +#Mon Oct 16 14:28:18 CEST 2017 +name=Betriebsmode +description=Verify that the different RPS Modes give correct Outputs on the RPS modules +parameters=mode&"2,IQCOM,$BMA1,1,DIA"&"vla";rpsCh14&"J102003:REG:R:3"&"rps channel 1-4";rpsCh58&"J102003:REG:R:34"&"rps channel 5-8";expectedVal14&"0x0000"&"[hex] Expected value for channels 1-4";expectedVal58&"0x0000"&"[hex] Expected value for channels 5-8";setGetDelay&"1"&"[s] delay between set and get"; diff --git a/script/tests/new-structure-tests-devices/tests/RPS Tests Betriebsmode/Betriebsmode/Betriebsmode.py b/script/tests/new-structure-tests-devices/tests/RPS Tests Betriebsmode/Betriebsmode/Betriebsmode.py new file mode 100644 index 0000000..c950c51 --- /dev/null +++ b/script/tests/new-structure-tests-devices/tests/RPS Tests Betriebsmode/Betriebsmode/Betriebsmode.py @@ -0,0 +1,171 @@ +# Test name: Betriebsmode (old caRPSTest test #1) +# betriebsmode +# Copyright (c) 2015 Paul Scherrer Institute. All rights reserved. + +###### Init - DO NOT MODIFY THE CODE BELOW ###### +global sys, inspect, os, traceback +import sys, inspect, os, traceback + + +def startTest(testName, DEVICE, params): + """ + Main method running the test + """ + # by default, assume the test failed: + ret = 'Test failed' + status = False + # put the whole custom code under try/catch. + try: + # get the path of this script: + testPath = inspect.getfile(inspect.currentframe()) + # init the testing tool class: + test = TestingTool(testName, testPath, DEVICE, params) + +################ END OF Init ##################### +######### WRITE YOUR CODE HERE BELOW ############# + + """ + All the code in this section # WRITE YOUR CODE HERE BELOW # is just an example and can be modified/deleted. + It must be indented to the same level as this comment. + ----------------------------------- + GETTING INPUTS: + ----------------------------------- + If needed, the following methods are available: + + test.getPath() string, path of this test file + test.getName() string, name of this test + test.getDeviceName() string, device for which the test must run (typically it is the beginning of a process variable name) + test.getPlotName() string, name to be given to the plot when using setPlotTitle(). Example: scan.setPlotTitle(test.getPlotName()) + ----------------------------------- + GETTING TEST PARAMETERS: + ----------------------------------- + if you need to get parameters for the test, use: + + myParamValue = test.getParam('myParamName') + + the calls to getParam are added to the code automatically, one per parameter, when creating the new test. + NOTE: Casting may be necessary. + See the test config for the list of parameters specific to the test. + ----------------------------------- + SETTING OUTPUTS: + ----------------------------------- + When the test has ended (error or success), this method must be called in order to return to pshell: + + test.sendFeedback(ret,success) + + ret string, a text summarizing the result of the test. + success bool, True = test successful. False = test failed. + ----------------------------------- + LOG INFO: + ----------------------------------- + when some information must be shown on the log on pshell, use the following line: + test.log('text to log') + """ + + + # print the list of parameters passed. If any error, stop and send feedback. + test.log("Test " + test.getName() + " for " + test.getDeviceName() ) + try: + test.log("Running test with the following parameters:") + test.printParams() + # fetch paramenters + rpsChName14 = (test.getParam('rpsCh14')) + rpsChName58 = (test.getParam('rpsCh58')) + expectedVal14 = (test.getParam('expectedVal14')) + expectedVal58 = (test.getParam('expectedVal58')) + mode = (test.getParam('mode')) + setGetDelay = float(test.getParam('setGetDelay')) ; + except: + import traceback + # test failed, write the report into the variables ret and success and send feedback: + ret = 'Could not retrieve testing parameters - ' + traceback.format_exc() + success = False + test.sendFeedback(ret, success) + return + + # now try with data from real device: this part will most probably fail: correct the PV names with existing ones. + rpsMask14 = 0x4440 # mask for outputs 2-4 + rpsMask58 = 0x0004 # mask for output 5 + ilk = Interlock() + ilk.setInterlockMode(mode) + sleep(setGetDelay) + ilk.masterReset() + sleep(setGetDelay) + modeRead = ilk.getInterlockMode(); + if not modeRead: + ret = 'No mode received' + success = False + test.sendFeedback(ret, success) + return + try: + modePresent = modeRead.index(mode) + except: + modePresent = -1 + ret = 'Could not set mode ' + mode + success = False + test.sendFeedback(ret, success) + return + try: + # set up connection to channels. "type" of data can be "d" (= double), "l" (= long). + # outputs 1-4 + rpsCh14 = Channel(rpsChName14, type='d') + # outputs 5-8 + rpsCh58 = Channel(rpsChName58, type='d') + + rpsVal14 = rpsCh14.get() + rpsVal58 = rpsCh58.get() + + success = True + if ((rpsVal14 & rpsMask14) == expectedVal14): + ret = 'Interlocks outputs (1-4) of ' + rpsChName14 + ': ' + rpsVal14 + ' as expected' + else: + ret = 'Interlocks outputs (1-4) of ' + rpsChName14 + ': ' + rpsVal14 + ' was expected: ' + expectedVal14 + success = False + + if ((rpsVal58 & rpsMask58) == expectedVal58): + ret = ret + '\nInterlocks outputs (5-8) of ' + rpsChName58 + ': ' + rpsVal58 + ' as expected' + else: + ret = ret + '\nInterlocks outputs (5-8) of ' + rpsChName58 + ': ' + rpsVal58 + ' was expected: ' + expectedVal58 + success = False + except: + import traceback + # prepare return information: return text: + ret = 'Unable to connect to channel - ' + traceback.format_exc() + # prepare return information: return success: + success = False + # send return information: + test.sendFeedback(ret, success) + return + + # Closing channels: all channels that were opened with Channel() must be closed before exit: + rpsCh14.close() + rpsCh58.close() + + # once the test is finished, no need to do anything. The code below yours will do the rest. + +################ END OF YOUR CODE ################ +###### Final - DO NOT MODIFY THE CODE BELOW ###### + + # just in case the feedback was forgotten. + test.sendFeedback(ret, success) + except (KeyboardInterrupt): + # user stop error handler. + import traceback + ret = 'Test stopped by user.' + success = False + test.sendFeedback(ret, success) + except: + # generic error handler. + import traceback + ret = traceback.format_exc() + success = False + test.sendFeedback(ret, success) + + +# launch the test. +startTest(test, device, parameters) + +################ END OF Final #################### +#### IF NEEDED, ADD YOUR FUNCTIONS HERE BELOW #### +# Indent to end left +# def yourCustomFunction: diff --git a/script/tests/new-structure-tests-devices/tests/RPS Tests Betriebsmode/Betriebsmode/help.html b/script/tests/new-structure-tests-devices/tests/RPS Tests Betriebsmode/Betriebsmode/help.html new file mode 100644 index 0000000..adb0ce7 --- /dev/null +++ b/script/tests/new-structure-tests-devices/tests/RPS Tests Betriebsmode/Betriebsmode/help.html @@ -0,0 +1,19 @@ + + + +

Description

+Verify that the different RPS Modes give correct Outputs on the RPS modules (Test n. 1 in old caRPS_Tests) +

Parameters

+ + + + + + +
mode [string] Betriebs mode
expectedVal14 [hex] Expected value for channels 1-4
expectedVal58 [hex] Expected value for channels 5-8
setGetDelay [ms] delay between set and get
+

Contact

+Marco Boccioli
+Tel. 3078 + + + diff --git a/script/tests/new-structure-tests-devices/tests/RPS Tests Diagnostic/Diagnostic/.config b/script/tests/new-structure-tests-devices/tests/RPS Tests Diagnostic/Diagnostic/.config new file mode 100644 index 0000000..8460d43 --- /dev/null +++ b/script/tests/new-structure-tests-devices/tests/RPS Tests Diagnostic/Diagnostic/.config @@ -0,0 +1,4 @@ +#Fri Oct 20 13:31:23 CEST 2017 +name=Diagnostic +parameters=setGetDelay&"1"&"[s] delay between set and get"; +description=Test interlocks of diagnostic modules by generating a pulse diff --git a/script/tests/new-structure-tests-devices/tests/RPS Tests Diagnostic/Diagnostic/Diagnostic.py b/script/tests/new-structure-tests-devices/tests/RPS Tests Diagnostic/Diagnostic/Diagnostic.py new file mode 100644 index 0000000..8abf082 --- /dev/null +++ b/script/tests/new-structure-tests-devices/tests/RPS Tests Diagnostic/Diagnostic/Diagnostic.py @@ -0,0 +1,143 @@ +# Test name: Diagnostic +# Test interlocks of diagnostic modules by generating a pulse +# Copyright (c) 2015 Paul Scherrer Institute. All rights reserved. + +###### Init - DO NOT MODIFY THE CODE BELOW ###### +global sys, inspect, os, traceback +import sys, inspect, os, traceback + + +def startTest(testName, DEVICE, params): + """ + Main method running the test + """ + # by default, assume the test failed: + ret = 'Test failed' + status = False + # put the whole custom code under try/catch. + try: + # get the path of this script: + testPath = inspect.getfile(inspect.currentframe()) + # init the testing tool class: + test = TestingTool(testName, testPath, DEVICE, params) + +################ END OF Init ##################### +######### WRITE YOUR CODE HERE BELOW ############# + + """ + All the code in this section # WRITE YOUR CODE HERE BELOW # is just an example and can be modified/deleted. + It must be indented to the same level as this comment. + ----------------------------------- + GETTING INPUTS: + ----------------------------------- + If needed, the following methods are available: + + test.getPath() string, path of this test file + test.getName() string, name of this test + test.getDeviceName() string, device for which the test must run (typically it is the beginning of a process variable name) + test.getPlotName() string, name to be given to the plot when using setPlotTitle(). Example: scan.setPlotTitle(test.getPlotName()) + ----------------------------------- + GETTING TEST PARAMETERS: + ----------------------------------- + if you need to get parameters for the test, use: + + myParamValue = test.getParam('myParamName') + + the calls to getParam are added to the code automatically, one per parameter, when creating the new test. + NOTE: Casting may be necessary. + See the test config for the list of parameters specific to the test. + ----------------------------------- + SETTING OUTPUTS: + ----------------------------------- + When the test has ended (error or success), this method must be called in order to return to pshell: + + test.sendFeedback(ret,success) + + ret string, a text summarizing the result of the test. + success bool, True = test successful. False = test failed. + ----------------------------------- + LOG INFO: + ----------------------------------- + when some information must be shown on the log on pshell, use the following line: + test.log('text to log') + """ + + ########## Example (can be removed) ###### + + # print the list of parameters passed. If any error, stop and send feedback. + test.log("Example - Test name: " + test.getName()) + test.log("Example - Device name: " + test.getDeviceName() ) + try: + test.log("Running test with the following parameters:") + test.printParams() + # If present, use the parameters here below for your test script. + # These parameters were automatically generated: you might need to change the casting. + setGetDelay = float(test.getParam('setGetDelay')) + rpsAttribute = test.getParam('rpsAttribute') + rpsModule = test.getParam('rpsModule') + expectedValue2 = test.getParam('expectedValue2') + expectedValue1 = test.getParam('expectedValue1') + except: + import traceback + # test failed, write the report into the variables ret and success and send feedback: + ret = 'Could not retrieve testing parameters - ' + traceback.format_exc() + success = False + test.sendFeedback(ret, success) + return + + # now try with data from real device: this part will most probably fail: correct the PV names with existing ones. + try: + # set up connection to channels. "type" of data can be "d" (= double), "l" (= long). + #rpsCh = Channel(test.getDeviceName() + ':' + rpsAttribute , type='d') + test.log('doing nothing here...') + except: + import traceback + # prepare return information: return text: + ret = 'Unable to create channel - ' + traceback.format_exc() + # prepare return information: return success: + success = False + # send return information: + test.sendFeedback(ret, success) + return + # send a command to a channel (it is translated to a caput): uncomment this line below to try it + #pv_motor_com.put(1.0, timeout=None) # optionally, a timeout can be given. + # take 100 samples of the channels and plot them: + # get value (it is translated to a caget): + # motor_msta = pv_motor_msta.get() + + # Closing channels: all channels that were opened with Channel() must be closed before exit: + #rpsCh.close() + + # IMPORTANT: if the test was successful, write the report into the variables ret and success. + # for example, write the following: + ret = "Success, nothing was done :-)" + success = True + # once the test is finished, no need to do anything. The code below yours will do the rest. + ################ End of Example ########## + +################ END OF YOUR CODE ################ +###### Final - DO NOT MODIFY THE CODE BELOW ###### + + # just in case the feedback was forgotten. + test.sendFeedback(ret, success) + except (KeyboardInterrupt): + # user stop error handler. + import traceback + ret = 'Test stopped by user.' + success = False + test.sendFeedback(ret, success) + except: + # generic error handler. + import traceback + ret = traceback.format_exc() + success = False + test.sendFeedback(ret, success) + + +# launch the test. +startTest(test, device, parameters) + +################ END OF Final #################### +#### IF NEEDED, ADD YOUR FUNCTIONS HERE BELOW #### +# Indent to end left +# def yourCustomFunction: diff --git a/script/tests/new-structure-tests-devices/tests/RPS Tests Diagnostic/Diagnostic/help.html b/script/tests/new-structure-tests-devices/tests/RPS Tests Diagnostic/Diagnostic/help.html new file mode 100644 index 0000000..c2f029f --- /dev/null +++ b/script/tests/new-structure-tests-devices/tests/RPS Tests Diagnostic/Diagnostic/help.html @@ -0,0 +1,19 @@ + + + +

Description

+Test interlocks of diagnostic modules by generating a pulse (Test n. 5 in old caRPS_Tests) +

Parameters

+ + + + + + +
setGetDelay [s] delay between set and get
rpsAttributeRPS EPICS attribute
rpsModuleRPS module EPICS channel name
expectedValue2[hex] expected value 2
expectedValue1[hex] expected value 1
+

Contact

+Marco Boccioli
+Tel. 3078 + + + diff --git a/script/tests/new-structure-tests-devices/tests/RPS Tests Interlocklilmits/RPSlimits/.config b/script/tests/new-structure-tests-devices/tests/RPS Tests Interlocklilmits/RPSlimits/.config new file mode 100644 index 0000000..cb621ab --- /dev/null +++ b/script/tests/new-structure-tests-devices/tests/RPS Tests Interlocklilmits/RPSlimits/.config @@ -0,0 +1,4 @@ +#Wed Oct 18 14:59:58 CEST 2017 +name=RPSlimits +parameters= +description=Verify that for different modes, the RPS behaves correctly when scanning the current settings of the Ablenkungsmagnet diff --git a/script/tests/new-structure-tests-devices/tests/RPS Tests Interlocklilmits/RPSlimits/RPSlimits.py b/script/tests/new-structure-tests-devices/tests/RPS Tests Interlocklilmits/RPSlimits/RPSlimits.py new file mode 100644 index 0000000..317e2cb --- /dev/null +++ b/script/tests/new-structure-tests-devices/tests/RPS Tests Interlocklilmits/RPSlimits/RPSlimits.py @@ -0,0 +1,191 @@ +# Test name: Interlocklimits +# Interlock Limits for Ablenksmagnet +# Copyright (c) 2015 Paul Scherrer Institute. All rights reserved. + +###### Init - DO NOT MODIFY THE CODE BELOW ###### +global sys, inspect, os, traceback +import sys, inspect, os, traceback + + +def startTest(testName, DEVICE, params): + """ + Main method running the test + """ + # by default, assume the test failed: + ret = 'Test failed' + status = False + # put the whole custom code under try/catch. + try: + # get the path of this script: + testPath = inspect.getfile(inspect.currentframe()) + # init the testing tool class: + test = TestingTool(testName, testPath, DEVICE, params) + +################ END OF Init ##################### +######### WRITE YOUR CODE HERE BELOW ############# + + """ + All the code in this section # WRITE YOUR CODE HERE BELOW # is just an example and can be modified/deleted. + It must be indented to the same level as this comment. + ----------------------------------- + GETTING INPUTS: + ----------------------------------- + If needed, the following methods are available: + + test.getPath() string, path of this test file + test.getName() string, name of this test + test.getDeviceName() string, device for which the test must run (typically it is the beginning of a process variable name) + test.getPlotName() string, name to be given to the plot when using setPlotTitle(). Example: scan.setPlotTitle(test.getPlotName()) + ----------------------------------- + GETTING TEST PARAMETERS: + ----------------------------------- + if you need to get parameters for the test, use: + + myParamValue = test.getParam('myParamName') + + the calls to getParam are added to the code automatically, one per parameter, when creating the new test. + NOTE: Casting may be necessary. + See the test config for the list of parameters specific to the test. + ----------------------------------- + SETTING OUTPUTS: + ----------------------------------- + When the test has ended (error or success), this method must be called in order to return to pshell: + + test.sendFeedback(ret,success) + + ret string, a text summarizing the result of the test. + success bool, True = test successful. False = test failed. + ----------------------------------- + LOG INFO: + ----------------------------------- + when some information must be shown on the log on pshell, use the following line: + test.log('text to log') + """ + + ########## Example (can be removed) ###### + + # print the list of parameters passed. If any error, stop and send feedback. + test.log("Test " + test.getName() + " for " + test.getDeviceName() ) + try: + test.log("Running test with the following parameters:") + test.printParams() + ret = 'Success, nothing was done :-)' + success = True + test.sendFeedback(ret, success) + return + # fetch parameters + mode = (test.getParam('mode')) + ilkInExpectedValS = (test.getParam('ilkInExpectedValS')) + magnetChName = (test.getParam('magnetCh')) + ilkInChName = (test.getParam('ilkInCh')) + ilkInExpectedValIni = (test.getParam('ilkInExpectedValIni')) + ilkOutExpectedValL = (test.getParam('ilkOutExpectedValL')) + magnetEndVal = int(test.getParam('magnetEndVal')) + ilkOutChName = (test.getParam('ilkOutCh')) + ilkOutExpectedValIni = (test.getParam('ilkOutExpectedValIni')) + ilkOutExpectedValS = (test.getParam('ilkOutExpectedValS')) + magnetInitVal = int(test.getParam('magnetInitVal')) + setGetDelay = float(test.getParam('setGetDelay')) + except: + import traceback + # test failed, write the report into the variables ret and success and send feedback: + ret = 'Could not retrieve testing parameters - ' + traceback.format_exc() + success = False + test.sendFeedback(ret, success) + return + + rpsMask14 = 0x4440 # mask for outputs 2-4 + rpsMask58 = 0x0004 # mask for output 5 + ilk = Interlock() + ilk.setInterlockMode(mode) + sleep(setGetDelay) + ilk.masterReset() + # loop to read channels for a while and plot the channels values. + # initialise plot tab with 3 plots: + scan = ManualScan(['units'], ['Magnet', 'Interlock-In', 'Interlock-Out']) + # set plot name(tab title): + scan.setPlotTitle(test.getPlotName()) + # start plots. See further below how to add points to the plots (scan): + scan.start() + # now try with data from real device: this part will most probably fail: correct the PV names with existing ones. + try: + # set up connection to channels. "type" of data can be "d" (= double), "l" (= long). + #magnetCh = Channel(magnetChName , type='d') + #ilkInCh = Channel(ilkInChName , type='d') + #ilkOutCh = Channel(ilkOutChName , type='d') + print magnetChName + except: + import traceback + # prepare return information: return text: + ret = 'Unable to create channel - ' + traceback.format_exc() + # prepare return information: return success: + success = False + # send return information: + test.sendFeedback(ret, success) + return + # check RPS status + #ilkInVal = ilkInCh.get() + #ilkOutVal = ilkOutCh.get() + ilkInVal = ilkInExpectedValIni #delete!! + ilkOutVal = ilkOutExpectedValIni #delete!! + if (ilkInVal == ilkInExpectedValIni): + test.log(ilkInChName + ' ok') + else: + ret = ilkInChName + ' wrong - expected: ' + ilkInExpectedValIni + ' got: ' + ilkInVal + success = False + return + if ((ilkOutVal & 0x000C) == ilkOutExpectedValIni): + test.log(ilkOutChName + ' ok') + else: + ret = ilkOutChName + ' wrong - expected: ' + ilkOutExpectedValIni + ' got: ' + (ilkOutVal & 0x000C) + success = False + return + + # start scan of magnet + # inject a sinus into the plot, as example + from math import sin + for sample in range(magnetInitVal, magnetEndVal, 10): + readback1 = sample #the x axis. + sleep(0.01) # settling time. + # get value (it is translated to a caget): + magnetVal = sample + # get value: + ilkInVal = sin(float(sample)/10.0)*10.0-10.0 + ilkOutVal = ilkInVal*0.5+10 + # add values to plot: + scan.append([readback1], [readback1], [magnetVal, ilkInVal, ilkOutVal]) + + #magnetCh.close() + #ilkInCh.close() + #ilkOutCh.close() + + ret = "Success, because..." + success = True + ################ End of Example ########## + +################ END OF YOUR CODE ################ +###### Final - DO NOT MODIFY THE CODE BELOW ###### + + # just in case the feedback was forgotten. + test.sendFeedback(ret, success) + except (KeyboardInterrupt): + # user stop error handler. + import traceback + ret = 'Test stopped by user.' + success = False + test.sendFeedback(ret, success) + except: + # generic error handler. + import traceback + ret = traceback.format_exc() + success = False + test.sendFeedback(ret, success) + + +# launch the test. +startTest(test, device, parameters) + +################ END OF Final #################### +#### IF NEEDED, ADD YOUR FUNCTIONS HERE BELOW #### +# Indent to end left +# def yourCustomFunction: diff --git a/script/tests/new-structure-tests-devices/tests/RPS Tests Interlocklilmits/RPSlimits/help.html b/script/tests/new-structure-tests-devices/tests/RPS Tests Interlocklilmits/RPSlimits/help.html new file mode 100644 index 0000000..7a07635 --- /dev/null +++ b/script/tests/new-structure-tests-devices/tests/RPS Tests Interlocklilmits/RPSlimits/help.html @@ -0,0 +1,26 @@ + + + +

Description

+Interlock Limits for Ablenksmagnet (Test n. 2 in old caRPS_Tests) +

Parameters

+ + + + + + + + + + + + + +
ilkInExpectedValS [hex] Interlock Input expected value for small values of magnet
magnetCh Magnet epics channel
ilkInCh Interlock Input epics channel
ilkInExpectedValIni [hex] Interlock Input expected initial value
ilkOutExpectedValL [hex] Interlock Output expected value for large values of magnet
magnetEndVal [int] magnet final value for scan sequence
ilkOutCh Interlock Output epics channel
ilkOutExpectedValIni [hex] Interlock Output expected initial value
ilkOutExpectedValS [hex] Interlock Output expected value for small values of magnet
magnetInitVal [int] magnet initial value for scan sequence
setGetDelay [s] delay between set and get
+

Contact

+Marco Boccioli
+Tel. 3078 + + + diff --git a/script/tests/tests.properties b/script/tests/tests.properties index fff372e..9a05b9a 100644 --- a/script/tests/tests.properties +++ b/script/tests/tests.properties @@ -1,5 +1,5 @@ #TestingList for pshell: configuration properties -#Tue Mar 20 14:04:44 CET 2018 +#Tue Mar 20 14:07:19 CET 2018 customPanel= showEnabledTestsOnly= listFilter=rps-test diff --git a/script/tests/tests/Collimator Tests pro/Calibrate/.config b/script/tests/tests/Collimator Tests pro/Calibrate/.config new file mode 100644 index 0000000..5e59d3d --- /dev/null +++ b/script/tests/tests/Collimator Tests pro/Calibrate/.config @@ -0,0 +1,12 @@ +name=Calibrate +description=Calibrates the device +filename=Calibrate.xml +help = \ +This test sends a command to the low level firmware which controls the collimators \n\ +requesting that it calibrates itself. \n\n\ +Calibration involves moving to the R1 and R2 reference positions and measuring the \n\ +number of steps required to do so. At the end of the sequence the default collimator \n\ +will be selected. \n\n\ +During the course of the expected calibration period (45-70 seconds) the test \n\ +procedure will plot the values of all critical system variables. \n\n\ +For further information please consult Valery Ovinnikov.
\ diff --git a/script/tests/tests/Collimator Tests pro/Calibrate/Calibrate.py b/script/tests/tests/Collimator Tests pro/Calibrate/Calibrate.py new file mode 100644 index 0000000..344762f --- /dev/null +++ b/script/tests/tests/Collimator Tests pro/Calibrate/Calibrate.py @@ -0,0 +1,139 @@ +###### Init - DO NOT MODIFY THE CODE BELOW ###### +global sys, inspect, os, traceback +import sys, inspect, os, traceback + + +def startTest(testName, DEVICE, params): + # by default, assume the test failed + ret = 'Test failed' + success = False + # plot name to be given to the scan. Use: scan.setPlotTitle(plotName) + plotName = DEVICE + ' - ' + testName + # put the whole custom code under try/catch + try: + # get the path of this script + testPath = inspect.getfile(inspect.currentframe()) + # init the testing tool class. It can be sued in the following ways: + test = TestingTool(testName, testPath, DEVICE, params) + samplePeriod = 0.1 + +######### WRITE YOUR CODE HERE BELOW ############# + scan = ManualScan(['time [1/'+ str(1/samplePeriod) + ' s]'], ['Motor Pos (IST3:2)', 'Poti Position (IST2:1)', + 'Motor Status (STA:1)', 'Inkr (INKR:2)', 'InkrRb (INKRRB:2)', + 'Diameter (DIAM:2)', 'Logical Position (IST:2)', + 'Motor Pos Raw (IST3:1)','Poti Pos From Beam (IST1:2)', + 'Poti Raw (POSA:1)', 'Poti Ref1 Position (REF1:1)', 'Poti Ref2 Position (REF2:1)']) + scan.setPlotTitle(plotName) + scan.start() + + try: + idMotorStatus = Channel(DEVICE + ':STA:1' , type = 'd') # DSP device_status reg + idLogicalPosition = Channel(DEVICE + ':IST:2' , type = 'd') # Shows current position in logical units as calculated from motor step counter [1..n] + idPotiRaw = Channel(DEVICE + ':POSA:1' , type = 'd') # poti raw data [ADC units] + idMotorPositionRaw = Channel(DEVICE + ':IST3:1' , type = 'd') # shows current position in steps as as obtained from motor step counter [steps] + idInkr = Channel(DEVICE + ':INKR:2' , type = 'd') # move relative distance (positive means towards R2) [mm] + idInkrRb = Channel(DEVICE + ':INKRRB:2' , type = 'd') # readback of move relative distance (positive means towards R2) [mm] + idDiameter = Channel(DEVICE + ':DIAM:2' , type = 'd') # collimator diameter [mm] + idCom = Channel(DEVICE + ':COM:2' , type = 'd') # current position as from motor step counter [mm] + idMotorPosition = Channel(DEVICE + ':IST3:2' , type = 'd') # current position as from motor step counter [mm] + idPotiPosFromBeam = Channel(DEVICE + ':IST1:2' , type = 'd') # current position from beam as from potentiometer [mm] + idPotiPosition = Channel(DEVICE + ':IST2:1' , type = 'd') # current position as from potentiometer [mm] + idPotiRef1Position = Channel(DEVICE + ':REF1:1' , type = 'd') # R1 position as from potentiometer [mm] + idPotiRef2Position = Channel(DEVICE + ':REF2:1' , type = 'd') # R2 position as from potentiometer [mm] + + #Pre-actions: 1 = calibrate + caput(DEVICE+':COM:2', 1) + except: + ret = 'Unable to create channel - ' + traceback.format_exc() + success = False + test.sendFeedback( ret, success) + return + + countDeviceInModeIdle = 0 + for setpoint1 in range(0, 10000): + sleep( samplePeriod ) # Settling time + + MotorStatus = idMotorStatus.get() + LogicalPosition = idLogicalPosition.get() + PotiRaw = idPotiRaw.get() + MotorPositionRaw = idMotorPositionRaw.get() + MotorPosition = idMotorPosition.get() + PotiPosFromBeam = idPotiPosFromBeam.get() + PotiPosition = idPotiPosition.get() + PotiRef1Position = idPotiRef1Position.get() + PotiRef2Position = idPotiRef2Position.get() + Diameter = idDiameter.get() + Inkr = idInkr.get() + InkrRb = idInkrRb.get() + + scan.append([setpoint1], [setpoint1], + [MotorPosition, PotiPosition, MotorStatus, Inkr, InkrRb, Diameter, LogicalPosition, + MotorPositionRaw, PotiPosFromBeam, PotiRaw, PotiRef1Position, PotiRef2Position]) + + if (int(MotorStatus) & int('1',2))==0: #device finished calibration (bit#1) + #give the device some time before stating that it has really finished + countDeviceInModeIdle = countDeviceInModeIdle +1 + if countDeviceInModeIdle == 10: + break + else: + countDeviceInModeIdle = 0 + + #check if any error bit is raised + if bool(int(MotorStatus) & int('10000',2)): #error: abort test + test.sendFeedback('Motor switched off (bit#4)', False) + return + if bool(int(MotorStatus) & int('100000',2)): #error: abort test + test.sendFeedback('No motor link (bit#5)', False) + return + if bool(int(MotorStatus) & int('1000000',2)): #error: abort test + test.sendFeedback('No poti link (bit#6)', False) + return + if bool(int(MotorStatus) & int('10000000',2)): #error: abort test + test.sendFeedback('Calibration error (bit#7)', False) + return + if bool(int(MotorStatus) & int('100000000',2)): #error: abort test + test.sendFeedback('Cannot get to R1 (bit#8)', False) + return + if bool(int(MotorStatus) & int('1000000000',2)): #error: abort test + test.sendFeedback('Cannot get to R2 (bit#9)', False) + return + if bool(int(MotorStatus) & int('10000000000',2)): #error: abort test + test.sendFeedback('Position measurement mismatch (bit#10)', False) + return + if bool(int(MotorStatus) & int('100000000000',2)): #error: abort test + test.sendFeedback('Movement timeout (bit#11)', False) + return + + #Closing channels + idMotorStatus.close() + idLogicalPosition.close() + idPotiRaw.close() + idMotorPositionRaw.close() + idMotorPosition.close() + idPotiPosFromBeam.close() + idPotiPosition.close() + idPotiRef1Position.close() + idPotiRef2Position.close() + idDiameter.close() + idInkr.close() + idInkrRb.close() + scan.end() + + ret = 'Calibration done' + success = True + scan.end() + +################ END OF YOUR CODE ################ +###### Final - DO NOT MODIFY THE CODE BELOW ###### + + # just in case the feedback was forgotten + test.sendFeedback(ret, success) + except: + # generic error handler + ret = traceback.format_exc() + success = False + test.sendFeedback(ret, success) + + +# launch the test +startTest(test, device, parameters) diff --git a/script/tests/tests/Collimator Tests pro/Calibrate/Calibrate.xml b/script/tests/tests/Collimator Tests pro/Calibrate/Calibrate.xml new file mode 100644 index 0000000..7e5028f --- /dev/null +++ b/script/tests/tests/Collimator Tests pro/Calibrate/Calibrate.xml @@ -0,0 +1,61 @@ + + + + + + + + + + + 900 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/script/tests/tests/Collimator Tests pro/Drive Out/.config b/script/tests/tests/Collimator Tests pro/Drive Out/.config new file mode 100644 index 0000000..3589d0d --- /dev/null +++ b/script/tests/tests/Collimator Tests pro/Drive Out/.config @@ -0,0 +1,3 @@ +name=Drive Out +description=Drives the Collimator to the Out Position +filename=Drive Out.xml \ No newline at end of file diff --git a/script/tests/tests/Collimator Tests pro/Drive Out/Drive Out - Copy.py b/script/tests/tests/Collimator Tests pro/Drive Out/Drive Out - Copy.py new file mode 100644 index 0000000..704a950 --- /dev/null +++ b/script/tests/tests/Collimator Tests pro/Drive Out/Drive Out - Copy.py @@ -0,0 +1,82 @@ +#Script imported from: Drive Out.xml +import traceback + +#by default, failed +ret = 'Test failed' +success = False + +try: + #Pre-actions: 2 = drive out + caput(DEVICE+':COM:2', 2) + #Creating channels: dimension 1 + #PseudoPositioner id000000 + #ScalarDetector id000001 + id000001 = Channel(DEVICE+':STA:1', type = 'd') + #ScalarDetector id000003 + id000003 = Channel(DEVICE+':IST:2', type = 'd') + #ScalarDetector id000004 + id000004 = Channel(DEVICE+':DIAM:2', type = 'd') + #ScalarDetector id000005 + id000005 = Channel(DEVICE+':IST1:1', type = 'd') + #ScalarDetector id000006 + id000006 = Channel(DEVICE+':IST1:2', type = 'd') + #ScalarDetector id000007 + id000007 = Channel(DEVICE+':IST2:1', type = 'd') + #ScalarDetector id000008 + id000008 = Channel(DEVICE+':IST2:2', type = 'd') + #ScalarDetector id000009 + id000009 = Channel(DEVICE+':IST3:1', type = 'd') + #ScalarDetector id000010 + id000010 = Channel(DEVICE+':IST3:2', type = 'd') +except: + print "Unexpected error:", sys.exc_info()[0] + ret = 'Unable to create channel - ' + traceback.format_exc() + success = False + raise Exception('Unable to create channel - ' + traceback.format_exc()) + sys.exit() + +#TODO: Set the diplay names of positioners and detectors +scan = ManualScan(['id000000'], ['id000001', 'id000003', 'id000004', 'id000005', 'id000006', 'id000007', 'id000008', 'id000009', 'id000010'] , [0.0], [3000.0], [3000]) +scan.start() + +#Dimension 1 +#PseudoPositioner id000000 +for setpoint1 in range(0, 3000): + readback1 = setpoint1 + sleep( 0.1 ) # Settling time + #Detector id000001 + detector1 = id000001.get() + #Detector id000003 + detector2 = id000003.get() + #Detector id000004 + detector3 = id000004.get() + #Detector id000005 + detector4 = id000005.get() + #Detector id000006 + detector5 = id000006.get() + #Detector id000007 + detector6 = id000007.get() + #Detector id000008 + detector7 = id000008.get() + #Detector id000009 + detector8 = id000009.get() + #Detector id000010 + detector9 = id000010.get() + scan.append ([setpoint1], [readback1], [detector1, detector2, detector3, detector4, detector5, detector6, detector7, detector8, detector9]) + +#Closing channels +id000001.close() +id000003.close() +id000004.close() +id000005.close() +id000006.close() +id000007.close() +id000008.close() +id000009.close() +id000010.close() + +scan.end() + +#return ok +ret = 'Slides moved out' +success = True \ No newline at end of file diff --git a/script/tests/tests/Collimator Tests pro/Drive Out/Drive Out.py b/script/tests/tests/Collimator Tests pro/Drive Out/Drive Out.py new file mode 100644 index 0000000..53b0594 --- /dev/null +++ b/script/tests/tests/Collimator Tests pro/Drive Out/Drive Out.py @@ -0,0 +1,144 @@ +# Drive Out + +###### Init - DO NOT MODIFY THE CODE BELOW ###### +global sys, inspect, os, traceback +import sys, inspect, os, traceback + + +def startTest(testName, DEVICE, params): + # by default, assume the test failed + ret = 'Test failed' + success = False + # plot name to be given to the scan. Use: scan.setPlotTitle(plotName) + plotName = DEVICE + ' - ' + testName + # put the whole custom code under try/catch + try: + # get the path of this script + testPath = inspect.getfile(inspect.currentframe()) + # init the testing tool class. It can be sued in the following ways: + test = TestingTool(testName, testPath, DEVICE, params) + samplePeriod = 0.1 + +######### WRITE YOUR CODE HERE BELOW ############# + scan = ManualScan(['time [1/'+ str(1/samplePeriod) + ' s]'], ['Motor Pos (IST3:2)', 'Poti Position (IST2:1)', + 'Motor Status (STA:1)', 'Inkr (INKR:2)', 'InkrRb (INKRRB:2)', + 'Diameter (DIAM:2)', 'Com (COM:2)', 'Logical Position (IST:2)', + 'Motor Pos Raw (IST3:1)','Poti Pos From Beam (IST1:2)', + 'Poti Raw (POSA:1)', 'Poti Ref1 Position (REF1:1)', 'Poti Ref2 Position (REF2:1)']) + scan.setPlotTitle(plotName) + scan.start() + + try: + idMotorStatus = Channel(DEVICE + ':STA:1' , type = 'd') # DSP device_status reg + idLogicalPosition = Channel(DEVICE + ':IST:2' , type = 'd') # Shows current position in logical units as calculated from motor step counter [1..n] + idPotiRaw = Channel(DEVICE + ':POSA:1' , type = 'd') # poti raw data [ADC units] + idMotorPositionRaw = Channel(DEVICE + ':IST3:1' , type = 'd') # shows current position in steps as as obtained from motor step counter [steps] + idInkr = Channel(DEVICE + ':INKR:2' , type = 'd') # move relative distance (positive means towards R2) [mm] + idInkrRb = Channel(DEVICE + ':INKRRB:2' , type = 'd') # readback of move relative distance (positive means towards R2) [mm] + idDiameter = Channel(DEVICE + ':DIAM:2' , type = 'd') # collimator diameter [mm] + idCom = Channel(DEVICE + ':COM:2' , type = 'd') # current position as from motor step counter [mm] + idMotorPosition = Channel(DEVICE + ':IST3:2' , type = 'd') # current position as from motor step counter [mm] + idPotiPosFromBeam = Channel(DEVICE + ':IST1:2' , type = 'd') # current position from beam as from potentiometer [mm] + idPotiPosition = Channel(DEVICE + ':IST2:1' , type = 'd') # current position as from potentiometer [mm] + idPotiRef1Position = Channel(DEVICE + ':REF1:1' , type = 'd') # R1 position as from potentiometer [mm] + idPotiRef2Position = Channel(DEVICE + ':REF2:1' , type = 'd') # R2 position as from potentiometer [mm] + + #Pre-actions: 2 = drive out + caput(DEVICE+':COM:2', 2) + sleep( samplePeriod ) # Settling time + except: + ret = 'Unable to create channel - ' + traceback.format_exc() + success = False + test.sendFeedback( ret, success) + return + + for setpoint1 in range(0, 10000): + sleep( samplePeriod ) # Settling time + + MotorStatus = idMotorStatus.get() + LogicalPosition = idLogicalPosition.get() + PotiRaw = idPotiRaw.get() + MotorPositionRaw = idMotorPositionRaw.get() + Com = idCom.get() + MotorPosition = idMotorPosition.get() + PotiPosFromBeam = idPotiPosFromBeam.get() + PotiPosition = idPotiPosition.get() + PotiRef1Position = idPotiRef1Position.get() + PotiRef2Position = idPotiRef2Position.get() + Diameter = idDiameter.get() + Inkr = idInkr.get() + InkrRb = idInkrRb.get() + + + scan.append([setpoint2], [setpoint2], + [MotorPosition, PotiPosition, MotorStatus, Inkr, InkrRb, Diameter, Com, LogicalPosition, + MotorPositionRaw, PotiPosFromBeam, PotiRaw, PotiRef1Position, PotiRef2Position]) + + if (MotorStatus & int('1',2))==0: #device finished calibration (bit#1) + #give the device some time before stating that it has really finished + countDeviceInModeIdle = countDeviceInModeIdle +1 + if countDeviceInModeIdle == 10: + break + else: + countDeviceInModeIdle = 0 + + #check if any error bit is raised + if bool(int(MotorStatus) & int('10000',2)): #error: abort test + test.sendFeedback('Motor switched off (bit#4)', False) + return + if bool(int(MotorStatus) & int('100000',2)): #error: abort test + test.sendFeedback('No motor link (bit#5)', False) + return + if bool(int(MotorStatus) & int('1000000',2)): #error: abort test + test.sendFeedback('No poti link (bit#6)', False) + return + if bool(int(MotorStatus) & int('10000000',2)): #error: abort test + test.sendFeedback('Calibration error (bit#7)', False) + return + if bool(int(MotorStatus) & int('100000000',2)): #error: abort test + test.sendFeedback('Cannot get to R1 (bit#8)', False) + return + if bool(int(MotorStatus) & int('1000000000',2)): #error: abort test + test.sendFeedback('Cannot get to R2 (bit#9)', False) + return + if bool(int(MotorStatus) & int('10000000000',2)): #error: abort test + test.sendFeedback('Position measurement mismatch (bit#10)', False) + return + if bool(int(MotorStatus) & int('100000000000',2)): #error: abort test + test.sendFeedback('Movement timeout (bit#11)', False) + return + + #Closing channels + idMotorStatus.close() + idLogicalPosition.close() + idPotiRaw.close() + idMotorPositionRaw.close() + idCom.close() + idMotorPosition.close() + idPotiPosFromBeam.close() + idPotiPosition.close() + idPotiRef1Position.close() + idPotiRef2Position.close() + idDiameter.close() + idInkr.close() + idInkrRb.close() + scan.end() + + ret = 'Drive Out done' + success = True + scan.end() + +################ END OF YOUR CODE ################ +###### Final - DO NOT MODIFY THE CODE BELOW ###### + + # just in case the feedback was forgotten + test.sendFeedback(ret, success) + except: + # generic error handler + ret = traceback.format_exc() + success = False + test.sendFeedback(ret, success) + + +# launch the test +startTest(test, device, parameters) diff --git a/script/tests/tests/Collimator Tests pro/Drive Out/Drive Out.xml b/script/tests/tests/Collimator Tests pro/Drive Out/Drive Out.xml new file mode 100644 index 0000000..5a1c925 --- /dev/null +++ b/script/tests/tests/Collimator Tests pro/Drive Out/Drive Out.xml @@ -0,0 +1,61 @@ + + + + + + + + + + + 3000 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/script/tests/tests/Collimator Tests pro/Monitor Movement/.config b/script/tests/tests/Collimator Tests pro/Monitor Movement/.config new file mode 100644 index 0000000..916f437 --- /dev/null +++ b/script/tests/tests/Collimator Tests pro/Monitor Movement/.config @@ -0,0 +1,4 @@ +#Fri Jun 09 14&14&06 CEST 2017 +name=Monitor Movement +description=Monitor the movements during the specified time interval. No commands are sent. +parameters=monitorTime&20&How long the monitoring is performed [s];samplingDelay&0.1&Delay between each sample is taken [s]; diff --git a/script/tests/tests/Collimator Tests pro/Monitor Movement/Monitor Movement.py b/script/tests/tests/Collimator Tests pro/Monitor Movement/Monitor Movement.py new file mode 100644 index 0000000..5a4b63f --- /dev/null +++ b/script/tests/tests/Collimator Tests pro/Monitor Movement/Monitor Movement.py @@ -0,0 +1,98 @@ + +###### Init - DO NOT MODIFY THE CODE BELOW ###### +global sys, inspect, os, traceback +import sys, inspect, os, traceback + +def startTest(testName, DEVICE, params): + #by default, assume the test failed + ret = 'Test failed' + success = False + #plot name to be given to the scan. Use: scan.setPlotTitle(plotName) + plotName = DEVICE + ' - ' + testName + #put the whole custom code under try/catch + try: + #get the path of this script + testPath = inspect.getfile(inspect.currentframe()) + #init the testing tool class. It can be sued in the following ways: + test = TestingTool(testName, testPath, DEVICE, params) + +######### WRITE YOUR CODE HERE BELOW ############# + #get parameters from the calling interface + try: + #test.log( "with the following parameters:\n" + str(params)) + #test.log( 'testpath: ' + testPath ) + #test.log( 'parameters:' + str( params) ) + #test.log( 'device: ' + DEVICE ) + monitorTime = float(test.getParam("monitorTime")) + samplePeriod = 0.05 #seconds + except: + ret = 'Could not retrieve testing parameters - ' + traceback.format_exc() + success = False + test.sendFeedback( ret, success) + return + + #get parameters from the calling interface + scan = ManualScan(['time [s]'], + ['Motor Pos (IST3:2)', 'Poti Position (IST2:1)', 'Motor Pos - Poti Pos'] ) + scan.setPlotTitle(plotName) + scan.start() + + #Creating channels: dimension 1 + try: + idCom = Channel(DEVICE+':COM:2' , type = 'd') #current position as from motor step counter [mm] + idMotorPosition = Channel(DEVICE+':IST3:2', type = 'd') #current position as from motor step counter [mm] + #idPotiPosFromBeam = Channel(DEVICE+':IST1:2', type = 'd') #current position from beam as from potentiometer [mm] + idPotiPosition = Channel(DEVICE+':IST2:1', type = 'd') #current position as from potentiometer [mm] + #idPotiRef1Position = Channel(DEVICE+':REF1:1', type = 'd') #R1 position as from potentiometer [mm] + #idPotiRef2Position = Channel(DEVICE+':REF2:1', type = 'd') #R2 position as from potentiometer [mm] + + except: + test.sendFeedback( 'Unable to create channel - ' + traceback.format_exc(), False) + return + + r1 = tscan((idMotorPosition, idPotiPosition), int(monitorTime/0.02), 0.02) + + + test.log( 'Monitoring movement for ' + str(monitorTime) + 's') + #scan quickly the output during some seconds + timeElapsed=0 + startTime=float(java.lang.System.currentTimeMillis()) + currentTime = float(java.lang.System.currentTimeMillis()) + timeElapsed=currentTime-startTime + while timeElapsed<(monitorTime*1000): + #Detector time + currentTime = float(java.lang.System.currentTimeMillis()) + timeElapsed=currentTime-startTime + motorPosition = idMotorPosition.get() + #potiPosFromBeam = idPotiPosFromBeam.get() + potiPosition = idPotiPosition.get() + #potiRef1Position = idPotiRef1Position.get() + #potiRef2Position = idPotiRef2Position.get() + diff1 = motorPosition-potiPosition + scan.append ([timeElapsed/1000], [timeElapsed/1000], [motorPosition, potiPosition, diff1]) + sleep( samplePeriod ) # Settling time + #timeElapsed=timeElapsed+1 + + #Closing channels + idCom.close() + idMotorPosition.close() + #idPotiPosFromBeam.close() + idPotiPosition.close() + #idPotiRef1Position.close() + #idPotiRef2Position.close() + ret = 'End of Monitoring' + success = True + +################ END OF YOUR CODE ################ +###### Final - DO NOT MODIFY THE CODE BELOW ###### + + #just in case the feedback was forgotten + test.sendFeedback(ret, success) + except: + #generic error handler + ret = traceback.format_exc() + success = False + test.sendFeedback(ret, success) + +#launch the test +startTest(test, device, parameters) \ No newline at end of file diff --git a/script/tests/tests/Collimator Tests pro/Monitor Movement/help.html b/script/tests/tests/Collimator Tests pro/Monitor Movement/help.html new file mode 100644 index 0000000..7d4e3ca --- /dev/null +++ b/script/tests/tests/Collimator Tests pro/Monitor Movement/help.html @@ -0,0 +1,12 @@ + + +

Description

+Monitor the movements during the specified time interval. No commands are sent. +

Parameters

+monitorTime Monitoring time interval [s]
+samplingDelay Delay between each sample is taken [s] +

Contact

+Marco Boccioli + + + diff --git a/script/tests/tests/Collimator Tests pro/Motor Test 1/.config b/script/tests/tests/Collimator Tests pro/Motor Test 1/.config new file mode 100644 index 0000000..82f7ba0 --- /dev/null +++ b/script/tests/tests/Collimator Tests pro/Motor Test 1/.config @@ -0,0 +1,7 @@ +name=Motor Test 1 +description=Moves to CW switch then CCW switch N times. + + +#optional parameters. Description is compulsory. Syntax& +#parameters=&&[;&&] +parameters=repeatTimes&1&Repeat N times;delayS&5&Pause delay [s] diff --git a/script/tests/tests/Collimator Tests pro/Motor Test 1/Motor Test 1 - Copy.py b/script/tests/tests/Collimator Tests pro/Motor Test 1/Motor Test 1 - Copy.py new file mode 100644 index 0000000..f14d7ef --- /dev/null +++ b/script/tests/tests/Collimator Tests pro/Motor Test 1/Motor Test 1 - Copy.py @@ -0,0 +1,154 @@ +#Script Motor Test 1 +#Moves to CCW switch; then for M times moves N times to CW switch then CCW switch; between each M pauses for delay; log at CCW and CW + +import traceback + +#by default, failed +ret = 'Test failed' +status = False +DEVICE = device +params = parameters +#DEVICE = 'PO2DV-NCS-LS' +#get parameters from the calling interface +try: + print "Running test Motor Test 1 with the following parameters:" + print params + loopTimes = int(params["repeatTimes"]["value"]) + delaySeconds = int(params["delayS"]["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]) +scan.start() +#Creating channels: dimension 1 +try: + #RegionPositioner idInkr + #idInkr = Channel(DEVICE+':INKR:2', type = 'd') + idInkr = Channel(DEVICE+':MOTOR.VAL', type = 'd') + #ScalarDetector idMotorStatus + #idMotorStatus = Channel(DEVICE+':STA:1', type = 'd') + idMotorStatus = Channel(DEVICE+':MOTOR.MSTA', type = 'd') + #ScalarDetector idLogicalPosition + #idLogicalPosition = Channel(DEVICE+':IST:2', 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.RBV', type = 'd') + #ScalarDetector idPotiRaw + #idPotiRaw = Channel(DEVICE+':POSA:1', type = 'd') + idPotiRaw = Channel(DEVICE+':ENCODERraw', type = 'd') + #ScalarDetector idPotiProc + #idPotiProc = Channel(DEVICE+':POSA:2', type = 'd') + idPotiProc = Channel(DEVICE+':ENCODER', type = 'd') + #ScalarDetector idBtvsRaw + #idBtvsRaw = Channel(DEVICE+':IST3:1', type = 'd') + idBtvsRaw = Channel(DEVICE+':MOTOR.LLS', type = 'd') + #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 Exception('Unable to create channel - ' + traceback.format_exc()) + sys.exit() + +#remove limits +idLimitH.put(999999.9, timeout=None) +idLimitL.put(-999999.9, timeout=None) +#Dimension 1 +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 +print 'Homing' +idInkr.put(-100.0, timeout=None) # TODO: Set appropriate timeout +start = startDefault #idInkr.get()+direction +setpoint2 = end +count = 0 +print 'Starting test sequence' +for setpoint1 in range(0, loopTimes*2): + sleep( delaySeconds ) # Settling time + #RegionPositioner idInkr + 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 + idDiff02 = a-b + #Manipulation idDiff01 + #Variable Mappings + a = detector4 + b = detector6 + count = count + 1 + idDiff01 = a-b + if endH>0.0 : + #invert direction and swap start with end of translation + setpoint2 = start + print 'End H switch, changing target to ' + str(setpoint2) + scan.append ([setpoint2], [readback2], [detector1, detector2, detector3, detector4, detector5, detector6, detector7, detector8, idDiff02, idDiff01]) + if endL>0.0 : + #invert direction and swap start with end of translation + setpoint2 = end + print 'End L switch, changing target to ' + str(setpoint2) + scan.append ([setpoint2], [readback2], [detector1, detector2, detector3, detector4, detector5, detector6, detector7, detector8, idDiff02, idDiff01]) + +#set limits back +idLimitH.put(145.0, timeout=None) +idLimitL.put(0.0, timeout=None) +#Closing channels +idInkr.close() +idMotorStatus.close() +idLogicalPosition.close() +idDiameter.close() +idMotorPosition.close() +idPotiRaw.close() +idPotiProc.close() +idBtvsRaw.close() +idBtvsProc.close() +scan.end() +ret = 'Slide moved back and forth (' + str(count) + ' runs)' +status = True diff --git a/script/tests/tests/Collimator Tests pro/Motor Test 1/Motor Test 1.py b/script/tests/tests/Collimator Tests pro/Motor Test 1/Motor Test 1.py new file mode 100644 index 0000000..e449c36 --- /dev/null +++ b/script/tests/tests/Collimator Tests pro/Motor Test 1/Motor Test 1.py @@ -0,0 +1,187 @@ +# Script Motor Test 1 +# Moves to CCW switch; then for M times moves N times to CW switch then CCW switch; between each M pauses for delay; log at CCW and CW + + +###### Init - DO NOT MODIFY THE CODE BELOW ###### +global sys, inspect, os, traceback +import sys, inspect, os, traceback + + +def startTest(testName, DEVICE, params): + # by default, assume the test failed + ret = 'Test failed' + success = False + # plot name to be given to the scan. Use: scan.setPlotTitle(plotName) + plotName = DEVICE + ' - ' + testName + # put the whole custom code under try/catch + try: + # get the path of this script + testPath = inspect.getfile(inspect.currentframe()) + # init the testing tool class. It can be sued in the following ways: + test = TestingTool(testName, testPath, DEVICE, params) + +######### WRITE YOUR CODE HERE BELOW ############# + + # DEVICE = 'PO2DV-NCS-LS' + # get parameters from the calling interface + try: + test.log("Running test with the following parameters:") + test.log(params) + loopTimes = int(test.getParam("repeatTimes")) + delaySeconds = int(test.getParam("delayS")) + samplePeriod = 0.05 #seconds + except: + ret = 'Could not retrieve testing parameters - ' + traceback.format_exc() + success = False + test.sendFeedback(ret, success) + return + + scan = ManualScan(['time [1/'+ str(1/samplePeriod) + ' s]'], [ + 'Btvs Poti Position (IST3:2)', + 'Mcs Poti Position (IST2:1)', + 'Motor Status (STA:1)', + 'Inkr (INKR:2)', + 'InkrRb (INKRRB:2)', + 'Diameter (DIAM:2)', + 'Logical Position (IST:2)', + 'Btvs Raw (IST3:1)', + 'Motor Position (IST1:2)', + 'Poti Raw (POSA:1)', + 'Poti Ref1 Position (REF1:1)', + 'Poti Ref2 Position (REF2:1)']) + + p1 = plot(None, name = "Motor Position - Btvs Poti Position", context = plotName + " pos difference")[0] + scan.setPlotTitle(plotName) + scan.start() + # Creating channels: dimension 1 + try: + idMotorStatus = Channel(DEVICE + ':STA:1' , type = 'd') # DSP device_status reg + idLogicalPosition = Channel(DEVICE + ':IST:2' , type = 'd') # Shows current position in logical units as calculated from motor step counter [1..n] + idPotiRaw = Channel(DEVICE + ':POSA:1' , type = 'd') # poti raw data [ADC units] + idBtvsRaw = Channel(DEVICE + ':IST3:1' , type = 'd') # shows current position in steps as as obtained from motor step counter [steps] + idInkr = Channel(DEVICE + ':INKR:2' , type = 'd') # move relative distance (positive means towards R2) [mm] + idInkrRb = Channel(DEVICE + ':INKRRB:2' , type = 'd') # readback of move relative distance (positive means towards R2) [mm] + idDiameter = Channel(DEVICE + ':DIAM:2' , type = 'd') # collimator diameter [mm] + idCom = Channel(DEVICE + ':COM:2' , type = 'd') # motor commands [0=Stop; 1=Calibrate; 2=gotoR1; 3=gotoR2] + idBtvs = Channel(DEVICE + ':IST3:2' , type = 'd') # current position as from motor step counter [mm] + idMotorPosition = Channel(DEVICE + ':IST1:2' , type = 'd') # current position from beam as from potentiometer [mm] + idPotiPosition = Channel(DEVICE + ':IST2:1' , type = 'd') # current position as from potentiometer [mm] + idPotiRef1Position = Channel(DEVICE + ':REF1:1' , type = 'd') # R1 position as from potentiometer [mm] + idPotiRef2Position = Channel(DEVICE + ':REF2:1' , type = 'd') # R2 position as from potentiometer [mm] + except: + ret = 'Unable to create channel - ' + traceback.format_exc() + success = False + test.sendFeedback(ret, success) + return + + end = 4.0 #go to R2 + start = 3.0 #go to R1 + setpoint2 = end + count = 0 + test.log('Starting test sequence') + for setpoint1 in range(0, (loopTimes * 2)): + p1.addSeries(LinePlotSeries("Run"+str(count))) + sleep(delaySeconds) # Settling time between runs + # RegionPositioner idInkr + idCom.put(setpoint2, timeout=None) # TODO: Set appropriate timeout + count = count + 1 + # scan for changes + for scanTimes in range(0, 100000): + sleep(samplePeriod) + currentTime = float(java.lang.System.currentTimeMillis()) + + MotorStatus = idMotorStatus.get() + LogicalPosition = idLogicalPosition.get() + PotiRaw = idPotiRaw.get() + BtvsRaw = idBtvsRaw.get() + Btvs = idBtvs.get() + MotorPosition = idMotorPosition.get() + PotiPosition = idPotiPosition.get() + PotiRef1Position = idPotiRef1Position.get() + PotiRef2Position = idPotiRef2Position.get() + Diameter = idDiameter.get() + Inkr = idInkr.get() + InkrRb = idInkrRb.get() + + idDiff01 = MotorPosition - Btvs + + scan.append([currentTime], [currentTime], + [Btvs, PotiPosition, MotorStatus, Inkr, InkrRb, Diameter, LogicalPosition, + BtvsRaw, MotorPosition, PotiRaw, PotiRef1Position, PotiRef2Position]) + + p1.getSeries(count).appendData(currentTime, idDiff01) + + #extract Status bits + endH = bool(int(MotorStatus) & 8) #Ref2 (high limit) + endL = bool(int(MotorStatus) & 4) #Ref1 (low limit) + + #check if arrived to R1 or R2 + if endH: + # invert direction and swap start with end of translation + setpoint2 = start + test.log('Reached R2 switch, changing target to R1') + break + elif endL: + # invert direction and swap start with end of translation + setpoint2 = end + test.log('Reached R1 switch, changing target to R2') + break + #check if any error bit is raised + if bool(int(MotorStatus) & int('10000',2)): #error: abort test + test.sendFeedback('Motor switched off (bit#4)', False) + return + if bool(int(MotorStatus) & int('100000',2)): #error: abort test + test.sendFeedback('No motor link (bit#5)', False) + return + if bool(int(MotorStatus) & int('1000000',2)): #error: abort test + test.sendFeedback('No poti link (bit#6)', False) + return + if bool(int(MotorStatus) & int('10000000',2)): #error: abort test + test.sendFeedback('Calibration error (bit#7)', False) + return + if bool(int(MotorStatus) & int('100000000',2)): #error: abort test + test.sendFeedback('Cannot get to R1 (bit#8)', False) + return + if bool(int(MotorStatus) & int('1000000000',2)): #error: abort test + test.sendFeedback('Cannot get to R2 (bit#9)', False) + return + if bool(int(MotorStatus) & int('10000000000',2)): #error: abort test + test.sendFeedback('Position measurement mismatch (bit#10)', False) + return + if bool(int(MotorStatus) & int('100000000000',2)): #error: abort test + test.sendFeedback('Movement timeout (bit#11)', False) + return + + # Closing channels + idMotorStatus.close() + idLogicalPosition.close() + idPotiRaw.close() + idBtvsRaw.close() + idBtvs.close() + idMotorPosition.close() + idPotiPosition.close() + idPotiRef1Position.close() + idPotiRef2Position.close() + idDiameter.close() + idCom.close() + idInkr.close() + idInkrRb.close() + + scan.end() + ret = 'Slide moved back and forth (' + str(count) + ' runs)' + success = True + +################ END OF YOUR CODE ################ +###### Final - DO NOT MODIFY THE CODE BELOW ###### + + # just in case the feedback was forgotten + test.sendFeedback(ret, success) + except: + # generic error handler + ret = traceback.format_exc() + success = False + test.sendFeedback(ret, success) + + +# launch the test +startTest(test, device, parameters) diff --git a/script/tests/tests/Collimator Tests pro/Motor Test 1/Motor Test 1.py.bak b/script/tests/tests/Collimator Tests pro/Motor Test 1/Motor Test 1.py.bak new file mode 100644 index 0000000..0d66c9a --- /dev/null +++ b/script/tests/tests/Collimator Tests pro/Motor Test 1/Motor Test 1.py.bak @@ -0,0 +1,178 @@ +# Script Motor Test 1 +# Moves to CCW switch; then for M times moves N times to CW switch then CCW switch; between each M pauses for delay; log at CCW and CW + + +###### Init - DO NOT MODIFY THE CODE BELOW ###### +global sys, inspect, os, traceback +import sys, inspect, os, traceback + + +def startTest(testName, DEVICE, params): + # by default, assume the test failed + ret = 'Test failed' + success = False + # plot name to be given to the scan. Use: scan.setPlotTitle(plotName) + plotName = DEVICE + ' - ' + testName + # put the whole custom code under try/catch + try: + # get the path of this script + testPath = inspect.getfile(inspect.currentframe()) + # init the testing tool class. It can be sued in the following ways: + test = TestingTool(testName, testPath, DEVICE, params) + +######### WRITE YOUR CODE HERE BELOW ############# + + # DEVICE = 'PO2DV-NCS-LS' + # get parameters from the calling interface + try: + test.log("Running test with the following parameters:") + test.log(params) + loopTimes = int(test.getParam("repeatTimes")) + delaySeconds = int(test.getParam("delayS")) + samplePeriod = 0.05 #seconds + except: + ret = 'Could not retrieve testing parameters - ' + traceback.format_exc() + success = False + test.sendFeedback(ret, success) + return + + scan = ManualScan(['time [1/'+ str(1/samplePeriod) + ' s]'], ['Btvs (IST3:2)', 'Poti Position (IST2:1)', + 'Motor Status (STA:1)', 'Inkr (INKR:2)', 'InkrRb (INKRRB:2)', + 'Diameter (DIAM:2)', 'Logical Position (IST:2)', + 'Btvs Raw (IST3:1)','Motor Position (IST1:2)', + 'Poti Raw (POSA:1)', 'Poti Ref1 Position (REF1:1)', 'Poti Ref2 Position (REF2:1)']) + p1 = plot(None, name = "Poti Pos From Beam - Motor Position", context = plotName + " pos difference")[0] + scan.setPlotTitle(plotName) + scan.start() + # Creating channels: dimension 1 + try: + idMotorStatus = Channel(DEVICE + ':STA:1' , type = 'd') # DSP device_status reg + idLogicalPosition = Channel(DEVICE + ':IST:2' , type = 'd') # Shows current position in logical units as calculated from motor step counter [1..n] + idPotiRaw = Channel(DEVICE + ':POSA:1' , type = 'd') # poti raw data [ADC units] + idBtvsRaw = Channel(DEVICE + ':IST3:1' , type = 'd') # shows current position in steps as as obtained from motor step counter [steps] + idInkr = Channel(DEVICE + ':INKR:2' , type = 'd') # move relative distance (positive means towards R2) [mm] + idInkrRb = Channel(DEVICE + ':INKRRB:2' , type = 'd') # readback of move relative distance (positive means towards R2) [mm] + idDiameter = Channel(DEVICE + ':DIAM:2' , type = 'd') # collimator diameter [mm] + idCom = Channel(DEVICE + ':COM:2' , type = 'd') # current position as from motor step counter [mm] + idBtvs = Channel(DEVICE + ':IST3:2' , type = 'd') # current position as from motor step counter [mm] + idMotorPosition = Channel(DEVICE + ':IST1:2' , type = 'd') # current position from beam as from potentiometer [mm] + idPotiPosition = Channel(DEVICE + ':IST2:1' , type = 'd') # current position as from potentiometer [mm] + idPotiRef1Position = Channel(DEVICE + ':REF1:1' , type = 'd') # R1 position as from potentiometer [mm] + idPotiRef2Position = Channel(DEVICE + ':REF2:1' , type = 'd') # R2 position as from potentiometer [mm] + except: + ret = 'Unable to create channel - ' + traceback.format_exc() + success = False + test.sendFeedback(ret, success) + return + + end = 4.0 #go to R2 + start = 3.0 #go to R1 + setpoint2 = end + count = 0 + test.log('Starting test sequence') + for setpoint1 in range(0, (loopTimes * 2)): + p1.addSeries(LinePlotSeries("Run"+str(count))) + sleep(delaySeconds) # Settling time between runs + # RegionPositioner idInkr + idCom.put(setpoint2, timeout=None) # TODO: Set appropriate timeout + count = count + 1 + # scan for changes + for scanTimes in range(0, 100000): + sleep(samplePeriod) + currentTime = float(java.lang.System.currentTimeMillis()) + + MotorStatus = idMotorStatus.get() + LogicalPosition = idLogicalPosition.get() + PotiRaw = idPotiRaw.get() + BtvsRaw = idBtvsRaw.get() + Btvs = idBtvs.get() + MotorPosition = idMotorPosition.get() + PotiPosition = idPotiPosition.get() + PotiRef1Position = idPotiRef1Position.get() + PotiRef2Position = idPotiRef2Position.get() + Diameter = idDiameter.get() + Inkr = idInkr.get() + InkrRb = idInkrRb.get() + + idDiff01 = PotiPosition - Btvs + + scan.append([currentTime], [currentTime], + [Btvs , PotiPosition, MotorStatus, Inkr, InkrRb, Diameter, LogicalPosition, + BtvsRaw , MotorPosition, PotiRaw, PotiRef1Position, PotiRef2Position]) + + p1.getSeries(count).appendData(currentTime, idDiff01) + + #extract Status bits + endH = bool(int(MotorStatus) & 8) #Ref2 (high limit) + endL = bool(int(MotorStatus) & 4) #Ref1 (low limit) + + #check if arrived to R1 or R2 + if endH: + # invert direction and swap start with end of translation + setpoint2 = start + test.log('Reached R2 switch, changing target to R1') + break + elif endL: + # invert direction and swap start with end of translation + setpoint2 = end + test.log('Reached R1 switch, changing target to R2') + break + #check if any error bit is raised + if bool(int(MotorStatus) & int('10000',2)): #error: abort test + test.sendFeedback('Motor switched off (bit#4)', False) + return + if bool(int(MotorStatus) & int('100000',2)): #error: abort test + test.sendFeedback('No motor link (bit#5)', False) + return + if bool(int(MotorStatus) & int('1000000',2)): #error: abort test + test.sendFeedback('No poti link (bit#6)', False) + return + if bool(int(MotorStatus) & int('10000000',2)): #error: abort test + test.sendFeedback('Calibration error (bit#7)', False) + return + if bool(int(MotorStatus) & int('100000000',2)): #error: abort test + test.sendFeedback('Cannot get to R1 (bit#8)', False) + return + if bool(int(MotorStatus) & int('1000000000',2)): #error: abort test + test.sendFeedback('Cannot get to R2 (bit#9)', False) + return + if bool(int(MotorStatus) & int('10000000000',2)): #error: abort test + test.sendFeedback('Position measurement mismatch (bit#10)', False) + return + if bool(int(MotorStatus) & int('100000000000',2)): #error: abort test + test.sendFeedback('Movement timeout (bit#11)', False) + return + + # Closing channels + idMotorStatus.close() + idLogicalPosition.close() + idPotiRaw.close() + idBtvsRaw .close() + idBtvs.close() + idMotorPosition.close() + idPotiPosition.close() + idPotiRef1Position.close() + idPotiRef2Position.close() + idDiameter.close() + idCom.close() + idInkr.close() + idInkrRb.close() + + scan.end() + ret = 'Slide moved back and forth (' + str(count) + ' runs)' + success = True + +################ END OF YOUR CODE ################ +###### Final - DO NOT MODIFY THE CODE BELOW ###### + + # just in case the feedback was forgotten + test.sendFeedback(ret, success) + except: + # generic error handler + ret = traceback.format_exc() + success = False + test.sendFeedback(ret, success) + + +# launch the test +startTest(test, device, parameters) diff --git a/script/tests/tests/Collimator Tests pro/Motor Test 1/help.html b/script/tests/tests/Collimator Tests pro/Motor Test 1/help.html new file mode 100644 index 0000000..87b5e83 --- /dev/null +++ b/script/tests/tests/Collimator Tests pro/Motor Test 1/help.html @@ -0,0 +1,14 @@ + + +

Short Description

+Moves to CW switch then CCW switch N times. +

Details

+Moves to CW switch then CCW switch N times. +

Parameters

+repeatTimes Repeat the moving N times
+delayS Pause delay between each repetition [s] +

Contact

+Marco Boccioli + + + diff --git a/script/tests/tests/Collimator Tests pro/Motor Test 2/.config b/script/tests/tests/Collimator Tests pro/Motor Test 2/.config new file mode 100644 index 0000000..01f6773 --- /dev/null +++ b/script/tests/tests/Collimator Tests pro/Motor Test 2/.config @@ -0,0 +1,7 @@ +name=Motor Test 2 +description=Go to absolute position A, then move +B steps, then -2B steps, then +2Bsteps (ie oscillate round centre position, logging after each movement); repeat N times + + +#optional parameters. Description is compulsory. Syntax& +#parameters=&&[;&&] +parameters=repeatTimes&1&Repeat N times;midPoint&41.0&Middle point A [mm];spanFromMidPoint&2.0&B steps around middle point A [integer];translationStep&5.0&Step lenght [mm] diff --git a/script/tests/tests/Collimator Tests pro/Motor Test 2/Motor Test 2.py b/script/tests/tests/Collimator Tests pro/Motor Test 2/Motor Test 2.py new file mode 100644 index 0000000..5cb7aa4 --- /dev/null +++ b/script/tests/tests/Collimator Tests pro/Motor Test 2/Motor Test 2.py @@ -0,0 +1,206 @@ +# Script Motor Test 2 for production system +# Go to absolute position A, then move +B steps, then -2B steps, then +2Bsteps (ie oscillate round centre position, logging after each movement); repeat N times + +###### Init - DO NOT MODIFY THE CODE BELOW ###### +global sys, inspect, os, traceback +import sys, inspect, os, traceback + + +def startTest(testName, DEVICE, params): + # by default, assume the test failed + ret = 'Test failed' + success = False + # plot name to be given to the scan. Use: scan.setPlotTitle(plotName) + plotName = DEVICE + ' - ' + testName + # put the whole custom code under try/catch + try: + # get the path of this script + testPath = inspect.getfile(inspect.currentframe()) + # init the testing tool class. It can be sued in the following ways: + test = TestingTool(testName, testPath, DEVICE, params) + +######### WRITE YOUR CODE HERE BELOW ############# + + # get parameters from the calling interface + try: + test.log("Running test with the following parameters:") + test.log(params) + middle = float(test.getParam("midPoint")) + loopTimes = int(test.getParam("repeatTimes")) + span = float(test.getParam("spanFromMidPoint")) + translationStep = float(test.getParam("translationStep")) # each translation will be this amount of mm + settlingTime = 0.2 # seconds + except: + ret = 'Could not retrieve testing parameters - ' + traceback.format_exc() + success = False + test.sendFeedback(ret, success) + return + + scan = ManualScan(['time [1/'+ str(1/settlingTime) + ' s]'], ['Btvs Poti Position (IST3:2)', 'Mcs Poti Position (IST2:1)', + 'Motor Status (STA:1)', 'Inkr (INKR:2)', 'InkrRb (INKRRB:2)', + 'Diameter (DIAM:2)', 'Logical Position (IST:2)', + 'Btvs Raw (IST3:1)','Motor Position (IST1:2)', + 'Poti Raw (POSA:1)', 'Poti Ref1 Position (REF1:1)', 'Poti Ref2 Position (REF2:1)']) + scan.setPlotTitle(plotName) + scan.start() + # coloured plot (one colour per scan) + p1 = plot(None, name="Motor Position - Btvs Poti Position", context=plotName + " difference")[0] + + # Creating channels: dimension 1 + try: + idMotorStatus = Channel(DEVICE + ':STA:1' , type = 'd') # DSP device_status reg + idLogicalPosition = Channel(DEVICE + ':IST:2' , type = 'd') # Shows current position in logical units as calculated from motor step counter [1..n] + idPotiRaw = Channel(DEVICE + ':POSA:1' , type = 'd') # poti raw data [ADC units] + idBtvsRaw = Channel(DEVICE + ':IST3:1' , type = 'd') # shows current position in steps as as obtained from motor step counter [steps] + idInkr = Channel(DEVICE + ':INKR:2' , type = 'd') # move relative distance (positive means towards R2) [mm] + idInkrRb = Channel(DEVICE + ':INKRRB:2' , type = 'd') # readback of move relative distance (positive means towards R2) [mm] + idDiameter = Channel(DEVICE + ':DIAM:2' , type = 'd') # collimator diameter [mm] + idBtvs = Channel(DEVICE + ':IST3:2' , type = 'd') # current position as from motor step counter [mm] + idMotorPosition = Channel(DEVICE + ':IST1:2' , type = 'd') # current position from beam as from potentiometer [mm] + idPotiPosition = Channel(DEVICE + ':IST2:1' , type = 'd') # current position as from potentiometer [mm] + idPotiRef1Position = Channel(DEVICE + ':REF1:1' , type = 'd') # R1 position as from potentiometer [mm] + idPotiRef2Position = Channel(DEVICE + ':REF2:1' , type = 'd') # R2 position as from potentiometer [mm] + idCom = Channel(DEVICE + ':COM:2' , type = 'd') # motor commands [0=Stop; 1=Calibrate; 2=gotoR1; 3=gotoR2] + except: + ret = 'Unable to create channel - ' + traceback.format_exc() + success = False + test.sendFeedback(ret, success) + return + + + # find position: it will be the middle point of the test + test.log('Moving to initial position R1') + idCom.put(2, timeout=None) # go to R1 start limit + test.log('Moving to middle point ' + str(middle)) + idInkr.put(middle, timeout=None) # TODO: Set appropriate timeout + if abs(readback2 - middle) > 5: # TODO: Check accuracy + ret = 'Actor idInkr could not be set to the value ' + str(middle) + ' (current value: ' + str(readback2) + ')' + success = False + test.sendFeedback(ret, success) + return + direction = 1.0 + count = 0 + test.log('Moving around middle point (+-' + str(span) + ')') + for setpoint1 in range(0, (loopTimes * 2)): + count = count + 1 + sleep(5) # Settling time + p1.addSeries(LinePlotSeries("Run" + str(count))) + # RegionPositioner idInkr + for setpoint2 in range(0, span+1): + idInkr.put(translationStep*direction, timeout=None) + sleep(settlingTime) # Settling time + currentTime = float(java.lang.System.currentTimeMillis()) + + MotorStatus = idMotorStatus.get() + LogicalPosition = idLogicalPosition.get() + PotiRaw = idPotiRaw.get() + BtvsRaw = idBtvsRaw.get() + Btvs = idBtvs.get() + MotorPosition = idMotorPosition.get() + PotiPosition = idPotiPosition.get() + PotiRef1Position = idPotiRef1Position.get() + PotiRef2Position = idPotiRef2Position.get() + Diameter = idDiameter.get() + Inkr = idInkr.get() + InkrRb = idInkrRb.get() + + idDiff01 = MotorPosition - Btvs + + # plots + scan.append([currentTime], [currentTime], + [Btvs, PotiPosition, MotorStatus, Inkr, InkrRb, Diameter, LogicalPosition, + BtvsRaw, MotorPosition, PotiRaw, PotiRef1Position, PotiRef2Position]) + # plot error against position + p1.getSeries(count).appendData(MotorPosition, idDiff01) + + # end of loop: invert direction + if setpoint2 == span: + direction = direction*(-1.0) + break + + # check if reached end of span before the end of loop; if so, invert direction + if (direction > 0.0 and MotorPosition >= middle+span): + # invert direction and swap start with end of translation + direction = -1.0 + test.log('End of span (' + str(MotorPosition) + '), changing direction to towards R1') + break + if (direction < 0.0 and MotorPosition <= middle-span): + # invert direction and swap start with end of translation + direction = 1.0 + test.log('End of span (' + str(MotorPosition) + '), changing direction to towards R2') + break + + # extract Status bits + endH = bool(int(MotorStatus) & 8) # Ref2 (high limit) + endL = bool(int(MotorStatus) & 4) # Ref1 (low limit) + # check if arrived to R1 or R2; if so, invert direction + if endH: + # invert direction and swap start with end of translation + direction = -1.0 + test.log('Reached R2, changing direction to ' + str(direction)) + break + elif endL: + # invert direction and swap start with end of translation + direction = 1.0 + test.log('Reached R1, changing direction to ' + str(direction)) + break + + # check if any error bit is raised + if bool(int(MotorStatus) & int('10000',2)): # error: abort test + test.sendFeedback('Motor switched off (bit# 4)', False) + return + if bool(int(MotorStatus) & int('100000',2)): # error: abort test + test.sendFeedback('No motor link (bit# 5)', False) + return + if bool(int(MotorStatus) & int('1000000',2)): # error: abort test + test.sendFeedback('No poti link (bit# 6)', False) + return + if bool(int(MotorStatus) & int('10000000',2)): # error: abort test + test.sendFeedback('Calibration error (bit# 7)', False) + return + if bool(int(MotorStatus) & int('100000000',2)): # error: abort test + test.sendFeedback('Cannot get to R1 (bit# 8)', False) + return + if bool(int(MotorStatus) & int('1000000000',2)): # error: abort test + test.sendFeedback('Cannot get to R2 (bit# 9)', False) + return + if bool(int(MotorStatus) & int('10000000000',2)): # error: abort test + test.sendFeedback('Position measurement mismatch (bit# 10)', False) + return + if bool(int(MotorStatus) & int('100000000000',2)): # error: abort test + test.sendFeedback('Movement timeout (bit# 11)', False) + return + + # Closing channels + idMotorStatus.close() + idLogicalPosition.close() + idPotiRaw.close() + idBtvsRaw.close() + idBtvs.close() + idMotorPosition.close() + idPotiPosition.close() + idPotiRef1Position.close() + idPotiRef2Position.close() + idDiameter.close() + idInkr.close() + idInkrRb.close() + idCom.close() + + scan.end() + ret = 'Slide moved back and forth (' + str(count) + ' runs)' + success = True + +################ END OF YOUR CODE ################ +###### Final - DO NOT MODIFY THE CODE BELOW ###### + + # just in case the feedback was forgotten + test.sendFeedback(ret, success) + except: + # generic error handler + ret = traceback.format_exc() + success = False + test.sendFeedback(ret, success) + + +# launch the test +startTest(test, device, parameters) diff --git a/script/tests/tests/Collimator Tests pro/Motor Test 2/Motor Test 2.py.bak b/script/tests/tests/Collimator Tests pro/Motor Test 2/Motor Test 2.py.bak new file mode 100644 index 0000000..0ef89b0 --- /dev/null +++ b/script/tests/tests/Collimator Tests pro/Motor Test 2/Motor Test 2.py.bak @@ -0,0 +1,209 @@ +# Script Motor Test 2 for production system +# Go to absolute position A, then move +B steps, then -2B steps, then +2Bsteps (ie oscillate round centre position, logging after each movement); repeat N times + +###### Init - DO NOT MODIFY THE CODE BELOW ###### +global sys, inspect, os, traceback +import sys, inspect, os, traceback + + +def startTest(testName, DEVICE, params): + # by default, assume the test failed + ret = 'Test failed' + success = False + # plot name to be given to the scan. Use: scan.setPlotTitle(plotName) + plotName = DEVICE + ' - ' + testName + # put the whole custom code under try/catch + try: + # get the path of this script + testPath = inspect.getfile(inspect.currentframe()) + # init the testing tool class. It can be sued in the following ways: + test = TestingTool(testName, testPath, DEVICE, params) + +######### WRITE YOUR CODE HERE BELOW ############# + + # get parameters from the calling interface + try: + test.log("Running test with the following parameters:") + test.log(params) + middle = float(test.getParam("midPoint")) + loopTimes = int(test.getParam("repeatTimes")) + span = float(test.getParam("spanFromMidPoint")) + settlingTime = 0.2 #seconds + except: + ret = 'Could not retrieve testing parameters - ' + traceback.format_exc() + success = False + test.sendFeedback(ret, success) + return + + scan = ManualScan(['time [1/'+ str(1/settlingTime) + ' s]'], ['Motor Pos (IST3:2)', 'Poti Position (IST2:1)', + 'Motor Status (STA:1)', 'Inkr (INKR:2)', 'InkrRb (INKRRB:2)', + 'Diameter (DIAM:2)', 'Logical Position (IST:2)', + 'Motor Pos Raw (IST3:1)','Poti Pos From Beam (IST1:2)', + 'Poti Raw (POSA:1)', 'Poti Ref1 Position (REF1:1)', 'Poti Ref2 Position (REF2:1)']) + scan.setPlotTitle(plotName) + scan.start() + # coloured plot (one colour per scan) + p1 = plot(None, name="Poti-Increment difference", context=plotName + " difference")[0] + p2 = plot(None, name="Poti-MotorPosition difference", context=plotName + " difference")[0] + + # Creating channels: dimension 1 + try: + idMotorStatus = Channel(DEVICE + ':STA:1' , type = 'd') # DSP device_status reg + idLogicalPosition = Channel(DEVICE + ':IST:2' , type = 'd') # Shows current position in logical units as calculated from motor step counter [1..n] + idPotiRaw = Channel(DEVICE + ':POSA:1' , type = 'd') # poti raw data [ADC units] + idMotorPositionRaw = Channel(DEVICE + ':IST3:1' , type = 'd') # shows current position in steps as as obtained from motor step counter [steps] + idInkr = Channel(DEVICE + ':INKR:2' , type = 'd') # move relative distance (positive means towards R2) [mm] + idInkrRb = Channel(DEVICE + ':INKRRB:2' , type = 'd') # readback of move relative distance (positive means towards R2) [mm] + idDiameter = Channel(DEVICE + ':DIAM:2' , type = 'd') # collimator diameter [mm] + idMotorPosition = Channel(DEVICE + ':IST3:2' , type = 'd') # current position as from motor step counter [mm] + idPotiPosFromBeam = Channel(DEVICE + ':IST1:2' , type = 'd') # current position from beam as from potentiometer [mm] + idPotiPosition = Channel(DEVICE + ':IST2:1' , type = 'd') # current position as from potentiometer [mm] + idPotiRef1Position = Channel(DEVICE + ':REF1:1' , type = 'd') # R1 position as from potentiometer [mm] + idPotiRef2Position = Channel(DEVICE + ':REF2:1' , type = 'd') # R2 position as from potentiometer [mm] + except: + ret = 'Unable to create channel - ' + traceback.format_exc() + success = False + test.sendFeedback(ret, success) + return + + direction = 1.0 + startDefault = middle - span + endDefault = middle + span + end = endDefault + 1 + # find position: it will be the middle point of the test + test.log('Moving to middle point ' + str(middle)) + idInkr.put(middle, timeout=None) # TODO: Set appropriate timeout + readback2 = idInkr.get() + if abs(readback2 - middle) > 5: # TODO: Check accuracy + ret = 'Actor idInkr could not be set to the value ' + str(middle) + ' (current value: ' + str( + readback2) + ')' + success = False + test.sendFeedback(ret, success) + return + start = readback2 + direction + countSteps = 0 + count = 0 + test.log('Moving around middle point (+-' + str(span) + ')') + for setpoint1 in range(0, (loopTimes * 2)): + count = count + 1 + sleep(5) # Settling time + p1.addSeries(LinePlotSeries("Run" + str(count))) + # RegionPositioner idInkr + for setpoint2 in frange(start, end, direction): + readback1 = setpoint1 + idInkr.put(setpoint2, timeout=None) # TODO: Set appropriate timeout + sleep(settlingTime) # Settling time + readback2 = idInkr.get() + + MotorStatus = idMotorStatus.get() + LogicalPosition = idLogicalPosition.get() + PotiRaw = idPotiRaw.get() + MotorPositionRaw = idMotorPositionRaw.get() + MotorPosition = idMotorPosition.get() + PotiPosFromBeam = idPotiPosFromBeam.get() + PotiPosition = idPotiPosition.get() + PotiRef1Position = idPotiRef1Position.get() + PotiRef2Position = idPotiRef2Position.get() + Diameter = idDiameter.get() + Inkr = idInkr.get() + InkrRb = idInkrRb.get() + + idDiff01 = PotiPosition - MotorPosition + countSteps = countSteps + 1 + scan.append([setpoint2], [setpoint2], + [MotorPosition, PotiPosition, MotorStatus, Inkr, InkrRb, Diameter, LogicalPosition, + MotorPositionRaw, PotiPosFromBeam, PotiRaw, PotiRef1Position, PotiRef2Position]) + p1.getSeries(count).appendData(setpoint2, idDiff01) + if (direction > 0.0 and setpoint2 >= end - 1): + # invert direction and swap start with end of translation + end = startDefault - 1 + start = setpoint2 - direction + direction = -1.0 + test.log('End of span (' + str(setpoint2) + '), changing direction to ' + str(direction)) + break + if (direction < 0.0 and setpoint2 <= end + 1): + # invert direction and swap start with end of translation + end = endDefault + 1 + start = setpoint2 - direction + direction = 1.0 + test.log('End of span (' + str(setpoint2) + '), changing direction to ' + str(direction)) + break + + + #extract Status bits + endH = bool(int(MotorStatus) & 8) #Ref2 (high limit) + endL = bool(int(MotorStatus) & 4) #Ref1 (low limit) + + #check if arrived to R1 or R2; if so, invert direction + if endH: + # invert direction and swap start with end of translation + end = startDefault - 1 + start = setpoint2 - direction + direction = -1.0 + test.log('Reached R2 switch, changing direction to ' + str(direction)) + break + elif endL: + # invert direction and swap start with end of translation + end = endDefault + 1 + start = setpoint2 - direction + direction = 1.0 + test.log('Reached R1 switch, changing direction to ' + str(direction)) + break + #check if any error bit is raised + if bool(int(MotorStatus) & int('10000',2)): #error: abort test + test.sendFeedback('Motor switched off (bit#4)', False) + return + if bool(int(MotorStatus) & int('100000',2)): #error: abort test + test.sendFeedback('No motor link (bit#5)', False) + return + if bool(int(MotorStatus) & int('1000000',2)): #error: abort test + test.sendFeedback('No poti link (bit#6)', False) + return + if bool(int(MotorStatus) & int('10000000',2)): #error: abort test + test.sendFeedback('Calibration error (bit#7)', False) + return + if bool(int(MotorStatus) & int('100000000',2)): #error: abort test + test.sendFeedback('Cannot get to R1 (bit#8)', False) + return + if bool(int(MotorStatus) & int('1000000000',2)): #error: abort test + test.sendFeedback('Cannot get to R2 (bit#9)', False) + return + if bool(int(MotorStatus) & int('10000000000',2)): #error: abort test + test.sendFeedback('Position measurement mismatch (bit#10)', False) + return + if bool(int(MotorStatus) & int('100000000000',2)): #error: abort test + test.sendFeedback('Movement timeout (bit#11)', False) + return + + # Closing channels + idMotorStatus.close() + idLogicalPosition.close() + idPotiRaw.close() + idMotorPositionRaw.close() + idMotorPosition.close() + idPotiPosFromBeam.close() + idPotiPosition.close() + idPotiRef1Position.close() + idPotiRef2Position.close() + idDiameter.close() + idInkr.close() + idInkrRb.close() + + scan.end() + ret = 'Slide moved back and forth (' + str(count) + ' runs)' + success = True + +################ END OF YOUR CODE ################ +###### Final - DO NOT MODIFY THE CODE BELOW ###### + + # just in case the feedback was forgotten + test.sendFeedback(ret, success) + except: + # generic error handler + ret = traceback.format_exc() + success = False + test.sendFeedback(ret, success) + + +# launch the test +startTest(test, device, parameters) diff --git a/script/tests/tests/Collimator Tests pro/Motor Test 2/help.html b/script/tests/tests/Collimator Tests pro/Motor Test 2/help.html new file mode 100644 index 0000000..1fa73d6 --- /dev/null +++ b/script/tests/tests/Collimator Tests pro/Motor Test 2/help.html @@ -0,0 +1,16 @@ + + +

Short Description

+Oscillate around a specified position +

Details

+Go to absolute position A, then move +B steps, then -2B steps, then +2Bsteps (ie oscillate round centre position, logging after each movement); repeat N times +

Parameters

+repeatTimes Repeat N times
+midPoint Position A [mm]
+spanFromMidPoint The B steps [integer]
+translationStep Length of the movement per each traslation step [mm]
+

Contact

+Marco Boccioli + + + diff --git a/script/tests/tests/Collimator Tests pro/Motor Test 3/.config b/script/tests/tests/Collimator Tests pro/Motor Test 3/.config new file mode 100644 index 0000000..79d889a --- /dev/null +++ b/script/tests/tests/Collimator Tests pro/Motor Test 3/.config @@ -0,0 +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 + + +#optional parameters. Description is compulsory. Syntax& +#parameters=&&[;&&] +parameters=repeatTimes&1&Repeat N times;translation&2&Translation C steps diff --git a/script/tests/tests/Collimator Tests pro/Motor Test 3/Motor Test 3.py b/script/tests/tests/Collimator Tests pro/Motor Test 3/Motor Test 3.py new file mode 100644 index 0000000..1a8d2b1 --- /dev/null +++ b/script/tests/tests/Collimator Tests pro/Motor Test 3/Motor Test 3.py @@ -0,0 +1,212 @@ +#Script Motor Test 3 +#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 + +###### Init - DO NOT MODIFY THE CODE BELOW ###### +global sys, inspect, os, traceback +import sys, inspect, os, traceback + +def startTest(testName, DEVICE, params): + #by default, assume the test failed + ret = 'Test failed' + success = False + #plot name to be given to the scan. Use: scan.setPlotTitle(plotName) + plotName = DEVICE + ' - ' + testName + #put the whole custom code under try/catch + try: + #get the path of this script + testPath = inspect.getfile(inspect.currentframe()) + #init the testing tool class. It can be sued in the following ways: + test = TestingTool(testName, testPath, DEVICE, params) + +######### WRITE YOUR CODE HERE BELOW ############# + #get parameters from the calling interface + try: + test.log("Running test Motor Test 3 with the following parameters:") + test.log(params) + loopTimes = int(test.getParam("repeatTimes")) # C times + translation = int(test.getParam("translation")) # Increment mm + samplePeriod = 0.2 #seconds + except: + test.log("Could not retrieve testing parameters: ", sys.exc_info()[0]) + ret = 'Could not retrieve testing parameters - ' + traceback.format_exc() + success = False + test.sendFeedback(ret, success) + return + + scan = ManualScan(['time [1/'+ str(1/samplePeriod) + ' s]'], [ + 'Btvs Poti Position (IST3:2)', + 'Mcs Poti Position (IST2:1)', + 'Motor Status (STA:1)', + 'Inkr (INKR:2)', + 'InkrRb (INKRRB:2)', + 'Diameter (DIAM:2)', + 'Logical Position (IST:2)', + 'Btvs Raw (IST3:1)', + 'Motor Position (IST1:2)', + 'Poti Raw (POSA:1)', + 'Poti Ref1 Position (REF1:1)', + 'Poti Ref2 Position (REF2:1)']) + scan.setPlotTitle(plotName) + scan.start() + p1 = plot(None, name = "Motor Position - Btvs Poti Position", context = plotName + " Motor-Poti difference")[0] + # Creating channels + try: + idMotorStatus = Channel(DEVICE + ':STA:1' , type = 'd') # DSP device_status reg + idLogicalPosition = Channel(DEVICE + ':IST:2' , type = 'd') # Shows current position in logical units as calculated from motor step counter [1..n] + idPotiRaw = Channel(DEVICE + ':POSA:1' , type = 'd') # poti raw data [ADC units] + idBtvsRaw = Channel(DEVICE + ':IST3:1' , type = 'd') # shows current position in steps as as obtained from motor step counter [steps] + idInkr = Channel(DEVICE + ':INKR:2' , type = 'd') # move relative distance (positive means towards R2) [mm] + idInkrRb = Channel(DEVICE + ':INKRRB:2' , type = 'd') # readback of move relative distance (positive means towards R2) [mm] + idDiameter = Channel(DEVICE + ':DIAM:2' , type = 'd') # collimator diameter [mm] + idBtvs = Channel(DEVICE + ':IST3:2' , type = 'd') # current position as from motor step counter [mm] + idMotorPosition = Channel(DEVICE + ':IST1:2' , type = 'd') # current position from beam as from potentiometer [mm] + idPotiPosition = Channel(DEVICE + ':IST2:1' , type = 'd') # current position as from potentiometer [mm] + idPotiRef1Position = Channel(DEVICE + ':REF1:1' , type = 'd') # R1 position as from potentiometer [mm] + idPotiRef2Position = Channel(DEVICE + ':REF2:1' , type = 'd') # R2 position as from potentiometer [mm] + idCom = Channel(DEVICE + ':COM:2' , type = 'd') # motor commands [0=Stop; 1=Calibrate; 2=gotoR1; 3=gotoR2] + + except: + ret = 'Unable to create channel - ' + traceback.format_exc() + success = False + test.sendFeedback( ret, success) + return + + + #go to position at Low end switch: it will be the starting point of the test + test.log('Homing') + idCom.put(2, timeout=10) # go to R1 + # wait for motor to get to Ref1 + for setpoint1 in range(0, 100): + sleep( 2 ) # Settling time + MotorStatus = idMotorStatus.get() + if bool(int(MotorStatus) & 4): # arrived at Ref1 (low limit) + break + if not bool(int(MotorStatus) & 4): # not arrived at Ref1 (low limit) + ret = 'Could not reach Ref1' + success = False + test.sendFeedback( ret, success) + return + + direction = 1 + countSteps = 0 + test.log('Starting testing sequence') + count = 0 + for setpoint1 in range(0, (loopTimes*2)): + count = count + 1 + sleep( 2 ) # Settling time + # add multi cuve plot + p1.addSeries(LinePlotSeries("Run"+str(count))) + + for setpoint2 in frange(0, 1000000): + + idInkr.put(translation*direction, timeout=10) + sleep(samplePeriod) # Settling time + currentTime = float(java.lang.System.currentTimeMillis()) + + MotorStatus = idMotorStatus.get() + LogicalPosition = idLogicalPosition.get() + PotiRaw = idPotiRaw.get() + BtvsRaw = idBtvsRaw.get() + Btvs = idBtvs.get() + MotorPosition = idMotorPosition.get() + PotiPosition = idPotiPosition.get() + PotiRef1Position = idPotiRef1Position.get() + PotiRef2Position = idPotiRef2Position.get() + Diameter = idDiameter.get() + Inkr = idInkr.get() + InkrRb = idInkrRb.get() + + idDiff01 = MotorPosition-Btvs + countSteps = countSteps + (translation*direction) + + # multi plot + scan.append([currentTime], [currentTime],[ + Btvs, + PotiPosition, + MotorStatus, + Inkr, + InkrRb, + Diameter, + LogicalPosition, + BtvsRaw, + MotorPosition, + PotiRaw, + PotiRef1Position, + PotiRef2Position]) + # draw diff against steps + p1.getSeries(count).appendData(countSteps, idDiff01) + + #extract Status bits + endH = bool(int(MotorStatus) & 8) #Ref2 (high limit) + endL = bool(int(MotorStatus) & 4) #Ref1 (low limit) + + #check if arrived to R1 or R2 + if endH: + #invert direction and swap start with end of translation + direction = -1 + test.log('Reached R2 switch, changing target to R1') + break + elif endL: + #invert direction and swap start with end of translation + direction = 1 + test.log('Reached R1 switch, changing target to R2') + break + + #check if any error bit is raised + if bool(int(MotorStatus) & int('10000',2)): #error: abort test + test.sendFeedback('Motor switched off (bit#4)', False) + return + if bool(int(MotorStatus) & int('100000',2)): #error: abort test + test.sendFeedback('No motor link (bit#5)', False) + return + if bool(int(MotorStatus) & int('1000000',2)): #error: abort test + test.sendFeedback('No poti link (bit#6)', False) + return + if bool(int(MotorStatus) & int('10000000',2)): #error: abort test + test.sendFeedback('Calibration error (bit#7)', False) + return + if bool(int(MotorStatus) & int('100000000',2)): #error: abort test + test.sendFeedback('Cannot get to R1 (bit#8)', False) + return + if bool(int(MotorStatus) & int('1000000000',2)): #error: abort test + test.sendFeedback('Cannot get to R2 (bit#9)', False) + return + if bool(int(MotorStatus) & int('10000000000',2)): #error: abort test + test.sendFeedback('Position measurement mismatch (bit#10)', False) + return + if bool(int(MotorStatus) & int('100000000000',2)): #error: abort test + test.sendFeedback('Movement timeout (bit#11)', False) + return + + #Closing channels + idMotorStatus.close() + idLogicalPosition.close() + idPotiRaw.close() + idBtvsRaw.close() + idBtvs.close() + idMotorPosition.close() + idPotiPosition.close() + idPotiRef1Position.close() + idPotiRef2Position.close() + idDiameter.close() + idInkr.close() + idInkrRb.close() + idCom.close() + + scan.end() + ret = 'Slide moved back and forth (' + str(count) + ' runs)' + success = True + +################ END OF YOUR CODE ################ +###### Final - DO NOT MODIFY THE CODE BELOW ###### + + #just in case the feedback was forgotten + test.sendFeedback(ret, success) + except: + #generic error handler + ret = traceback.format_exc() + success = False + test.sendFeedback(ret, success) + +#launch the test +startTest(test, device, parameters) \ No newline at end of file diff --git a/script/tests/tests/Collimator Tests pro/Motor Test 3/help.html b/script/tests/tests/Collimator Tests pro/Motor Test 3/help.html new file mode 100644 index 0000000..6fef1db --- /dev/null +++ b/script/tests/tests/Collimator Tests pro/Motor Test 3/help.html @@ -0,0 +1,13 @@ + + +

Description

+Moves from CCW to CW as a series of discrete translations (C steps) logs after each translation. When end switch is encountered change direction. Repeat N times +

Parameters

+repeatTimes How many N times the test is repeated
+translation How many C steps are done for one translation
+ +

Contact

+boccioli_m + + + diff --git a/script/tests/tests/Collimator Tests pro/Move Ref 1/.config b/script/tests/tests/Collimator Tests pro/Move Ref 1/.config new file mode 100644 index 0000000..895fbd5 --- /dev/null +++ b/script/tests/tests/Collimator Tests pro/Move Ref 1/.config @@ -0,0 +1,3 @@ +name=Move Ref 1 +description=Moves to the Reference 1 Position +filename=Move Ref 1.xml \ No newline at end of file diff --git a/script/tests/tests/Collimator Tests pro/Move Ref 1/Move Ref 1 - Copy.py b/script/tests/tests/Collimator Tests pro/Move Ref 1/Move Ref 1 - Copy.py new file mode 100644 index 0000000..ebcd9cb --- /dev/null +++ b/script/tests/tests/Collimator Tests pro/Move Ref 1/Move Ref 1 - Copy.py @@ -0,0 +1,90 @@ + +###### DO NOT MODIFY THE CODE BELOW ###### +def startTest(testName, DEVICE, params): + #get the path of this script + testPath = inspect.getfile(inspect.currentframe()) + #by default, failed + ret = 'Test failed' + success = False + #plot name to be given to the scan. Use: scan.setPlotTitle(plotName) + plotName = DEVICE + ' - ' + testName +###### WRITE YOUR CODE HERE BELOW ####### + #get parameters from the calling interface + print_log(testName, DEVICE, 'testpath: ' + testPath ) + print_log(testName, DEVICE, 'parameters:' + str( params) ) + print_log(testName, DEVICE, 'device: ' + DEVICE ) + scan = ManualScan(['time'], ['idMotorStep', 'idPotiPosition', 'idPotiRef1Position','idMotorStep-idPotiPosition'] , [0.0], [30.0], [20]) + scan.setPlotTitle(plotName) + scan.start() + + #Creating channels: dimension 1 + try: + idCom = Channel(DEVICE+':COM:2', type = 'd') #current position as from motor step counter [mm] + idMotorStep = Channel(DEVICE+':IST3:2', type = 'd') #current position as from motor step counter [mm] + idPotiPosFromBeam = Channel(DEVICE+':IST1:2', type = 'd') #current position from beam as from potentiometer [mm] + idPotiPosition = Channel(DEVICE+':IST2:1', type = 'd') #current position as from potentiometer [mm] + idPotiRef1Position = Channel(DEVICE+':REF1:1', type = 'd') #R1 position as from potentiometer [mm] + idPotiRef2Position = Channel(DEVICE+':REF2:1', type = 'd') #R2 position as from potentiometer [mm] + + except: + sendFeedback(testPath, testName, DEVICE, 'Unable to create channel - ' + traceback.format_exc(), False) + #raise Exception('Unable to create channel - ' + traceback.format_exc()) + return + + idCom.put('3', timeout=None) # go to R1 + print_log(testName, DEVICE, 'Moving to reference point') + #scan quickly the output during some seconds + detector4 = idPotiPosition.get() + detector6 = idPotiRef2Position.get() + timeElapsed=0 + while detector4>detector6 and timeElapsed<600: + #Detector time + detector1 = float(java.lang.System.currentTimeMillis()) + + detector2 = idMotorStep.get() + detector3 = idPotiPosFromBeam.get() + detector4 = idPotiPosition.get() + detector5 = idPotiRef1Position.get() + detector6 = idPotiRef2Position.get() + diff1 = detector2-detector4 + scan.append ([detector1], [detector1], [detector2, detector4, detector5, diff1]) + sleep( 0.1 ) # Settling time + timeElapsed=timeElapsed+1 + + #Closing channels + idCom.close() + idMotorStep.close() + idPotiPosFromBeam.close() + idPotiPosition.close() + idPotiRef1Position.close() + idPotiRef2Position.close() + print_log(testName, DEVICE, ' Reference point reached') + +########## END OF YOUR CODE ########### + +###### DO NOT MODIFY THE CODE BELOW ###### + sendFeedback(testPath, testName, DEVICE, ret, success) + +#prepare and send feedback to calling tool +def sendFeedback(testPath, testName, DEVICE, returnString, testPassed): + print_log(testName, DEVICE, 'End of test. Result:') + print_log(testName, DEVICE, 'Test path: ' + testPath) + print_log(testName, DEVICE, 'Test name: ' + testName ) + print_log(testName, DEVICE, 'Device: ' + DEVICE) + print_log(testName, DEVICE, 'Test passed: ' + str(testPassed)) + print_log(testName, DEVICE, 'Return string: ' + returnString) + ret = [testPath, DEVICE, returnString, testPassed] + set_return(ret) + +def print_log(testName, DEVICE, text): + time.ctime() + now = time.strftime('%Y.%m.%d %H:%M:%S') + print now + ' ' + DEVICE + ' - ' + testName + ': ' + text + +import sys, inspect, os, traceback +#get test arguments +DEVICE = device +testName = test +params = parameters +#launch the test +startTest(testName, DEVICE, params) diff --git a/script/tests/tests/Collimator Tests pro/Move Ref 1/Move Ref 1.py b/script/tests/tests/Collimator Tests pro/Move Ref 1/Move Ref 1.py new file mode 100644 index 0000000..0a631ac --- /dev/null +++ b/script/tests/tests/Collimator Tests pro/Move Ref 1/Move Ref 1.py @@ -0,0 +1,144 @@ + +# Drive to R1 + +###### Init - DO NOT MODIFY THE CODE BELOW ###### +global sys, inspect, os, traceback +import sys, inspect, os, traceback + + +def startTest(testName, DEVICE, params): + # by default, assume the test failed + ret = 'Test failed' + success = False + # plot name to be given to the scan. Use: scan.setPlotTitle(plotName) + plotName = DEVICE + ' - ' + testName + # put the whole custom code under try/catch + try: + # get the path of this script + testPath = inspect.getfile(inspect.currentframe()) + # init the testing tool class. It can be sued in the following ways: + test = TestingTool(testName, testPath, DEVICE, params) + samplePeriod = 0.1 + +######### WRITE YOUR CODE HERE BELOW ############# + scan = ManualScan(['time [1/'+ str(1/samplePeriod) + ' s]'], ['Motor Pos (IST3:2)', 'Poti Position (IST2:1)', + 'Motor Status (STA:1)', 'Inkr (INKR:2)', 'InkrRb (INKRRB:2)', + 'Diameter (DIAM:2)', 'Com (COM:2)', 'Logical Position (IST:2)', + 'Motor Pos Raw (IST3:1)','Poti Pos From Beam (IST1:2)', + 'Poti Raw (POSA:1)', 'Poti Ref1 Position (REF1:1)', 'Poti Ref2 Position (REF2:1)']) + scan.setPlotTitle(plotName) + scan.start() + + try: + idMotorStatus = Channel(DEVICE + ':STA:1' , type = 'd') # DSP device_status reg + idLogicalPosition = Channel(DEVICE + ':IST:2' , type = 'd') # Shows current position in logical units as calculated from motor step counter [1..n] + idPotiRaw = Channel(DEVICE + ':POSA:1' , type = 'd') # poti raw data [ADC units] + idMotorPositionRaw = Channel(DEVICE + ':IST3:1' , type = 'd') # shows current position in steps as as obtained from motor step counter [steps] + idInkr = Channel(DEVICE + ':INKR:2' , type = 'd') # move relative distance (positive means towards R2) [mm] + idInkrRb = Channel(DEVICE + ':INKRRB:2' , type = 'd') # readback of move relative distance (positive means towards R2) [mm] + idDiameter = Channel(DEVICE + ':DIAM:2' , type = 'd') # collimator diameter [mm] + idCom = Channel(DEVICE + ':COM:2' , type = 'd') # current position as from motor step counter [mm] + idMotorPosition = Channel(DEVICE + ':IST3:2' , type = 'd') # current position as from motor step counter [mm] + idPotiPosFromBeam = Channel(DEVICE + ':IST1:2' , type = 'd') # current position from beam as from potentiometer [mm] + idPotiPosition = Channel(DEVICE + ':IST2:1' , type = 'd') # current position as from potentiometer [mm] + idPotiRef1Position = Channel(DEVICE + ':REF1:1' , type = 'd') # R1 position as from potentiometer [mm] + idPotiRef2Position = Channel(DEVICE + ':REF2:1' , type = 'd') # R2 position as from potentiometer [mm] + + idCom.put('3', timeout=None) # go to R1 + sleep( samplePeriod ) # Settling time + except: + ret = 'Unable to create channel - ' + traceback.format_exc() + success = False + test.sendFeedback( ret, success) + return + + #scan for a while to collect data + for setpoint1 in range(0, 10000): + sleep( samplePeriod ) # Settling time + + MotorStatus = idMotorStatus.get() + LogicalPosition = idLogicalPosition.get() + PotiRaw = idPotiRaw.get() + MotorPositionRaw = idMotorPositionRaw.get() + Com = idCom.get() + MotorPosition = idMotorPosition.get() + PotiPosFromBeam = idPotiPosFromBeam.get() + PotiPosition = idPotiPosition.get() + PotiRef1Position = idPotiRef1Position.get() + PotiRef2Position = idPotiRef2Position.get() + Diameter = idDiameter.get() + Inkr = idInkr.get() + InkrRb = idInkrRb.get() + + + scan.append([setpoint2], [setpoint2], + [MotorPosition, PotiPosition, MotorStatus, Inkr, InkrRb, Diameter, Com, LogicalPosition, + MotorPositionRaw, PotiPosFromBeam, PotiRaw, PotiRef1Position, PotiRef2Position]) + + if (MotorStatus & int('1',2))==0: #device finished calibration (bit#1) + #give the device some time before stating that it has really finished + countDeviceInModeIdle = countDeviceInModeIdle +1 + if countDeviceInModeIdle == 10: + break + else: + countDeviceInModeIdle = 0 + + #check if any error bit is raised + if bool(int(MotorStatus) & int('10000',2)): #error: abort test + test.sendFeedback('Motor switched off (bit#4)', False) + return + if bool(int(MotorStatus) & int('100000',2)): #error: abort test + test.sendFeedback('No motor link (bit#5)', False) + return + if bool(int(MotorStatus) & int('1000000',2)): #error: abort test + test.sendFeedback('No poti link (bit#6)', False) + return + if bool(int(MotorStatus) & int('10000000',2)): #error: abort test + test.sendFeedback('Calibration error (bit#7)', False) + return + if bool(int(MotorStatus) & int('100000000',2)): #error: abort test + test.sendFeedback('Cannot get to R1 (bit#8)', False) + return + if bool(int(MotorStatus) & int('1000000000',2)): #error: abort test + test.sendFeedback('Cannot get to R2 (bit#9)', False) + return + if bool(int(MotorStatus) & int('10000000000',2)): #error: abort test + test.sendFeedback('Position measurement mismatch (bit#10)', False) + return + if bool(int(MotorStatus) & int('100000000000',2)): #error: abort test + test.sendFeedback('Movement timeout (bit#11)', False) + return + + #Closing channels + idMotorStatus.close() + idLogicalPosition.close() + idPotiRaw.close() + idMotorPositionRaw.close() + idCom.close() + idMotorPosition.close() + idPotiPosFromBeam.close() + idPotiPosition.close() + idPotiRef1Position.close() + idPotiRef2Position.close() + idDiameter.close() + idInkr.close() + idInkrRb.close() + scan.end() + + ret = 'Moved to R1' + success = True + scan.end() + +################ END OF YOUR CODE ################ +###### Final - DO NOT MODIFY THE CODE BELOW ###### + + # just in case the feedback was forgotten + test.sendFeedback(ret, success) + except: + # generic error handler + ret = traceback.format_exc() + success = False + test.sendFeedback(ret, success) + +# launch the test +startTest(test, device, parameters) diff --git a/script/tests/tests/Collimator Tests pro/Move Ref 1/Move Ref 1.xml b/script/tests/tests/Collimator Tests pro/Move Ref 1/Move Ref 1.xml new file mode 100644 index 0000000..5b81083 --- /dev/null +++ b/script/tests/tests/Collimator Tests pro/Move Ref 1/Move Ref 1.xml @@ -0,0 +1,61 @@ + + + + + + + + + + + 3000 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/script/tests/tests/Collimator Tests pro/Move Ref 1/help.html b/script/tests/tests/Collimator Tests pro/Move Ref 1/help.html new file mode 100644 index 0000000..627f6dd --- /dev/null +++ b/script/tests/tests/Collimator Tests pro/Move Ref 1/help.html @@ -0,0 +1,13 @@ + + +

Short Description

+Go to reference position R1 +

Details

+Go to reference position R1 (command '3'). +

Parameters

+none +

Contact

+Marco Boccioli + + + diff --git a/script/tests/tests/Collimator Tests pro/Move Ref 2/.config b/script/tests/tests/Collimator Tests pro/Move Ref 2/.config new file mode 100644 index 0000000..0d83dba --- /dev/null +++ b/script/tests/tests/Collimator Tests pro/Move Ref 2/.config @@ -0,0 +1,3 @@ +name=Move Ref 2 +description=Moves to the Reference 2 Position +filename=Move Ref 2.xml \ No newline at end of file diff --git a/script/tests/tests/Collimator Tests pro/Move Ref 2/Move Ref 2.py b/script/tests/tests/Collimator Tests pro/Move Ref 2/Move Ref 2.py new file mode 100644 index 0000000..ea100da --- /dev/null +++ b/script/tests/tests/Collimator Tests pro/Move Ref 2/Move Ref 2.py @@ -0,0 +1,144 @@ + +# Drive to R2 + +###### Init - DO NOT MODIFY THE CODE BELOW ###### +global sys, inspect, os, traceback +import sys, inspect, os, traceback + + +def startTest(testName, DEVICE, params): + # by default, assume the test failed + ret = 'Test failed' + success = False + # plot name to be given to the scan. Use: scan.setPlotTitle(plotName) + plotName = DEVICE + ' - ' + testName + # put the whole custom code under try/catch + try: + # get the path of this script + testPath = inspect.getfile(inspect.currentframe()) + # init the testing tool class. It can be sued in the following ways: + test = TestingTool(testName, testPath, DEVICE, params) + samplePeriod = 0.1 + +######### WRITE YOUR CODE HERE BELOW ############# + scan = ManualScan(['time [1/'+ str(1/samplePeriod) + ' s]'], ['Motor Pos (IST3:2)', 'Poti Position (IST2:1)', + 'Motor Status (STA:1)', 'Inkr (INKR:2)', 'InkrRb (INKRRB:2)', + 'Diameter (DIAM:2)', 'Com (COM:2)', 'Logical Position (IST:2)', + 'Motor Pos Raw (IST3:1)','Poti Pos From Beam (IST1:2)', + 'Poti Raw (POSA:1)', 'Poti Ref1 Position (REF1:1)', 'Poti Ref2 Position (REF2:1)']) + scan.setPlotTitle(plotName) + scan.start() + + try: + idMotorStatus = Channel(DEVICE + ':STA:1' , type = 'd') # DSP device_status reg + idLogicalPosition = Channel(DEVICE + ':IST:2' , type = 'd') # Shows current position in logical units as calculated from motor step counter [1..n] + idPotiRaw = Channel(DEVICE + ':POSA:1' , type = 'd') # poti raw data [ADC units] + idMotorPositionRaw = Channel(DEVICE + ':IST3:1' , type = 'd') # shows current position in steps as as obtained from motor step counter [steps] + idInkr = Channel(DEVICE + ':INKR:2' , type = 'd') # move relative distance (positive means towards R2) [mm] + idInkrRb = Channel(DEVICE + ':INKRRB:2' , type = 'd') # readback of move relative distance (positive means towards R2) [mm] + idDiameter = Channel(DEVICE + ':DIAM:2' , type = 'd') # collimator diameter [mm] + idCom = Channel(DEVICE + ':COM:2' , type = 'd') # current position as from motor step counter [mm] + idMotorPosition = Channel(DEVICE + ':IST3:2' , type = 'd') # current position as from motor step counter [mm] + idPotiPosFromBeam = Channel(DEVICE + ':IST1:2' , type = 'd') # current position from beam as from potentiometer [mm] + idPotiPosition = Channel(DEVICE + ':IST2:1' , type = 'd') # current position as from potentiometer [mm] + idPotiRef1Position = Channel(DEVICE + ':REF1:1' , type = 'd') # R1 position as from potentiometer [mm] + idPotiRef2Position = Channel(DEVICE + ':REF2:1' , type = 'd') # R2 position as from potentiometer [mm] + + idCom.put('4', timeout=None) # go to R2 + sleep( samplePeriod ) # Settling time + except: + ret = 'Unable to create channel - ' + traceback.format_exc() + success = False + test.sendFeedback( ret, success) + return + + #scan for a while to collect data + for setpoint1 in range(0, 10000): + sleep( samplePeriod ) # Settling time + + MotorStatus = idMotorStatus.get() + LogicalPosition = idLogicalPosition.get() + PotiRaw = idPotiRaw.get() + MotorPositionRaw = idMotorPositionRaw.get() + Com = idCom.get() + MotorPosition = idMotorPosition.get() + PotiPosFromBeam = idPotiPosFromBeam.get() + PotiPosition = idPotiPosition.get() + PotiRef1Position = idPotiRef1Position.get() + PotiRef2Position = idPotiRef2Position.get() + Diameter = idDiameter.get() + Inkr = idInkr.get() + InkrRb = idInkrRb.get() + + + scan.append([setpoint2], [setpoint2], + [MotorPosition, PotiPosition, MotorStatus, Inkr, InkrRb, Diameter, Com, LogicalPosition, + MotorPositionRaw, PotiPosFromBeam, PotiRaw, PotiRef1Position, PotiRef2Position]) + + if (MotorStatus & int('1',2))==0: #device finished calibration (bit#1) + #give the device some time before stating that it has really finished + countDeviceInModeIdle = countDeviceInModeIdle +1 + if countDeviceInModeIdle == 10: + break + else: + countDeviceInModeIdle = 0 + + #check if any error bit is raised + if bool(int(MotorStatus) & int('10000',2)): #error: abort test + test.sendFeedback('Motor switched off (bit#4)', False) + return + if bool(int(MotorStatus) & int('100000',2)): #error: abort test + test.sendFeedback('No motor link (bit#5)', False) + return + if bool(int(MotorStatus) & int('1000000',2)): #error: abort test + test.sendFeedback('No poti link (bit#6)', False) + return + if bool(int(MotorStatus) & int('10000000',2)): #error: abort test + test.sendFeedback('Calibration error (bit#7)', False) + return + if bool(int(MotorStatus) & int('100000000',2)): #error: abort test + test.sendFeedback('Cannot get to R1 (bit#8)', False) + return + if bool(int(MotorStatus) & int('1000000000',2)): #error: abort test + test.sendFeedback('Cannot get to R2 (bit#9)', False) + return + if bool(int(MotorStatus) & int('10000000000',2)): #error: abort test + test.sendFeedback('Position measurement mismatch (bit#10)', False) + return + if bool(int(MotorStatus) & int('100000000000',2)): #error: abort test + test.sendFeedback('Movement timeout (bit#11)', False) + return + + #Closing channels + idMotorStatus.close() + idLogicalPosition.close() + idPotiRaw.close() + idMotorPositionRaw.close() + idCom.close() + idMotorPosition.close() + idPotiPosFromBeam.close() + idPotiPosition.close() + idPotiRef1Position.close() + idPotiRef2Position.close() + idDiameter.close() + idInkr.close() + idInkrRb.close() + scan.end() + + ret = 'Moved to R2' + success = True + scan.end() + +################ END OF YOUR CODE ################ +###### Final - DO NOT MODIFY THE CODE BELOW ###### + + # just in case the feedback was forgotten + test.sendFeedback(ret, success) + except: + # generic error handler + ret = traceback.format_exc() + success = False + test.sendFeedback(ret, success) + +# launch the test +startTest(test, device, parameters) diff --git a/script/tests/tests/Collimator Tests pro/Move Ref 2/Move Ref 2.xml b/script/tests/tests/Collimator Tests pro/Move Ref 2/Move Ref 2.xml new file mode 100644 index 0000000..2cf0a0a --- /dev/null +++ b/script/tests/tests/Collimator Tests pro/Move Ref 2/Move Ref 2.xml @@ -0,0 +1,61 @@ + + + + + + + + + + + 3000 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/script/tests/tests/Collimator Tests pro/Move Ref 2/help.html b/script/tests/tests/Collimator Tests pro/Move Ref 2/help.html new file mode 100644 index 0000000..91f86e9 --- /dev/null +++ b/script/tests/tests/Collimator Tests pro/Move Ref 2/help.html @@ -0,0 +1,13 @@ + + +

Short Description

+Go to reference position R2 +

Details

+Go to reference position R2 (command '4'). +

Parameters

+none +

Contact

+Marco Boccioli + + + diff --git a/script/tests/tests/Collimator Tests pro/Stop/.config b/script/tests/tests/Collimator Tests pro/Stop/.config new file mode 100644 index 0000000..89d5a5f --- /dev/null +++ b/script/tests/tests/Collimator Tests pro/Stop/.config @@ -0,0 +1,3 @@ +name=Stop +description=Sends the STOP command +filename=Stop.xml \ No newline at end of file diff --git a/script/tests/tests/Collimator Tests pro/Stop/Stop.xml b/script/tests/tests/Collimator Tests pro/Stop/Stop.xml new file mode 100644 index 0000000..27228d3 --- /dev/null +++ b/script/tests/tests/Collimator Tests pro/Stop/Stop.xml @@ -0,0 +1,61 @@ + + + + + + + + + + + 3000 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/script/tests/tests/Collimator Tests pro/monitorAllParams/.config b/script/tests/tests/Collimator Tests pro/monitorAllParams/.config new file mode 100644 index 0000000..2f1d86a --- /dev/null +++ b/script/tests/tests/Collimator Tests pro/monitorAllParams/.config @@ -0,0 +1,4 @@ +#Fri Sep 11 13&31&33 CEST 2015 +name=monitorAllParams +parameters=monitorTime&0.1&This is the parameter n.1 with unit [unit];samplingDelay&30&This is the parameter n.2 with unit [unit]; +description=d diff --git a/script/tests/tests/Collimator Tests pro/monitorAllParams/help.html b/script/tests/tests/Collimator Tests pro/monitorAllParams/help.html new file mode 100644 index 0000000..0d6eb66 --- /dev/null +++ b/script/tests/tests/Collimator Tests pro/monitorAllParams/help.html @@ -0,0 +1,13 @@ + + +

Description

+d +

Parameters

+monitorTime This is the parameter n.1 with unit [unit]
+samplingDelay This is the parameter n.2 with unit [unit]
+ +

Contact

+boccioli_m + + + diff --git a/script/tests/tests/Collimator Tests pro/monitorAllParams/monitorAllParams.py b/script/tests/tests/Collimator Tests pro/monitorAllParams/monitorAllParams.py new file mode 100644 index 0000000..529764f --- /dev/null +++ b/script/tests/tests/Collimator Tests pro/monitorAllParams/monitorAllParams.py @@ -0,0 +1,145 @@ +# Test name: monitorAllParams +# d + +###### Init - DO NOT MODIFY THE CODE BELOW ###### +global sys, inspect, os, traceback +import sys, inspect, os, traceback + + +def startTest(testName, DEVICE, params): + # by default, assume the test failed + ret = 'Test failed' + success = False + # plot name to be given to the scan. Use: scan.setPlotTitle(plotName) + plotName = DEVICE + ' - ' + testName + # put the whole custom code under try/catch + try: + # get the path of this script + testPath = inspect.getfile(inspect.currentframe()) + # init the testing tool class. It can be sued in the following ways: + test = TestingTool(testName, testPath, DEVICE, params) + + ################ END OF Init ##################### + ######### WRITE YOUR CODE HERE BELOW ############# + + """ + All the code in this section ###..YOUR CODE..### can be modified/deleted. + It must be indented to the same level as this comment + ----------------------------------- + GETTING INPUTS: + If needed, the following variables are available: + testPath string, path of this test file + testName string, name of this test + DEVICE string, device for which the test must run (typically it is the beginning of a process variable name) + ----------------------------------- + GETTING TEST PARAMETERS: + if you need to get parameters for the test, use (casting may be necessary): + myParamValue = test.getParam('myParamName') + see the test config for the list of parameters specific to the test. + ----------------------------------- + SETTING OUTPUTS: + ret string, a text summarizing the result of the test. It must be set before the end of your code. + success bool, True = test successful. It must be set before the end of your code. + test.sendFeedback(ret,success) method that ends the testing script and gives the report to the calling application. + Examples: + + whenever the code must quit (i.e. after an error), you must end with: + ret = 'here is some info on what failed on the test' + success = false + test.sendFeedback(ret, success) + + whenever the code is finished successfully, you must end with: + ret = 'here is some info on the success of the test' + success = true + test.sendFeedback(ret, success) + ----------------------------------- + LOG INFO: + when some information must be shown on the log, use: + test.log('test to log') + """ + + ########## Example (can be removed) ###### + # print the list of parameters passed. If any error, stop and send feedback + test.log("Example - Test name: " + testName) + test.log("Example - Device name: " + DEVICE) + try: + test.log("Running test Initialise with the following parameters:") + test.log(params) + # If present, use the parameters here below for your test script. You might need to change the casting + monitorTime = float(test.getParam('monitorTime')) ; samplingDelay = float(test.getParam('samplingDelay')) ; + except: + ret = 'Could not retrieve testing parameters - ' + traceback.format_exc() + success = False + test.sendFeedback(ret, success) + return + + # loop to read channels for a while and plot the channels values. + # initialise plot tab with 2 plots + scan = ManualScan(['sample'], ['Motor Status (MSTA)', 'Motor Position (VAL)']) + # set plot name(tab title) + scan.setPlotTitle(plotName) + # start plots. See further below how to add points to the plots + scan.start() + + # IMPORTANT: if the test failed, write the report into the variables ret and success. + # for example, write the following: + ret = "Example - Error, the test failed because...." + success = False + # set up connection to channels. "type" of data can be "d" (= double), "l" (= long) + try: + pv_motor_msta = Channel(DEVICE + ':MOTOR.MSTA', type='d') + pv_motor_val = Channel(DEVICE + ':MOTOR.VAL', type='d') + except: + # prepare return information: return text + ret = 'Unable to create channel - ' + traceback.format_exc() + # prepare return information: return success + success = False + # send return information + test.sendFeedback(ret, success) + return + # take 100 samples of the channels + for sample in range(0, 100): + readback1 = sample + sleep(0.1) # Settling time + # get value + motor_msta = pv_motor_msta.get() + # get value + motor_val = pv_motor_val.get() + # add values to plot + scan.append([sample], [readback1], [motor_msta, motor_val]) + + # Closing channels + pv_motor_msta.close() + pv_motor_val.close() + + # IMPORTANT: if the test was successful, write the report into the variables ret and success. + # for example, write the following: + ret = "Example - Test successful, here some detail: ..." + success = True + test.sendFeedback(ret, success) + # once the test is finished, no need to do anything. The code below yours will do the rest. + ################ End of Example ########## + + ################ END OF YOUR CODE ################ + ###### Final - DO NOT MODIFY THE CODE BELOW ###### + + # just in case the feedback was forgotten + test.sendFeedback(ret, success) + except (KeyboardInterrupt): + # user stop error handler + ret = 'Test stopped by user.' + success = False + test.sendFeedback(ret, success) + except: + # generic error handler + ret = traceback.format_exc() + success = False + test.sendFeedback(ret, success) + + +# launch the test +startTest(test, device, parameters) + +################ END OF Final #################### +#### IF NEEDED, ADD YOUR FUNCTIONS HERE BELOW #### +# def yourCustomFunction: diff --git a/script/tests/tests/Collimator Tests pro/what is on damir test tool.txt b/script/tests/tests/Collimator Tests pro/what is on damir test tool.txt new file mode 100644 index 0000000..e69ec71 --- /dev/null +++ b/script/tests/tests/Collimator Tests pro/what is on damir test tool.txt @@ -0,0 +1,8 @@ +Test 1 plotted curves + +CCWsteps +CCWpoti +CWsteps +CWpoti + + diff --git a/script/tests/tests/Collimator Tests/Calibrate test vme/.config b/script/tests/tests/Collimator Tests/Calibrate test vme/.config new file mode 100644 index 0000000..7ec0790 --- /dev/null +++ b/script/tests/tests/Collimator Tests/Calibrate test vme/.config @@ -0,0 +1,12 @@ +name=Calibrate test vme +description=Calibrates the device +filename=Calibrate.xml +help = \ +This test sends a command to the low level firmware which controls the collimators \n\ +requesting that it calibrates itself. \n\n\ +Calibration involves moving to the R1 and R2 reference positions and measuring the \n\ +number of steps required to do so. At the end of the sequence the default collimator \n\ +will be selected. \n\n\ +During the course of the expected calibration period (45-70 seconds) the test \n\ +procedure will plot the values of all critical system variables. \n\n\ +For further information please consult Valery Ovinnikov.
\ diff --git a/script/tests/tests/Collimator Tests/Calibrate test vme/Calibrate test vme.py b/script/tests/tests/Collimator Tests/Calibrate test vme/Calibrate test vme.py new file mode 100644 index 0000000..d47c358 --- /dev/null +++ b/script/tests/tests/Collimator Tests/Calibrate test vme/Calibrate test vme.py @@ -0,0 +1,136 @@ +#Script imported from: Calibrate.xml + +###### DO NOT MODIFY THE CODE BELOW ###### +import sys, inspect, os, traceback, time +global print_log, sendFeedback +def startTest(testName, DEVICE, params): + try: + import traceback + #get the path of this script + testPath = inspect.getfile(inspect.currentframe()) + #by default, failed + ret = 'Test failed' + success = False + #plot name to be given to the scan. Use: scan.setPlotTitle(plotName) + plotName = DEVICE + ' - ' + testName +####### WRITE YOUR CODE HERE BELOW ####### + + #Pre-actions + try: + caput(DEVICE+':INIT.PROC', '1') + except: + ret = 'Unable to create channel - ' + traceback.format_exc() + success = False + sendFeedback(testPath, testName, DEVICE, ret, success) + return + + #TODO: Set the diplay names of positioners and detectors + scan = ManualScan(['id000000'], ['id000001', 'id000002', 'id000003', 'id000004', 'id000005', 'id000006', 'id000007', 'id000008', 'id000009', 'id000010', 'idResult'] , [0.0], [1000.0], [1000]) + scan.start() + + #Creating channels: dimension 1 + #PseudoPositioner id000000 + #ScalarDetector id000001 + id000001 = Channel(DEVICE+':MOTOR.MSTA', type = 'd') + #ScalarDetector id000002 + id000002 = Channel(DEVICE+':MOTOR.RVAL', type = 'd') + #ScalarDetector id000003 + id000003 = Channel(DEVICE+':MOTOR.VAL', type = 'd') + #ScalarDetector id000004 + id000004 = Channel(DEVICE+':MOTOR.ATHM', type = 'd') + #ScalarDetector id000005 + id000005 = Channel(DEVICE+':MOTOR.LLS', type = 'd') + #ScalarDetector id000006 + id000006 = Channel(DEVICE+':MOTOR.HLS', type = 'd') + #ScalarDetector id000007 + id000007 = Channel(DEVICE+':ENCODERraw', type = 'd') + #ScalarDetector id000008 + id000008 = Channel(DEVICE+':ENCODER', type = 'd') + #ScalarDetector id000009 + id000009 = Channel(DEVICE+':RDY', type = 'd') + #ScalarDetector id000010 + id000010 = Channel(DEVICE+':ILK', type = 'd') + + #Dimension 1 + #PseudoPositioner id000000 + for setpoint1 in range(0, 1000): + readback1 = setpoint1 + sleep( 0.05 ) # Settling time + #Detector id000001 + detector1 = id000001.get() + #Detector id000002 + detector2 = id000002.get() + #Detector id000003 + detector3 = id000003.get() + #Detector id000004 + detector4 = id000004.get() + #Detector id000005 + detector5 = id000005.get() + #Detector id000006 + detector6 = id000006.get() + #Detector id000007 + detector7 = id000007.get() + #Detector id000008 + detector8 = id000008.get() + #Detector id000009 + detector9 = id000009.get() + #Detector id000010 + detector10 = id000010.get() + #Manipulation idResult + #Variable Mappings + ready = detector9 + interlock = detector10 + count = setpoint1 + if count < 800: + idResult = (0, "Note: the "+DEVICE+" calibration procedure did not complete.") + if ready == 1 and interlock == 1: + #print "The "+DEVICE+" drive was successfully initialised. The RDY and ILK signals indicate the drive is ready." + ret = 'Drive successfully initialised' + success = True + else: + #print "The RS calibration procedure failed. The RDY and ILK signals indicate the drive was NOT ready at the expected time (after 40s)." + ret = 'The RDY and ILK signals indicate the drive was NOT ready at the expected time (after 40s).' + success = False + scan.append ([setpoint1], [readback1], [detector1, detector2, detector3, detector4, detector5, detector6, detector7, detector8, detector9, detector10, idResult]) + + #Closing channels + id000001.close() + id000002.close() + id000003.close() + id000004.close() + id000005.close() + id000006.close() + id000007.close() + id000008.close() + id000009.close() + id000010.close() + + scan.end() +############# END OF YOUR CODE ########### +###### DO NOT MODIFY THE CODE BELOW ###### + sendFeedback(testPath, testName, DEVICE, ret, success) + except: + ret = traceback.format_exc() + success = False + sendFeedback(testPath, testName, DEVICE, ret, success) + return + +#prepare and send feedback to calling tool +def sendFeedback(testPath, testName, DEVICE, returnString, testPassed): + print_log(testName, DEVICE, 'End of test. Result:') + print_log(testName, DEVICE, 'Test path: ' + testPath) + print_log(testName, DEVICE, 'Test name: ' + testName) + print_log(testName, DEVICE, 'Device: ' + DEVICE) + print_log(testName, DEVICE, 'Test passed: ' + str(testPassed)) + print_log(testName, DEVICE, 'Return string: ' + returnString) + ret = [testPath, DEVICE, returnString, testPassed] + set_return(ret) + +def print_log(testName, DEVICE, text): + time.ctime() + now = time.strftime('%Y.%m.%d %H:%M:%S') + print now + ' ' + DEVICE + ' - ' + testName + ': ' + text + +#launch the test +startTest(test, device, parameters) + \ No newline at end of file diff --git a/script/tests/tests/Collimator Tests/Calibrate/.config b/script/tests/tests/Collimator Tests/Calibrate/.config new file mode 100644 index 0000000..5e59d3d --- /dev/null +++ b/script/tests/tests/Collimator Tests/Calibrate/.config @@ -0,0 +1,12 @@ +name=Calibrate +description=Calibrates the device +filename=Calibrate.xml +help = \ +This test sends a command to the low level firmware which controls the collimators \n\ +requesting that it calibrates itself. \n\n\ +Calibration involves moving to the R1 and R2 reference positions and measuring the \n\ +number of steps required to do so. At the end of the sequence the default collimator \n\ +will be selected. \n\n\ +During the course of the expected calibration period (45-70 seconds) the test \n\ +procedure will plot the values of all critical system variables. \n\n\ +For further information please consult Valery Ovinnikov.
\ diff --git a/script/tests/tests/Collimator Tests/Calibrate/Calibrate.py b/script/tests/tests/Collimator Tests/Calibrate/Calibrate.py new file mode 100644 index 0000000..8bb4faa --- /dev/null +++ b/script/tests/tests/Collimator Tests/Calibrate/Calibrate.py @@ -0,0 +1,79 @@ +#Script imported from: Calibrate.xml + +ret = 'Calibration failed' +success = False + +try: + #Pre-actions: 1 = calibrate + caput(DEVICE+':COM:2', 1) + #Creating channels: dimension 1 + #PseudoPositioner id000000 + #ScalarDetector id000001 + id000001 = Channel(DEVICE+':STA:1', type = 'd') + #ScalarDetector id000003 + id000003 = Channel(DEVICE+':IST:2', type = 'd') + #ScalarDetector id000004 + id000004 = Channel(DEVICE+':DIAM:2', type = 'd') + #ScalarDetector id000005 + id000005 = Channel(DEVICE+':IST1:1', type = 'd') + #ScalarDetector id000006 + id000006 = Channel(DEVICE+':IST1:2', type = 'd') + #ScalarDetector id000007 + id000007 = Channel(DEVICE+':IST2:1', type = 'd') + #ScalarDetector id000008 + id000008 = Channel(DEVICE+':IST2:2', type = 'd') + #ScalarDetector id000009 + id000009 = Channel(DEVICE+':IST3:1', type = 'd') + #ScalarDetector id000010 + id000010 = Channel(DEVICE+':IST3:2', type = 'd') +except: + print "Unexpected error:", sys.exc_info()[0] + ret = 'Unable to create channel - ' + traceback.format_exc() + success = False + raise Exception('Unable to create channel - ' + traceback.format_exc()) + sys.exit() + +#TODO: Set the diplay names of positioners and detectors +scan = ManualScan(['id000000'], ['id000001', 'id000003', 'id000004', 'id000005', 'id000006', 'id000007', 'id000008', 'id000009', 'id000010'] , [0.0], [900.0], [900]) +scan.start() + +#Dimension 1 +#PseudoPositioner id000000 +for setpoint1 in range(0, 900): + readback1 = setpoint1 + sleep( 0.1 ) # Settling time + #Detector id000001 + detector1 = id000001.get() + #Detector id000003 + detector2 = id000003.get() + #Detector id000004 + detector3 = id000004.get() + #Detector id000005 + detector4 = id000005.get() + #Detector id000006 + detector5 = id000006.get() + #Detector id000007 + detector6 = id000007.get() + #Detector id000008 + detector7 = id000008.get() + #Detector id000009 + detector8 = id000009.get() + #Detector id000010 + detector9 = id000010.get() + scan.append ([setpoint1], [readback1], [detector1, detector2, detector3, detector4, detector5, detector6, detector7, detector8, detector9]) + +#Closing channels +id000001.close() +id000003.close() +id000004.close() +id000005.close() +id000006.close() +id000007.close() +id000008.close() +id000009.close() +id000010.close() + +scan.end() + +ret = 'Calibration done' +success = True diff --git a/script/tests/tests/Collimator Tests/Calibrate/Calibrate.xml b/script/tests/tests/Collimator Tests/Calibrate/Calibrate.xml new file mode 100644 index 0000000..7e5028f --- /dev/null +++ b/script/tests/tests/Collimator Tests/Calibrate/Calibrate.xml @@ -0,0 +1,61 @@ + + + + + + + + + + + 900 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/script/tests/tests/Collimator Tests/Check Status/.config b/script/tests/tests/Collimator Tests/Check Status/.config new file mode 100644 index 0000000..15def22 --- /dev/null +++ b/script/tests/tests/Collimator Tests/Check Status/.config @@ -0,0 +1,5 @@ +name=Check Status +description=Monitors the success of the device +filename=Check Status.xml +help= \ +This test plots the success of all relevant drive signals for a period of 15 seconds. diff --git a/script/tests/tests/Collimator Tests/Check Status/Check Status.xml b/script/tests/tests/Collimator Tests/Check Status/Check Status.xml new file mode 100644 index 0000000..b9371fe --- /dev/null +++ b/script/tests/tests/Collimator Tests/Check Status/Check Status.xml @@ -0,0 +1,67 @@ + + + + + + + 3000 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/script/tests/tests/Collimator Tests/Drive Out/.config b/script/tests/tests/Collimator Tests/Drive Out/.config new file mode 100644 index 0000000..3589d0d --- /dev/null +++ b/script/tests/tests/Collimator Tests/Drive Out/.config @@ -0,0 +1,3 @@ +name=Drive Out +description=Drives the Collimator to the Out Position +filename=Drive Out.xml \ No newline at end of file diff --git a/script/tests/tests/Collimator Tests/Drive Out/Drive Out.py b/script/tests/tests/Collimator Tests/Drive Out/Drive Out.py new file mode 100644 index 0000000..704a950 --- /dev/null +++ b/script/tests/tests/Collimator Tests/Drive Out/Drive Out.py @@ -0,0 +1,82 @@ +#Script imported from: Drive Out.xml +import traceback + +#by default, failed +ret = 'Test failed' +success = False + +try: + #Pre-actions: 2 = drive out + caput(DEVICE+':COM:2', 2) + #Creating channels: dimension 1 + #PseudoPositioner id000000 + #ScalarDetector id000001 + id000001 = Channel(DEVICE+':STA:1', type = 'd') + #ScalarDetector id000003 + id000003 = Channel(DEVICE+':IST:2', type = 'd') + #ScalarDetector id000004 + id000004 = Channel(DEVICE+':DIAM:2', type = 'd') + #ScalarDetector id000005 + id000005 = Channel(DEVICE+':IST1:1', type = 'd') + #ScalarDetector id000006 + id000006 = Channel(DEVICE+':IST1:2', type = 'd') + #ScalarDetector id000007 + id000007 = Channel(DEVICE+':IST2:1', type = 'd') + #ScalarDetector id000008 + id000008 = Channel(DEVICE+':IST2:2', type = 'd') + #ScalarDetector id000009 + id000009 = Channel(DEVICE+':IST3:1', type = 'd') + #ScalarDetector id000010 + id000010 = Channel(DEVICE+':IST3:2', type = 'd') +except: + print "Unexpected error:", sys.exc_info()[0] + ret = 'Unable to create channel - ' + traceback.format_exc() + success = False + raise Exception('Unable to create channel - ' + traceback.format_exc()) + sys.exit() + +#TODO: Set the diplay names of positioners and detectors +scan = ManualScan(['id000000'], ['id000001', 'id000003', 'id000004', 'id000005', 'id000006', 'id000007', 'id000008', 'id000009', 'id000010'] , [0.0], [3000.0], [3000]) +scan.start() + +#Dimension 1 +#PseudoPositioner id000000 +for setpoint1 in range(0, 3000): + readback1 = setpoint1 + sleep( 0.1 ) # Settling time + #Detector id000001 + detector1 = id000001.get() + #Detector id000003 + detector2 = id000003.get() + #Detector id000004 + detector3 = id000004.get() + #Detector id000005 + detector4 = id000005.get() + #Detector id000006 + detector5 = id000006.get() + #Detector id000007 + detector6 = id000007.get() + #Detector id000008 + detector7 = id000008.get() + #Detector id000009 + detector8 = id000009.get() + #Detector id000010 + detector9 = id000010.get() + scan.append ([setpoint1], [readback1], [detector1, detector2, detector3, detector4, detector5, detector6, detector7, detector8, detector9]) + +#Closing channels +id000001.close() +id000003.close() +id000004.close() +id000005.close() +id000006.close() +id000007.close() +id000008.close() +id000009.close() +id000010.close() + +scan.end() + +#return ok +ret = 'Slides moved out' +success = True \ No newline at end of file diff --git a/script/tests/tests/Collimator Tests/Drive Out/Drive Out.xml b/script/tests/tests/Collimator Tests/Drive Out/Drive Out.xml new file mode 100644 index 0000000..5a1c925 --- /dev/null +++ b/script/tests/tests/Collimator Tests/Drive Out/Drive Out.xml @@ -0,0 +1,61 @@ + + + + + + + + + + + 3000 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/script/tests/tests/Collimator Tests/Go to specific position/.config b/script/tests/tests/Collimator Tests/Go to specific position/.config new file mode 100644 index 0000000..59cbf88 --- /dev/null +++ b/script/tests/tests/Collimator Tests/Go to specific position/.config @@ -0,0 +1,7 @@ +name=Go to specific position +description=Go to absolute position A, then move +B steps, then -2B steps, then +2Bsteps (ie oscillate round centre position, logging after each movement); repeat N times + + +#optional parameters. Description is compulsory. Syntax& +#parameters=&&[;&&] +parameters=repeatTimes&2&Repeat N times;midPoint&41.0&Middle point A;spanFromMidPoint&3.0&B steps around middle point A;delayS&0&Delay between each oscillation [s] diff --git a/script/tests/tests/Collimator Tests/Go to specific position/Go to specific position.py b/script/tests/tests/Collimator Tests/Go to specific position/Go to specific position.py new file mode 100644 index 0000000..18616d1 --- /dev/null +++ b/script/tests/tests/Collimator Tests/Go to specific position/Go to specific position.py @@ -0,0 +1,162 @@ + +#Go to absolute position A, then move +B steps, then -2B steps, then +2Bsteps (ie oscillate round centre position, logging after each movement); repeat N times + + +###### DO NOT MODIFY THE CODE BELOW ###### +global print_log, sendFeedback, inspect +import sys, inspect, os, traceback + +def print_log(testName, DEVICE, text): + time.ctime() + now = time.strftime('%Y.%m.%d %H:%M:%S') + print now + ' ' + DEVICE + ' - ' + testName + ': ' + str(text) + +#prepare and send feedback to calling tool +def sendFeedback(testPath, testName, DEVICE, returnString, testPassed): + print_log(testName, DEVICE, 'End of test. Result:') + print_log(testName, DEVICE, 'Device: ' + DEVICE) + print_log(testName, DEVICE, 'Test name: ' + testName) + print_log(testName, DEVICE, 'Test path: ' + testPath) + print_log(testName, DEVICE, 'Test passed: ' + str(testPassed)) + print_log(testName, DEVICE, 'Return string: ' + returnString) + ret = [testPath, DEVICE, returnString, testPassed] + set_return(ret) + +def startTest(testName, DEVICE, params): + try: + import traceback + #get the path of this script + testPath = inspect.getfile(inspect.currentframe()) + #by default, failed + ret = 'Test failed' + success = False + #plot name to be given to the scan. Use: scan.setPlotTitle(plotName) + plotName = DEVICE + ' - ' + testName + +###### WRITE YOUR CODE HERE BELOW ####### + + #get parameters from the calling interface + try: + print_log(testName, DEVICE, "Running test Motor Test 2 for device " + DEVICE + " with the following parameters:\n" + str(params)) + middle = float(params["midPoint"]["value"]) + loopTimes = int(params["repeatTimes"]["value"]) + delayS = int(params["delayS"]["value"]) + if(delayS<1): delayS=1 + span = float(params["spanFromMidPoint"]["value"]) + except: + ret = 'Could not retrieve testing parameters - ' + traceback.format_exc() + success = False + sendFeedback(testPath, testName, DEVICE, ret, success) + return + + #scan = ManualScan(['idX'], ['idMotorStatus', 'idLogicalPosition', 'idDiameter', 'idMotorPosition', 'idPotiRaw', 'idEncoderPosition', 'idBtvsRaw', 'idBtvsProc', 'idDiff01', 'idDiff02'] , [ 0.0], [ 3000.0], [20]) + scan = ManualScan(['idX'], ['idMotorStatus', 'idMotorPosition', 'idEncoderPosition', 'idError']) + scan.setPlotTitle(plotName) + scan.start() + + #Creating channels: dimension 1 + try: + idInkr = Channel(DEVICE+':MOTOR.VAL', type = 'd') + idMotorStatus = Channel(DEVICE+':MOTOR.MSTA', type = 'd') + idMotorPosition = Channel(DEVICE+':MOTOR.RBV', type = 'd') + idEncoderPosition = Channel(DEVICE+':ENCODER', type = 'd') + idEndSwitchL = Channel(DEVICE+':MOTOR.LLS', type = 'd') + idEndSwitchH = Channel(DEVICE+':MOTOR.HLS', type = 'd') + idLimitH = Channel(DEVICE+':MOTOR.HLM', type = 'd') + idLimitL = Channel(DEVICE+':MOTOR.LLM', type = 'd') + except: + ret = 'Unable to create channel - ' + traceback.format_exc() + success = False + sendFeedback(testPath, testName, DEVICE, ret, success) + return + + #remove limits + idLimitH.put(999999.9, timeout=None) + idLimitL.put(-999999.9, timeout=None) + + direction = 1.0 + startDefault = middle - span + endDefault = middle + span + end = endDefault+1 + #find position: it will be the middle point of the test + print_log(testName, DEVICE, 'Moving to middle point ' + str(middle) ) + idInkr.put(middle, timeout=None) # TODO: Set appropriate timeout + readback2 = idInkr.get() + if abs(readback2 - middle) > 1 : # TODO: Check accuracy + ret = 'Actor idInkr could not be set to the value ' + str(middle) + ' (current value: ' + str(readback2) + ')' + success = False + sendFeedback(testPath, testName, DEVICE, ret, success) + return + start = readback2+direction + countSteps = 0 + count = 0 + print_log(testName, DEVICE, 'Moving around middle point (+-' + str(span) + ')' ) + for setpoint1 in range(0, loopTimes*2): + count = count + 1 + print_log(testName, DEVICE, 'Pausing ' + str(delayS) + 's' ) + sleep( delayS ) # Settling time + #RegionPositioner idInkr + for setpoint2 in frange(start, end, direction): + readback1 = setpoint1 + idInkr.put(setpoint2, timeout=None) # TODO: Set appropriate timeout + sleep( 0.2 ) # Settling time + 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 + sendFeedback(testPath, testName, DEVICE, ret, success) + return + #Detector idMotorStatus + detector1 = idMotorStatus.get() + detector4 = idMotorPosition.get() + detector6 = idEncoderPosition.get() + endH = idEndSwitchH.get() + endL = idEndSwitchL.get() + #Manipulation idDiff01 + #Variable Mappings + a = detector4 + b = detector6 + idDiff01 = a-b + countSteps = countSteps + 1 + scan.append ([countSteps], [countSteps], [detector1, detector4, detector6, idDiff01]) + if endH>0.0 or (direction > 0.0 and setpoint2 >= end -1): + #invert direction and swap start with end of translation + end = startDefault-1 + start = setpoint2 - direction + direction = -1.0 + print_log(testName, DEVICE, 'End of span (' + str(setpoint2) + '), changing direction to ' + str(direction) ) + break + if endL>0.0 or ( direction < 0.0 and setpoint2 <= end +1): + #invert direction and swap start with end of translation + end = endDefault+1 + start = setpoint2 - direction + direction = 1.0 + print_log(testName, DEVICE, 'End of span (' + str(setpoint2) + '), 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() + idMotorStatus.close() + idMotorPosition.close() + idEncoderPosition.close() + idLimitH.close() + idLimitL.close() + scan.end() + ret = 'Slide moved back and forth (' + str(count) + ' runs)' + success = True + +############# END OF YOUR CODE ########### +###### DO NOT MODIFY THE CODE BELOW ###### + sendFeedback(testPath, testName, DEVICE, ret, success) + except: + ret = traceback.format_exc() + success = False + sendFeedback(testPath, testName, DEVICE, ret, success) + return + +#launch the test +startTest(test, device, parameters) diff --git a/script/tests/tests/Collimator Tests/Go to specific position/help.html b/script/tests/tests/Collimator Tests/Go to specific position/help.html new file mode 100644 index 0000000..8aac8f3 --- /dev/null +++ b/script/tests/tests/Collimator Tests/Go to specific position/help.html @@ -0,0 +1,16 @@ + + +

Short Description

+Oscillate around a specific position +

Details

+Go to absolute position A, then move +B steps, then -2B steps, then +2Bsteps (ie oscillate round centre position, logging after each movement); repeat N times +

Parameters

+midPoint Middle point A around which it will oscillate
+spanFromMidPoint B stepst to oscillate around A
+repeatTimes Repeat the moving N times
+delayS Pause delay (>0s) between each oscillation [s] +

Contact

+Marco Boccioli + + + diff --git a/script/tests/tests/Collimator Tests/Initialise/.config b/script/tests/tests/Collimator Tests/Initialise/.config new file mode 100644 index 0000000..2f02383 --- /dev/null +++ b/script/tests/tests/Collimator Tests/Initialise/.config @@ -0,0 +1,8 @@ +name=Initialise +description=Initialises the motor +help = \ +This test sends a INIT command to the device, as many times as configured with the parameter RepeatTimes. + +#optional parameters. Description is compulsory. Syntax& +#parameters=&&[;&&] +parameters=repeatTimes&2&Repeat N times;delayS&4&Delay between each initialisation [s] \ No newline at end of file diff --git a/script/tests/tests/Collimator Tests/Initialise/Initialise.py b/script/tests/tests/Collimator Tests/Initialise/Initialise.py new file mode 100644 index 0000000..b5dfa0b --- /dev/null +++ b/script/tests/tests/Collimator Tests/Initialise/Initialise.py @@ -0,0 +1,129 @@ + + + +###### DO NOT MODIFY THE CODE BELOW ###### +global print_log, sendFeedback, inspect +import sys, inspect, os, traceback + +def print_log(testName, DEVICE, text): + time.ctime() + now = time.strftime('%Y.%m.%d %H:%M:%S') + print now + ' ' + DEVICE + ' - ' + testName + ': ' + str(text) + +#prepare and send feedback to calling tool +def sendFeedback(testPath, testName, DEVICE, returnString, testPassed): + print_log(testName, DEVICE, 'End of test. Result:') + print_log(testName, DEVICE, 'Device: ' + DEVICE) + print_log(testName, DEVICE, 'Test name: ' + testName) + print_log(testName, DEVICE, 'Test path: ' + testPath) + print_log(testName, DEVICE, 'Test passed: ' + str(testPassed)) + print_log(testName, DEVICE, 'Return string: ' + returnString) + ret = [testPath, DEVICE, returnString, testPassed] + set_return(ret) + +def startTest(testName, DEVICE, params): + try: + import traceback + #get the path of this script + testPath = inspect.getfile(inspect.currentframe()) + #by default, failed + ret = 'Test failed' + success = False + #plot name to be given to the scan. Use: scan.setPlotTitle(plotName) + plotName = DEVICE + ' - ' + testName + +###### WRITE YOUR CODE HERE BELOW ####### + + #Pre-actions + # try: + # caput(DEVICE+':INIT.PROC', '1') + # except: + # ret = 'Unable to create channel - ' + traceback.format_exc() + # success = False + # sendFeedback(testPath, testName, DEVICE, ret, success) + # return + + + #get parameters from the calling interface + try: + print_log(testName, DEVICE, "Running test Initialise with the following parameters:") + print_log(testName, DEVICE, params ) + loopTimes = int(params["repeatTimes"]["value"]) + delaySeconds = int(params["delayS"]["value"]) + except: + ret = 'Could not retrieve testing parameters - ' + traceback.format_exc() + success = False + sendFeedback(testPath, testName, DEVICE, ret, success) + return + + scan = ManualScan(['idX'], ['idMotorPosition', 'idEncoderPosition', 'idError'] ) + scan.setPlotTitle(plotName) + scan.start() + #Creating channels: dimension 1 + try: + idInit = Channel(DEVICE+':INIT.PROC', type = 'l') + idReady = Channel(DEVICE+':RDY', type = 'l') + idInterlock = Channel(DEVICE+':ILK', type = 'l') + idMotorPosition = Channel(DEVICE+':MOTOR.RBV', type = 'd') + idEncoderPosition = Channel(DEVICE+':ENCODER', type = 'd') + except: + ret = 'Unable to create channel - ' + traceback.format_exc() + success = False + sendFeedback(testPath, testName, DEVICE, ret, success) + return + + count = 0 + timeout = 90000 #timeout in ms + for count in range(1, loopTimes+1): + print_log(testName, DEVICE, 'Initialisation #' + str(count) + '/' + str(loopTimes)) + idInit.put(1, timeout=None) # TODO: Set appropriate timeout + timeStampStart = float(java.lang.System.currentTimeMillis()) + sleep(0.1) + ready = 0 + interlock = idInterlock.get() + timeElapsed = 0 #in ms + while (ready == 0) and timeElapsed + +

Short Description

+Initialise N times. +

Details

+This test sends a INIT command to the device, as many times as configured with the parameter repeatTimes. +

Parameters

+repeatTimes Repeat the Initialisation N times
+delayS Pause delay between each Initialisation [s] +

Contact

+Marco Boccioli + + + diff --git a/script/tests/tests/Collimator Tests/Motor Test 1/.config b/script/tests/tests/Collimator Tests/Motor Test 1/.config new file mode 100644 index 0000000..82f7ba0 --- /dev/null +++ b/script/tests/tests/Collimator Tests/Motor Test 1/.config @@ -0,0 +1,7 @@ +name=Motor Test 1 +description=Moves to CW switch then CCW switch N times. + + +#optional parameters. Description is compulsory. Syntax& +#parameters=&&[;&&] +parameters=repeatTimes&1&Repeat N times;delayS&5&Pause delay [s] diff --git a/script/tests/tests/Collimator Tests/Motor Test 1/Motor Test 1 - Copy.py b/script/tests/tests/Collimator Tests/Motor Test 1/Motor Test 1 - Copy.py new file mode 100644 index 0000000..d228bb4 --- /dev/null +++ b/script/tests/tests/Collimator Tests/Motor Test 1/Motor Test 1 - Copy.py @@ -0,0 +1,154 @@ +#Script Motor Test 1 +#Moves to CCW switch; then for M times moves N times to CW switch then CCW switch; between each M pauses for delay; log at CCW and CW + +import traceback + +#by default, failed +ret = 'Test failed' +success = False +DEVICE = device +params = parameters +#DEVICE = 'PO2DV-NCS-LS' +#get parameters from the calling interface +try: + print "Running test Motor Test 1 with the following parameters:" + print params + loopTimes = int(params["repeatTimes"]["value"]) + delaySeconds = int(params["delayS"]["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]) +scan.start() +#Creating channels: dimension 1 +try: + #RegionPositioner idInkr + #idInkr = Channel(DEVICE+':INKR:2', type = 'd') + idInkr = Channel(DEVICE+':MOTOR.VAL', type = 'd') + #ScalarDetector idMotorStatus + #idMotorStatus = Channel(DEVICE+':STA:1', type = 'd') + idMotorStatus = Channel(DEVICE+':MOTOR.MSTA', type = 'd') + #ScalarDetector idLogicalPosition + #idLogicalPosition = Channel(DEVICE+':IST:2', 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.RBV', type = 'd') + #ScalarDetector idPotiRaw + #idPotiRaw = Channel(DEVICE+':POSA:1', type = 'd') + idPotiRaw = Channel(DEVICE+':ENCODERraw', type = 'd') + #ScalarDetector idPotiProc + #idPotiProc = Channel(DEVICE+':POSA:2', type = 'd') + idPotiProc = Channel(DEVICE+':ENCODER', type = 'd') + #ScalarDetector idBtvsRaw + #idBtvsRaw = Channel(DEVICE+':IST3:1', type = 'd') + idBtvsRaw = Channel(DEVICE+':MOTOR.LLS', type = 'd') + #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 Exception('Unable to create channel - ' + traceback.format_exc()) + sys.exit() + +#remove limits +idLimitH.put(999999.9, timeout=None) +idLimitL.put(-999999.9, timeout=None) +#Dimension 1 +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 +print 'Homing' +idInkr.put(-100.0, timeout=None) # TODO: Set appropriate timeout +start = startDefault #idInkr.get()+direction +setpoint2 = end +count = 0 +print 'Starting test sequence' +for setpoint1 in range(0, loopTimes*2): + sleep( delaySeconds ) # Settling time + #RegionPositioner idInkr + 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 + idDiff02 = a-b + #Manipulation idDiff01 + #Variable Mappings + a = detector4 + b = detector6 + count = count + 1 + idDiff01 = a-b + if endH>0.0 : + #invert direction and swap start with end of translation + setpoint2 = start + print 'End H switch, changing target to ' + str(setpoint2) + scan.append ([setpoint2], [readback2], [detector1, detector2, detector3, detector4, detector5, detector6, detector7, detector8, idDiff02, idDiff01]) + if endL>0.0 : + #invert direction and swap start with end of translation + setpoint2 = end + print 'End L switch, changing target to ' + str(setpoint2) + scan.append ([setpoint2], [readback2], [detector1, detector2, detector3, detector4, detector5, detector6, detector7, detector8, idDiff02, idDiff01]) + +#set limits back +idLimitH.put(145.0, timeout=None) +idLimitL.put(0.0, timeout=None) +#Closing channels +idInkr.close() +idMotorStatus.close() +idLogicalPosition.close() +idDiameter.close() +idMotorPosition.close() +idPotiRaw.close() +idPotiProc.close() +idBtvsRaw.close() +idBtvsProc.close() +scan.end() +ret = 'Slide moved back and forth (' + str(count) + ' runs)' +success = True diff --git a/script/tests/tests/Collimator Tests/Motor Test 1/Motor Test 1.py b/script/tests/tests/Collimator Tests/Motor Test 1/Motor Test 1.py new file mode 100644 index 0000000..95dcf4d --- /dev/null +++ b/script/tests/tests/Collimator Tests/Motor Test 1/Motor Test 1.py @@ -0,0 +1,192 @@ +#Script Motor Test 1 +#Moves to CCW switch; then for M times moves N times to CW switch then CCW switch; between each M pauses for delay; log at CCW and CW + +###### DO NOT MODIFY THE CODE BELOW ###### +import sys, inspect, os, traceback, time +global print_log, sendFeedback + +#prepare and send feedback to calling tool +def sendFeedback(testPath, testName, DEVICE, returnString, testPassed): + print_log(testName, DEVICE, 'End of test. Result:') + print_log(testName, DEVICE, 'Test path: ' + testPath) + print_log(testName, DEVICE, 'Test name: ' + testName) + print_log(testName, DEVICE, 'Device: ' + DEVICE) + print_log(testName, DEVICE, 'Test passed: ' + str(testPassed)) + print_log(testName, DEVICE, 'Return string: ' + returnString) + ret = [testPath, DEVICE, returnString, testPassed] + set_return(ret) + +def print_log(testName, DEVICE, text): + time.ctime() + now = time.strftime('%Y.%m.%d %H:%M:%S') + print now + ' ' + DEVICE + ' - ' + testName + ': ' + str(text) + +def startTest(testName, DEVICE, params): + try: + import traceback + #get the path of this script + testPath = inspect.getfile(inspect.currentframe()) + #by default, failed + ret = 'Test failed' + success = False + #plot name to be given to the scan. Use: scan.setPlotTitle(plotName) + plotName = DEVICE + ' - ' + testName + +####### WRITE YOUR CODE HERE BELOW ######## + + #DEVICE = 'PO2DV-NCS-LS' + #get parameters from the calling interface + try: + print_log(testName, DEVICE, "Running test Motor Test 1 with the following parameters:") + print_log(testName, DEVICE, params ) + loopTimes = int(params["repeatTimes"]["value"]) + delaySeconds = int(params["delayS"]["value"]) + except: + ret = 'Could not retrieve testing parameters - ' + traceback.format_exc() + success = False + sendFeedback(testPath, testName, DEVICE, ret, success) + return + + #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.setPlotTitle(plotName) + scan.start() + #Creating channels: dimension 1 + try: + #RegionPositioner idInkr + #idInkr = Channel(DEVICE+':INKR:2', type = 'd') + idInkr = Channel(DEVICE+':MOTOR.VAL', type = 'd') + #ScalarDetector idMotorStatus + #idMotorStatus = Channel(DEVICE+':STA:1', type = 'd') + idMotorStatus = Channel(DEVICE+':MOTOR.MSTA', type = 'd') + #ScalarDetector idLogicalPosition + #idLogicalPosition = Channel(DEVICE+':IST:2', 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.RBV', type = 'd') + #ScalarDetector idPotiRaw + #idPotiRaw = Channel(DEVICE+':POSA:1', type = 'd') + idPotiRaw = Channel(DEVICE+':ENCODERraw', type = 'd') + #ScalarDetector idPotiProc + #idPotiProc = Channel(DEVICE+':POSA:2', type = 'd') + idPotiProc = Channel(DEVICE+':ENCODER', type = 'd') + #ScalarDetector idBtvsRaw + #idBtvsRaw = Channel(DEVICE+':IST3:1', type = 'd') + idBtvsRaw = Channel(DEVICE+':MOTOR.LLS', type = 'd') + #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: + ret = 'Unable to create channel - ' + traceback.format_exc() + success = False + sendFeedback(testPath, testName, DEVICE, ret, success) + return + + #remove limits + idLimitH.put(999999.9, timeout=None) + idLimitL.put(-999999.9, timeout=None) + #Dimension 1 + 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 + print_log(testName, DEVICE, 'Homing') + idInkr.put(-100.0, timeout=None) # TODO: Set appropriate timeout + start = startDefault #idInkr.get()+direction + setpoint2 = end + count = 0 + print_log(testName, DEVICE, 'Starting test sequence') + for setpoint1 in range(0, loopTimes*2): + sleep( delaySeconds ) # Settling time + #RegionPositioner idInkr + 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 + idDiff02 = a-b + #Manipulation idDiff01 + #Variable Mappings + a = detector4 + b = detector6 + count = count + 1 + idDiff01 = a-b + if endH>0.0 : + #invert direction and swap start with end of translation + setpoint2 = start + print_log(testName, DEVICE, 'End H switch, changing target to ' + str(setpoint2)) + scan.append ([setpoint2], [readback2], [detector1, detector2, detector3, detector4, detector5, detector6, detector7, detector8, idDiff02, idDiff01]) + if endL>0.0 : + #invert direction and swap start with end of translation + setpoint2 = end + print_log(testName, DEVICE, 'End L switch, changing target to ' + str(setpoint2)) + scan.append ([setpoint2], [readback2], [detector1, detector2, detector3, detector4, detector5, detector6, detector7, detector8, idDiff02, idDiff01]) + + #set limits back + idLimitH.put(145.0, timeout=None) + idLimitL.put(0.0, timeout=None) + #Closing channels + idInkr.close() + idMotorStatus.close() + idLogicalPosition.close() + idDiameter.close() + idMotorPosition.close() + idPotiRaw.close() + idPotiProc.close() + idBtvsRaw.close() + idBtvsProc.close() + scan.end() + ret = 'Slide moved back and forth (' + str(count) + ' runs)' + success = True + +############# END OF YOUR CODE ########### +###### DO NOT MODIFY THE CODE BELOW ###### + sendFeedback(testPath, testName, DEVICE, ret, success) + except: + ret = traceback.format_exc() + success = False + sendFeedback(testPath, testName, DEVICE, ret, success) + return + +#launch the test +startTest(test, device, parameters) \ No newline at end of file diff --git a/script/tests/tests/Collimator Tests/Motor Test 1/help.html b/script/tests/tests/Collimator Tests/Motor Test 1/help.html new file mode 100644 index 0000000..87b5e83 --- /dev/null +++ b/script/tests/tests/Collimator Tests/Motor Test 1/help.html @@ -0,0 +1,14 @@ + + +

Short Description

+Moves to CW switch then CCW switch N times. +

Details

+Moves to CW switch then CCW switch N times. +

Parameters

+repeatTimes Repeat the moving N times
+delayS Pause delay between each repetition [s] +

Contact

+Marco Boccioli + + + diff --git a/script/tests/tests/Collimator Tests/Motor Test 2/.config b/script/tests/tests/Collimator Tests/Motor Test 2/.config new file mode 100644 index 0000000..5eae050 --- /dev/null +++ b/script/tests/tests/Collimator Tests/Motor Test 2/.config @@ -0,0 +1,7 @@ +name=Motor Test 2 +description=Go to absolute position A, then move +B steps, then -2B steps, then +2Bsteps (ie oscillate round centre position, logging after each movement); repeat N times + + +#optional parameters. Description is compulsory. Syntax& +#parameters=&&[;&&] +parameters=repeatTimes&1&Repeat N times;midPoint&41.0&Middle point A;spanFromMidPoint&2.0&B steps around middle point A diff --git a/script/tests/tests/Collimator Tests/Motor Test 2/Motor Test 2.py b/script/tests/tests/Collimator Tests/Motor Test 2/Motor Test 2.py new file mode 100644 index 0000000..b5ca1ad --- /dev/null +++ b/script/tests/tests/Collimator Tests/Motor Test 2/Motor Test 2.py @@ -0,0 +1,211 @@ +#Script Motor Test 2 +#Go to absolute position A, then move +B steps, then -2B steps, then +2Bsteps (ie oscillate round centre position, logging after each movement); repeat N times + + +###### DO NOT MODIFY THE CODE BELOW ###### +import sys, inspect, os, traceback, time +global print_log, sendFeedback +def startTest(testName, DEVICE, params): + try: + import traceback + #get the path of this script + testPath = inspect.getfile(inspect.currentframe()) + #by default, failed + ret = 'Test failed' + success = False + #plot name to be given to the scan. Use: scan.setPlotTitle(plotName) + plotName = DEVICE + ' - ' + testName +####### WRITE YOUR CODE HERE BELOW ####### + + #get parameters from the calling interface + try: + print_log(testName, DEVICE, "Running test Motor Test 2 for device " + DEVICE + " with the following parameters:\n" + str(params)) + middle = float(params["midPoint"]["value"]) + loopTimes = int(params["repeatTimes"]["value"]) + span = float(params["spanFromMidPoint"]["value"]) + except: + ret = 'Could not retrieve testing parameters - ' + traceback.format_exc() + success = False + sendFeedback(testPath, testName, DEVICE, ret, success) + return + + #scan = ManualScan(['idX'], ['idMotorStatus', 'idLogicalPosition', 'idDiameter', 'idMotorPosition', 'idPotiRaw', 'idPotiProc', 'idBtvsRaw', 'idBtvsProc', 'idDiff01', 'idDiff02'] , [ 0.0], [ 3000.0], [20]) + scan = ManualScan(['idX'], ['idMotorStatus', 'idLogicalPosition', 'idDiameter', 'idMotorPosition', 'idPotiRaw', 'idPotiProc', 'idBtvsRaw', 'idBtvsProc', 'idDiff01', 'idDiff02']) + scan.setPlotTitle(plotName) + scan.start() + + #Creating channels: dimension 1 + try: + #RegionPositioner idInkr + #idInkr = Channel(DEVICE+':INKR:2', type = 'd') + idInkr = Channel(DEVICE+':MOTOR.VAL', type = 'd') + #ScalarDetector idMotorStatus + #idMotorStatus = Channel(DEVICE+':STA:1', type = 'd') + idMotorStatus = Channel(DEVICE+':MOTOR.MSTA', type = 'd') + #ScalarDetector idLogicalPosition + #idLogicalPosition = Channel(DEVICE+':IST:2', 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.RBV', type = 'd') + #ScalarDetector idPotiRaw + #idPotiRaw = Channel(DEVICE+':POSA:1', type = 'd') + idPotiRaw = Channel(DEVICE+':ENCODERraw', type = 'd') + #ScalarDetector idPotiProc + #idPotiProc = Channel(DEVICE+':POSA:2', type = 'd') + idPotiProc = Channel(DEVICE+':ENCODER', type = 'd') + #ScalarDetector idBtvsRaw + #idBtvsRaw = Channel(DEVICE+':IST3:1', type = 'd') + idBtvsRaw = Channel(DEVICE+':MOTOR.LLS', type = 'd') + #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: + ret = 'Unable to create channel - ' + traceback.format_exc() + success = False + sendFeedback(testPath, testName, DEVICE, ret, success) + return + + #remove limits + idLimitH.put(999999.9, timeout=None) + idLimitL.put(-999999.9, timeout=None) + + direction = 1.0 + startDefault = middle - span + endDefault = middle + span + end = endDefault+1 + #find position: it will be the middle point of the test + print_log(testName, DEVICE, 'Moving to middle point ' + str(middle) ) + idInkr.put(middle, timeout=None) # TODO: Set appropriate timeout + readback2 = idInkr.get() + if abs(readback2 - middle) > 1 : # TODO: Check accuracy + ret = 'Actor idInkr could not be set to the value ' + str(middle) + ' (current value: ' + str(readback2) + ')' + success = False + sendFeedback(testPath, testName, DEVICE, ret, success) + return + start = readback2+direction + countSteps = 0 + count = 0 + print_log(testName, DEVICE, 'Moving around middle point (+-' + str(span) + ')' ) + for setpoint1 in range(0, loopTimes*2): + count = count + 1 + sleep( 2 ) # Settling time + #RegionPositioner idInkr + for setpoint2 in frange(start, end, direction): + readback1 = setpoint1 + idInkr.put(setpoint2, timeout=None) # TODO: Set appropriate timeout + sleep( 0.2 ) # Settling time + 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 + sendFeedback(testPath, testName, DEVICE, ret, success) + return + #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 + idDiff02 = a-b + #Manipulation idDiff01 + #Variable Mappings + a = detector4 + b = detector6 + idDiff01 = a-b + countSteps = countSteps + 1 + scan.append ([countSteps], [countSteps], [detector1, detector2, detector3, detector4, detector5, detector6, detector7, detector8, idDiff02, idDiff01]) + if endH>0.0 or (direction > 0.0 and setpoint2 >= end -1): + #invert direction and swap start with end of translation + end = startDefault-1 + start = setpoint2 - direction + direction = -1.0 + print_log(testName, DEVICE, 'End of span (' + str(setpoint2) + '), changing direction to ' + str(direction) ) + break + if endL>0.0 or ( direction < 0.0 and setpoint2 <= end +1): + #invert direction and swap start with end of translation + end = endDefault+1 + start = setpoint2 - direction + direction = 1.0 + print_log(testName, DEVICE, 'End of span (' + str(setpoint2) + '), 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() + idMotorStatus.close() + idLogicalPosition.close() + idDiameter.close() + idMotorPosition.close() + idPotiRaw.close() + idPotiProc.close() + idBtvsRaw.close() + idBtvsProc.close() + + scan.end() + ret = 'Slide moved back and forth (' + str(count) + ' runs)' + success = True + +############# END OF YOUR CODE ########### +###### DO NOT MODIFY THE CODE BELOW ###### + sendFeedback(testPath, testName, DEVICE, ret, success) + except: + ret = traceback.format_exc() + success = False + sendFeedback(testPath, testName, DEVICE, ret, success) + return + +#prepare and send feedback to calling tool +def sendFeedback(testPath, testName, DEVICE, returnString, testPassed): + print_log(testName, DEVICE, 'End of test. Result:') + print_log(testName, DEVICE, 'Test path: ' + testPath) + print_log(testName, DEVICE, 'Test name: ' + testName) + print_log(testName, DEVICE, 'Device: ' + DEVICE) + print_log(testName, DEVICE, 'Test passed: ' + str(testPassed)) + print_log(testName, DEVICE, 'Return string: ' + returnString) + ret = [testPath, DEVICE, returnString, testPassed] + set_return(ret) + +def print_log(testName, DEVICE, text): + time.ctime() + now = time.strftime('%Y.%m.%d %H:%M:%S') + print now + ' ' + DEVICE + ' - ' + testName + ': ' + str(text) + +#launch the test +#from pshellTestGeneral import testUtils +#testUtil = testUtils() +#testUtil.print_log(test, device, "CLASSE!!!") +startTest(test, device, parameters) diff --git a/script/tests/tests/Collimator Tests/Motor Test 3 in several ms/Motor Test 3 100ms/.config b/script/tests/tests/Collimator Tests/Motor Test 3 in several ms/Motor Test 3 100ms/.config new file mode 100644 index 0000000..2b64d0a --- /dev/null +++ b/script/tests/tests/Collimator Tests/Motor Test 3 in several ms/Motor Test 3 100ms/.config @@ -0,0 +1,3 @@ +name=Motor Test 3 100ms +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 diff --git a/script/tests/tests/Collimator Tests/Motor Test 3 in several ms/Motor Test 3 100ms/Motor Test 3 - with original pv.xml b/script/tests/tests/Collimator Tests/Motor Test 3 in several ms/Motor Test 3 100ms/Motor Test 3 - with original pv.xml new file mode 100644 index 0000000..bc9aae6 --- /dev/null +++ b/script/tests/tests/Collimator Tests/Motor Test 3 in several ms/Motor Test 3 100ms/Motor Test 3 - with original pv.xml @@ -0,0 +1,74 @@ + + + + + + + 3000 + + + + + 0.0 + 10.0 + 1.0 + + + 10.0 + 0.0 + -1.0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/script/tests/tests/Collimator Tests/Motor Test 3 in several ms/Motor Test 3 100ms/Motor Test 3.xml b/script/tests/tests/Collimator Tests/Motor Test 3 in several ms/Motor Test 3 100ms/Motor Test 3.xml new file mode 100644 index 0000000..bc9aae6 --- /dev/null +++ b/script/tests/tests/Collimator Tests/Motor Test 3 in several ms/Motor Test 3 100ms/Motor Test 3.xml @@ -0,0 +1,74 @@ + + + + + + + 3000 + + + + + 0.0 + 10.0 + 1.0 + + + 10.0 + 0.0 + -1.0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/script/tests/tests/Collimator Tests/Motor Test 3 in several ms/Motor Test 3 200ms/.config b/script/tests/tests/Collimator Tests/Motor Test 3 in several ms/Motor Test 3 200ms/.config new file mode 100644 index 0000000..8058e03 --- /dev/null +++ b/script/tests/tests/Collimator Tests/Motor Test 3 in several ms/Motor Test 3 200ms/.config @@ -0,0 +1,3 @@ +name=Motor Test 3 200ms +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 diff --git a/script/tests/tests/Collimator Tests/Motor Test 3 in several ms/Motor Test 3 200ms/Motor Test 3 - with original pv.xml b/script/tests/tests/Collimator Tests/Motor Test 3 in several ms/Motor Test 3 200ms/Motor Test 3 - with original pv.xml new file mode 100644 index 0000000..bc9aae6 --- /dev/null +++ b/script/tests/tests/Collimator Tests/Motor Test 3 in several ms/Motor Test 3 200ms/Motor Test 3 - with original pv.xml @@ -0,0 +1,74 @@ + + + + + + + 3000 + + + + + 0.0 + 10.0 + 1.0 + + + 10.0 + 0.0 + -1.0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/script/tests/tests/Collimator Tests/Motor Test 3 in several ms/Motor Test 3 200ms/Motor Test 3.xml b/script/tests/tests/Collimator Tests/Motor Test 3 in several ms/Motor Test 3 200ms/Motor Test 3.xml new file mode 100644 index 0000000..bc9aae6 --- /dev/null +++ b/script/tests/tests/Collimator Tests/Motor Test 3 in several ms/Motor Test 3 200ms/Motor Test 3.xml @@ -0,0 +1,74 @@ + + + + + + + 3000 + + + + + 0.0 + 10.0 + 1.0 + + + 10.0 + 0.0 + -1.0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/script/tests/tests/Collimator Tests/Motor Test 3 in several ms/Motor Test 3 500ms/.config b/script/tests/tests/Collimator Tests/Motor Test 3 in several ms/Motor Test 3 500ms/.config new file mode 100644 index 0000000..9733dd0 --- /dev/null +++ b/script/tests/tests/Collimator Tests/Motor Test 3 in several ms/Motor Test 3 500ms/.config @@ -0,0 +1,3 @@ +name=Motor Test 3 500ms +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 diff --git a/script/tests/tests/Collimator Tests/Motor Test 3 in several ms/Motor Test 3 500ms/Motor Test 3 - with original pv.xml b/script/tests/tests/Collimator Tests/Motor Test 3 in several ms/Motor Test 3 500ms/Motor Test 3 - with original pv.xml new file mode 100644 index 0000000..bc9aae6 --- /dev/null +++ b/script/tests/tests/Collimator Tests/Motor Test 3 in several ms/Motor Test 3 500ms/Motor Test 3 - with original pv.xml @@ -0,0 +1,74 @@ + + + + + + + 3000 + + + + + 0.0 + 10.0 + 1.0 + + + 10.0 + 0.0 + -1.0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/script/tests/tests/Collimator Tests/Motor Test 3 in several ms/Motor Test 3 500ms/Motor Test 3.xml b/script/tests/tests/Collimator Tests/Motor Test 3 in several ms/Motor Test 3 500ms/Motor Test 3.xml new file mode 100644 index 0000000..bc9aae6 --- /dev/null +++ b/script/tests/tests/Collimator Tests/Motor Test 3 in several ms/Motor Test 3 500ms/Motor Test 3.xml @@ -0,0 +1,74 @@ + + + + + + + 3000 + + + + + 0.0 + 10.0 + 1.0 + + + 10.0 + 0.0 + -1.0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/script/tests/tests/Collimator Tests/Motor Test 3/.config b/script/tests/tests/Collimator Tests/Motor Test 3/.config new file mode 100644 index 0000000..79d889a --- /dev/null +++ b/script/tests/tests/Collimator Tests/Motor Test 3/.config @@ -0,0 +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 + + +#optional parameters. Description is compulsory. Syntax& +#parameters=&&[;&&] +parameters=repeatTimes&1&Repeat N times;translation&2&Translation C steps diff --git a/script/tests/tests/Collimator Tests/Motor Test 3/Motor Test 3.py b/script/tests/tests/Collimator Tests/Motor Test 3/Motor Test 3.py new file mode 100644 index 0000000..75ba927 --- /dev/null +++ b/script/tests/tests/Collimator Tests/Motor Test 3/Motor Test 3.py @@ -0,0 +1,169 @@ +#Script Motor Test 3 +#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 + +import traceback + +#by default, failed +ret = 'Test failed' +success = False +DEVICE = device +params = parameters +#get parameters from the calling interface +try: + print "Running test Motor Test 3 with the following parameters:" + print params + loopTimes = int(params["repeatTimes"]["value"]) + direction = int(params["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]) +scan.start() + +#Creating channels: dimension 1 +try: + #RegionPositioner idInkr + #idInkr = Channel(DEVICE+':INKR:2', type = 'd') + idInkr = Channel(DEVICE+':MOTOR.VAL', type = 'd') + #ScalarDetector idMotorStatus + #idMotorStatus = Channel(DEVICE+':STA:1', type = 'd') + idMotorStatus = Channel(DEVICE+':MOTOR.MSTA', type = 'd') + #ScalarDetector idLogicalPosition + #idLogicalPosition = Channel(DEVICE+':IST:2', 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.RBV', type = 'd') + #ScalarDetector idPotiRaw + #idPotiRaw = Channel(DEVICE+':POSA:1', type = 'd') + idPotiRaw = Channel(DEVICE+':ENCODERraw', type = 'd') + #ScalarDetector idPotiProc + #idPotiProc = Channel(DEVICE+':POSA:2', type = 'd') + idPotiProc = Channel(DEVICE+':ENCODER', type = 'd') + #ScalarDetector idBtvsRaw + #idBtvsRaw = Channel(DEVICE+':IST3:1', type = 'd') + idBtvsRaw = Channel(DEVICE+':MOTOR.LLS', type = 'd') + #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) + + +if direction == 0.0 : + 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 +print 'Homing' +idInkr.put(-100.0, timeout=None) # TODO: Set appropriate timeout +start = idInkr.get()+direction +countSteps = 0 +print 'Starting testing sequence' +count = 0 +for setpoint1 in range(0, loopTimes*2): + count = count + 1 + sleep( 2 ) # Settling time + #RegionPositioner idInkr + for setpoint2 in frange(start, end, direction): + readback1 = setpoint1 + idInkr.put(setpoint2, timeout=None) # TODO: Set appropriate timeout + sleep( 0.2 ) # Settling time + 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 + idDiff02 = a-b + #Manipulation idDiff01 + #Variable Mappings + a = detector4 + b = detector6 + idDiff01 = a-b + countSteps = countSteps + 1 + scan.append ([countSteps], [countSteps], [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() +idMotorStatus.close() +idLogicalPosition.close() +idDiameter.close() +idMotorPosition.close() +idPotiRaw.close() +idPotiProc.close() +idBtvsRaw.close() +idBtvsProc.close() + +scan.end() +ret = 'Slide moved back and forth (' + str(count) + ' runs)' +success = True diff --git a/script/tests/tests/Collimator Tests/Move Ref 1/.config b/script/tests/tests/Collimator Tests/Move Ref 1/.config new file mode 100644 index 0000000..895fbd5 --- /dev/null +++ b/script/tests/tests/Collimator Tests/Move Ref 1/.config @@ -0,0 +1,3 @@ +name=Move Ref 1 +description=Moves to the Reference 1 Position +filename=Move Ref 1.xml \ No newline at end of file diff --git a/script/tests/tests/Collimator Tests/Move Ref 1/Move Ref 1.xml b/script/tests/tests/Collimator Tests/Move Ref 1/Move Ref 1.xml new file mode 100644 index 0000000..5b81083 --- /dev/null +++ b/script/tests/tests/Collimator Tests/Move Ref 1/Move Ref 1.xml @@ -0,0 +1,61 @@ + + + + + + + + + + + 3000 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/script/tests/tests/Collimator Tests/Move Ref 2/.config b/script/tests/tests/Collimator Tests/Move Ref 2/.config new file mode 100644 index 0000000..2b6e946 --- /dev/null +++ b/script/tests/tests/Collimator Tests/Move Ref 2/.config @@ -0,0 +1,3 @@ +name=Move Ref 2 +description=Moves to the Reference 2 Position +filename=Move Ref 2.xml \ No newline at end of file diff --git a/script/tests/tests/Collimator Tests/Move Ref 2/Move Ref 2.xml b/script/tests/tests/Collimator Tests/Move Ref 2/Move Ref 2.xml new file mode 100644 index 0000000..2cf0a0a --- /dev/null +++ b/script/tests/tests/Collimator Tests/Move Ref 2/Move Ref 2.xml @@ -0,0 +1,61 @@ + + + + + + + + + + + 3000 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/script/tests/tests/Collimator Tests/Stop/.config b/script/tests/tests/Collimator Tests/Stop/.config new file mode 100644 index 0000000..89d5a5f --- /dev/null +++ b/script/tests/tests/Collimator Tests/Stop/.config @@ -0,0 +1,3 @@ +name=Stop +description=Sends the STOP command +filename=Stop.xml \ No newline at end of file diff --git a/script/tests/tests/Collimator Tests/Stop/Stop.xml b/script/tests/tests/Collimator Tests/Stop/Stop.xml new file mode 100644 index 0000000..27228d3 --- /dev/null +++ b/script/tests/tests/Collimator Tests/Stop/Stop.xml @@ -0,0 +1,61 @@ + + + + + + + + + + + 3000 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/script/tests/tests/Collimator Tests/Zig Zag Test/.config b/script/tests/tests/Collimator Tests/Zig Zag Test/.config new file mode 100644 index 0000000..c522777 --- /dev/null +++ b/script/tests/tests/Collimator Tests/Zig Zag Test/.config @@ -0,0 +1,4 @@ +name=Zig Zag Test +description=Moves the drive back and forth between the end-switches +filename=Zig Zag Test.xml +help = This test repetitively moves the collimator between the R1 and R2 positions. diff --git a/script/tests/tests/Collimator Tests/Zig Zag Test/Zig Zag Test.xml b/script/tests/tests/Collimator Tests/Zig Zag Test/Zig Zag Test.xml new file mode 100644 index 0000000..970032d --- /dev/null +++ b/script/tests/tests/Collimator Tests/Zig Zag Test/Zig Zag Test.xml @@ -0,0 +1,35 @@ + + + + + + + 3000 + + + + 3.0 + 4.0 + 1.0 + + + 4.0 + 4.0 + 1.0 + + + + + + + + + + + + + + + + + diff --git a/script/tests/tests/Collimator Tests/motor-slide/.config b/script/tests/tests/Collimator Tests/motor-slide/.config new file mode 100644 index 0000000..3616e40 --- /dev/null +++ b/script/tests/tests/Collimator Tests/motor-slide/.config @@ -0,0 +1,3 @@ +name=motor-slide +description=Moves the device +filename=Calibrate.xml diff --git a/script/tests/tests/Collimator Tests/motor-slide/motor-slide.py b/script/tests/tests/Collimator Tests/motor-slide/motor-slide.py new file mode 100644 index 0000000..4c4766a --- /dev/null +++ b/script/tests/tests/Collimator Tests/motor-slide/motor-slide.py @@ -0,0 +1,73 @@ +#Script imported from: PO2DV-NCS-LS_mot.xml +import traceback + +#by default, failed +ret = 'Test failed' +success = False + +#Pre-actions +try: + caput('PO2DV-NCS-LS:MOTOR.TWF', '0') + sleep(0.5) + caput('PO2DV-NCS-LS:MOTOR.RDBD', '0.1') +except: + print "Unexpected error:", sys.exc_info()[0] + ret = 'Unable to create channel - ' + traceback.format_exc() + success = False + raise + sys.exit() + +#TODO: Set the diplay names of positioners and detectors +scan = ManualScan(['VAL'], ['time', 'RVAL', 'Encoder', 'RBV', 'Busy'] , [40.0], [44.0], [22]) +scan.start() + +#Creating channels: dimension 1 +#RegionPositioner VAL +VAL = Channel('PO2DV-NCS-LS:MOTOR.VAL', type = 'd') +VALReadback = Channel('PO2DV-NCS-LS:MOTOR.RBV', type = 'd') +#Timestamp time +#ScalarDetector RVAL +RVAL = Channel('PO2DV-NCS-LS:MOTOR.RVAL', type = 'd') +#ScalarDetector ENCODER +ENCODER = Channel('PO2DV-NCS-LS:ENCODER', type = 'd') +#ScalarDetector RBV +RBV = Channel('PO2DV-NCS-LS:MOTOR.RBV', type = 'd') +#ScalarDetector Busy +Busy = Channel('PO2DV-NCS-LS:MOTOR.DMOV', type = 'd') + +#Dimension 1 +#RegionPositioner VAL +for setpoint1 in frange(40.0, 42.0, 0.2, True) + frange(41.8, 40.0, 0.2, True): + VAL.put(setpoint1, timeout=None) # TODO: Set appropriate timeout + readback1 = VALReadback.get() + if abs(readback1 - setpoint1) > 0.1 : # TODO: Check accuracy + ret = 'Actor VAL could not be set to the value ' + str(setpoint2) + ' (current value: ' + str(readback2) + ')' + success = False + raise Exception(ret) + #Detector time + detector1 = float(java.lang.System.currentTimeMillis()) + #Detector RVAL + detector2 = RVAL.get() + #Detector TWF + detector3 = ENCODER.get() + #Detector RBV + detector4 = RBV.get() + #Detector Busy + detector5 = Busy.get() + scan.append ([setpoint1], [readback1], [detector1, detector2, detector3, detector4, detector5]) + +#Closing channels +VAL.close() +VALReadback.close() +RVAL.close() +ENCODER.close() +RBV.close() +Busy.close() + +scan.end() + +#Post-actions +caput('PO2DV-NCS-LS:MOTOR.RDBD', '1') + +ret = 'Test done' +success = True \ No newline at end of file diff --git a/script/tests/tests/Display Tests/Display Test/.config b/script/tests/tests/Display Tests/Display Test/.config new file mode 100644 index 0000000..cb8ae63 --- /dev/null +++ b/script/tests/tests/Display Tests/Display Test/.config @@ -0,0 +1,6 @@ +name=Display Test +description=Positioning sequence + +#optional parameters. Description is compulsory. Syntax& +#parameters=&&[;&&] +parameters=repeatTimes&2&Repeat N times;delayS&4&Delay between each initialisation [s] \ No newline at end of file diff --git a/script/tests/tests/Display Tests/Display Test/Display Test.py b/script/tests/tests/Display Tests/Display Test/Display Test.py new file mode 100644 index 0000000..bc2f098 --- /dev/null +++ b/script/tests/tests/Display Tests/Display Test/Display Test.py @@ -0,0 +1,90 @@ + + + +###### DO NOT MODIFY THE CODE BELOW ###### +global print_log, sendFeedback, inspect, log, sys, inspect, os, traceback +import sys, inspect, os, traceback + +def print_log(testName, DEVICE, text): + time.ctime() + now = time.strftime('%Y.%m.%d %H:%M:%S') + print now + ' ' + DEVICE + ' - ' + testName + ': ' + str(text) + +#prepare and send feedback to calling tool +def sendFeedback(testPath, testName, DEVICE, returnString, testPassed): + print_log(testName, DEVICE, 'End of test. Result:') + print_log(testName, DEVICE, 'Device: ' + DEVICE) + print_log(testName, DEVICE, 'Test name: ' + testName) + print_log(testName, DEVICE, 'Test path: ' + testPath) + print_log(testName, DEVICE, 'Test passed: ' + str(testPassed)) + print_log(testName, DEVICE, 'Return string: ' + returnString) + ret = [testPath, DEVICE, returnString, testPassed] + set_return(ret) + +def startTest(testName, DEVICE, params): + try: + import traceback + #get the path of this script + testPath = inspect.getfile(inspect.currentframe()) + #by default, failed + ret = 'Test failed' + success = False + #plot name to be given to the scan. Use: scan.setPlotTitle(plotName) + plotName = DEVICE + ' - ' + testName + +###### WRITE YOUR CODE HERE BELOW ####### + + # caput(DEVICE+':INIT.PROC', '1') + + #get parameters from the calling interface + try: + print_log(testName, DEVICE, "Running test Initialise with the following parameters:") + print_log(testName, DEVICE, params ) + loopTimes = int(params["repeatTimes"]["value"]) + delaySeconds = int(params["delayS"]["value"]) + except: + ret = 'Could not retrieve testing parameters - ' + traceback.format_exc() + success = False + sendFeedback(testPath, testName, DEVICE, ret, success) + return + + scan = ManualScan(['idX'], ['idPositioner'] ) + scan.setPlotTitle(plotName) + scan.start() + try: + idInit = Channel(DEVICE+':DEMAND', type = 'l') + except: + ret = 'Unable to create channel - ' + traceback.format_exc() + success = False + sendFeedback(testPath, testName, DEVICE, ret, success) + return + + for count in range(1, loopTimes+1): + print_log(testName, DEVICE, 'Positioning sequence #' + str(count) + '/' + str(loopTimes)) + timeStampStart = float(java.lang.System.currentTimeMillis()) + for positioner in range(1, 143): + #Detector time + idInit.put(positioner, timeout=1000) # TODO: Set appropriate timeout + timeStamp = float(java.lang.System.currentTimeMillis()) + sleep( 0.01 ) + detector = idInit.get() + scan.append ([timeStamp],[timeStamp], [detector]) + if(count < loopTimes): + print_log(testName, DEVICE, 'Next sequence starting in ' + str(delaySeconds) + 's') + sleep( delaySeconds ) # pause between two sequences + + idInit.close() + scan.end() + +############# END OF YOUR CODE ########### +###### DO NOT MODIFY THE CODE BELOW ###### + sendFeedback(testPath, testName, DEVICE, ret, success) + except: + ret = traceback.format_exc() + success = False + sendFeedback(testPath, testName, DEVICE, ret, success) + return + +#launch the test +startTest(test, device, parameters) + \ No newline at end of file diff --git a/script/tests/tests/Display Tests/Display Test/Display Test.xml b/script/tests/tests/Display Tests/Display Test/Display Test.xml new file mode 100644 index 0000000..69b8eb8 --- /dev/null +++ b/script/tests/tests/Display Tests/Display Test/Display Test.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + 1000 + + + + 1 + 143 + 1 + + + + + + + 1 + + + + + + + diff --git a/script/tests/tests/Linear Slide Tests/Calibrate/.config b/script/tests/tests/Linear Slide Tests/Calibrate/.config new file mode 100644 index 0000000..b1b8790 --- /dev/null +++ b/script/tests/tests/Linear Slide Tests/Calibrate/.config @@ -0,0 +1,8 @@ +name=Calibrate +description=Initialises the motor +help = \ +This test sends a INIT command to the device, as many times as configured with the parameter RepeatTimes. + +#optional parameters. Description is compulsory. Syntax& +#parameters=&&[;&&] +parameters=repeatTimes&2&Repeat N times;delayS&4&Delay between each initialisation [s] \ No newline at end of file diff --git a/script/tests/tests/Linear Slide Tests/Calibrate/Calibrate-try-to-use-external-module.py b/script/tests/tests/Linear Slide Tests/Calibrate/Calibrate-try-to-use-external-module.py new file mode 100644 index 0000000..d261ea7 --- /dev/null +++ b/script/tests/tests/Linear Slide Tests/Calibrate/Calibrate-try-to-use-external-module.py @@ -0,0 +1,125 @@ + +###### DO NOT MODIFY THE CODE BELOW ###### + +global print_log, sendFeedback, inspect, pshellTestGeneral, testPath, testName, DEVICE +import sys, inspect, os, traceback, time, pshellTestGeneral + +#prepare and send feedback to calling tool +def sendFeedback(returnString, testPassed): + ret = pshellTestGeneral.buildFeedback(testPath, testName, DEVICE, returnString, testPassed) + set_return(ret) + +def startTest(testName, DEVICE, params): + global testPath, testName, DEVICE + try: + import traceback, pshellTestGeneral + #get the path of this script + testPath = inspect.getfile(inspect.currentframe()) + #by default, failed + ret = 'Test failed' + success = False + #plot name to be given to the scan. Use: scan.setPlotTitle(plotName) + plotName = DEVICE + ' - ' + testName + +###### WRITE YOUR CODE HERE BELOW ####### + + #Pre-actions + # try: + # caput(DEVICE+':INIT.PROC', '1') + # except: + # ret = 'Unable to create channel - ' + traceback.format_exc() + # success = False + # pshellTestGeneral.sendFeedback(testPath, testName, DEVICE, ret, success) + # return + + + #get parameters from the calling interface + try: + pshellTestGeneral.print_log(testName, DEVICE, "Running test Initialise with the following parameters:") + pshellTestGeneral.print_log(testName, DEVICE, params ) + loopTimes = int(params["repeatTimes"]["value"]) + delaySeconds = int(params["delayS"]["value"]) + except: + ret = 'Could not retrieve testing parameters - ' + traceback.format_exc() + success = False + sendFeedback(ret, success) + return + + scan = ManualScan(['idX'], ['Motor Position (RBV)', 'Encoder Position (ENCODER)', 'Diff Motor - Encoder'] ) + scan.setPlotTitle(plotName) + scan.start() + #Creating channels: dimension 1 + try: + idInit = Channel(DEVICE+':INIT.PROC', type = 'l') + idReady = Channel(DEVICE+':RDY', type = 'l') + idInterlock = Channel(DEVICE+':ILK', type = 'l') + idMotorPosition = Channel(DEVICE+':MOTOR.RBV', type = 'd') + idEncoderPosition = Channel(DEVICE+':ENCODER', type = 'd') + #idBtvsRaw = Channel(DEVICE+':IST3:1', type = 'd') + idEndSwitchL = Channel(DEVICE+':MOTOR.LLS', type = 'd') + #idBtvsProc = Channel(DEVICE+':IST3:2', type = 'd') + idEndSwitchH = Channel(DEVICE+':MOTOR.HLS', type = 'd') + except: + ret = 'Unable to create channel - ' + traceback.format_exc() + success = False + sendFeedback(ret, success) + return + + count = 0 + timeout = 90000 #timeout in ms + for count in range(1, loopTimes+1): + pshellTestGeneral.print_log(testName, DEVICE, 'Initialisation #' + str(count) + '/' + str(loopTimes)) + idInit.put(1, timeout=None) # TODO: Set appropriate timeout + timeStampStart = float(java.lang.System.currentTimeMillis()) + sleep(0.1) + ready = 0 + interlock = idInterlock.get() + timeElapsed = 0 #in ms + while (ready == 0) and timeElapsed + +

Short Description

+Initialise N times. +

Details

+This test sends a INIT command to the device, as many times as configured with the parameter repeatTimes. +

Parameters

+repeatTimes Repeat the Initialisation N times
+delayS Pause delay between each Initialisation [s] +

Contact

+Marco Boccioli + + + diff --git a/script/tests/tests/Linear Slide Tests/Check Linearity/.config b/script/tests/tests/Linear Slide Tests/Check Linearity/.config new file mode 100644 index 0000000..e477d18 --- /dev/null +++ b/script/tests/tests/Linear Slide Tests/Check Linearity/.config @@ -0,0 +1,4 @@ +#Fri Sep 04 11&43&56 CEST 2015 +name=Check Linearity +description=Go to absolute position A, then move +B steps, then -2B steps, then +2Bsteps (ie oscillate round centre position, logging after each movement); repeat N times +parameters=repeatTimes&2&Repeat N times;midPoint&41.0&Middle point A;spanFromMidPoint&10.0&B steps around middle point A;delayS&0&Delay between each oscillation [s]; diff --git a/script/tests/tests/Linear Slide Tests/Check Linearity/Check Linearity - Copy.py b/script/tests/tests/Linear Slide Tests/Check Linearity/Check Linearity - Copy.py new file mode 100644 index 0000000..f70c42c --- /dev/null +++ b/script/tests/tests/Linear Slide Tests/Check Linearity/Check Linearity - Copy.py @@ -0,0 +1,162 @@ + +#Go to absolute position A, then move +B steps, then -2B steps, then +2Bsteps (ie oscillate round centre position, logging after each movement); repeat N times + + +###### DO NOT MODIFY THE CODE BELOW ###### +global print_log, sendFeedback, inspect, log, sys, inspect, os, traceback +import sys, inspect, os, traceback + +def print_log(testName, DEVICE, text): + time.ctime() + now = time.strftime('%Y.%m.%d %H:%M:%S') + print now + ' ' + DEVICE + ' - ' + testName + ': ' + str(text) + +#prepare and send feedback to calling tool +def sendFeedback(testPath, testName, DEVICE, returnString, testPassed): + print_log(testName, DEVICE, 'End of test. Result:') + print_log(testName, DEVICE, 'Device: ' + DEVICE) + print_log(testName, DEVICE, 'Test name: ' + testName) + print_log(testName, DEVICE, 'Test path: ' + testPath) + print_log(testName, DEVICE, 'Test passed: ' + str(testPassed)) + print_log(testName, DEVICE, 'Return string: ' + returnString) + ret = [testPath, DEVICE, returnString, testPassed] + set_return(ret) + +def startTest(testName, DEVICE, params): + try: + import traceback + #get the path of this script + testPath = inspect.getfile(inspect.currentframe()) + #by default, failed + ret = 'Test failed' + success = False + #plot name to be given to the scan. Use: scan.setPlotTitle(plotName) + plotName = DEVICE + ' - ' + testName + +###### WRITE YOUR CODE HERE BELOW ####### + + #get parameters from the calling interface + try: + print_log(testName, DEVICE, "Running test Motor Test 2 for device " + DEVICE + " with the following parameters:\n" + str(params)) + middle = float(params["midPoint"]["value"]) + loopTimes = int(params["repeatTimes"]["value"]) + delayS = int(params["delayS"]["value"]) + if(delayS<1): delayS=1 + span = float(params["spanFromMidPoint"]["value"]) + except: + ret = 'Could not retrieve testing parameters - ' + traceback.format_exc() + success = False + sendFeedback(testPath, testName, DEVICE, ret, success) + return + + #scan = ManualScan(['idX'], ['idMotorStatus', 'idLogicalPosition', 'idDiameter', 'idMotorPosition', 'idPotiRaw', 'idEncoderPosition', 'idBtvsRaw', 'idBtvsProc', 'idDiff01', 'idDiff02'] , [ 0.0], [ 3000.0], [20]) + scan = ManualScan(['idX'], ['idMotorStatus', 'idMotorPosition', 'idEncoderPosition', 'idError']) + scan.setPlotTitle(plotName) + scan.start() + + #Creating channels: dimension 1 + try: + idInkr = Channel(DEVICE+':MOTOR.VAL', type = 'd') + idMotorStatus = Channel(DEVICE+':MOTOR.MSTA', type = 'd') + idMotorPosition = Channel(DEVICE+':MOTOR.RBV', type = 'd') + idEncoderPosition = Channel(DEVICE+':ENCODER', type = 'd') + idEndSwitchL = Channel(DEVICE+':MOTOR.LLS', type = 'd') + idEndSwitchH = Channel(DEVICE+':MOTOR.HLS', type = 'd') + idLimitH = Channel(DEVICE+':MOTOR.HLM', type = 'd') + idLimitL = Channel(DEVICE+':MOTOR.LLM', type = 'd') + except: + ret = 'Unable to create channel - ' + traceback.format_exc() + success = False + sendFeedback(testPath, testName, DEVICE, ret, success) + return + + #remove limits + idLimitH.put(999999.9, timeout=None) + idLimitL.put(-999999.9, timeout=None) + + direction = 1.0 + startDefault = middle - span + endDefault = middle + span + end = endDefault+1 + #find position: it will be the middle point of the test + print_log(testName, DEVICE, 'Moving to middle point ' + str(middle) ) + idInkr.put(middle, timeout=None) # TODO: Set appropriate timeout + readback2 = idInkr.get() + if abs(readback2 - middle) > 1 : # TODO: Check accuracy + ret = 'Actor idInkr could not be set to the value ' + str(middle) + ' (current value: ' + str(readback2) + ')' + success = False + sendFeedback(testPath, testName, DEVICE, ret, success) + return + start = readback2+direction + countSteps = 0 + count = 0 + print_log(testName, DEVICE, 'Moving around middle point (+-' + str(span) + ')' ) + for setpoint1 in range(0, loopTimes*2): + count = count + 1 + print_log(testName, DEVICE, 'Pausing ' + str(delayS) + 's' ) + sleep( delayS ) # Settling time + #RegionPositioner idInkr + for setpoint2 in frange(start, end, direction): + readback1 = setpoint1 + idInkr.put(setpoint2, timeout=None) # TODO: Set appropriate timeout + sleep( 0.2 ) # Settling time + 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 + sendFeedback(testPath, testName, DEVICE, ret, success) + return + #Detector idMotorStatus + detector1 = idMotorStatus.get() + detector4 = idMotorPosition.get() + detector6 = idEncoderPosition.get() + endH = idEndSwitchH.get() + endL = idEndSwitchL.get() + #Manipulation idDiff01 + #Variable Mappings + a = detector4 + b = detector6 + idDiff01 = a-b + countSteps = countSteps + 1 + scan.append ([countSteps], [countSteps], [detector1, detector4, detector6, idDiff01]) + if endH>0.0 or (direction > 0.0 and setpoint2 >= end -1): + #invert direction and swap start with end of translation + end = startDefault-1 + start = setpoint2 - direction + direction = -1.0 + print_log(testName, DEVICE, 'End of span (' + str(setpoint2) + '), changing direction to ' + str(direction) ) + break + if endL>0.0 or ( direction < 0.0 and setpoint2 <= end +1): + #invert direction and swap start with end of translation + end = endDefault+1 + start = setpoint2 - direction + direction = 1.0 + print_log(testName, DEVICE, 'End of span (' + str(setpoint2) + '), 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() + idMotorStatus.close() + idMotorPosition.close() + idEncoderPosition.close() + idLimitH.close() + idLimitL.close() + scan.end() + ret = 'Slide moved back and forth (' + str(count) + ' runs)' + success = True + +############# END OF YOUR CODE ########### +###### DO NOT MODIFY THE CODE BELOW ###### + sendFeedback(testPath, testName, DEVICE, ret, success) + except: + ret = traceback.format_exc() + success = False + sendFeedback(testPath, testName, DEVICE, ret, success) + return + +#launch the test +startTest(test, device, parameters) diff --git a/script/tests/tests/Linear Slide Tests/Check Linearity/Check Linearity.py b/script/tests/tests/Linear Slide Tests/Check Linearity/Check Linearity.py new file mode 100644 index 0000000..e0b31fe --- /dev/null +++ b/script/tests/tests/Linear Slide Tests/Check Linearity/Check Linearity.py @@ -0,0 +1,199 @@ + +#Go to absolute position A, then move +B steps, then -2B steps, then +2Bsteps (ie oscillate round centre position, logging after each movement); repeat N times + +###### Init - DO NOT MODIFY THE CODE BELOW ###### +global sys, inspect, os, traceback +import sys, inspect, os, traceback + +def startTest(testName, DEVICE, params): + #by default, assume the test failed + ret = 'Test failed' + success = False + #plot name to be given to the scan. Use: scan.setPlotTitle(plotName) + plotName = DEVICE + ' - ' + testName + #put the whole custom code under try/catch + try: + #get the path of this script + testPath = inspect.getfile(inspect.currentframe()) + #init the testing tool class. It can be sued in the following ways: + test = TestingTool(testName, testPath, DEVICE, params) + +######### WRITE YOUR CODE HERE BELOW ############# + + #get parameters from the calling interface + try: + test.log( "Running test Motor Test 2 for device " + DEVICE + " with the following parameters:\n" + str(params)) + middle = float(test.getParam("midPoint")) + loopTimes = int(test.getParam("repeatTimes")) + span = float(test.getParam("spanFromMidPoint")) + delayS = int(test.getParam("delayS")) + if(delayS<1): delayS=1 + except: + ret = 'Could not retrieve testing parameters - ' + traceback.format_exc() + success = False + test.sendFeedback( ret, success) + return + + #scan = ManualScan(['idX'], ['idMotorStatus', 'idLogicalPosition', 'idDiameter', 'idMotorPosition', 'idPotiRaw', 'idEncoderPosition', 'idBtvsRaw', 'idBtvsProc', 'idDiff01', 'idDiff02'] , [ 0.0], [ 3000.0], [20]) + scan = ManualScan(['idX'], ['idMotorStatus', 'idMotorPosition', 'idEncoderPosition', 'idError']) + scan.setPlotTitle(plotName + " parameters") + scan.start() + + #coloured plot (one colour per scan) + p1 = plot(None,name="Run0", context = plotName + " error")[0] + + #Creating channels: dimension 1 + try: + idInkr = Channel(DEVICE+':MOTOR.VAL', type = 'd') + idMotorStatus = Channel(DEVICE+':MOTOR.MSTA', type = 'd') + idMotorPosition = Channel(DEVICE+':MOTOR.RBV', type = 'd') + idEncoderPosition = Channel(DEVICE+':ENCODER', type = 'd') + idEndSwitchL = Channel(DEVICE+':MOTOR.LLS', type = 'd') + idEndSwitchH = Channel(DEVICE+':MOTOR.HLS', type = 'd') + idLimitH = Channel(DEVICE+':MOTOR.HLM', type = 'd') + idLimitL = Channel(DEVICE+':MOTOR.LLM', type = 'd') + except: + ret = 'Unable to create channel - ' + traceback.format_exc() + success = False + test.sendFeedback( ret, success) + return + + #remove limits + idLimitH.put(999999.9, timeout=None) + idLimitL.put(-999999.9, timeout=None) + + + min = 9999999999 + minPos = 0 + max = 0 + maxPos = 0 + minDev = [] + minDevPos = [] + maxDev = [] + maxDevPos = [] + + direction = 1.0 + startDefault = middle - span + endDefault = middle + span + end = endDefault+1 + #find position: it will be the middle point of the test + test.log( 'Moving to middle point ' + str(middle) ) + idInkr.put(middle, timeout=None) # TODO: Set appropriate timeout + readback2 = idInkr.get() + if abs(readback2 - middle) > 1 : # TODO: Check accuracy + ret = 'Actor idInkr could not be set to the value ' + str(middle) + ' (current value: ' + str(readback2) + ')' + success = False + test.sendFeedback( ret, success) + return + start = readback2+direction + countSteps = 0 + count = 0 + test.log( 'Moving around middle point (+-' + str(span) + ')' ) + for setpoint1 in range(0, loopTimes*2): + count = count + 1 + test.log( 'Pausing ' + str(delayS) + 's' ) + sleep( delayS ) # Settling time + p1.addSeries(LinePlotSeries("Run"+str(count))) + maxDev.append(0) + maxDevPos.append(0) + minDev.append(9999999999) + minDevPos.append(0) + #RegionPositioner idInkr + for setpoint2 in frange(start, end, direction): + readback1 = setpoint1 + idInkr.put(setpoint2, timeout=None) # TODO: Set appropriate timeout + sleep( 0.2 ) # Settling time + 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 + test.sendFeedback( ret, success) + return + #Detector idMotorStatus + detector1 = idMotorStatus.get() + detector4 = idMotorPosition.get() + detector6 = idEncoderPosition.get() + endH = idEndSwitchH.get() + endL = idEndSwitchL.get() + #Manipulation idDiff01 + #Variable Mappings + a = detector4 + b = detector6 + idDiff01 = a-b + countSteps = countSteps + 1 + scan.append ([countSteps], [countSteps], [detector1, detector4, detector6, idDiff01]) + p1.getSeries(count).appendData(setpoint2, idDiff01) + #compute min and max differences + if abs(idDiff01) > max: + max = abs(idDiff01) + maxPos = setpoint2 + if abs(idDiff01) < min: + min = abs(idDiff01) + minPos = setpoint2 + #compute min and max deviation + if abs(idDiff01) > maxDev[count-1]: + maxDev[count-1] = abs(idDiff01) + maxDevPos[count-1] = setpoint2 + if abs(idDiff01) < minDev[count-1]: + minDev[count-1] = abs(idDiff01) + minDevPos[count-1] = setpoint2 + if endH>0.0 or (direction > 0.0 and setpoint2 >= end -1): + #invert direction and swap start with end of translation + end = startDefault-1 + start = setpoint2 - direction + direction = -1.0 + test.log( 'End of span (' + str(setpoint2) + '), changing direction to ' + str(direction) ) + break + if endL>0.0 or ( direction < 0.0 and setpoint2 <= end +1): + #invert direction and swap start with end of translation + end = endDefault+1 + start = setpoint2 - direction + direction = 1.0 + test.log( 'End of span (' + str(setpoint2) + '), changing direction to ' + str(direction) ) + break + #show differences in the plot + import java.awt.Color + p1.addMarker(maxPos, None, "Max=" + str(max), java.awt.Color.LIGHT_GRAY) + p1.addMarker(minPos, None, "Min=" + str(min), java.awt.Color.LIGHT_GRAY) + #show deviations in the plot + absMaxDev = 0 + absMinDev = 9999999999 + absMaxPos = 0 + absMinPos = 0 + for index in range(len(maxDev)): + if absMaxDev < maxDev[index]: + absMaxDev = maxDev[index] + absMaxPos = maxDevpos[index] + if absMinDev > minDev[index]: + absMinDev = minDev[index] + absMinPos = minDevPos[index] + p1.addMarker(absMaxPos, None, "MaxDev=" + str(absMaxDev), java.awt.Color.LIGHT_GRAY) + p1.addMarker(absMinPos, None, "MinDev=" + str(absMinDev), java.awt.Color.LIGHT_GRAY) + + + #set limits back + idLimitH.put(145.0, timeout=None) + idLimitL.put(0.0, timeout=None) + + #Closing channels + idInkr.close() + idMotorStatus.close() + idMotorPosition.close() + idEncoderPosition.close() + idLimitH.close() + idLimitL.close() + scan.end() + ret = 'Slide moved back and forth (' + str(count) + ' runs)' + success = True + +############# END OF YOUR CODE ########### +###### DO NOT MODIFY THE CODE BELOW ###### + test.sendFeedback( ret, success) + except: + ret = traceback.format_exc() + success = False + test.sendFeedback( ret, success) + return + +#launch the test +startTest(test, device, parameters) diff --git a/script/tests/tests/Linear Slide Tests/Check Linearity/help.html b/script/tests/tests/Linear Slide Tests/Check Linearity/help.html new file mode 100644 index 0000000..8aac8f3 --- /dev/null +++ b/script/tests/tests/Linear Slide Tests/Check Linearity/help.html @@ -0,0 +1,16 @@ + + +

Short Description

+Oscillate around a specific position +

Details

+Go to absolute position A, then move +B steps, then -2B steps, then +2Bsteps (ie oscillate round centre position, logging after each movement); repeat N times +

Parameters

+midPoint Middle point A around which it will oscillate
+spanFromMidPoint B stepst to oscillate around A
+repeatTimes Repeat the moving N times
+delayS Pause delay (>0s) between each oscillation [s] +

Contact

+Marco Boccioli + + + diff --git a/script/tests/tests/Old struct tests/oldtest/.config b/script/tests/tests/Old struct tests/oldtest/.config new file mode 100644 index 0000000..30b4d87 --- /dev/null +++ b/script/tests/tests/Old struct tests/oldtest/.config @@ -0,0 +1,4 @@ +#Tue Mar 20 13:50:42 CET 2018 +name=oldtest +parameters=examplePar1\:2\:This is the parameter n.1 with unit [unit];examplePar2\:4.5\:This is the parameter n.2 with unit [unit]; +description=o diff --git a/script/tests/tests/Old struct tests/oldtest/help.html b/script/tests/tests/Old struct tests/oldtest/help.html new file mode 100644 index 0000000..df78fc5 --- /dev/null +++ b/script/tests/tests/Old struct tests/oldtest/help.html @@ -0,0 +1,17 @@ + + + +

Description

+o +

Parameters

+ + + + +
examplePar1 This is the parameter n.1 with unit [unit]
examplePar2 This is the parameter n.2 with unit [unit]
+

Contact

+Marco Boccioli
+Tel. 3078 + + + diff --git a/script/tests/tests/Old struct tests/oldtest/oldtest.py b/script/tests/tests/Old struct tests/oldtest/oldtest.py new file mode 100644 index 0000000..65b047c --- /dev/null +++ b/script/tests/tests/Old struct tests/oldtest/oldtest.py @@ -0,0 +1,174 @@ +# Test name: oldtest +# o +# Copyright (c) 2015 Paul Scherrer Institute. All rights reserved. + +###### Init - DO NOT MODIFY THE CODE BELOW ###### +global sys, inspect, os, traceback +import sys, inspect, os, traceback + + +def startTest(testName, DEVICE, params): + """ + Main method running the test + """ + # by default, assume the test failed: + ret = 'Test failed' + status = False + # put the whole custom code under try/catch. + try: + # get the path of this script: + testPath = inspect.getfile(inspect.currentframe()) + # init the testing tool class: + test = TestingTool(testName, testPath, DEVICE, params) + +################ END OF Init ##################### +######### WRITE YOUR CODE HERE BELOW ############# + + """ + All the code in this section # WRITE YOUR CODE HERE BELOW # is just an example and can be modified/deleted. + It must be indented to the same level as this comment. + ----------------------------------- + GETTING INPUTS: + ----------------------------------- + If needed, the following methods are available: + + test.getPath() string, path of this test file + test.getName() string, name of this test + test.getDeviceName() string, device for which the test must run (typically it is the beginning of a process variable name) + test.getPlotName() string, name to be given to the plot when using setPlotTitle(). Example: scan.setPlotTitle(test.getPlotName()) + ----------------------------------- + GETTING TEST PARAMETERS: + ----------------------------------- + if you need to get parameters for the test, use: + + myParamValue = test.getParam('myParamName') + + the calls to getParam are added to the code automatically, one per parameter, when creating the new test. + NOTE: Casting may be necessary. + See the test config for the list of parameters specific to the test. + ----------------------------------- + SETTING OUTPUTS: + ----------------------------------- + When the test has ended (error or success), this method must be called in order to return to pshell: + + test.sendFeedback(ret,success) + + ret string, a text summarizing the result of the test. + success bool, True = test successful. False = test failed. + ----------------------------------- + LOG INFO: + ----------------------------------- + when some information must be shown on the log on pshell, use the following line: + test.log('text to log') + """ + + ########## Example (can be removed) ###### + + # print the list of parameters passed. If any error, stop and send feedback. + test.log("Example - Test name: " + test.getName()) + test.log("Example - Device name: " + test.getDeviceName() ) + try: + test.log("Running test with the following parameters:") + test.printParams() + # If present, use the parameters here below for your test script. + # These parameters were automatically generated: you might need to change the casting. + examplePar1 = float(test.getParam('examplePar1')) ; examplePar2 = float(test.getParam('examplePar2')) ; + except: + import traceback + # test failed, write the report into the variables ret and success and send feedback: + ret = 'Could not retrieve testing parameters - ' + traceback.format_exc() + success = False + test.sendFeedback(ret, success) + return + + # loop to read channels for a while and plot the channels values. + # initialise plot tab with 2 plots: pass here the axis names: + scan = ManualScan(['sample'], ['Status (MSTA)', 'Position (VAL)']) + # set plot name(tab title): + scan.setPlotTitle(test.getPlotName()) + # start plots. See further below how to add points to the plots (scan): + scan.start() + + # inject a sinus into the plot, as example + from math import sin + motor_msta = 0 + # take 100 samples of a sinus and a jigsaw plot them: + for sample in range(0, 100): + readback1 = sample #the x axis. + sleep(0.1) # settling time. + # get value (it is translated to a caget): + motor_msta = motor_msta + +1 + if motor_msta > 50: + motor_msta = 0 + # get value: + motor_val = sin(float(sample)/10.0)*10.0-10.0 + # add values to plot: + scan.append([readback1], [readback1], [motor_msta, motor_val]) + + # now try with data from real device: this part will most probably fail: correct the PV names with existing ones. + try: + # set up connection to channels. "type" of data can be "d" (= double), "l" (= long). + pv_motor_msta = Channel(test.getDeviceName() + ':IST:2' , type='d') + pv_motor_val = Channel(test.getDeviceName() + ':IST:1' , type='d') + pv_motor_com = Channel(test.getDeviceName() + ':COM:2' , type='d') + except: + import traceback + # prepare return information: return text: + ret = 'Unable to create channel - ' + traceback.format_exc() + # prepare return information: return success: + success = False + # send return information: + test.sendFeedback(ret, success) + return + # send a command to a channel (it is translated to a caput): uncomment this line below to try it + #pv_motor_com.put(1.0, timeout=None) # optionally, a timeout can be given. + # take 100 samples of the channels and plot them: + for sample in range(0, 100): + readback1 = sample #the x axis. + sleep(0.1) # settling time. + # get value (it is translated to a caget): + motor_msta = pv_motor_msta.get() + # get value: + motor_val = pv_motor_val.get() + # add values to plot: + scan.append([readback1], [readback1], [motor_msta, motor_val]) + + # Closing channels: all channels that were opened with Channel() must be closed before exit: + pv_motor_msta.close() + pv_motor_val.close() + pv_motor_com.close() + + # IMPORTANT: if the test was successful, write the report into the variables ret and success. + # for example, write the following: + ret = "Example - Test successful, here some detail: ..." + success = True + test.sendFeedback(ret, success) + # once the test is finished, no need to do anything. The code below yours will do the rest. + ################ End of Example ########## + +################ END OF YOUR CODE ################ +###### Final - DO NOT MODIFY THE CODE BELOW ###### + + # just in case the feedback was forgotten. + test.sendFeedback(ret, success) + except (KeyboardInterrupt): + # user stop error handler. + import traceback + ret = 'Test stopped by user.' + success = False + test.sendFeedback(ret, success) + except: + # generic error handler. + import traceback + ret = traceback.format_exc() + success = False + test.sendFeedback(ret, success) + + +# launch the test. +startTest(test, device, parameters) + +################ END OF Final #################### +#### IF NEEDED, ADD YOUR FUNCTIONS HERE BELOW #### +# Indent to end left +# def yourCustomFunction: diff --git a/script/tests/tests/Old struct tests/oldtest2/.config b/script/tests/tests/Old struct tests/oldtest2/.config new file mode 100644 index 0000000..fc7a908 --- /dev/null +++ b/script/tests/tests/Old struct tests/oldtest2/.config @@ -0,0 +1,4 @@ +#Tue Mar 20 13:50:48 CET 2018 +name=oldtest2 +parameters=examplePar1\:2\:This is the parameter n.1 with unit [unit];examplePar2\:4.5\:This is the parameter n.2 with unit [unit]; +description=o diff --git a/script/tests/tests/Old struct tests/oldtest2/help.html b/script/tests/tests/Old struct tests/oldtest2/help.html new file mode 100644 index 0000000..df78fc5 --- /dev/null +++ b/script/tests/tests/Old struct tests/oldtest2/help.html @@ -0,0 +1,17 @@ + + + +

Description

+o +

Parameters

+ + + + +
examplePar1 This is the parameter n.1 with unit [unit]
examplePar2 This is the parameter n.2 with unit [unit]
+

Contact

+Marco Boccioli
+Tel. 3078 + + + diff --git a/script/tests/tests/Old struct tests/oldtest2/oldtest2.py b/script/tests/tests/Old struct tests/oldtest2/oldtest2.py new file mode 100644 index 0000000..00c0784 --- /dev/null +++ b/script/tests/tests/Old struct tests/oldtest2/oldtest2.py @@ -0,0 +1,174 @@ +# Test name: oldtest2 +# o +# Copyright (c) 2015 Paul Scherrer Institute. All rights reserved. + +###### Init - DO NOT MODIFY THE CODE BELOW ###### +global sys, inspect, os, traceback +import sys, inspect, os, traceback + + +def startTest(testName, DEVICE, params): + """ + Main method running the test + """ + # by default, assume the test failed: + ret = 'Test failed' + status = False + # put the whole custom code under try/catch. + try: + # get the path of this script: + testPath = inspect.getfile(inspect.currentframe()) + # init the testing tool class: + test = TestingTool(testName, testPath, DEVICE, params) + +################ END OF Init ##################### +######### WRITE YOUR CODE HERE BELOW ############# + + """ + All the code in this section # WRITE YOUR CODE HERE BELOW # is just an example and can be modified/deleted. + It must be indented to the same level as this comment. + ----------------------------------- + GETTING INPUTS: + ----------------------------------- + If needed, the following methods are available: + + test.getPath() string, path of this test file + test.getName() string, name of this test + test.getDeviceName() string, device for which the test must run (typically it is the beginning of a process variable name) + test.getPlotName() string, name to be given to the plot when using setPlotTitle(). Example: scan.setPlotTitle(test.getPlotName()) + ----------------------------------- + GETTING TEST PARAMETERS: + ----------------------------------- + if you need to get parameters for the test, use: + + myParamValue = test.getParam('myParamName') + + the calls to getParam are added to the code automatically, one per parameter, when creating the new test. + NOTE: Casting may be necessary. + See the test config for the list of parameters specific to the test. + ----------------------------------- + SETTING OUTPUTS: + ----------------------------------- + When the test has ended (error or success), this method must be called in order to return to pshell: + + test.sendFeedback(ret,success) + + ret string, a text summarizing the result of the test. + success bool, True = test successful. False = test failed. + ----------------------------------- + LOG INFO: + ----------------------------------- + when some information must be shown on the log on pshell, use the following line: + test.log('text to log') + """ + + ########## Example (can be removed) ###### + + # print the list of parameters passed. If any error, stop and send feedback. + test.log("Example - Test name: " + test.getName()) + test.log("Example - Device name: " + test.getDeviceName() ) + try: + test.log("Running test with the following parameters:") + test.printParams() + # If present, use the parameters here below for your test script. + # These parameters were automatically generated: you might need to change the casting. + examplePar1 = float(test.getParam('examplePar1')) ; examplePar2 = float(test.getParam('examplePar2')) ; + except: + import traceback + # test failed, write the report into the variables ret and success and send feedback: + ret = 'Could not retrieve testing parameters - ' + traceback.format_exc() + success = False + test.sendFeedback(ret, success) + return + + # loop to read channels for a while and plot the channels values. + # initialise plot tab with 2 plots: pass here the axis names: + scan = ManualScan(['sample'], ['Status (MSTA)', 'Position (VAL)']) + # set plot name(tab title): + scan.setPlotTitle(test.getPlotName()) + # start plots. See further below how to add points to the plots (scan): + scan.start() + + # inject a sinus into the plot, as example + from math import sin + motor_msta = 0 + # take 100 samples of a sinus and a jigsaw plot them: + for sample in range(0, 100): + readback1 = sample #the x axis. + sleep(0.1) # settling time. + # get value (it is translated to a caget): + motor_msta = motor_msta + +1 + if motor_msta > 50: + motor_msta = 0 + # get value: + motor_val = sin(float(sample)/10.0)*10.0-10.0 + # add values to plot: + scan.append([readback1], [readback1], [motor_msta, motor_val]) + + # now try with data from real device: this part will most probably fail: correct the PV names with existing ones. + try: + # set up connection to channels. "type" of data can be "d" (= double), "l" (= long). + pv_motor_msta = Channel(test.getDeviceName() + ':IST:2' , type='d') + pv_motor_val = Channel(test.getDeviceName() + ':IST:1' , type='d') + pv_motor_com = Channel(test.getDeviceName() + ':COM:2' , type='d') + except: + import traceback + # prepare return information: return text: + ret = 'Unable to create channel - ' + traceback.format_exc() + # prepare return information: return success: + success = False + # send return information: + test.sendFeedback(ret, success) + return + # send a command to a channel (it is translated to a caput): uncomment this line below to try it + #pv_motor_com.put(1.0, timeout=None) # optionally, a timeout can be given. + # take 100 samples of the channels and plot them: + for sample in range(0, 100): + readback1 = sample #the x axis. + sleep(0.1) # settling time. + # get value (it is translated to a caget): + motor_msta = pv_motor_msta.get() + # get value: + motor_val = pv_motor_val.get() + # add values to plot: + scan.append([readback1], [readback1], [motor_msta, motor_val]) + + # Closing channels: all channels that were opened with Channel() must be closed before exit: + pv_motor_msta.close() + pv_motor_val.close() + pv_motor_com.close() + + # IMPORTANT: if the test was successful, write the report into the variables ret and success. + # for example, write the following: + ret = "Example - Test successful, here some detail: ..." + success = True + test.sendFeedback(ret, success) + # once the test is finished, no need to do anything. The code below yours will do the rest. + ################ End of Example ########## + +################ END OF YOUR CODE ################ +###### Final - DO NOT MODIFY THE CODE BELOW ###### + + # just in case the feedback was forgotten. + test.sendFeedback(ret, success) + except (KeyboardInterrupt): + # user stop error handler. + import traceback + ret = 'Test stopped by user.' + success = False + test.sendFeedback(ret, success) + except: + # generic error handler. + import traceback + ret = traceback.format_exc() + success = False + test.sendFeedback(ret, success) + + +# launch the test. +startTest(test, device, parameters) + +################ END OF Final #################### +#### IF NEEDED, ADD YOUR FUNCTIONS HERE BELOW #### +# Indent to end left +# def yourCustomFunction: diff --git a/script/tests/tests/PS Tests/newTest/.config b/script/tests/tests/PS Tests/newTest/.config new file mode 100644 index 0000000..12de8d1 --- /dev/null +++ b/script/tests/tests/PS Tests/newTest/.config @@ -0,0 +1,4 @@ +#Wed Jan 13 15&10&04 CET 2016 +name=newTest +parameters=examplePar1&2&This is the parameter n.1 with unit [unit];examplePar2&4.5&This is the parameter n.2 with unit [unit]; +description=try new template diff --git a/script/tests/tests/PS Tests/newTest/help.html b/script/tests/tests/PS Tests/newTest/help.html new file mode 100644 index 0000000..4c59256 --- /dev/null +++ b/script/tests/tests/PS Tests/newTest/help.html @@ -0,0 +1,15 @@ + + + +

Description

+try new template +

Parameters

+examplePar1 This is the parameter n.1 with unit [unit]
+examplePar2 This is the parameter n.2 with unit [unit]
+ +

Contact

+Marco Boccioli
+Tel. 3078 + + + diff --git a/script/tests/tests/PS Tests/newTest/newTest.py b/script/tests/tests/PS Tests/newTest/newTest.py new file mode 100644 index 0000000..8179606 --- /dev/null +++ b/script/tests/tests/PS Tests/newTest/newTest.py @@ -0,0 +1,169 @@ +# Test name: newTest +# try new template +# Copyright (c) 2015 Paul Scherrer Institute. All rights reserved. + +###### Init - DO NOT MODIFY THE CODE BELOW ###### +global sys, inspect, os, traceback +import sys, inspect, os, traceback + + +def startTest(testName, DEVICE, params): + """ + Main method running the test + """ + # by default, assume the test failed: + ret = 'Test failed' + status = False + # put the whole custom code under try/catch. + try: + # get the path of this script: + testPath = inspect.getfile(inspect.currentframe()) + # init the testing tool class: + test = TestingTool(testName, testPath, DEVICE, params) + +################ END OF Init ##################### +######### WRITE YOUR CODE HERE BELOW ############# + + """ + All the code in this section # WRITE YOUR CODE HERE BELOW # can be modified/deleted. + It must be indented to the same level as this comment + ----------------------------------- + GETTING INPUTS: + ----------------------------------- + If needed, the following methods are available: + + test.getPath() string, path of this test file + test.getName() string, name of this test + test.getDeviceName() string, device for which the test must run (typically it is the beginning of a process variable name) + test.getPlotName() string, name to be given to the plot when using setPlotTitle(). Example: scan.setPlotTitle(test.getPlotName()) + ----------------------------------- + GETTING TEST PARAMETERS: + ----------------------------------- + if you need to get parameters for the test, use: + + myParamValue = test.getParam('myParamName') + + the calls to getParam are added to the code automatically, one per parameter, when creating the new test. + NOTE: Casting may be necessary. + See the test config for the list of parameters specific to the test. + ----------------------------------- + SETTING OUTPUTS: + ----------------------------------- + When the test has ended (error or success), this method must be called in order to return to pshell: + + test.sendFeedback(ret,success) + + ret string, a text summarizing the result of the test. + success bool, True = test successful. False = test failed. + ----------------------------------- + LOG INFO: + ----------------------------------- + when some information must be shown on the log on pshell, use the following line: + test.log('text to log') + """ + + ########## Example (can be removed) ###### + + # print the list of parameters passed. If any error, stop and send feedback. + test.log("Example - Test name: " + test.getName()) + test.log("Example - Device name: " + test.getDeviceName() ) + try: + test.log("Running test with the following parameters:") + test.log(params) + # If present, use the parameters here below for your test script. + # These parameters were automatically generated: you might need to change the casting. + examplePar1 = float(test.getParam('examplePar1')) ; examplePar2 = float(test.getParam('examplePar2')) ; + except: + # test failed, write the report into the variables ret and success and send feedback: + ret = 'Could not retrieve testing parameters - ' + traceback.format_exc() + success = False + test.sendFeedback(ret, success) + return + + # loop to read channels for a while and plot the channels values. + # initialise plot tab with 2 plots: pass here the axis names: + scan = ManualScan(['sample'], ['Status (MSTA)', 'Position (VAL)']) + # set plot name(tab title): + scan.setPlotTitle(test.getPlotName()) + # start plots. See further below how to add points to the plots (scan): + scan.start() + + # inject a sinus into the plot, as example + from math import sin + motor_msta = 0 + for sample in range(0, 100): + readback1 = sample #the x axis. + sleep(0.1) # settling time. + # get value (it is translated to a caget): + motor_msta = motor_msta + +1 + if motor_msta > 50: + motor_msta = 0 + # get value: + motor_val = sin(float(sample)/10.0)*10.0-10.0 + # add values to plot: + scan.append([readback1], [readback1], [motor_msta, motor_val]) + + + try: + # set up connection to channels. "type" of data can be "d" (= double), "l" (= long). + pv_motor_msta = Channel(test.getDeviceName() + ':IST:2' , type='d') + pv_motor_val = Channel(test.getDeviceName() + ':IST:1' , type='d') + pv_motor_com = Channel(test.getDeviceName() + ':COM:2' , type='d') + except: + # prepare return information: return text: + ret = 'Unable to create channel - ' + traceback.format_exc() + # prepare return information: return success: + success = False + # send return information: + test.sendFeedback(ret, success) + return + # send a command to a channel (it is translated to a caput): uncomment this line below to try it + #pv_motor_com.put(1.0, timeout=None) # optionally, a timeout can be given. + # take 100 samples of the channels and plot them: + for sample in range(0, 100): + readback1 = sample #the x axis. + sleep(0.1) # settling time. + # get value (it is translated to a caget): + motor_msta = pv_motor_msta.get() + # get value: + motor_val = pv_motor_val.get() + # add values to plot: + scan.append([readback1], [readback1], [motor_msta, motor_val]) + + # Closing channels: all channels that were opened with Channel() must be closed before exit: + pv_motor_msta.close() + pv_motor_val.close() + pv_motor_com.close() + + # IMPORTANT: if the test was successful, write the report into the variables ret and success. + # for example, write the following: + ret = "Example - Test successful, here some detail: ..." + success = True + test.sendFeedback(ret, success) + # once the test is finished, no need to do anything. The code below yours will do the rest. + ################ End of Example ########## + +################ END OF YOUR CODE ################ +###### Final - DO NOT MODIFY THE CODE BELOW ###### + + # just in case the feedback was forgotten. + test.sendFeedback(ret, success) + except (KeyboardInterrupt): + # user stop error handler. + ret = 'Test stopped by user.' + success = False + test.sendFeedback(ret, success) + except: + # generic error handler. + ret = traceback.format_exc() + success = False + test.sendFeedback(ret, success) + + +# launch the test. +startTest(test, device, parameters) + +################ END OF Final #################### +#### IF NEEDED, ADD YOUR FUNCTIONS HERE BELOW #### +# Indent to end left +# def yourCustomFunction: diff --git a/script/tests/tests/PS Tests/playground-pw84/.config b/script/tests/tests/PS Tests/playground-pw84/.config new file mode 100644 index 0000000..af06b24 --- /dev/null +++ b/script/tests/tests/PS Tests/playground-pw84/.config @@ -0,0 +1,4 @@ +#Mon Oct 26 15&46&18 CET 2015 +name=playground-pw84 +parameters=examplePar1&2&This is the parameter n.1 with unit [unit];examplePar2&4.5&This is the parameter n.2 with unit [unit]; +description=on dir playground, iocsh pw84.db diff --git a/script/tests/tests/PS Tests/playground-pw84/help.html b/script/tests/tests/PS Tests/playground-pw84/help.html new file mode 100644 index 0000000..5bb4051 --- /dev/null +++ b/script/tests/tests/PS Tests/playground-pw84/help.html @@ -0,0 +1,15 @@ + + + +

Description

+on dir playground, iocsh pw84.db +

Parameters

+examplePar1 This is the parameter n.1 with unit [unit]
+examplePar2 This is the parameter n.2 with unit [unit]
+ +

Contact

+Marco Boccioli
+Tel. 3078 + + + diff --git a/script/tests/tests/PS Tests/playground-pw84/playground-pw84.py b/script/tests/tests/PS Tests/playground-pw84/playground-pw84.py new file mode 100644 index 0000000..787fe8a --- /dev/null +++ b/script/tests/tests/PS Tests/playground-pw84/playground-pw84.py @@ -0,0 +1,130 @@ +# Test name: playground-pw84 +# on dir playground, iocsh pw84.db +# Copyright (c) 2015 Paul Scherrer Institute. All rights reserved. + +###### Init - DO NOT MODIFY THE CODE BELOW ###### +global sys, inspect, os, traceback +import sys, inspect, os, traceback + + +def startTest(testName, DEVICE, params): + """ + Main method running the test + """ + # by default, assume the test failed + ret = 'Test failed' + status = False + # plot name to be given to the scan. Use: scan.setPlotTitle(plotName) + plotName = DEVICE + ' - ' + testName + # put the whole custom code under try/catch + try: + # get the path of this script + testPath = inspect.getfile(inspect.currentframe()) + # init the testing tool class. It can be sued in the following ways: + test = TestingTool(testName, testPath, DEVICE, params) + +################ END OF Init ##################### +######### WRITE YOUR CODE HERE BELOW ############# + test.log( 'testpath A: ' + testPath ) + test.log( 'parameters: ' + str(params) ) + test.log( 'device: ' + DEVICE ) + #scan = ManualScan(['time'], ['SetV', 'ActualV', 'ActualI'] , [0.0], [30.0], [20]) + scan = ManualScan(['time'], ['SetV', 'ActualV', 'ActualI']) + scan.setPlotTitle(plotName) + scan.start() + + try: + #Creating channels: dimension 1 + #Ramp rate + #SetRamp = Channel(DEVICE + ':Set-RampA', type = 'd') + SetRamp = Channel('pw84:ai', type = 'd') + #LinearPositioner SetV + #SetV = Channel(DEVICE + ':Set-VA', type = 'd') + SetV = Channel('pw84:ai', type = 'd') + #Timestamp time + #ScalarDetector ActualV + #ActualV = Channel(DEVICE + ':Actual-VA', type = 'd') + ActualV = Channel('pw84:ai', type = 'd') + #ScalarDetector ActualI + #ActualI = Channel(DEVICE + ':Actual-IA', type = 'd') + ActualI = Channel('pw84:ai', type = 'd') + except: + import traceback + test.sendFeedback( 'Unable to create channel - ' + traceback.format_exc(), False) + #raise Exception('Unable to create channel - ' + traceback.format_exc()) + return + + #Init + SetRamp.put(10.0, timeout=None) + + #set voltage to 0 + test.log( 'Ramping down power supply A to 0V' ) + SetV.put(0.0, timeout=None) + + #wait up to 2 minutes for voltage to be ~0 + for setpoint1 in frange(0.0, 120.0, 1.0, True): + detector2 = ActualV.get() + if detector2 <= 1.0: + break + sleep(0.5) + + #Dimension 1 + #LinearPositioner SetV + test.log( 'Ramping up power supply A' ) + for setpoint1 in frange(0.0, 20.0, 5.0, True): + if setpoint1 > 50.0 or setpoint1 < 0.0: + break + SetV.put(setpoint1, timeout=None) # TODO: Set appropriate timeout + readback1 = SetV.get() + if abs(readback1 - setpoint1) > 0.9 : # TODO: Check accuracy + raise Exception('SetV could not be set to the value ' + str(setpoint1)) + ret = 'SetV could not be set to the value ' + str(setpoint1) + '(measured value: '+str(readback1)+')' + success = False + break + #scan quickly the output during some seconds + for setpoint2 in range(0, 20): + #Detector time + detector1 = float(java.lang.System.currentTimeMillis()) + #Detector ActualV + detector2 = ActualV.get() + detector3 = ActualI.get() + #scan.append ([setpoint1], [readback1], [detector1, detector2]) + #append(setpoints, positions, values) + scan.append ([detector1], [detector1], [readback1, detector2, detector3]) + sleep( 0.1 ) # Settling time + + #reset output to 0V + SetV.put(0.0, timeout=None) + #Closing channels + SetV.close() + ActualV.close() + ActualI.close() + + scan.end() + ret = 'Test ps A completed' + success = True +################ END OF YOUR CODE ################ +###### Final - DO NOT MODIFY THE CODE BELOW ###### + + # just in case the feedback was forgotten + test.sendFeedback(ret, success) + except (KeyboardInterrupt): + # user stop error handler + import traceback + ret = 'Test stopped by user.' + success = False + test.sendFeedback(ret, success) + except: + # generic error handler + import traceback + ret = traceback.format_exc() + success = False + test.sendFeedback(ret, success) + + +# launch the test +startTest(test, device, parameters) + +################ END OF Final #################### +#### IF NEEDED, ADD YOUR FUNCTIONS HERE BELOW #### +# def yourCustomFunction: diff --git a/script/tests/tests/PS Tests/power-supply-A/.config b/script/tests/tests/PS Tests/power-supply-A/.config new file mode 100644 index 0000000..e41edb6 --- /dev/null +++ b/script/tests/tests/PS Tests/power-supply-A/.config @@ -0,0 +1,12 @@ +name=power-supply-A +description=power-supply A + +help = \ +This test sends a command to the low level firmware which controls the collimators \n\ +requesting that it calibrates itself. \n\n\ +Calibration involves moving to the R1 and R2 reference positions and measuring the \n\ +number of steps required to do so. At the end of the sequence the default collimator \n\ +will be selected. \n\n\ +During the course of the expected calibration period (45-70 seconds) the test \n\ +procedure will plot the values of all critical system variables. \n\n\ +For further information please consult Valery Ovinnikov.
\ diff --git a/script/tests/tests/PS Tests/power-supply-A/power-supply-A - Copy works with testcommons.py b/script/tests/tests/PS Tests/power-supply-A/power-supply-A - Copy works with testcommons.py new file mode 100644 index 0000000..3e801ae --- /dev/null +++ b/script/tests/tests/PS Tests/power-supply-A/power-supply-A - Copy works with testcommons.py @@ -0,0 +1,115 @@ +######################################### +###### DO NOT MODIFY THE CODE BELOW ##### +######################################### +global print_log, sendFeedback, sys, inspect, os, traceback, testcommons +import sys, inspect, os, traceback, testcommons + +def print_log(testName, DEVICE, text): + testcommons.print_log(testName, DEVICE, text) + +def sendFeedback(testPath, testName, DEVICE, returnString, testPassed): + ret = testcommons.sendFeedback(testPath, testName, DEVICE, returnString, testPassed) + set_return(ret) + +def startTest(testName, DEVICE, params): + #get the path of this script + testcommons.print_pio() + import inspect + testPath = inspect.getfile(inspect.currentframe()) + #by default, failed + ret = 'Test failed' + success = False + #plot name to be given to the scan. Use: scan.setPlotTitle(plotName) + plotName = DEVICE + ' - ' + testName +######################################### +###### WRITE YOUR CODE HERE BELOW ####### +######################################### + print_log(testName, DEVICE, 'testpath A: ' + testPath ) + print_log(testName, DEVICE, 'parameters: ' + str(params) ) + print_log(testName, DEVICE, 'device: ' + DEVICE ) + #scan = ManualScan(['time'], ['SetV', 'ActualV', 'ActualI'] , [0.0], [30.0], [20]) + scan = ManualScan(['time'], ['SetV', 'ActualV', 'ActualI']) + scan.setPlotTitle(plotName) + scan.start() + try: + #Creating channels: dimension 1 + #Ramp rate + SetRamp = Channel(DEVICE + ':Set-RampA', type = 'd') + #SetRamp = Channel('pw84:ai', type = 'd') + #LinearPositioner SetV + SetV = Channel(DEVICE + ':Set-VA', type = 'd') + #SetV = Channel('pw84:ai', type = 'd') + #Timestamp time + #ScalarDetector ActualV + ActualV = Channel(DEVICE + ':Actual-VA', type = 'd') + #ActualV = Channel('pw84:ai', type = 'd') + #ScalarDetector ActualI + ActualI = Channel(DEVICE + ':Actual-IA', type = 'd') + #ActualI = Channel('pw84:ai', type = 'd') + except: + import traceback + sendFeedback(testPath, testName, DEVICE, 'Unable to create channel - ' + traceback.format_exc(), False) + #raise Exception('Unable to create channel - ' + traceback.format_exc()) + return + + #Init + SetRamp.put(10.0, timeout=None) + + #set voltage to 0 + print_log(testName, DEVICE, 'Ramping down power supply A to 0V' ) + SetV.put(0.0, timeout=None) + + #wait up to 2 minutes for voltage to be ~0 + for setpoint1 in frange(0.0, 120.0, 1.0, True): + detector2 = ActualV.get() + if detector2 <= 1.0: + break + sleep(0.5) + + #Dimension 1 + #LinearPositioner SetV + print_log(testName, DEVICE, 'Ramping up power supply A' ) + for setpoint1 in frange(0.0, 20.0, 5.0, True): + if setpoint1 > 50.0 or setpoint1 < 0.0: + break + SetV.put(setpoint1, timeout=None) # TODO: Set appropriate timeout + readback1 = SetV.get() + if abs(readback1 - setpoint1) > 0.9 : # TODO: Check accuracy + raise Exception('SetV could not be set to the value ' + str(setpoint1)) + ret = 'SetV could not be set to the value ' + str(setpoint1) + '(measured value: '+str(readback1)+')' + success = False + break + #scan quickly the output during some seconds + for setpoint2 in range(0, 20): + #Detector time + detector1 = float(java.lang.System.currentTimeMillis()) + #Detector ActualV + detector2 = ActualV.get() + detector3 = ActualI.get() + #scan.append ([setpoint1], [readback1], [detector1, detector2]) + #append(setpoints, positions, values) + scan.append ([detector1], [detector1], [readback1, detector2, detector3]) + sleep( 0.1 ) # Settling time + ret = 'Test ps A completed' + success = True + + #reset output to 0V + SetV.put(0.0, timeout=None) + #Closing channels + SetV.close() + ActualV.close() + ActualI.close() + + scan.end() +######################################### +############# END OF YOUR CODE ########## +######################################### +###### DO NOT MODIFY THE CODE BELOW ##### +######################################### + sendFeedback(testPath, testName, DEVICE, ret, success) + + +#launch the test +#parameters = {} +startTest(test, device, parameters) + \ No newline at end of file diff --git a/script/tests/tests/PS Tests/power-supply-A/power-supply-A - Copy.py b/script/tests/tests/PS Tests/power-supply-A/power-supply-A - Copy.py new file mode 100644 index 0000000..5389446 --- /dev/null +++ b/script/tests/tests/PS Tests/power-supply-A/power-supply-A - Copy.py @@ -0,0 +1,124 @@ +######################################### +###### DO NOT MODIFY THE CODE BELOW ##### +######################################### +global print_log, sendFeedback, sys, inspect, os, traceback +import sys, inspect, os, traceback + +def print_log(testName, DEVICE, text): + time.ctime() + now = time.strftime('%Y.%m.%d %H:%M:%S') + print now + ' ' + DEVICE + ' - ' + testName + ': ' + str(text) + +#prepare and send feedback to calling tool +def sendFeedback(testPath, testName, DEVICE, returnString, testPassed): + print_log(testName, DEVICE, 'End of test. Result:') + print_log(testName, DEVICE, 'Device: ' + DEVICE) + print_log(testName, DEVICE, 'Test name: ' + testName) + print_log(testName, DEVICE, 'Test path: ' + testPath) + print_log(testName, DEVICE, 'Test passed: ' + str(testPassed)) + print_log(testName, DEVICE, 'Return string: ' + returnString) + ret = [testPath, DEVICE, returnString, testPassed] + set_return(ret) + +def startTest(testName, DEVICE, params): + #get the path of this script + import inspect + testPath = inspect.getfile(inspect.currentframe()) + #by default, failed + ret = 'Test failed' + success = False + #plot name to be given to the scan. Use: scan.setPlotTitle(plotName) + plotName = DEVICE + ' - ' + testName +######################################### +###### WRITE YOUR CODE HERE BELOW ####### +######################################### + print_log(testName, DEVICE, 'testpath A: ' + testPath ) + print_log(testName, DEVICE, 'parameters: ' + str(params) ) + print_log(testName, DEVICE, 'device: ' + DEVICE ) + #scan = ManualScan(['time'], ['SetV', 'ActualV', 'ActualI'] , [0.0], [30.0], [20]) + scan = ManualScan(['time'], ['SetV', 'ActualV', 'ActualI']) + scan.setPlotTitle(plotName) + scan.start() + + try: + #Creating channels: dimension 1 + #Ramp rate + SetRamp = Channel(DEVICE + ':Set-RampA', type = 'd') + #SetRamp = Channel('pw84:ai', type = 'd') + #LinearPositioner SetV + SetV = Channel(DEVICE + ':Set-VA', type = 'd') + #SetV = Channel('pw84:ai', type = 'd') + #Timestamp time + #ScalarDetector ActualV + ActualV = Channel(DEVICE + ':Actual-VA', type = 'd') + #ActualV = Channel('pw84:ai', type = 'd') + #ScalarDetector ActualI + ActualI = Channel(DEVICE + ':Actual-IA', type = 'd') + #ActualI = Channel('pw84:ai', type = 'd') + except: + import traceback + sendFeedback(testPath, testName, DEVICE, 'Unable to create channel - ' + traceback.format_exc(), False) + #raise Exception('Unable to create channel - ' + traceback.format_exc()) + return + + #Init + SetRamp.put(10.0, timeout=None) + + #set voltage to 0 + print_log(testName, DEVICE, 'Ramping down power supply A to 0V' ) + SetV.put(0.0, timeout=None) + + #wait up to 2 minutes for voltage to be ~0 + for setpoint1 in frange(0.0, 120.0, 1.0, True): + detector2 = ActualV.get() + if detector2 <= 1.0: + break + sleep(0.5) + + #Dimension 1 + #LinearPositioner SetV + print_log(testName, DEVICE, 'Ramping up power supply A' ) + for setpoint1 in frange(0.0, 20.0, 5.0, True): + if setpoint1 > 50.0 or setpoint1 < 0.0: + break + SetV.put(setpoint1, timeout=None) # TODO: Set appropriate timeout + readback1 = SetV.get() + if abs(readback1 - setpoint1) > 0.9 : # TODO: Check accuracy + raise Exception('SetV could not be set to the value ' + str(setpoint1)) + ret = 'SetV could not be set to the value ' + str(setpoint1) + '(measured value: '+str(readback1)+')' + success = False + break + #scan quickly the output during some seconds + for setpoint2 in range(0, 20): + #Detector time + detector1 = float(java.lang.System.currentTimeMillis()) + #Detector ActualV + detector2 = ActualV.get() + detector3 = ActualI.get() + #scan.append ([setpoint1], [readback1], [detector1, detector2]) + #append(setpoints, positions, values) + scan.append ([detector1], [detector1], [readback1, detector2, detector3]) + sleep( 0.1 ) # Settling time + ret = 'Test ps A completed' + success = True + + #reset output to 0V + SetV.put(0.0, timeout=None) + #Closing channels + SetV.close() + ActualV.close() + ActualI.close() + + scan.end() +######################################### +############# END OF YOUR CODE ########## +######################################### +###### DO NOT MODIFY THE CODE BELOW ##### +######################################### + sendFeedback(testPath, testName, DEVICE, ret, success) + + +#launch the test +#parameters = {} +startTest(test, device, parameters) + \ No newline at end of file diff --git a/script/tests/tests/PS Tests/power-supply-A/power-supply-A.py b/script/tests/tests/PS Tests/power-supply-A/power-supply-A.py new file mode 100644 index 0000000..914bcd5 --- /dev/null +++ b/script/tests/tests/PS Tests/power-supply-A/power-supply-A.py @@ -0,0 +1,117 @@ + +###### Init - DO NOT MODIFY THE CODE BELOW ###### +global sys, inspect, os, traceback +import sys, inspect, os, traceback + +def startTest(testName, DEVICE, params): + #by default, assume the test failed + ret = 'Test failed' + success = False + #plot name to be given to the scan. Use: scan.setPlotTitle(plotName) + plotName = DEVICE + ' - ' + testName + #put the whole custom code under try/catch + try: + #get the path of this script + testPath = inspect.getfile(inspect.currentframe()) + #init the testing tool class. It can be sued in the following ways: + test = TestingTool(testName, testPath, DEVICE, params) + +######### WRITE YOUR CODE HERE BELOW ############# + test.log( 'testpath A: ' + testPath ) + test.log( 'parameters: ' + str(params) ) + test.log( 'device: ' + DEVICE ) + #scan = ManualScan(['time'], ['SetV', 'ActualV', 'ActualI'] , [0.0], [30.0], [20]) + scan = ManualScan(['time'], ['SetV', 'ActualV', 'ActualI']) + scan.setPlotTitle(plotName) + scan.start() + + try: + #Creating channels: dimension 1 + #Ramp rate + SetRamp = Channel(DEVICE + ':Set-RampA', type = 'd') + #SetRamp = Channel('pw84:ai', type = 'd') + #LinearPositioner SetV + SetV = Channel(DEVICE + ':Set-VA', type = 'd') + #SetV = Channel('pw84:ai', type = 'd') + #Timestamp time + #ScalarDetector ActualV + ActualV = Channel(DEVICE + ':Actual-VA', type = 'd') + #ActualV = Channel('pw84:ai', type = 'd') + #ScalarDetector ActualI + ActualI = Channel(DEVICE + ':Actual-IA', type = 'd') + #ActualI = Channel('pw84:ai', type = 'd') + except: + import traceback + test.sendFeedback( 'Unable to create channel - ' + traceback.format_exc(), False) + #raise Exception('Unable to create channel - ' + traceback.format_exc()) + return + + #Init + SetRamp.put(10.0, timeout=None) + + #set voltage to 0 + test.log( 'Ramping down power supply A to 0V' ) + SetV.put(0.0, timeout=None) + + #wait up to 2 minutes for voltage to be ~0 + for setpoint1 in frange(0.0, 120.0, 1.0, True): + detector2 = ActualV.get() + if detector2 <= 1.0: + break + sleep(0.5) + + #Dimension 1 + #LinearPositioner SetV + test.log( 'Ramping up power supply A' ) + for setpoint1 in frange(0.0, 20.0, 5.0, True): + if setpoint1 > 50.0 or setpoint1 < 0.0: + break + SetV.put(setpoint1, timeout=None) # TODO: Set appropriate timeout + readback1 = SetV.get() + if abs(readback1 - setpoint1) > 0.9 : # TODO: Check accuracy + raise Exception('SetV could not be set to the value ' + str(setpoint1)) + ret = 'SetV could not be set to the value ' + str(setpoint1) + '(measured value: '+str(readback1)+')' + success = False + break + #scan quickly the output during some seconds + for setpoint2 in range(0, 20): + #Detector time + detector1 = float(java.lang.System.currentTimeMillis()) + #Detector ActualV + detector2 = ActualV.get() + detector3 = ActualI.get() + #scan.append ([setpoint1], [readback1], [detector1, detector2]) + #append(setpoints, positions, values) + scan.append ([detector1], [detector1], [readback1, detector2, detector3]) + sleep( 0.1 ) # Settling time + + #reset output to 0V + SetV.put(0.0, timeout=None) + #Closing channels + SetV.close() + ActualV.close() + ActualI.close() + + scan.end() + ret = 'Test ps A completed' + success = True +################ END OF YOUR CODE ################ +###### Final - DO NOT MODIFY THE CODE BELOW ###### + + #just in case the feedback was forgotten + test.sendFeedback(ret, success) + except (KeyboardInterrupt): + #user stop error handler + import traceback + ret = 'Test stopped by user.' + success = False + test.sendFeedback(ret, success) + except: + #generic error handler + import traceback + ret = traceback.format_exc() + success = False + test.sendFeedback(ret, success) + +#launch the test +startTest(test, device, parameters) \ No newline at end of file diff --git a/script/tests/tests/PS Tests/power-supply-B/.config b/script/tests/tests/PS Tests/power-supply-B/.config new file mode 100644 index 0000000..488f56b --- /dev/null +++ b/script/tests/tests/PS Tests/power-supply-B/.config @@ -0,0 +1,12 @@ +name=power-supply-B +description=power-supply B + +help = \ +This test sends a command to the low level firmware which controls the collimators \n\ +requesting that it calibrates itself. \n\n\ +Calibration involves moving to the R1 and R2 reference positions and measuring the \n\ +number of steps required to do so. At the end of the sequence the default collimator \n\ +will be selected. \n\n\ +During the course of the expected calibration period (45-70 seconds) the test \n\ +procedure will plot the values of all critical system variables. \n\n\ +For further information please consult Valery Ovinnikov.
\ diff --git a/script/tests/tests/PS Tests/power-supply-B/power-supply-B - Copy.py b/script/tests/tests/PS Tests/power-supply-B/power-supply-B - Copy.py new file mode 100644 index 0000000..f4b9d72 --- /dev/null +++ b/script/tests/tests/PS Tests/power-supply-B/power-supply-B - Copy.py @@ -0,0 +1,112 @@ + +###### Init - DO NOT MODIFY THE CODE BELOW ###### +global print_log, sendFeedback, sys, inspect, os, traceback +import sys, inspect, os, traceback + +def print_log(testName, DEVICE, text): + time.ctime() + now = time.strftime('%Y.%m.%d %H:%M:%S') + print now + ' ' + DEVICE + ' - ' + testName + ': ' + text + +#prepare and send feedback to calling tool +def sendFeedback(testPath, testName, DEVICE, returnString, testPassed): + print_log(testName, DEVICE, 'End of test. Result:') + print_log(testName, DEVICE, 'Device: ' + DEVICE) + print_log(testName, DEVICE, 'Test name: ' + testName) + print_log(testName, DEVICE, 'Test path: ' + testPath) + print_log(testName, DEVICE, 'Test passed: ' + str(testPassed)) + print_log(testName, DEVICE, 'Return string: ' + returnString) + ret = [testPath, DEVICE, returnString, testPassed] + set_return(ret) + +def startTest(testName, DEVICE, params): + #get the path of this script + import inspect + testPath = inspect.getfile(inspect.currentframe()) + #by default, failed + ret = 'Test failed' + success = False + #plot name to be given to the scan. Use: scan.setPlotTitle(plotName) + plotName = DEVICE + ' - ' + testName +######### WRITE YOUR CODE HERE BELOW ############# + print_log(testName, DEVICE, 'testpath B: ' + testPath ) + print_log(testName, DEVICE, 'parameters:' + str( params) ) + print_log(testName, DEVICE, 'device: ' + DEVICE ) + #scan = ManualScan(['time'], ['SetVB', 'ActualVB', 'ActualIB'] , [0.0], [30.0], [20]) + scan = ManualScan(['time'], ['SetVB', 'ActualVB', 'ActualIB'] ) + scan.setPlotTitle(plotName) + scan.start() + + #Creating channels: dimension 1 + try: + #Ramp rate + SetRamp = Channel(DEVICE + ':Set-RampB', type = 'd') + #SetRamp = Channel('pw84:ai', type = 'd') + #LinearPositioner SetVA + SetVA = Channel(DEVICE + ':Set-VB', type = 'd') + #SetVA = Channel('pw84:ai', type = 'd') + #Timestamp time + #ScalarDetector ActualVA + ActualVA = Channel(DEVICE + ':Actual-VB', type = 'd') + #ActualVA = Channel('pw84:ai', type = 'd') + #ScalarDetector ActualIA + ActualIA = Channel(DEVICE + ':Actual-IB', type = 'd') + #ActualIA = Channel('pw84:ai', type = 'd') + except: + sendFeedback(testPath, testName, DEVICE, 'Unable to create channel - ' + traceback.format_exc(), False) + return + #Init + SetRamp.put(10.0, timeout=None) + + #set voltage to 0 + print_log(testName, DEVICE, 'Ramping down power supply B to 0V') + SetVA.put(0.0, timeout=None) + + #wait up to 2 minutes for voltage to be ~0 + for setpoint1 in frange(0.0, 120.0, 1.0, True): + detector2 = ActualVA.get() + if detector2 <= 1.0: + break + sleep(0.5) + + #Dimension 1 + #LinearPositioner SetVA + print_log(testName, DEVICE, 'Ramping up power supply') + for setpoint1 in frange(0.0, 20.0, 5.0, True): + if setpoint1 > 50.0 or setpoint1 < 0.0: + break + SetVA.put(setpoint1, timeout=None) # TODO: Set appropriate timeout + readback1 = SetVA.get() + if abs(readback1 - setpoint1) > 0.9 : # TODO: Check accuracy + raise Exception('SetVB could not be set to the value ' + str(setpoint1)) + ret = 'SetVB could not be set to the value ' + str(setpoint1) + '(measured value: '+str(readback1)+')' + success = False + break + #scan quickly the output during some seconds + for setpoint2 in range(0, 20): + #Detector time + detector1 = float(java.lang.System.currentTimeMillis()) + #Detector ActualVA + detector2 = ActualVA.get() + detector3 = ActualIA.get() + #scan.append ([setpoint1], [readback1], [detector1, detector2]) + #append(setpoints, positions, values) + scan.append ([detector1], [detector1], [readback1, detector2, detector3]) + sleep( 0.1 ) # Settling time + ret = 'Test ps B completed' + success = True + + #reset output to 0V + SetVA.put(0.0, timeout=None) + #Closing channels + SetVA.close() + ActualVA.close() + ActualIA.close() +################ END OF YOUR CODE ################ +###### Final - DO NOT MODIFY THE CODE BELOW ###### + sendFeedback(testPath, testName, DEVICE, ret, success) + +#launch the test +parameters = {} +startTest(test, device, parameters) + diff --git a/script/tests/tests/PS Tests/power-supply-B/power-supply-B.py b/script/tests/tests/PS Tests/power-supply-B/power-supply-B.py new file mode 100644 index 0000000..bab49a9 --- /dev/null +++ b/script/tests/tests/PS Tests/power-supply-B/power-supply-B.py @@ -0,0 +1,113 @@ + +###### Init - DO NOT MODIFY THE CODE BELOW ###### +global sys, inspect, os, traceback +import sys, inspect, os, traceback + +def startTest(testName, DEVICE, params): + #by default, assume the test failed + ret = 'Test failed' + success = False + #plot name to be given to the scan. Use: scan.setPlotTitle(plotName) + plotName = DEVICE + ' - ' + testName + #put the whole custom code under try/catch + try: + #get the path of this script + testPath = inspect.getfile(inspect.currentframe()) + #init the testing tool class. It can be sued in the following ways: + test = TestingTool(testName, testPath, DEVICE, params) + +######### WRITE YOUR CODE HERE BELOW ############# + test.log( 'testpath B: ' + testPath ) + test.log( 'parameters:' + str( params) ) + test.log( 'device: ' + DEVICE ) + #scan = ManualScan(['time'], ['SetVB', 'ActualVB', 'ActualIB'] , [0.0], [30.0], [20]) + scan = ManualScan(['time'], ['SetVB', 'ActualVB', 'ActualIB'] ) + scan.setPlotTitle(plotName) + scan.start() + + #Creating channels: dimension 1 + try: + #Ramp rate + SetRamp = Channel(DEVICE + ':Set-RampB', type = 'd') + #SetRamp = Channel('pw84:ai', type = 'd') + #LinearPositioner SetVA + SetVA = Channel(DEVICE + ':Set-VB', type = 'd') + #SetVA = Channel('pw84:ai', type = 'd') + #Timestamp time + #ScalarDetector ActualVA + ActualVA = Channel(DEVICE + ':Actual-VB', type = 'd') + #ActualVA = Channel('pw84:ai', type = 'd') + #ScalarDetector ActualIA + ActualIA = Channel(DEVICE + ':Actual-IB', type = 'd') + #ActualIA = Channel('pw84:ai', type = 'd') + except: + import traceback + test.sendFeedback( 'Unable to create channel - ' + traceback.format_exc(), False) + return + #Init + SetRamp.put(10.0, timeout=None) + + #set voltage to 0 + test.log( 'Ramping down power supply B to 0V') + SetVA.put(0.0, timeout=None) + + #wait up to 2 minutes for voltage to be ~0 + for setpoint1 in frange(0.0, 120.0, 1.0, True): + detector2 = ActualVA.get() + if detector2 <= 1.0: + break + sleep(0.5) + + #Dimension 1 + #LinearPositioner SetVA + test.log( 'Ramping up power supply') + for setpoint1 in frange(0.0, 20.0, 5.0, True): + if setpoint1 > 50.0 or setpoint1 < 0.0: + break + SetVA.put(setpoint1, timeout=None) # TODO: Set appropriate timeout + readback1 = SetVA.get() + if abs(readback1 - setpoint1) > 0.9 : # TODO: Check accuracy + raise Exception('SetVB could not be set to the value ' + str(setpoint1)) + ret = 'SetVB could not be set to the value ' + str(setpoint1) + '(measured value: '+str(readback1)+')' + success = False + break + #scan quickly the output during some seconds + for setpoint2 in range(0, 20): + #Detector time + detector1 = float(java.lang.System.currentTimeMillis()) + #Detector ActualVA + detector2 = ActualVA.get() + detector3 = ActualIA.get() + #scan.append ([setpoint1], [readback1], [detector1, detector2]) + #append(setpoints, positions, values) + scan.append ([detector1], [detector1], [readback1, detector2, detector3]) + sleep( 0.1 ) # Settling time + + #reset output to 0V + SetVA.put(0.0, timeout=None) + #Closing channels + SetVA.close() + ActualVA.close() + ActualIA.close() + ret = 'Test ps B completed' + success = True +################ END OF YOUR CODE ################ +###### Final - DO NOT MODIFY THE CODE BELOW ###### + + #just in case the feedback was forgotten + test.sendFeedback(ret, success) + except (KeyboardInterrupt): + #user stop error handler + import traceback + ret = 'Test stopped by user.' + success = False + test.sendFeedback(ret, success) + except: + #generic error handler + import traceback + ret = traceback.format_exc() + success = False + test.sendFeedback(ret, success) + +#launch the test +startTest(test, device, parameters) \ No newline at end of file diff --git a/script/tests/tests/PS Tests/test without ioc 2/.config b/script/tests/tests/PS Tests/test without ioc 2/.config new file mode 100644 index 0000000..472d5ef --- /dev/null +++ b/script/tests/tests/PS Tests/test without ioc 2/.config @@ -0,0 +1,4 @@ +#Mon Sep 07 10&48&01 CEST 2015 +name=test without ioc 2 +description=test that does not use any connection to IOC. It is useful to test pure pshell graphical features. +parameters=repeatTimes&3&how many times the test is repeated;howManySamples&300&How many samples are plotted;delayBetweenSampleS&0.05&delay [s] between two samples; diff --git a/script/tests/tests/PS Tests/test without ioc 2/help.html b/script/tests/tests/PS Tests/test without ioc 2/help.html new file mode 100644 index 0000000..03230c0 --- /dev/null +++ b/script/tests/tests/PS Tests/test without ioc 2/help.html @@ -0,0 +1,14 @@ + + +

Description

+test that does not use any connection to IOC. It is useful to test pure pshell graphical features. +

Parameters

+repeatTimes how many times the test is repeated
+howManySamples How many samples are plotted
+delayBetweenSampleS delay [s] between two samples
+ +

Contact

+boccioli_m + + + diff --git a/script/tests/tests/PS Tests/test without ioc 2/test without ioc - Copy.py b/script/tests/tests/PS Tests/test without ioc 2/test without ioc - Copy.py new file mode 100644 index 0000000..ea70a3c --- /dev/null +++ b/script/tests/tests/PS Tests/test without ioc 2/test without ioc - Copy.py @@ -0,0 +1,147 @@ +#Test name: test without ioc +#test that does not use any connection to IOC. It is useful to test pure pshell graphical features. + +###### Init - DO NOT MODIFY THE CODE BELOW ###### +global sys, inspect, os, traceback +import sys, inspect, os, traceback + +def startTest(testName, DEVICE, params): + #by default, assume the test failed + ret = 'Test failed' + success = False + #plot name to be given to the scan. Use: scan.setPlotTitle(plotName) + plotName = DEVICE + ' - ' + testName + #put the whole custom code under try/catch + try: + #get the path of this script + testPath = inspect.getfile(inspect.currentframe()) + #init the testing tool class. It can be sued in the following ways: + test = TestingTool(testName, testPath, DEVICE, params) + +######### WRITE YOUR CODE HERE BELOW ############# + + #All the code in this section ## ..YOUR CODE.. ## can be modified/deleted. + #It must be indented at the same level as this comment + #----------------------------------- + # GETTING INPUTS: + #If needed, the following variables are available: + #testPath string, path of this test file + #testName string, name of this test + #DEVICE string, device for which the test must run (typically it is the beginning of a process variable name) + #----------------------------------- + # GETTING TEST PARAMETERS: + #if you need to get parameters for the test, use (casting may be necessary): + #myParamValue = test.getParam('myParamName') + #see the test config for the list of parameters specific to the test. + #----------------------------------- + # SETTING OUTPUTS: + #ret string, a text summarizing the result of the test. It must be set before the end of your code. + #success bool, True = test successful. It must be set before the end of your code. + #test.sendFeedback(ret,success) method that ends the testing script and gives the report to the calling application. + #Examples: + # + #whenever the code must quit (i.e. after an error), you must end with: + #ret = 'here is some info on what failed on the test' + #success = false + #test.sendFeedback(ret, success) + # + #whenever the code is finished successfully, you must end with: + #ret = 'here is some info on the success of the test' + #success = true + #test.sendFeedback(ret, success) + #----------------------------------- + # LOG INFO: + #when some information must be shown on the log, use: + #test.log('test to log') + + ########## Example (can be removed) ###### + #print the list of parameters passed. If any error, stop and send feedback + test.log("Example - Test name: "+testName) + test.log("Example - Device name: "+DEVICE) + try: + test.log("Running test Initialise with the following parameters:") + test.log(params ) + #If present, use the parameters here below for your test script + repeatTimes = int(test.getParam('repeatTimes')) ; howManySamples = int(test.getParam('howManySamples')) ; delayBetweenSampleS = float(test.getParam('delayBetweenSampleS')) ; + except: + ret = 'Could not retrieve testing parameters - ' + traceback.format_exc() + success = False + test.sendFeedback( ret, success) + return + + #loop to read channels for a while and plot the channels values. + + #initialise plot tab with 2 plots + scan = ManualScan(['sample'], ['Motor Status (MSTA)', 'Motor Position (VAL)'] ) + #set plot name(tab title) + scan.setPlotTitle(plotName + "Manual Scan") + #start plots. See further below how to add points to the plots + scan.start() + + #in this example we initialise also a plot type to show how to add several curves on the same plot + p1 = plot(None,name="Data 1", context = plotName + "Multi curves")[0] + #opionally set plot ranges + #p1.getAxis(p1.AxisId.X).setRange(0.0,80.0) + #p1.getAxis(p1.AxisId.Y).setRange(0.0,70.0) + p1.addSeries(LinePlotSeries("Data2")) + + motor_msta = 0 + motor_val = 50 + increment = 1 + + max = 0 + maxPos = 0 + min = 0 + minPos = 0 + + for sample in range(0, howManySamples): + readback1 = sample + sleep( delayBetweenSampleS ) # Settling time + #here we simulate getting values + motor_msta = motor_msta + increment + motor_val = motor_val - increment + if abs(motor_msta) == 50: + increment = -1 * increment + #add values to manual scan + scan.append ([sample], [readback1], [motor_msta, motor_val] ) + #add values to plot + p1.getSeries(0).appendData(sample, motor_msta) + p1.getSeries(1).appendData(sample, motor_val ) + #compute min and max peaks + if motor_msta - motor_val > max: + max = motor_msta - motor_val + maxPos = sample + if motor_msta - motor_val < min: + min = motor_msta - motor_val + minPos = sample + + + + import java.awt.Color + p1[0].addMarker(maxPos, None, "Max=" + str(max), java.awt.Color.LIGHT_GRAY) + p1[0].addMarker(minPos, None, "Min=" + str(min), java.awt.Color.LIGHT_GRAY) + + + + #IMPORTANT: if the test was successful, write the report into the variables ret and success. + #for example, write the following: + ret = "Example - Test successful, here some detail: ..." + success = True + test.sendFeedback(ret, success) + #once the test is finished, no need to do anything. The code below yours will do the rest. + ################ End of Example ########## + +################ END OF YOUR CODE ################ +###### Final - DO NOT MODIFY THE CODE BELOW ###### + + #just in case the feedback was forgotten + test.sendFeedback(ret, success) + except: + #generic error handler + ret = traceback.format_exc() + success = False + test.sendFeedback(ret, success) + +#launch the test +startTest(test, device, parameters) + \ No newline at end of file diff --git a/script/tests/tests/PS Tests/test without ioc 2/test without ioc 2.py b/script/tests/tests/PS Tests/test without ioc 2/test without ioc 2.py new file mode 100644 index 0000000..76626d6 --- /dev/null +++ b/script/tests/tests/PS Tests/test without ioc 2/test without ioc 2.py @@ -0,0 +1,154 @@ +#Test name: test without ioc +#test that does not use any connection to IOC. It is useful to test pure pshell graphical features. + +###### Init - DO NOT MODIFY THE CODE BELOW ###### +global sys, inspect, os, traceback +import sys, inspect, os, traceback + +def startTest(testName, DEVICE, params): + #by default, assume the test failed + ret = 'Test failed' + success = False + #plot name to be given to the scan. Use: scan.setPlotTitle(plotName) + plotName = DEVICE + ' - ' + testName + #put the whole custom code under try/catch + try: + #get the path of this script + testPath = inspect.getfile(inspect.currentframe()) + #init the testing tool class. It can be sued in the following ways: + test = TestingTool(testName, testPath, DEVICE, params) + +######### WRITE YOUR CODE HERE BELOW ############# + + #All the code in this section ## ..YOUR CODE.. ## can be modified/deleted. + #It must be indented at the same level as this comment + #----------------------------------- + # GETTING INPUTS: + #If needed, the following variables are available: + #testPath string, path of this test file + #testName string, name of this test + #DEVICE string, device for which the test must run (typically it is the beginning of a process variable name) + #----------------------------------- + # GETTING TEST PARAMETERS: + #if you need to get parameters for the test, use (casting may be necessary): + #myParamValue = test.getParam('myParamName') + #see the test config for the list of parameters specific to the test. + #----------------------------------- + # SETTING OUTPUTS: + #ret string, a text summarizing the result of the test. It must be set before the end of your code. + #success bool, True = test successful. It must be set before the end of your code. + #test.sendFeedback(ret,success) method that ends the testing script and gives the report to the calling application. + #Examples: + # + #whenever the code must quit (i.e. after an error), you must end with: + #ret = 'here is some info on what failed on the test' + #success = false + #test.sendFeedback(ret, success) + # + #whenever the code is finished successfully, you must end with: + #ret = 'here is some info on the success of the test' + #success = true + #test.sendFeedback(ret, success) + #----------------------------------- + # LOG INFO: + #when some information must be shown on the log, use: + #test.log('test to log') + + ########## Example (can be removed) ###### + #print the list of parameters passed. If any error, stop and send feedback + test.log("Example - Test name: "+testName) + test.log("Example - Device name: "+DEVICE) + try: + test.log("Running test Initialise with the following parameters:") + test.log(params ) + #If present, use the parameters here below for your test script + repeatTimes = int(test.getParam('repeatTimes')) ; howManySamples = int(test.getParam('howManySamples')) ; delayBetweenSampleS = float(test.getParam('delayBetweenSampleS')) ; + except: + ret = 'Could not retrieve testing parameters - ' + traceback.format_exc() + success = False + test.sendFeedback( ret, success) + return + + #loop to read channels for a while and plot the channels values. + + #initialise plot tab with 2 plots + scan = ManualScan(['sample'], ['Motor Status (MSTA)', 'Motor Position (VAL)'] ) + #set plot name(tab title) + scan.setPlotTitle(plotName + " Manual Scan") + #start plots. See further below how to add points to the plots + scan.start() + + #in this example we initialise also a plot type to show how to add several curves on the same plot + p1 = plot(None,name="motor_msta", context = plotName + " Multi curves")[0] + #opionally set plot ranges + #p1.getAxis(p1.AxisId.X).setRange(0.0,80.0) + #p1.getAxis(p1.AxisId.Y).setRange(0.0,70.0) + p1.addSeries(LinePlotSeries("motor_val")) + + motor_msta = 0 + motor_val = 50 + increment = 1 + + max = -1 + maxPos = 0 + min = 1000000000000 + minPos = 0 + from math import sin + for sample in range(0, howManySamples): + readback1 = sample + sleep( delayBetweenSampleS ) # Settling time + #here we simulate getting values + #just draw a saw + motor_msta = motor_msta + increment + #just draw a nice sinusoid + motor_val = sin(float(sample)/10.0)*10.0-10.0 + if abs(motor_msta) >= 50: + increment = -1 * increment + #add values to manual scan + scan.append ([sample], [readback1], [motor_msta, motor_val] ) + #add values to plot + p1.getSeries(0).appendData(sample, motor_msta) + p1.getSeries(1).appendData(sample, motor_val ) + #compute min and max differences + if abs(motor_msta - motor_val) > max: + max = abs(motor_msta - motor_val) + maxPos = sample + if abs(motor_msta - motor_val) < min: + min = abs(motor_msta - motor_val) + minPos = sample + + #show differences in the plot + import java.awt.Color + p1.addMarker(maxPos, None, "Max=" + str(max), java.awt.Color.LIGHT_GRAY) + p1.addMarker(minPos, None, "Min=" + str(min), java.awt.Color.LIGHT_GRAY) + +# plots[0].addMarker(25, None, "Mark", java.awt.Color.LIGHT_GRAY) + + #IMPORTANT: if the test was successful, write the report into the variables ret and success. + #for example, write the following: + ret = "Example Test successful" + success = True + #once the test is finished, no need to do anything. The code below yours will do the rest. + ################ End of Example ########## + +################ END OF YOUR CODE ################ +###### Final - DO NOT MODIFY THE CODE BELOW ###### + + #just in case the feedback was forgotten + test.sendFeedback(ret, success) + except (KeyboardInterrupt): + #user stop error handler + ret = 'Test stopped by user.' + success = False + test.sendFeedback(ret, success) + except: + #generic error handler + ret = traceback.format_exc() + success = False + test.sendFeedback(ret, success) + +#launch the test +startTest(test, device, parameters) + +################ END OF Final #################### +#### IF NEEDED, ADD YOUR FUNCTIONS HERE BELOW #### diff --git a/script/tests/tests/PS Tests/test without ioc 3/.config b/script/tests/tests/PS Tests/test without ioc 3/.config new file mode 100644 index 0000000..a819fcc --- /dev/null +++ b/script/tests/tests/PS Tests/test without ioc 3/.config @@ -0,0 +1,4 @@ +#Mon Sep 07 10&48&01 CEST 2015 +name=test without ioc 3 +description=test that does not use any connection to IOC. It is useful to test pure pshell graphical features. +parameters=repeatTimes&3&how many times the test is repeated;howManySamples&300&How many samples are plotted;delayBetweenSampleS&0.05&delay [s] between two samples; diff --git a/script/tests/tests/PS Tests/test without ioc 3/help.html b/script/tests/tests/PS Tests/test without ioc 3/help.html new file mode 100644 index 0000000..03230c0 --- /dev/null +++ b/script/tests/tests/PS Tests/test without ioc 3/help.html @@ -0,0 +1,14 @@ + + +

Description

+test that does not use any connection to IOC. It is useful to test pure pshell graphical features. +

Parameters

+repeatTimes how many times the test is repeated
+howManySamples How many samples are plotted
+delayBetweenSampleS delay [s] between two samples
+ +

Contact

+boccioli_m + + + diff --git a/script/tests/tests/PS Tests/test without ioc 3/test without ioc - Copy.py b/script/tests/tests/PS Tests/test without ioc 3/test without ioc - Copy.py new file mode 100644 index 0000000..ea70a3c --- /dev/null +++ b/script/tests/tests/PS Tests/test without ioc 3/test without ioc - Copy.py @@ -0,0 +1,147 @@ +#Test name: test without ioc +#test that does not use any connection to IOC. It is useful to test pure pshell graphical features. + +###### Init - DO NOT MODIFY THE CODE BELOW ###### +global sys, inspect, os, traceback +import sys, inspect, os, traceback + +def startTest(testName, DEVICE, params): + #by default, assume the test failed + ret = 'Test failed' + success = False + #plot name to be given to the scan. Use: scan.setPlotTitle(plotName) + plotName = DEVICE + ' - ' + testName + #put the whole custom code under try/catch + try: + #get the path of this script + testPath = inspect.getfile(inspect.currentframe()) + #init the testing tool class. It can be sued in the following ways: + test = TestingTool(testName, testPath, DEVICE, params) + +######### WRITE YOUR CODE HERE BELOW ############# + + #All the code in this section ## ..YOUR CODE.. ## can be modified/deleted. + #It must be indented at the same level as this comment + #----------------------------------- + # GETTING INPUTS: + #If needed, the following variables are available: + #testPath string, path of this test file + #testName string, name of this test + #DEVICE string, device for which the test must run (typically it is the beginning of a process variable name) + #----------------------------------- + # GETTING TEST PARAMETERS: + #if you need to get parameters for the test, use (casting may be necessary): + #myParamValue = test.getParam('myParamName') + #see the test config for the list of parameters specific to the test. + #----------------------------------- + # SETTING OUTPUTS: + #ret string, a text summarizing the result of the test. It must be set before the end of your code. + #success bool, True = test successful. It must be set before the end of your code. + #test.sendFeedback(ret,success) method that ends the testing script and gives the report to the calling application. + #Examples: + # + #whenever the code must quit (i.e. after an error), you must end with: + #ret = 'here is some info on what failed on the test' + #success = false + #test.sendFeedback(ret, success) + # + #whenever the code is finished successfully, you must end with: + #ret = 'here is some info on the success of the test' + #success = true + #test.sendFeedback(ret, success) + #----------------------------------- + # LOG INFO: + #when some information must be shown on the log, use: + #test.log('test to log') + + ########## Example (can be removed) ###### + #print the list of parameters passed. If any error, stop and send feedback + test.log("Example - Test name: "+testName) + test.log("Example - Device name: "+DEVICE) + try: + test.log("Running test Initialise with the following parameters:") + test.log(params ) + #If present, use the parameters here below for your test script + repeatTimes = int(test.getParam('repeatTimes')) ; howManySamples = int(test.getParam('howManySamples')) ; delayBetweenSampleS = float(test.getParam('delayBetweenSampleS')) ; + except: + ret = 'Could not retrieve testing parameters - ' + traceback.format_exc() + success = False + test.sendFeedback( ret, success) + return + + #loop to read channels for a while and plot the channels values. + + #initialise plot tab with 2 plots + scan = ManualScan(['sample'], ['Motor Status (MSTA)', 'Motor Position (VAL)'] ) + #set plot name(tab title) + scan.setPlotTitle(plotName + "Manual Scan") + #start plots. See further below how to add points to the plots + scan.start() + + #in this example we initialise also a plot type to show how to add several curves on the same plot + p1 = plot(None,name="Data 1", context = plotName + "Multi curves")[0] + #opionally set plot ranges + #p1.getAxis(p1.AxisId.X).setRange(0.0,80.0) + #p1.getAxis(p1.AxisId.Y).setRange(0.0,70.0) + p1.addSeries(LinePlotSeries("Data2")) + + motor_msta = 0 + motor_val = 50 + increment = 1 + + max = 0 + maxPos = 0 + min = 0 + minPos = 0 + + for sample in range(0, howManySamples): + readback1 = sample + sleep( delayBetweenSampleS ) # Settling time + #here we simulate getting values + motor_msta = motor_msta + increment + motor_val = motor_val - increment + if abs(motor_msta) == 50: + increment = -1 * increment + #add values to manual scan + scan.append ([sample], [readback1], [motor_msta, motor_val] ) + #add values to plot + p1.getSeries(0).appendData(sample, motor_msta) + p1.getSeries(1).appendData(sample, motor_val ) + #compute min and max peaks + if motor_msta - motor_val > max: + max = motor_msta - motor_val + maxPos = sample + if motor_msta - motor_val < min: + min = motor_msta - motor_val + minPos = sample + + + + import java.awt.Color + p1[0].addMarker(maxPos, None, "Max=" + str(max), java.awt.Color.LIGHT_GRAY) + p1[0].addMarker(minPos, None, "Min=" + str(min), java.awt.Color.LIGHT_GRAY) + + + + #IMPORTANT: if the test was successful, write the report into the variables ret and success. + #for example, write the following: + ret = "Example - Test successful, here some detail: ..." + success = True + test.sendFeedback(ret, success) + #once the test is finished, no need to do anything. The code below yours will do the rest. + ################ End of Example ########## + +################ END OF YOUR CODE ################ +###### Final - DO NOT MODIFY THE CODE BELOW ###### + + #just in case the feedback was forgotten + test.sendFeedback(ret, success) + except: + #generic error handler + ret = traceback.format_exc() + success = False + test.sendFeedback(ret, success) + +#launch the test +startTest(test, device, parameters) + \ No newline at end of file diff --git a/script/tests/tests/PS Tests/test without ioc 3/test without ioc 3.py b/script/tests/tests/PS Tests/test without ioc 3/test without ioc 3.py new file mode 100644 index 0000000..76626d6 --- /dev/null +++ b/script/tests/tests/PS Tests/test without ioc 3/test without ioc 3.py @@ -0,0 +1,154 @@ +#Test name: test without ioc +#test that does not use any connection to IOC. It is useful to test pure pshell graphical features. + +###### Init - DO NOT MODIFY THE CODE BELOW ###### +global sys, inspect, os, traceback +import sys, inspect, os, traceback + +def startTest(testName, DEVICE, params): + #by default, assume the test failed + ret = 'Test failed' + success = False + #plot name to be given to the scan. Use: scan.setPlotTitle(plotName) + plotName = DEVICE + ' - ' + testName + #put the whole custom code under try/catch + try: + #get the path of this script + testPath = inspect.getfile(inspect.currentframe()) + #init the testing tool class. It can be sued in the following ways: + test = TestingTool(testName, testPath, DEVICE, params) + +######### WRITE YOUR CODE HERE BELOW ############# + + #All the code in this section ## ..YOUR CODE.. ## can be modified/deleted. + #It must be indented at the same level as this comment + #----------------------------------- + # GETTING INPUTS: + #If needed, the following variables are available: + #testPath string, path of this test file + #testName string, name of this test + #DEVICE string, device for which the test must run (typically it is the beginning of a process variable name) + #----------------------------------- + # GETTING TEST PARAMETERS: + #if you need to get parameters for the test, use (casting may be necessary): + #myParamValue = test.getParam('myParamName') + #see the test config for the list of parameters specific to the test. + #----------------------------------- + # SETTING OUTPUTS: + #ret string, a text summarizing the result of the test. It must be set before the end of your code. + #success bool, True = test successful. It must be set before the end of your code. + #test.sendFeedback(ret,success) method that ends the testing script and gives the report to the calling application. + #Examples: + # + #whenever the code must quit (i.e. after an error), you must end with: + #ret = 'here is some info on what failed on the test' + #success = false + #test.sendFeedback(ret, success) + # + #whenever the code is finished successfully, you must end with: + #ret = 'here is some info on the success of the test' + #success = true + #test.sendFeedback(ret, success) + #----------------------------------- + # LOG INFO: + #when some information must be shown on the log, use: + #test.log('test to log') + + ########## Example (can be removed) ###### + #print the list of parameters passed. If any error, stop and send feedback + test.log("Example - Test name: "+testName) + test.log("Example - Device name: "+DEVICE) + try: + test.log("Running test Initialise with the following parameters:") + test.log(params ) + #If present, use the parameters here below for your test script + repeatTimes = int(test.getParam('repeatTimes')) ; howManySamples = int(test.getParam('howManySamples')) ; delayBetweenSampleS = float(test.getParam('delayBetweenSampleS')) ; + except: + ret = 'Could not retrieve testing parameters - ' + traceback.format_exc() + success = False + test.sendFeedback( ret, success) + return + + #loop to read channels for a while and plot the channels values. + + #initialise plot tab with 2 plots + scan = ManualScan(['sample'], ['Motor Status (MSTA)', 'Motor Position (VAL)'] ) + #set plot name(tab title) + scan.setPlotTitle(plotName + " Manual Scan") + #start plots. See further below how to add points to the plots + scan.start() + + #in this example we initialise also a plot type to show how to add several curves on the same plot + p1 = plot(None,name="motor_msta", context = plotName + " Multi curves")[0] + #opionally set plot ranges + #p1.getAxis(p1.AxisId.X).setRange(0.0,80.0) + #p1.getAxis(p1.AxisId.Y).setRange(0.0,70.0) + p1.addSeries(LinePlotSeries("motor_val")) + + motor_msta = 0 + motor_val = 50 + increment = 1 + + max = -1 + maxPos = 0 + min = 1000000000000 + minPos = 0 + from math import sin + for sample in range(0, howManySamples): + readback1 = sample + sleep( delayBetweenSampleS ) # Settling time + #here we simulate getting values + #just draw a saw + motor_msta = motor_msta + increment + #just draw a nice sinusoid + motor_val = sin(float(sample)/10.0)*10.0-10.0 + if abs(motor_msta) >= 50: + increment = -1 * increment + #add values to manual scan + scan.append ([sample], [readback1], [motor_msta, motor_val] ) + #add values to plot + p1.getSeries(0).appendData(sample, motor_msta) + p1.getSeries(1).appendData(sample, motor_val ) + #compute min and max differences + if abs(motor_msta - motor_val) > max: + max = abs(motor_msta - motor_val) + maxPos = sample + if abs(motor_msta - motor_val) < min: + min = abs(motor_msta - motor_val) + minPos = sample + + #show differences in the plot + import java.awt.Color + p1.addMarker(maxPos, None, "Max=" + str(max), java.awt.Color.LIGHT_GRAY) + p1.addMarker(minPos, None, "Min=" + str(min), java.awt.Color.LIGHT_GRAY) + +# plots[0].addMarker(25, None, "Mark", java.awt.Color.LIGHT_GRAY) + + #IMPORTANT: if the test was successful, write the report into the variables ret and success. + #for example, write the following: + ret = "Example Test successful" + success = True + #once the test is finished, no need to do anything. The code below yours will do the rest. + ################ End of Example ########## + +################ END OF YOUR CODE ################ +###### Final - DO NOT MODIFY THE CODE BELOW ###### + + #just in case the feedback was forgotten + test.sendFeedback(ret, success) + except (KeyboardInterrupt): + #user stop error handler + ret = 'Test stopped by user.' + success = False + test.sendFeedback(ret, success) + except: + #generic error handler + ret = traceback.format_exc() + success = False + test.sendFeedback(ret, success) + +#launch the test +startTest(test, device, parameters) + +################ END OF Final #################### +#### IF NEEDED, ADD YOUR FUNCTIONS HERE BELOW #### diff --git a/script/tests/tests/PS Tests/test without ioc/.config b/script/tests/tests/PS Tests/test without ioc/.config new file mode 100644 index 0000000..37d58c9 --- /dev/null +++ b/script/tests/tests/PS Tests/test without ioc/.config @@ -0,0 +1,4 @@ +#Wed Sep 16 16"&"17"&"06 CEST 2015 +name=test without ioc +description=test that does not use any connection to IOC. It is useful to test pure pshell graphical features. +parameters=repeatTimes/:3/:how many times the test is repeated/:howManySamples/:50/:How many samples are plotted/:delayBetweenSampleS/:0.05/:delay [s] between two samples; diff --git a/script/tests/tests/PS Tests/test without ioc/help.html b/script/tests/tests/PS Tests/test without ioc/help.html new file mode 100644 index 0000000..03230c0 --- /dev/null +++ b/script/tests/tests/PS Tests/test without ioc/help.html @@ -0,0 +1,14 @@ + + +

Description

+test that does not use any connection to IOC. It is useful to test pure pshell graphical features. +

Parameters

+repeatTimes how many times the test is repeated
+howManySamples How many samples are plotted
+delayBetweenSampleS delay [s] between two samples
+ +

Contact

+boccioli_m + + + diff --git a/script/tests/tests/PS Tests/test without ioc/test without ioc - Copy.py b/script/tests/tests/PS Tests/test without ioc/test without ioc - Copy.py new file mode 100644 index 0000000..ea70a3c --- /dev/null +++ b/script/tests/tests/PS Tests/test without ioc/test without ioc - Copy.py @@ -0,0 +1,147 @@ +#Test name: test without ioc +#test that does not use any connection to IOC. It is useful to test pure pshell graphical features. + +###### Init - DO NOT MODIFY THE CODE BELOW ###### +global sys, inspect, os, traceback +import sys, inspect, os, traceback + +def startTest(testName, DEVICE, params): + #by default, assume the test failed + ret = 'Test failed' + success = False + #plot name to be given to the scan. Use: scan.setPlotTitle(plotName) + plotName = DEVICE + ' - ' + testName + #put the whole custom code under try/catch + try: + #get the path of this script + testPath = inspect.getfile(inspect.currentframe()) + #init the testing tool class. It can be sued in the following ways: + test = TestingTool(testName, testPath, DEVICE, params) + +######### WRITE YOUR CODE HERE BELOW ############# + + #All the code in this section ## ..YOUR CODE.. ## can be modified/deleted. + #It must be indented at the same level as this comment + #----------------------------------- + # GETTING INPUTS: + #If needed, the following variables are available: + #testPath string, path of this test file + #testName string, name of this test + #DEVICE string, device for which the test must run (typically it is the beginning of a process variable name) + #----------------------------------- + # GETTING TEST PARAMETERS: + #if you need to get parameters for the test, use (casting may be necessary): + #myParamValue = test.getParam('myParamName') + #see the test config for the list of parameters specific to the test. + #----------------------------------- + # SETTING OUTPUTS: + #ret string, a text summarizing the result of the test. It must be set before the end of your code. + #success bool, True = test successful. It must be set before the end of your code. + #test.sendFeedback(ret,success) method that ends the testing script and gives the report to the calling application. + #Examples: + # + #whenever the code must quit (i.e. after an error), you must end with: + #ret = 'here is some info on what failed on the test' + #success = false + #test.sendFeedback(ret, success) + # + #whenever the code is finished successfully, you must end with: + #ret = 'here is some info on the success of the test' + #success = true + #test.sendFeedback(ret, success) + #----------------------------------- + # LOG INFO: + #when some information must be shown on the log, use: + #test.log('test to log') + + ########## Example (can be removed) ###### + #print the list of parameters passed. If any error, stop and send feedback + test.log("Example - Test name: "+testName) + test.log("Example - Device name: "+DEVICE) + try: + test.log("Running test Initialise with the following parameters:") + test.log(params ) + #If present, use the parameters here below for your test script + repeatTimes = int(test.getParam('repeatTimes')) ; howManySamples = int(test.getParam('howManySamples')) ; delayBetweenSampleS = float(test.getParam('delayBetweenSampleS')) ; + except: + ret = 'Could not retrieve testing parameters - ' + traceback.format_exc() + success = False + test.sendFeedback( ret, success) + return + + #loop to read channels for a while and plot the channels values. + + #initialise plot tab with 2 plots + scan = ManualScan(['sample'], ['Motor Status (MSTA)', 'Motor Position (VAL)'] ) + #set plot name(tab title) + scan.setPlotTitle(plotName + "Manual Scan") + #start plots. See further below how to add points to the plots + scan.start() + + #in this example we initialise also a plot type to show how to add several curves on the same plot + p1 = plot(None,name="Data 1", context = plotName + "Multi curves")[0] + #opionally set plot ranges + #p1.getAxis(p1.AxisId.X).setRange(0.0,80.0) + #p1.getAxis(p1.AxisId.Y).setRange(0.0,70.0) + p1.addSeries(LinePlotSeries("Data2")) + + motor_msta = 0 + motor_val = 50 + increment = 1 + + max = 0 + maxPos = 0 + min = 0 + minPos = 0 + + for sample in range(0, howManySamples): + readback1 = sample + sleep( delayBetweenSampleS ) # Settling time + #here we simulate getting values + motor_msta = motor_msta + increment + motor_val = motor_val - increment + if abs(motor_msta) == 50: + increment = -1 * increment + #add values to manual scan + scan.append ([sample], [readback1], [motor_msta, motor_val] ) + #add values to plot + p1.getSeries(0).appendData(sample, motor_msta) + p1.getSeries(1).appendData(sample, motor_val ) + #compute min and max peaks + if motor_msta - motor_val > max: + max = motor_msta - motor_val + maxPos = sample + if motor_msta - motor_val < min: + min = motor_msta - motor_val + minPos = sample + + + + import java.awt.Color + p1[0].addMarker(maxPos, None, "Max=" + str(max), java.awt.Color.LIGHT_GRAY) + p1[0].addMarker(minPos, None, "Min=" + str(min), java.awt.Color.LIGHT_GRAY) + + + + #IMPORTANT: if the test was successful, write the report into the variables ret and success. + #for example, write the following: + ret = "Example - Test successful, here some detail: ..." + success = True + test.sendFeedback(ret, success) + #once the test is finished, no need to do anything. The code below yours will do the rest. + ################ End of Example ########## + +################ END OF YOUR CODE ################ +###### Final - DO NOT MODIFY THE CODE BELOW ###### + + #just in case the feedback was forgotten + test.sendFeedback(ret, success) + except: + #generic error handler + ret = traceback.format_exc() + success = False + test.sendFeedback(ret, success) + +#launch the test +startTest(test, device, parameters) + \ No newline at end of file diff --git a/script/tests/tests/PS Tests/test without ioc/test without ioc.py b/script/tests/tests/PS Tests/test without ioc/test without ioc.py new file mode 100644 index 0000000..e478dbd --- /dev/null +++ b/script/tests/tests/PS Tests/test without ioc/test without ioc.py @@ -0,0 +1,169 @@ +#Test name: test without ioc +#test that does not use any connection to IOC. It is useful to test pure pshell graphical features. + + +###### Init - DO NOT MODIFY THE CODE BELOW ###### +global sys, inspect, os, traceback +import sys, inspect, os, traceback + +def startTest(testName, DEVICE, params): + #by default, assume the test failed + ret = 'Test failed' + success = False + #put the whole custom code under try/catch + try: + #get the path of this script + testPath = inspect.getfile(inspect.currentframe()) + #init the testing tool class. It can be sued in the following ways: + test = TestingTool(testName, testPath, DEVICE, params) + #plot name to be given to the scan. Use: scan.setPlotTitle(plotName) + plotName = test.getPlotName() + +######### WRITE YOUR CODE HERE BELOW ############# + + #All the code in this section ## ..YOUR CODE.. ## can be modified/deleted. + #It must be indented at the same level as this comment + #----------------------------------- + # GETTING INPUTS: + #If needed, the following variables are available: + #testPath string, path of this test file + #testName string, name of this test + #DEVICE string, device for which the test must run (typically it is the beginning of a process variable name) + #----------------------------------- + # GETTING TEST PARAMETERS: + #if you need to get parameters for the test, use (casting may be necessary): + #myParamValue = test.getParam('myParamName') + #see the test config for the list of parameters specific to the test. + #----------------------------------- + # SETTING OUTPUTS: + #ret string, a text summarizing the result of the test. It must be set before the end of your code. + #success bool, True = test successful. It must be set before the end of your code. + #test.sendFeedback(ret,success) method that ends the testing script and gives the report to the calling application. + #Examples: + # + #whenever the code must quit (i.e. after an error), you must end with: + #ret = 'here is some info on what failed on the test' + #success = false + #test.sendFeedback(ret, success) + # + #whenever the code is finished successfully, you must end with: + #ret = 'here is some info on the success of the test' + #success = true + #test.sendFeedback(ret, success) + #----------------------------------- + # LOG INFO: + #when some information must be shown on the log, use: + #test.log('test to log') + + ########## Example (can be removed) ###### + #print the list of parameters passed. If any error, stop and send feedback + test.log("-------------------------------------------") + test.log("Example - Test name: "+testName) + test.log("Example - Device name: "+DEVICE) + try: + test.log("Running test Initialise with the following parameters:") + test.printParams () + #If present, use the parameters here below for your test script + repeatTimes = int(test.getParam('repeatTimes')) ; howManySamples = int(test.getParam('howManySamples')) ; delayBetweenSampleS = float(test.getParam('delayBetweenSampleS')) ; + except: + import traceback + ret = 'Could not retrieve testing parameters - ' + traceback.format_exc() + success = False + test.sendFeedback( ret, success) + return + + #loop to read channels for a while and plot the channels values. + + #initialise plot tab with 2 plots + scan = ManualScan(['sample'], ['Motor Status (MSTA)', 'Motor Position (VAL)'] ) + #set plot name(tab title) + scan.setPlotTitle(plotName + " Manual Scan") + #start plots. See further below how to add points to the plots + scan.start() + + #in this example we initialise also a plot type to show how to add several curves on the same plot + p1 = plot(None,name="motor_msta", title = plotName + " Multi curves")[0] + #opionally set plot ranges + #p1.getAxis(p1.AxisId.X).setRange(0.0,80.0) + #p1.getAxis(p1.AxisId.Y).setRange(0.0,70.0) + p1.addSeries(LinePlotSeries("motor_val")) + + motor_msta = 0 + motor_val = 50 + increment = 1 + + max = -1 + maxPos = 0 + min = 1000000000000 + minPos = 0 + from math import sin + for sample in range(0, howManySamples): + readback1 = sample + sleep( delayBetweenSampleS ) # Settling time + #here we simulate getting values + #just draw a saw + motor_msta = motor_msta + increment + #just draw a nice sinusoid + motor_val = sin(float(sample)/10.0)*10.0-10.0 + if abs(motor_msta) >= 50: + increment = -1 * increment + #add values to manual scan + scan.append ([sample], [readback1], [motor_msta, motor_val] ) + #add values to plot + p1.getSeries(0).appendData(sample, motor_msta) + p1.getSeries(1).appendData(sample, motor_val ) + #compute min and max differences + if abs(motor_msta - motor_val) > max: + max = abs(motor_msta - motor_val) + maxPos = sample + if abs(motor_msta - motor_val) < min: + min = abs(motor_msta - motor_val) + minPos = sample + + #show differences in the plot + import java.awt.Color + p1.addMarker(maxPos, None, "Max=" + str(max), java.awt.Color.LIGHT_GRAY) + p1.addMarker(minPos, None, "Min=" + str(min), java.awt.Color.LIGHT_GRAY) + +# plots[0].addMarker(25, None, "Mark", java.awt.Color.LIGHT_GRAY) + + #IMPORTANT: if the test was successful, write the report into the variables ret and success. + #for example, write the following: + ret = "Example Test successful" + success = True + #once the test is finished, no need to do anything. The code below yours will do the rest. + ################ End of Example ########## + +################ END OF YOUR CODE ################ +###### Final - DO NOT MODIFY THE CODE BELOW ###### + + #just in case the feedback was forgotten + test.sendFeedback(ret, success) + except (KeyboardInterrupt): + #user stop error handler + ret = 'Test stopped by user.' + success = False + test.sendFeedback(ret, success) + except: + #generic error handler + import traceback + ret = traceback.format_exc() + success = False + test.sendFeedback(ret, success) + +# testing environment setup (if script is launched directly without Testinglist) +is_panel = get_exec_pars().source != CommandSource.ui +if not is_panel: + #launch the test with default input + test = "test without ioc" + device = "no-device" + import json + parameters = json.loads('{"howManySamples": {"description": "How many samples are plotted", "value": "50"}, "delayBetweenSampleS": {"description": "delay [s] between two samples", "value": "0.05"}, "repeatTimes": {"description": "how many times the test is repeated", "value": "3"}}') + startTest(test, device, parameters) + #pass +else: + #launch the test with input from tsting list + startTest(test, device, parameters) + +################ END OF Final #################### +#### IF NEEDED, ADD YOUR FUNCTIONS HERE BELOW #### diff --git a/script/tests/tests/Range Shifter Tests/Calibrate/.config b/script/tests/tests/Range Shifter Tests/Calibrate/.config new file mode 100644 index 0000000..b1b8790 --- /dev/null +++ b/script/tests/tests/Range Shifter Tests/Calibrate/.config @@ -0,0 +1,8 @@ +name=Calibrate +description=Initialises the motor +help = \ +This test sends a INIT command to the device, as many times as configured with the parameter RepeatTimes. + +#optional parameters. Description is compulsory. Syntax& +#parameters=&&[;&&] +parameters=repeatTimes&2&Repeat N times;delayS&4&Delay between each initialisation [s] \ No newline at end of file diff --git a/script/tests/tests/Range Shifter Tests/Calibrate/Calibrate.py b/script/tests/tests/Range Shifter Tests/Calibrate/Calibrate.py new file mode 100644 index 0000000..4d3d31e --- /dev/null +++ b/script/tests/tests/Range Shifter Tests/Calibrate/Calibrate.py @@ -0,0 +1,143 @@ + + + +###### DO NOT MODIFY THE CODE BELOW ###### +global print_log, sendFeedback, inspect, log, sys, inspect, os, traceback +import sys, inspect, os, traceback + +def print_log(testName, DEVICE, text): + time.ctime() + now = time.strftime('%Y.%m.%d %H:%M:%S') + print now + ' ' + DEVICE + ' - ' + testName + ': ' + str(text) + +#prepare and send feedback to calling tool +def sendFeedback(testPath, testName, DEVICE, returnString, testPassed): + print_log(testName, DEVICE, 'End of test. Result:') + print_log(testName, DEVICE, 'Device: ' + DEVICE) + print_log(testName, DEVICE, 'Test name: ' + testName) + print_log(testName, DEVICE, 'Test path: ' + testPath) + print_log(testName, DEVICE, 'Test passed: ' + str(testPassed)) + print_log(testName, DEVICE, 'Return string: ' + returnString) + ret = [testPath, DEVICE, returnString, testPassed] + set_return(ret) + +def startTest(testName, DEVICE, params): + try: + import traceback + #get the path of this script + testPath = inspect.getfile(inspect.currentframe()) + #by default, failed + ret = 'Test failed' + success = False + #plot name to be given to the scan. Use: scan.setPlotTitle(plotName) + plotName = DEVICE + ' - ' + testName + +###### WRITE YOUR CODE HERE BELOW ####### + + #Pre-actions + # try: + # caput(DEVICE+':INIT.PROC', '1') + # except: + # ret = 'Unable to create channel - ' + traceback.format_exc() + # success = False + # sendFeedback(testPath, testName, DEVICE, ret, success) + # return + + + #get parameters from the calling interface + try: + print_log(testName, DEVICE, "Running test Initialise with the following parameters:") + print_log(testName, DEVICE, params ) + loopTimes = int(params["repeatTimes"]["value"]) + delaySeconds = int(params["delayS"]["value"]) + except: + ret = 'Could not retrieve testing parameters - ' + traceback.format_exc() + success = False + sendFeedback(testPath, testName, DEVICE, ret, success) + return + + scan = ManualScan(['idX'], ['idMotorPosition', 'idEncoderPosition', 'idError'] ) + scan.setPlotTitle(plotName) + scan.start() + #Creating channels: dimension 1 + try: + idInit = Channel(DEVICE+':INIT.PROC', type = 'l') + idReady = Channel(DEVICE+':RDY', type = 'l') + idInterlock = Channel(DEVICE+':ILK', type = 'l') + #ScalarDetector idMotorPosition + #idMotorPosition = Channel(DEVICE+':IST1:2', type = 'd') + idMotorPosition = Channel(DEVICE+':MOTOR.RBV', type = 'd') + #ScalarDetector idEncoderPosition + #idEncoderPosition = Channel(DEVICE+':POSA:2', type = 'd') + idEncoderPosition = Channel(DEVICE+':ENCODER', type = 'd') + #ScalarDetector idBtvsProc + #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') + except: + ret = 'Unable to create channel - ' + traceback.format_exc() + success = False + sendFeedback(testPath, testName, DEVICE, ret, success) + return + + count = 0 + timeout = 5000 #timeout in ms + for count in range(1, loopTimes+1): + print_log(testName, DEVICE, 'Initialisation #' + str(count) + '/' + str(loopTimes)) + idInit.put(1, timeout=None) # TODO: Set appropriate timeout + timeStampStart = float(java.lang.System.currentTimeMillis()) + sleep(0.1) + ready = 0 + interlock = idInterlock.get() + timeElapsed = 0 #in ms + while (ready == 0) and timeElapsed + +

Short Description

+Initialise N times. +

Details

+This test sends a INIT command to the device, as many times as configured with the parameter repeatTimes. +

Parameters

+repeatTimes Repeat the Initialisation N times
+delayS Pause delay between each Initialisation [s] +

Contact

+Marco Boccioli + + + diff --git a/script/tests/tests/Range Shifter Tests/Check Linearity/.config b/script/tests/tests/Range Shifter Tests/Check Linearity/.config new file mode 100644 index 0000000..1acc5db --- /dev/null +++ b/script/tests/tests/Range Shifter Tests/Check Linearity/.config @@ -0,0 +1,7 @@ +name=Check Linearity +description=Go to absolute position A, then move +B steps, then -2B steps, then +2Bsteps (ie oscillate round centre position, logging after each movement); repeat N times + + +#optional parameters. Description is compulsory. Syntax& +#parameters=&&[;&&] +parameters=repeatTimes&2&Repeat N times;midPoint&41.0&Middle point A;spanFromMidPoint&3.0&B steps around middle point A;delayS&0&Delay between each oscillation [s] diff --git a/script/tests/tests/Range Shifter Tests/Check Linearity/Check Linearity.py b/script/tests/tests/Range Shifter Tests/Check Linearity/Check Linearity.py new file mode 100644 index 0000000..f70c42c --- /dev/null +++ b/script/tests/tests/Range Shifter Tests/Check Linearity/Check Linearity.py @@ -0,0 +1,162 @@ + +#Go to absolute position A, then move +B steps, then -2B steps, then +2Bsteps (ie oscillate round centre position, logging after each movement); repeat N times + + +###### DO NOT MODIFY THE CODE BELOW ###### +global print_log, sendFeedback, inspect, log, sys, inspect, os, traceback +import sys, inspect, os, traceback + +def print_log(testName, DEVICE, text): + time.ctime() + now = time.strftime('%Y.%m.%d %H:%M:%S') + print now + ' ' + DEVICE + ' - ' + testName + ': ' + str(text) + +#prepare and send feedback to calling tool +def sendFeedback(testPath, testName, DEVICE, returnString, testPassed): + print_log(testName, DEVICE, 'End of test. Result:') + print_log(testName, DEVICE, 'Device: ' + DEVICE) + print_log(testName, DEVICE, 'Test name: ' + testName) + print_log(testName, DEVICE, 'Test path: ' + testPath) + print_log(testName, DEVICE, 'Test passed: ' + str(testPassed)) + print_log(testName, DEVICE, 'Return string: ' + returnString) + ret = [testPath, DEVICE, returnString, testPassed] + set_return(ret) + +def startTest(testName, DEVICE, params): + try: + import traceback + #get the path of this script + testPath = inspect.getfile(inspect.currentframe()) + #by default, failed + ret = 'Test failed' + success = False + #plot name to be given to the scan. Use: scan.setPlotTitle(plotName) + plotName = DEVICE + ' - ' + testName + +###### WRITE YOUR CODE HERE BELOW ####### + + #get parameters from the calling interface + try: + print_log(testName, DEVICE, "Running test Motor Test 2 for device " + DEVICE + " with the following parameters:\n" + str(params)) + middle = float(params["midPoint"]["value"]) + loopTimes = int(params["repeatTimes"]["value"]) + delayS = int(params["delayS"]["value"]) + if(delayS<1): delayS=1 + span = float(params["spanFromMidPoint"]["value"]) + except: + ret = 'Could not retrieve testing parameters - ' + traceback.format_exc() + success = False + sendFeedback(testPath, testName, DEVICE, ret, success) + return + + #scan = ManualScan(['idX'], ['idMotorStatus', 'idLogicalPosition', 'idDiameter', 'idMotorPosition', 'idPotiRaw', 'idEncoderPosition', 'idBtvsRaw', 'idBtvsProc', 'idDiff01', 'idDiff02'] , [ 0.0], [ 3000.0], [20]) + scan = ManualScan(['idX'], ['idMotorStatus', 'idMotorPosition', 'idEncoderPosition', 'idError']) + scan.setPlotTitle(plotName) + scan.start() + + #Creating channels: dimension 1 + try: + idInkr = Channel(DEVICE+':MOTOR.VAL', type = 'd') + idMotorStatus = Channel(DEVICE+':MOTOR.MSTA', type = 'd') + idMotorPosition = Channel(DEVICE+':MOTOR.RBV', type = 'd') + idEncoderPosition = Channel(DEVICE+':ENCODER', type = 'd') + idEndSwitchL = Channel(DEVICE+':MOTOR.LLS', type = 'd') + idEndSwitchH = Channel(DEVICE+':MOTOR.HLS', type = 'd') + idLimitH = Channel(DEVICE+':MOTOR.HLM', type = 'd') + idLimitL = Channel(DEVICE+':MOTOR.LLM', type = 'd') + except: + ret = 'Unable to create channel - ' + traceback.format_exc() + success = False + sendFeedback(testPath, testName, DEVICE, ret, success) + return + + #remove limits + idLimitH.put(999999.9, timeout=None) + idLimitL.put(-999999.9, timeout=None) + + direction = 1.0 + startDefault = middle - span + endDefault = middle + span + end = endDefault+1 + #find position: it will be the middle point of the test + print_log(testName, DEVICE, 'Moving to middle point ' + str(middle) ) + idInkr.put(middle, timeout=None) # TODO: Set appropriate timeout + readback2 = idInkr.get() + if abs(readback2 - middle) > 1 : # TODO: Check accuracy + ret = 'Actor idInkr could not be set to the value ' + str(middle) + ' (current value: ' + str(readback2) + ')' + success = False + sendFeedback(testPath, testName, DEVICE, ret, success) + return + start = readback2+direction + countSteps = 0 + count = 0 + print_log(testName, DEVICE, 'Moving around middle point (+-' + str(span) + ')' ) + for setpoint1 in range(0, loopTimes*2): + count = count + 1 + print_log(testName, DEVICE, 'Pausing ' + str(delayS) + 's' ) + sleep( delayS ) # Settling time + #RegionPositioner idInkr + for setpoint2 in frange(start, end, direction): + readback1 = setpoint1 + idInkr.put(setpoint2, timeout=None) # TODO: Set appropriate timeout + sleep( 0.2 ) # Settling time + 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 + sendFeedback(testPath, testName, DEVICE, ret, success) + return + #Detector idMotorStatus + detector1 = idMotorStatus.get() + detector4 = idMotorPosition.get() + detector6 = idEncoderPosition.get() + endH = idEndSwitchH.get() + endL = idEndSwitchL.get() + #Manipulation idDiff01 + #Variable Mappings + a = detector4 + b = detector6 + idDiff01 = a-b + countSteps = countSteps + 1 + scan.append ([countSteps], [countSteps], [detector1, detector4, detector6, idDiff01]) + if endH>0.0 or (direction > 0.0 and setpoint2 >= end -1): + #invert direction and swap start with end of translation + end = startDefault-1 + start = setpoint2 - direction + direction = -1.0 + print_log(testName, DEVICE, 'End of span (' + str(setpoint2) + '), changing direction to ' + str(direction) ) + break + if endL>0.0 or ( direction < 0.0 and setpoint2 <= end +1): + #invert direction and swap start with end of translation + end = endDefault+1 + start = setpoint2 - direction + direction = 1.0 + print_log(testName, DEVICE, 'End of span (' + str(setpoint2) + '), 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() + idMotorStatus.close() + idMotorPosition.close() + idEncoderPosition.close() + idLimitH.close() + idLimitL.close() + scan.end() + ret = 'Slide moved back and forth (' + str(count) + ' runs)' + success = True + +############# END OF YOUR CODE ########### +###### DO NOT MODIFY THE CODE BELOW ###### + sendFeedback(testPath, testName, DEVICE, ret, success) + except: + ret = traceback.format_exc() + success = False + sendFeedback(testPath, testName, DEVICE, ret, success) + return + +#launch the test +startTest(test, device, parameters) diff --git a/script/tests/tests/Range Shifter Tests/Check Linearity/help.html b/script/tests/tests/Range Shifter Tests/Check Linearity/help.html new file mode 100644 index 0000000..8aac8f3 --- /dev/null +++ b/script/tests/tests/Range Shifter Tests/Check Linearity/help.html @@ -0,0 +1,16 @@ + + +

Short Description

+Oscillate around a specific position +

Details

+Go to absolute position A, then move +B steps, then -2B steps, then +2Bsteps (ie oscillate round centre position, logging after each movement); repeat N times +

Parameters

+midPoint Middle point A around which it will oscillate
+spanFromMidPoint B stepst to oscillate around A
+repeatTimes Repeat the moving N times
+delayS Pause delay (>0s) between each oscillation [s] +

Contact

+Marco Boccioli + + + diff --git a/script/tests/tests/Range Shifter Tests/Check Status/.config b/script/tests/tests/Range Shifter Tests/Check Status/.config new file mode 100644 index 0000000..c84634c --- /dev/null +++ b/script/tests/tests/Range Shifter Tests/Check Status/.config @@ -0,0 +1,3 @@ +name=Check Status +description=Checks the drive success +filename=Check Status.xml diff --git a/script/tests/tests/Range Shifter Tests/Check Status/Check Status.xml b/script/tests/tests/Range Shifter Tests/Check Status/Check Status.xml new file mode 100644 index 0000000..f1717df --- /dev/null +++ b/script/tests/tests/Range Shifter Tests/Check Status/Check Status.xml @@ -0,0 +1,55 @@ + + + + + + + + 3000 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/script/tests/tests/Range Shifter Tests/Monitor All/.config b/script/tests/tests/Range Shifter Tests/Monitor All/.config new file mode 100644 index 0000000..f64aa74 --- /dev/null +++ b/script/tests/tests/Range Shifter Tests/Monitor All/.config @@ -0,0 +1,7 @@ +name=Monitor All +description=Monitor drive all success pv. No commands are sent + + +#optional parameters. Description is compulsory. Syntax& +#parameters=&&[;&&] +parameters=samplingTimeS&0.1&Sampling Time;timeWindowS&30&Duration of the monitoring time window (For how long the check success must be performed) [s] diff --git a/script/tests/tests/Range Shifter Tests/Monitor All/Monitor All - Copy.py b/script/tests/tests/Range Shifter Tests/Monitor All/Monitor All - Copy.py new file mode 100644 index 0000000..b8688f6 --- /dev/null +++ b/script/tests/tests/Range Shifter Tests/Monitor All/Monitor All - Copy.py @@ -0,0 +1,196 @@ + + + +###### DO NOT MODIFY THE CODE BELOW ###### +global print_log, sendFeedback, inspect, log, sys, inspect, os, traceback +import sys, inspect, os, traceback + +def print_log(testName, DEVICE, text): + time.ctime() + now = time.strftime('%Y.%m.%d %H:%M:%S') + print now + ' ' + DEVICE + ' - ' + testName + ': ' + str(text) + +#prepare and send feedback to calling tool +def sendFeedback(testPath, testName, DEVICE, returnString, testPassed): + print_log(testName, DEVICE, 'End of test. Result:') + print_log(testName, DEVICE, 'Device: ' + DEVICE) + print_log(testName, DEVICE, 'Test name: ' + testName) + print_log(testName, DEVICE, 'Test path: ' + testPath) + print_log(testName, DEVICE, 'Test passed: ' + str(testPassed)) + print_log(testName, DEVICE, 'Return string: ' + returnString) + ret = [testPath, DEVICE, returnString, testPassed] + set_return(ret) + +def startTest(testName, DEVICE, params): + try: + import traceback + #get the path of this script + testPath = inspect.getfile(inspect.currentframe()) + #by default, failed + ret = 'Test failed' + success = False + #plot name to be given to the scan. Use: scan.setPlotTitle(plotName) + plotName = DEVICE + ' - ' + testName + +###### WRITE YOUR CODE HERE BELOW ####### + + #get parameters from the calling interface + try: + print_log(testName, DEVICE, "Running test Initialise with the following parameters:") + print_log(testName, DEVICE, params ) + samplingTimeWindow = int(params["timeWindowS"]["value"]) + samplingTime = float(params["samplingTimeS"]["value"]) + if samplingTime<0.001: + samplingTime=0.001 + except: + ret = 'Could not retrieve testing parameters - ' + traceback.format_exc() + success = False + sendFeedback(testPath, testName, DEVICE, ret, success) + return + scan = ManualScan(['id000000'], ['Motor Status (MSTA)', 'Motor Step Count (RVAL)', 'Motor Position (VAL)', 'Motor Home Switch (ATHM)', 'Encoder Count (ENCODERraw)', 'Encoder Position (ENCODER)', 'Motor/Encoder Diff', 'Drive Ready (RDY)', 'Drive interlock (ILK)', 'CAD_VALA', 'MOTOR_ATHM', 'MOTOR_LLS', 'MOTOR_HLS', 'MOTOR_DMOV', 'CAD_ODIR', 'MOTOR_HOMF', 'MOTOR_RLV', 'MOTOR_STOP', 'MOTOR_SET', 'MOTOR_OFF', 'MOTOR_VAL', 'MOTOR_DVAL', 'MOTOR_DLLM', 'MOTOR_DHLM', 'CAD_VALB', 'CAR_IVAL', 'CAR_IERR', 'SIR_VAL', 'ENCODERraw', 'ENCODERscale', 'ENCODER_oEN', 'ENCODER_HFF', 'FIRST_INIT'] ) + scan.setPlotTitle(plotName) + scan.start() + + #Creating channels: dimension 1 + try: + #ScalarDetector id000001 + id000001 = Channel(DEVICE+':MOTOR.MSTA', type = 'd') + #ScalarDetector id000002 + id000002 = Channel(DEVICE+':MOTOR.RVAL', type = 'd') + #ScalarDetector id000003 + id000003 = Channel(DEVICE+':MOTOR.VAL', type = 'd') + #ScalarDetector id000004 + id000004 = Channel(DEVICE+':MOTOR.ATHM', type = 'd') + #ScalarDetector id000005 + id000005 = Channel(DEVICE+':ENCODERraw', type = 'd') + #ScalarDetector id000006 + id000006 = Channel(DEVICE+':ENCODER', type = 'd') + #ScalarDetector id000007 + id000007 = Channel(DEVICE+':RDY', type = 'd') + #ScalarDetector id000008 + id000008 = Channel(DEVICE+':ILK', type = 'd') + + pV_CAD_VALA = Channel(DEVICE+':CAD.VALA', type = 'i'); + pV_MOTOR_ATHM = Channel(DEVICE+':MOTOR.ATHM', type = 'i'); + pV_MOTOR_LLS = Channel(DEVICE+':MOTOR.LLS', type = 'i'); + pV_MOTOR_HLS = Channel(DEVICE+':MOTOR.HLS', type = 'i'); + pV_MOTOR_DMOV = Channel(DEVICE+':MOTOR.DMOV', type = 'i'); + pV_CAD_ODIR = Channel(DEVICE+':CAD.ODIR', type = 'i'); + pV_MOTOR_HOMF = Channel(DEVICE+':MOTOR.HOMF', type = 'i'); + pV_MOTOR_RLV = Channel(DEVICE+':MOTOR.RLV', type = 'l'); + pV_MOTOR_STOP = Channel(DEVICE+':MOTOR.STOP', type = 'i'); + pV_MOTOR_SET = Channel(DEVICE+':MOTOR.SET', type = 'i'); + pV_MOTOR_OFF = Channel(DEVICE+':MOTOR.OFF', type = 'i'); + pV_MOTOR_VAL = Channel(DEVICE+':MOTOR.VAL', type = 'l'); + pV_MOTOR_DVAL = Channel(DEVICE+':MOTOR.DVAL', type = 'l'); + pV_MOTOR_DLLM = Channel(DEVICE+':MOTOR.DLLM', type = 'd'); + pV_MOTOR_DHLM = Channel(DEVICE+':MOTOR.DHLM', type = 'd'); + pV_CAD_VALB = Channel(DEVICE+':CAD.VALB', type = 'l'); + pV_CAR_IVAL = Channel(DEVICE+':CAR.IVAL', type = 'i'); + pV_CAR_IERR = Channel(DEVICE+':CAR.IERR', type = 'i'); + pV_SIR_VAL = Channel(DEVICE+':SIR.VAL', type = 'i'); + pV_ENCODERraw = Channel(DEVICE+':ENCODERraw', type = 'l'); + pV_ENCODERscale = Channel(DEVICE+':ENCODERscale', type = 'l'); + pV_ENCODER_oEN = Channel(DEVICE+':ENCODER_oEN', type = 'i'); + pV_ENCODER_HFF = Channel(DEVICE+':ENCODER_HFF', type = 'i'); + pV_FIRST_INIT = Channel(DEVICE+':FIRST_INIT', type = 'i'); + except: + ret = 'Unable to create channel - ' + traceback.format_exc() + success = False + sendFeedback(testPath, testName, DEVICE, ret, success) + return + #Dimension 1 + #PseudoPositioner id000000 + samplingRange = int(float(samplingTimeWindow) / samplingTime) + print_log(testName, DEVICE, 'Start monitoring during ' + samplingTimeWindow + 's') + for setpoint1 in range(0, samplingRange): + readback1 = setpoint1 + sleep( samplingTime ) # Settling time + detector1 = id000001.get() + detector2 = id000002.get() + detector3 = id000003.get() + detector4 = id000004.get() + detector5 = id000005.get() + detector6 = id000006.get() + detector7 = id000007.get() + detector8 = id000008.get() + CAD_VALA = pV_CAD_VALA.get() + MOTOR_ATHM = pV_MOTOR_ATHM.get() + MOTOR_LLS = pV_MOTOR_LLS.get() + MOTOR_HLS = pV_MOTOR_HLS.get() + MOTOR_DMOV = pV_MOTOR_DMOV.get() + CAD_ODIR = pV_CAD_ODIR.get() + MOTOR_HOMF = pV_MOTOR_HOMF.get() + MOTOR_RLV = pV_MOTOR_RLV.get() + MOTOR_STOP = pV_MOTOR_STOP.get() + MOTOR_SET = pV_MOTOR_SET.get() + MOTOR_OFF = pV_MOTOR_OFF.get() + MOTOR_VAL = pV_MOTOR_VAL.get() + MOTOR_DVAL = pV_MOTOR_DVAL.get() + MOTOR_DLLM = pV_MOTOR_DLLM.get() + MOTOR_DHLM = pV_MOTOR_DHLM.get() + CAD_VALB = pV_CAD_VALB.get() + CAR_IVAL = pV_CAR_IVAL.get() + CAR_IERR = pV_CAR_IERR.get() + SIR_VAL = pV_SIR_VAL.get() + ENCODERraw = pV_ENCODERraw.get() + ENCODERscale = pV_ENCODERscale.get() + ENCODER_oEN = pV_ENCODER_oEN.get() + ENCODER_HFF = pV_ENCODER_HFF.get() + FIRST_INIT = pV_FIRST_INIT.get() + #Variable Mappings + a = detector6 + b = detector3 + id000009 = a-b + scan.append ([setpoint1], [readback1], [detector1, detector2, detector3, detector4, detector5, detector6, detector7, detector8, id000009, CAD_VALA, MOTOR_ATHM, MOTOR_LLS, MOTOR_HLS, MOTOR_DMOV, CAD_ODIR, MOTOR_HOMF, MOTOR_RLV, MOTOR_STOP, MOTOR_SET, MOTOR_OFF, MOTOR_VAL, MOTOR_DVAL, MOTOR_DLLM, MOTOR_DHLM, CAD_VALB, CAR_IVAL, CAR_IERR, SIR_VAL, ENCODERraw, ENCODERscale, ENCODER_oEN, ENCODER_HFF, FIRST_INIT] ) + + #Closing channels + id000001.close() + id000002.close() + id000003.close() + id000004.close() + id000005.close() + id000006.close() + id000007.close() + id000008.close() + pV_CAD_VALA.close() + pV_MOTOR_ATHM.close() + pV_MOTOR_LLS.close() + pV_MOTOR_HLS.close() + pV_MOTOR_DMOV.close() + pV_CAD_ODIR.close() + pV_MOTOR_HOMF.close() + pV_MOTOR_RLV.close() + pV_MOTOR_STOP.close() + pV_MOTOR_SET.close() + pV_MOTOR_OFF.close() + pV_MOTOR_VAL.close() + pV_MOTOR_DVAL.close() + pV_MOTOR_DLLM.close() + pV_MOTOR_DHLM.close() + pV_CAD_VALB.close() + pV_CAR_IVAL.close() + pV_CAR_IERR.close() + pV_SIR_VAL.close() + pV_ENCODERraw.close() + pV_ENCODERscale.close() + pV_ENCODER_oEN.close() + pV_ENCODER_HFF.close() + pV_FIRST_INIT.close() + + scan.end() + + success = True + ret = 'Monitoring completed' + print_log(testName, DEVICE, ret) +############# END OF YOUR CODE ########### +###### DO NOT MODIFY THE CODE BELOW ###### + sendFeedback(testPath, testName, DEVICE, ret, success) + except: + ret = traceback.format_exc() + success = False + sendFeedback(testPath, testName, DEVICE, ret, success) + return + +#launch the test +startTest(test, device, parameters) \ No newline at end of file diff --git a/script/tests/tests/Range Shifter Tests/Monitor All/Monitor All.py b/script/tests/tests/Range Shifter Tests/Monitor All/Monitor All.py new file mode 100644 index 0000000..584af5a --- /dev/null +++ b/script/tests/tests/Range Shifter Tests/Monitor All/Monitor All.py @@ -0,0 +1,180 @@ + + + +###### DO NOT MODIFY THE CODE BELOW ###### +global sys, inspect, os, traceback +import sys, inspect, os, traceback + +def startTest(testName, DEVICE, params): + #by default, failed + ret = 'Test failed' + success = False + #plot name to be given to the scan. Use: scan.setPlotTitle(plotName) + plotName = DEVICE + ' - ' + testName + try: + #get the path of this script + testPath = inspect.getfile(inspect.currentframe()) + #init the testing tool class. It can be sued in the following ways: + test = TestingTool(testName, testPath, DEVICE, params) + +###### WRITE YOUR CODE HERE BELOW ####### + #get parameters from the calling interface + try: + test.log("Running test Initialise with the following parameters:") + test.log(params) + samplingTimeWindow = int(test.getParam('timeWindowS')) ; samplingTime = float(test.getParam("samplingTimeS")) ; + if samplingTime<0.001: + samplingTime=0.001 + except: + ret = 'Could not retrieve testing parameters - ' + traceback.format_exc() + success = False + test.sendFeedback( ret, success) + return + #setup plot + scan = ManualScan(['id000000'], ['Motor Status (MSTA)', 'Motor Step Count (RVAL)', 'Motor Position (VAL)', 'Motor Home Switch (ATHM)', 'Encoder Count (ENCODERraw)', 'Encoder Position (ENCODER)', 'Motor/Encoder Diff', 'Drive Ready (RDY)', 'Drive interlock (ILK)', 'CAD_VALA', 'MOTOR_ATHM', 'MOTOR_LLS', 'MOTOR_HLS', 'MOTOR_DMOV', 'CAD_ODIR', 'MOTOR_HOMF', 'MOTOR_RLV', 'MOTOR_STOP', 'MOTOR_SET', 'MOTOR_OFF', 'MOTOR_VAL', 'MOTOR_DVAL', 'MOTOR_DLLM', 'MOTOR_DHLM', 'CAD_VALB', 'CAR_IVAL', 'CAR_IERR', 'SIR_VAL', 'ENCODERraw', 'ENCODERscale', 'ENCODER_oEN', 'ENCODER_HFF', 'FIRST_INIT'] ) + scan.setPlotTitle(plotName) + scan.start() + + #Creating channels: dimension 1 + try: + #ScalarDetector id000001 + id000001 = Channel(DEVICE+':MOTOR.MSTA', type = 'd') + #ScalarDetector id000002 + id000002 = Channel(DEVICE+':MOTOR.RVAL', type = 'd') + #ScalarDetector id000003 + id000003 = Channel(DEVICE+':MOTOR.VAL', type = 'd') + #ScalarDetector id000004 + id000004 = Channel(DEVICE+':MOTOR.ATHM', type = 'd') + #ScalarDetector id000005 + id000005 = Channel(DEVICE+':ENCODERraw', type = 'd') + #ScalarDetector id000006 + id000006 = Channel(DEVICE+':ENCODER', type = 'd') + #ScalarDetector id000007 + id000007 = Channel(DEVICE+':RDY', type = 'd') + #ScalarDetector id000008 + id000008 = Channel(DEVICE+':ILK', type = 'd') + + pV_CAD_VALA = Channel(DEVICE+':CAD.VALA', type = 'i'); + pV_MOTOR_ATHM = Channel(DEVICE+':MOTOR.ATHM', type = 'i'); + pV_MOTOR_LLS = Channel(DEVICE+':MOTOR.LLS', type = 'i'); + pV_MOTOR_HLS = Channel(DEVICE+':MOTOR.HLS', type = 'i'); + pV_MOTOR_DMOV = Channel(DEVICE+':MOTOR.DMOV', type = 'i'); + pV_CAD_ODIR = Channel(DEVICE+':CAD.ODIR', type = 'i'); + pV_MOTOR_HOMF = Channel(DEVICE+':MOTOR.HOMF', type = 'i'); + pV_MOTOR_RLV = Channel(DEVICE+':MOTOR.RLV', type = 'l'); + pV_MOTOR_STOP = Channel(DEVICE+':MOTOR.STOP', type = 'i'); + pV_MOTOR_SET = Channel(DEVICE+':MOTOR.SET', type = 'i'); + pV_MOTOR_OFF = Channel(DEVICE+':MOTOR.OFF', type = 'i'); + pV_MOTOR_VAL = Channel(DEVICE+':MOTOR.VAL', type = 'l'); + pV_MOTOR_DVAL = Channel(DEVICE+':MOTOR.DVAL', type = 'l'); + pV_MOTOR_DLLM = Channel(DEVICE+':MOTOR.DLLM', type = 'd'); + pV_MOTOR_DHLM = Channel(DEVICE+':MOTOR.DHLM', type = 'd'); + pV_CAD_VALB = Channel(DEVICE+':CAD.VALB', type = 'l'); + pV_CAR_IVAL = Channel(DEVICE+':CAR.IVAL', type = 'i'); + pV_CAR_IERR = Channel(DEVICE+':CAR.IERR', type = 'i'); + pV_SIR_VAL = Channel(DEVICE+':SIR.VAL', type = 'i'); + pV_ENCODERraw = Channel(DEVICE+':ENCODERraw', type = 'l'); + pV_ENCODERscale = Channel(DEVICE+':ENCODERscale', type = 'l'); + pV_ENCODER_oEN = Channel(DEVICE+':ENCODER_oEN', type = 'i'); + pV_ENCODER_HFF = Channel(DEVICE+':ENCODER_HFF', type = 'i'); + pV_FIRST_INIT = Channel(DEVICE+':FIRST_INIT', type = 'i'); + except: + ret = 'Unable to create channel - ' + traceback.format_exc() + success = False + test.sendFeedback( ret, success) + return + #Dimension 1 + #PseudoPositioner id000000 + samplingRange = int(float(samplingTimeWindow) / samplingTime) + test.log('Start monitoring during ' + samplingTimeWindow + 's') + for setpoint1 in range(0, samplingRange): + readback1 = setpoint1 + sleep( samplingTime ) # Settling time + detector1 = id000001.get() + detector2 = id000002.get() + detector3 = id000003.get() + detector4 = id000004.get() + detector5 = id000005.get() + detector6 = id000006.get() + detector7 = id000007.get() + detector8 = id000008.get() + CAD_VALA = pV_CAD_VALA.get() + MOTOR_ATHM = pV_MOTOR_ATHM.get() + MOTOR_LLS = pV_MOTOR_LLS.get() + MOTOR_HLS = pV_MOTOR_HLS.get() + MOTOR_DMOV = pV_MOTOR_DMOV.get() + CAD_ODIR = pV_CAD_ODIR.get() + MOTOR_HOMF = pV_MOTOR_HOMF.get() + MOTOR_RLV = pV_MOTOR_RLV.get() + MOTOR_STOP = pV_MOTOR_STOP.get() + MOTOR_SET = pV_MOTOR_SET.get() + MOTOR_OFF = pV_MOTOR_OFF.get() + MOTOR_VAL = pV_MOTOR_VAL.get() + MOTOR_DVAL = pV_MOTOR_DVAL.get() + MOTOR_DLLM = pV_MOTOR_DLLM.get() + MOTOR_DHLM = pV_MOTOR_DHLM.get() + CAD_VALB = pV_CAD_VALB.get() + CAR_IVAL = pV_CAR_IVAL.get() + CAR_IERR = pV_CAR_IERR.get() + SIR_VAL = pV_SIR_VAL.get() + ENCODERraw = pV_ENCODERraw.get() + ENCODERscale = pV_ENCODERscale.get() + ENCODER_oEN = pV_ENCODER_oEN.get() + ENCODER_HFF = pV_ENCODER_HFF.get() + FIRST_INIT = pV_FIRST_INIT.get() + #Variable Mappings + a = detector6 + b = detector3 + id000009 = a-b + scan.append ([setpoint1], [readback1], [detector1, detector2, detector3, detector4, detector5, detector6, detector7, detector8, id000009, CAD_VALA, MOTOR_ATHM, MOTOR_LLS, MOTOR_HLS, MOTOR_DMOV, CAD_ODIR, MOTOR_HOMF, MOTOR_RLV, MOTOR_STOP, MOTOR_SET, MOTOR_OFF, MOTOR_VAL, MOTOR_DVAL, MOTOR_DLLM, MOTOR_DHLM, CAD_VALB, CAR_IVAL, CAR_IERR, SIR_VAL, ENCODERraw, ENCODERscale, ENCODER_oEN, ENCODER_HFF, FIRST_INIT] ) + + #Closing channels + id000001.close() + id000002.close() + id000003.close() + id000004.close() + id000005.close() + id000006.close() + id000007.close() + id000008.close() + pV_CAD_VALA.close() + pV_MOTOR_ATHM.close() + pV_MOTOR_LLS.close() + pV_MOTOR_HLS.close() + pV_MOTOR_DMOV.close() + pV_CAD_ODIR.close() + pV_MOTOR_HOMF.close() + pV_MOTOR_RLV.close() + pV_MOTOR_STOP.close() + pV_MOTOR_SET.close() + pV_MOTOR_OFF.close() + pV_MOTOR_VAL.close() + pV_MOTOR_DVAL.close() + pV_MOTOR_DLLM.close() + pV_MOTOR_DHLM.close() + pV_CAD_VALB.close() + pV_CAR_IVAL.close() + pV_CAR_IERR.close() + pV_SIR_VAL.close() + pV_ENCODERraw.close() + pV_ENCODERscale.close() + pV_ENCODER_oEN.close() + pV_ENCODER_HFF.close() + pV_FIRST_INIT.close() + + scan.end() + + success = True + ret = 'Monitoring completed' + test.log(ret) +############# END OF YOUR CODE ########### +###### DO NOT MODIFY THE CODE BELOW ###### + test.sendFeedback(ret, success) + except: + ret = traceback.format_exc() + success = False + test.sendFeedback(ret, success) + return + +#launch the test +startTest(test, device, parameters) \ No newline at end of file diff --git a/script/tests/tests/Range Shifter Tests/Monitor All/help.html b/script/tests/tests/Range Shifter Tests/Monitor All/help.html new file mode 100644 index 0000000..3d3fb7b --- /dev/null +++ b/script/tests/tests/Range Shifter Tests/Monitor All/help.html @@ -0,0 +1,14 @@ + + +

Short Description

+Monitor all process variables. +

Details

+Monitor all parameters during a fixed amount of time. No commands are sent. +

Parameters

+timeWindowS Duration of the monitoring time window [s]
+samplingTimeS Time resolution (time elapsed between two samples are taken) [s] +

Contact

+Marco Boccioli + + + diff --git a/script/tests/tests/sad/jtr/.config b/script/tests/tests/sad/jtr/.config new file mode 100644 index 0000000..be56916 --- /dev/null +++ b/script/tests/tests/sad/jtr/.config @@ -0,0 +1,4 @@ +#Fri Oct 13 10&14&47 CEST 2017 +name=jtr +parameters=a&IQCOM,$GNT3,1,DIA\&23&dfdf; +description=vv diff --git a/script/tests/tests/sad/jtr/help.html b/script/tests/tests/sad/jtr/help.html new file mode 100644 index 0000000..e788e6f --- /dev/null +++ b/script/tests/tests/sad/jtr/help.html @@ -0,0 +1,16 @@ + + + +

Description

+vv +

Parameters

+ + + +
a dfdf
+

Contact

+Marco Boccioli
+Tel. 3078 + + + diff --git a/script/tests/tests/sad/jtr/jtr.py b/script/tests/tests/sad/jtr/jtr.py new file mode 100644 index 0000000..74fba6a --- /dev/null +++ b/script/tests/tests/sad/jtr/jtr.py @@ -0,0 +1,172 @@ +# Test name: jtr +# vv +# Copyright (c) 2015 Paul Scherrer Institute. All rights reserved. + +###### Init - DO NOT MODIFY THE CODE BELOW ###### +global sys, inspect, os, traceback +import sys, inspect, os, traceback + + +def startTest(testName, DEVICE, params): + """ + Main method running the test + """ + # by default, assume the test failed: + ret = 'Test failed' + status = False + # put the whole custom code under try/catch. + try: + # get the path of this script: + testPath = inspect.getfile(inspect.currentframe()) + # init the testing tool class: + test = TestingTool(testName, testPath, DEVICE, params) + +################ END OF Init ##################### +######### WRITE YOUR CODE HERE BELOW ############# + + """ + All the code in this section # WRITE YOUR CODE HERE BELOW # is just an example and can be modified/deleted. + It must be indented to the same level as this comment. + ----------------------------------- + GETTING INPUTS: + ----------------------------------- + If needed, the following methods are available: + + test.getPath() string, path of this test file + test.getName() string, name of this test + test.getDeviceName() string, device for which the test must run (typically it is the beginning of a process variable name) + test.getPlotName() string, name to be given to the plot when using setPlotTitle(). Example: scan.setPlotTitle(test.getPlotName()) + ----------------------------------- + GETTING TEST PARAMETERS: + ----------------------------------- + if you need to get parameters for the test, use: + + myParamValue = test.getParam('myParamName') + + the calls to getParam are added to the code automatically, one per parameter, when creating the new test. + NOTE: Casting may be necessary. + See the test config for the list of parameters specific to the test. + ----------------------------------- + SETTING OUTPUTS: + ----------------------------------- + When the test has ended (error or success), this method must be called in order to return to pshell: + + test.sendFeedback(ret,success) + + ret string, a text summarizing the result of the test. + success bool, True = test successful. False = test failed. + ----------------------------------- + LOG INFO: + ----------------------------------- + when some information must be shown on the log on pshell, use the following line: + test.log('text to log') + """ + + ########## Example (can be removed) ###### + + # print the list of parameters passed. If any error, stop and send feedback. + test.log("Example - Test name: " + test.getName()) + test.log("Example - Device name: " + test.getDeviceName() ) + try: + test.log("Running test with the following parameters:") + test.printParams() + # If present, use the parameters here below for your test script. + # These parameters were automatically generated: you might need to change the casting. + a = float(test.getParam('a')) ; + except: + # test failed, write the report into the variables ret and success and send feedback: + ret = 'Could not retrieve testing parameters - ' + traceback.format_exc() + success = False + test.sendFeedback(ret, success) + return + + # loop to read channels for a while and plot the channels values. + # initialise plot tab with 2 plots: pass here the axis names: + scan = ManualScan(['sample'], ['Status (MSTA)', 'Position (VAL)']) + # set plot name(tab title): + scan.setPlotTitle(test.getPlotName()) + # start plots. See further below how to add points to the plots (scan): + scan.start() + + # inject a sinus into the plot, as example + from math import sin + motor_msta = 0 + # take 100 samples of a sinus and a jigsaw plot them: + for sample in range(0, 100): + readback1 = sample #the x axis. + sleep(0.1) # settling time. + # get value (it is translated to a caget): + motor_msta = motor_msta + +1 + if motor_msta > 50: + motor_msta = 0 + # get value: + motor_val = sin(float(sample)/10.0)*10.0-10.0 + # add values to plot: + scan.append([readback1], [readback1], [motor_msta, motor_val]) + + # now try with data from real device: this part will most probably fail: correct the PV names with existing ones. + try: + # set up connection to channels. "type" of data can be "d" (= double), "l" (= long). + pv_motor_msta = Channel(test.getDeviceName() + ':IST:2' , type='d') + pv_motor_val = Channel(test.getDeviceName() + ':IST:1' , type='d') + pv_motor_com = Channel(test.getDeviceName() + ':COM:2' , type='d') + except: + # prepare return information: return text: + ret = 'Unable to create channel - ' + traceback.format_exc() + # prepare return information: return success: + success = False + # send return information: + test.sendFeedback(ret, success) + return + # send a command to a channel (it is translated to a caput): uncomment this line below to try it + #pv_motor_com.put(1.0, timeout=None) # optionally, a timeout can be given. + # take 100 samples of the channels and plot them: + for sample in range(0, 100): + readback1 = sample #the x axis. + sleep(0.1) # settling time. + # get value (it is translated to a caget): + motor_msta = pv_motor_msta.get() + # get value: + motor_val = pv_motor_val.get() + # add values to plot: + scan.append([readback1], [readback1], [motor_msta, motor_val]) + + # Closing channels: all channels that were opened with Channel() must be closed before exit: + pv_motor_msta.close() + pv_motor_val.close() + pv_motor_com.close() + + # IMPORTANT: if the test was successful, write the report into the variables ret and success. + # for example, write the following: + ret = "Example - Test successful, here some detail: ..." + success = True + test.sendFeedback(ret, success) + # once the test is finished, no need to do anything. The code below yours will do the rest. + ################ End of Example ########## + +################ END OF YOUR CODE ################ +###### Final - DO NOT MODIFY THE CODE BELOW ###### + + # just in case the feedback was forgotten. + test.sendFeedback(ret, success) + except (KeyboardInterrupt): + # user stop error handler. + import traceback + ret = 'Test stopped by user.' + success = False + test.sendFeedback(ret, success) + except: + # generic error handler. + import traceback + ret = traceback.format_exc() + success = False + test.sendFeedback(ret, success) + + +# launch the test. +startTest(test, device, parameters) + +################ END OF Final #################### +#### IF NEEDED, ADD YOUR FUNCTIONS HERE BELOW #### +# Indent to end left +# def yourCustomFunction: diff --git a/script/tests/tests/sad/ltr/.config b/script/tests/tests/sad/ltr/.config new file mode 100644 index 0000000..26536e1 --- /dev/null +++ b/script/tests/tests/sad/ltr/.config @@ -0,0 +1,4 @@ +#Thu Oct 12 16&38&23 CEST 2017 +name=ltr +parameters=dv&2,IQCOM,$GNT3,1,DIA&23&fdv; +description=d v diff --git a/script/tests/tests/sad/ltr/help.html b/script/tests/tests/sad/ltr/help.html new file mode 100644 index 0000000..1c5f314 --- /dev/null +++ b/script/tests/tests/sad/ltr/help.html @@ -0,0 +1,16 @@ + + + +

Description

+d v +

Parameters

+ + + +
dv fdv
+

Contact

+Marco Boccioli
+Tel. 3078 + + + diff --git a/script/tests/tests/sad/ltr/ltr.py b/script/tests/tests/sad/ltr/ltr.py new file mode 100644 index 0000000..84dde5e --- /dev/null +++ b/script/tests/tests/sad/ltr/ltr.py @@ -0,0 +1,172 @@ +# Test name: ltr +# d v +# Copyright (c) 2015 Paul Scherrer Institute. All rights reserved. + +###### Init - DO NOT MODIFY THE CODE BELOW ###### +global sys, inspect, os, traceback +import sys, inspect, os, traceback + + +def startTest(testName, DEVICE, params): + """ + Main method running the test + """ + # by default, assume the test failed: + ret = 'Test failed' + status = False + # put the whole custom code under try/catch. + try: + # get the path of this script: + testPath = inspect.getfile(inspect.currentframe()) + # init the testing tool class: + test = TestingTool(testName, testPath, DEVICE, params) + +################ END OF Init ##################### +######### WRITE YOUR CODE HERE BELOW ############# + + """ + All the code in this section # WRITE YOUR CODE HERE BELOW # is just an example and can be modified/deleted. + It must be indented to the same level as this comment. + ----------------------------------- + GETTING INPUTS: + ----------------------------------- + If needed, the following methods are available: + + test.getPath() string, path of this test file + test.getName() string, name of this test + test.getDeviceName() string, device for which the test must run (typically it is the beginning of a process variable name) + test.getPlotName() string, name to be given to the plot when using setPlotTitle(). Example: scan.setPlotTitle(test.getPlotName()) + ----------------------------------- + GETTING TEST PARAMETERS: + ----------------------------------- + if you need to get parameters for the test, use: + + myParamValue = test.getParam('myParamName') + + the calls to getParam are added to the code automatically, one per parameter, when creating the new test. + NOTE: Casting may be necessary. + See the test config for the list of parameters specific to the test. + ----------------------------------- + SETTING OUTPUTS: + ----------------------------------- + When the test has ended (error or success), this method must be called in order to return to pshell: + + test.sendFeedback(ret,success) + + ret string, a text summarizing the result of the test. + success bool, True = test successful. False = test failed. + ----------------------------------- + LOG INFO: + ----------------------------------- + when some information must be shown on the log on pshell, use the following line: + test.log('text to log') + """ + + ########## Example (can be removed) ###### + + # print the list of parameters passed. If any error, stop and send feedback. + test.log("Example - Test name: " + test.getName()) + test.log("Example - Device name: " + test.getDeviceName() ) + try: + test.log("Running test with the following parameters:") + test.printParams() + # If present, use the parameters here below for your test script. + # These parameters were automatically generated: you might need to change the casting. + dv = float(test.getParam('dv')) ; + except: + # test failed, write the report into the variables ret and success and send feedback: + ret = 'Could not retrieve testing parameters - ' + traceback.format_exc() + success = False + test.sendFeedback(ret, success) + return + + # loop to read channels for a while and plot the channels values. + # initialise plot tab with 2 plots: pass here the axis names: + scan = ManualScan(['sample'], ['Status (MSTA)', 'Position (VAL)']) + # set plot name(tab title): + scan.setPlotTitle(test.getPlotName()) + # start plots. See further below how to add points to the plots (scan): + scan.start() + + # inject a sinus into the plot, as example + from math import sin + motor_msta = 0 + # take 100 samples of a sinus and a jigsaw plot them: + for sample in range(0, 100): + readback1 = sample #the x axis. + sleep(0.1) # settling time. + # get value (it is translated to a caget): + motor_msta = motor_msta + +1 + if motor_msta > 50: + motor_msta = 0 + # get value: + motor_val = sin(float(sample)/10.0)*10.0-10.0 + # add values to plot: + scan.append([readback1], [readback1], [motor_msta, motor_val]) + + # now try with data from real device: this part will most probably fail: correct the PV names with existing ones. + try: + # set up connection to channels. "type" of data can be "d" (= double), "l" (= long). + pv_motor_msta = Channel(test.getDeviceName() + ':IST:2' , type='d') + pv_motor_val = Channel(test.getDeviceName() + ':IST:1' , type='d') + pv_motor_com = Channel(test.getDeviceName() + ':COM:2' , type='d') + except: + # prepare return information: return text: + ret = 'Unable to create channel - ' + traceback.format_exc() + # prepare return information: return success: + success = False + # send return information: + test.sendFeedback(ret, success) + return + # send a command to a channel (it is translated to a caput): uncomment this line below to try it + #pv_motor_com.put(1.0, timeout=None) # optionally, a timeout can be given. + # take 100 samples of the channels and plot them: + for sample in range(0, 100): + readback1 = sample #the x axis. + sleep(0.1) # settling time. + # get value (it is translated to a caget): + motor_msta = pv_motor_msta.get() + # get value: + motor_val = pv_motor_val.get() + # add values to plot: + scan.append([readback1], [readback1], [motor_msta, motor_val]) + + # Closing channels: all channels that were opened with Channel() must be closed before exit: + pv_motor_msta.close() + pv_motor_val.close() + pv_motor_com.close() + + # IMPORTANT: if the test was successful, write the report into the variables ret and success. + # for example, write the following: + ret = "Example - Test successful, here some detail: ..." + success = True + test.sendFeedback(ret, success) + # once the test is finished, no need to do anything. The code below yours will do the rest. + ################ End of Example ########## + +################ END OF YOUR CODE ################ +###### Final - DO NOT MODIFY THE CODE BELOW ###### + + # just in case the feedback was forgotten. + test.sendFeedback(ret, success) + except (KeyboardInterrupt): + # user stop error handler. + import traceback + ret = 'Test stopped by user.' + success = False + test.sendFeedback(ret, success) + except: + # generic error handler. + import traceback + ret = traceback.format_exc() + success = False + test.sendFeedback(ret, success) + + +# launch the test. +startTest(test, device, parameters) + +################ END OF Final #################### +#### IF NEEDED, ADD YOUR FUNCTIONS HERE BELOW #### +# Indent to end left +# def yourCustomFunction: diff --git a/script/tests/tests/sad/rightleft/.config b/script/tests/tests/sad/rightleft/.config new file mode 100644 index 0000000..b28c8d5 --- /dev/null +++ b/script/tests/tests/sad/rightleft/.config @@ -0,0 +1,4 @@ +#Tue Aug 29 14&40&54 CEST 2017 +name=rightleft +parameters=delay&.2&delay between 2 steps;centre&2¢re where to move around;moveAround&10&move right and left from centre;steps&1&steps of each move;maxErr&5&maximum allowed error; +description=move around a value and plot the result diff --git a/script/tests/tests/sad/rightleft/help.html b/script/tests/tests/sad/rightleft/help.html new file mode 100644 index 0000000..1a7d5ec --- /dev/null +++ b/script/tests/tests/sad/rightleft/help.html @@ -0,0 +1,21 @@ + + + +

Description

+move around a value and plot the result +

Parameters

+ + + + + + +
delay delay between 2 steps
centre centre where to move around
moveAround move right and left from centre
steps steps of each move
maxErr maximum allowed error between the value when moving one direction and the corresponding value when moving to opposite direction
+ + +

Contact

+Marco Boccioli
+Tel. 3078 + + + diff --git a/script/tests/tests/sad/rightleft/rightleft.py b/script/tests/tests/sad/rightleft/rightleft.py new file mode 100644 index 0000000..32385f5 --- /dev/null +++ b/script/tests/tests/sad/rightleft/rightleft.py @@ -0,0 +1,221 @@ +# Test name: rightleft +# move around a value and plot the result +# Copyright (c) 2015 Paul Scherrer Institute. All rights reserved. + +###### Init - DO NOT MODIFY THE CODE BELOW ###### +global sys, inspect, os, traceback +import sys, inspect, os, traceback + +from array import * +a = bytearray() +a = array('B',[0x32,0,0x69,0,0x99,0x88,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0]) +mode = "2,IQCOM,$BMA1,1,DIA" +modebytes = array('B', mode) +a.extend(modebytes) +#a.append(4) +#a.fromlist([1,2,3,4]) +import binascii +print binascii.hexlify(a) +print a +a[16] = 1 +print a +print binascii.hexlify(a) + +def startTest(testName, DEVICE, params): + """ + Main method running the test + """ + + # by default, assume the test failed: + ret = 'Test failed' + status = False + # put the whole custom code under try/catch. + try: + # get the path of this script: + testPath = inspect.getfile(inspect.currentframe()) + # init the testing tool class: + test = TestingTool(testName, testPath, DEVICE, params) + +################ END OF Init ##################### +######### WRITE YOUR CODE HERE BELOW ############# + + """ + All the code in this section # WRITE YOUR CODE HERE BELOW # is just an example and can be modified/deleted. + It must be indented to the same level as this comment. + ----------------------------------- + GETTING INPUTS: + ----------------------------------- + If needed, the following methods are available: + + test.getPath() string, path of this test file + test.getName() string, name of this test + test.getDeviceName() string, device for which the test must run (typically it is the beginning of a process variable name) + test.getPlotName() string, name to be given to the plot when using setPlotTitle(). Example: scan.setPlotTitle(test.getPlotName()) + ----------------------------------- + GETTING TEST PARAMETERS: + ----------------------------------- + if you need to get parameters for the test, use: + + myParamValue = test.getParam('myParamName') + + the calls to getParam are added to the code automatically, one per parameter, when creating the new test. + NOTE: Casting may be necessary. + See the test config for the list of parameters specific to the test. + ----------------------------------- + SETTING OUTPUTS: + ----------------------------------- + When the test has ended (error or success), this method must be called in order to return to pshell: + + test.sendFeedback(ret,success) + + ret string, a text summarizing the result of the test. + success bool, True = test successful. False = test failed. + ----------------------------------- + LOG INFO: + ----------------------------------- + when some information must be shown on the log on pshell, use the following line: + test.log('text to log') + """ + + ########## Example (can be removed) ###### + + # print the list of parameters passed. If any error, stop and send feedback. + # test.log("Example - Test name: " + test.getName()) + # test.log("Example - Device name: " + test.getDeviceName() ) + try: + test.log("-------------------------------------------") + test.log("Running test with the following parameters:") + test.printParams() + # If present, use the parameters here below for your test script. + # These parameters were automatically generated: you might need to change the casting. + delay = float(test.getParam('delay')) ; centre = float(test.getParam('centre')) ; moveAround = float(test.getParam('moveAround')) ; steps = float(test.getParam('steps')) ; + except: + # test failed, write the report into the variables ret and success and send feedback: + import traceback + ret = 'Could not retrieve testing parameters - ' + traceback.format_exc() + success = False + test.sendFeedback(ret, success) + return + + # loop to read channels for a while and plot the channels values. + # initialise plot tab with 2 plots: pass here the axis names: + scan = ManualScan(['sample'], ['Status (sta)', 'Position (VAL)']) + # set plot name(tab title): + plotName = test.getPlotName() + scan.setPlotTitle(plotName) + # start plots. See further below how to add points to the plots (scan): + scan.start() + #in this example we initialise also a plot type to show how to add several curves on the same plot + p1 = plot(None,name="motor_sta", title = plotName + " Multi curves")[0] + #opionally set plot ranges + #p1.getAxis(p1.AxisId.X).setRange(0.0,80.0) + #p1.getAxis(p1.AxisId.Y).setRange(0.0,70.0) + p1.addSeries(LinePlotSeries("motor_val")) + # inject a sinus into the plot, as example + from math import sin + motor_val = 0 + # for testing: remove: + for sample in range(int(-moveAround), int(moveAround)+1, int(steps)): + break + readback1 = sample #the x axis. + sleep(delay) # settling time. + # get value (it is translated to a caget): + motor_val = motor_val + +1 + if motor_val > 50: + motor_val = 0 + # get value: + motor_sta = sin(float(readback1)/10.0)*10.0-10.0 + # add values to plot: + #scan.append([readback1], [readback1], [motor_sta, motor_val]) + # add values to 2 colour plot + p1.getSeries(0).appendData(motor_val, motor_sta) + + # now try with data from real device: this part will most probably fail: correct the PV names with existing ones. + try: + # set up connection to channels. "type" of data can be "d" (= double), "l" (= long). + pv_motor_sta = Channel(test.getDeviceName() + ':ao' , type='d') + pv_motor_val = Channel(test.getDeviceName() + ':ai' , type='d') + pv_motor_sta = Channel('DMAF1:IST3:1', type='l') + except: + # prepare return information: return text: + import traceback + ret = 'Unable to create channel - ' + traceback.format_exc() + # prepare return information: return success: + success = False + # send return information: + test.sendFeedback(ret, success) + return + # send a command to a channel (it is translated to a caput): uncomment this line below to try it + #pv_motor_com.put(1.0, timeout=None) # optionally, a timeout can be given. + # take 100 samples of the channels and plot them: + forwardsValues = {} + maxError = 0.0 + maxErrorPos = 0.0 + for sample in range(int(-moveAround), int(moveAround)+1, int(steps)): + readback1 = sample #the x axis. + sleep(delay) # settling time. + # get value: + motor_val = float(readback1) + pv_motor_val.put(motor_val) + # get value (it is translated to a caget): + motor_sta = float(pv_motor_sta.get()) + # add values to plot: + #scan.append([readback1], [readback1], [motor_sta, motor_val]) + # 2 colour plot + p1.getSeries(0).appendData(motor_val, motor_sta) + forwardsValues[sample] = motor_sta + for sample in range(int(moveAround), int(-moveAround)-1, int(-steps)): + readback1 = sample #the x axis. + sleep(delay) # settling time. + # get value: + motor_val = float(readback1) + pv_motor_val.put(motor_val+1.0) + # get value (it is translated to a caget): + motor_sta = float(pv_motor_sta.get()) + # add values to plot: + # scan.append([readback1], [readback1], [motor_sta, motor_val]) + # 2 colour plot + p1.getSeries(1).appendData(motor_val, motor_sta) + if abs(forwardsValues[sample] - motor_sta) > maxError: + maxError = abs(forwardsValues[sample] - motor_sta) + maxErrorPos = sample + import java.awt.Color + p1.addMarker(maxErrorPos, None, "Max Err = " + str(maxError), java.awt.Color.GREEN) + # Closing channels: all channels that were opened with Channel() must be closed before exit: + pv_motor_sta.close() + pv_motor_val.close() + + # IMPORTANT: if the test was successful, write the report into the variables ret and success. + # for example, write the following: + ret = "Test successful, max error: " + str(maxError) + " at " + str(maxErrorPos) + success = True + #test.sendFeedback(ret, success) + # once the test is finished, no need to do anything. The code below yours will do the rest. + ################ End of Example ########## + +################ END OF YOUR CODE ################ +###### Final - DO NOT MODIFY THE CODE BELOW ###### + + # just in case the feedback was forgotten. + test.sendFeedback(ret, success) + except (KeyboardInterrupt): + # user stop error handler. + import traceback + ret = 'Test stopped by user.' + success = False + test.sendFeedback(ret, success) + except: + # generic error handler. + import traceback + ret = traceback.format_exc() + success = False + test.sendFeedback(ret, success) + + +# launch the test. +startTest(test, device, parameters) + +################ END OF Final #################### +#### IF NEEDED, ADD YOUR FUNCTIONS HERE BELOW #### +# Indent to end left +# def yourCustomFunction: diff --git a/script/tests/tests/sad/rpstry/.config b/script/tests/tests/sad/rpstry/.config new file mode 100644 index 0000000..3b9860c --- /dev/null +++ b/script/tests/tests/sad/rpstry/.config @@ -0,0 +1,4 @@ +#Tue Oct 03 13&56&33 CEST 2017 +name=rpstry +parameters=delay&.2&delay between 2 steps;bla&234&bla bla;setVal&13&value to set;expectedVal&18.1&expected returned value;mask&2&bit mask; +description=try to use pshell for rps test diff --git a/script/tests/tests/sad/rpstry/help.html b/script/tests/tests/sad/rpstry/help.html new file mode 100644 index 0000000..1a7d5ec --- /dev/null +++ b/script/tests/tests/sad/rpstry/help.html @@ -0,0 +1,21 @@ + + + +

Description

+move around a value and plot the result +

Parameters

+ + + + + + +
delay delay between 2 steps
centre centre where to move around
moveAround move right and left from centre
steps steps of each move
maxErr maximum allowed error between the value when moving one direction and the corresponding value when moving to opposite direction
+ + +

Contact

+Marco Boccioli
+Tel. 3078 + + + diff --git a/script/tests/tests/sad/rpstry/rpstry.py b/script/tests/tests/sad/rpstry/rpstry.py new file mode 100644 index 0000000..121aae7 --- /dev/null +++ b/script/tests/tests/sad/rpstry/rpstry.py @@ -0,0 +1,148 @@ +# Test name: rightleft +# move around a value and plot the result +# Copyright (c) 2015 Paul Scherrer Institute. All rights reserved. + +###### Init - DO NOT MODIFY THE CODE BELOW ###### +global sys, inspect, os, traceback +import sys, inspect, os, traceback + + +def startTest(testName, DEVICE, params): + """ + Main method running the test + """ + # by default, assume the test failed: + ret = 'Test failed' + status = False + # put the whole custom code under try/catch. + try: + # get the path of this script: + testPath = inspect.getfile(inspect.currentframe()) + # init the testing tool class: + test = TestingTool(testName, testPath, DEVICE, params) + test.log('arriva pio') + p = Pio() + test.log('passato pio') + + ################ END OF Init ##################### +######### WRITE YOUR CODE HERE BELOW ############# + + """ + All the code in this section # WRITE YOUR CODE HERE BELOW # is just an example and can be modified/deleted. + It must be indented to the same level as this comment. + ----------------------------------- + GETTING INPUTS: + ----------------------------------- + If needed, the following methods are available: + + test.getPath() string, path of this test file + test.getName() string, name of this test + test.getDeviceName() string, device for which the test must run (typically it is the beginning of a process variable name) + test.getPlotName() string, name to be given to the plot when using setPlotTitle(). Example: scan.setPlotTitle(test.getPlotName()) + ----------------------------------- + GETTING TEST PARAMETERS: + ----------------------------------- + if you need to get parameters for the test, use: + + myParamValue = test.getParam('myParamName') + + the calls to getParam are added to the code automatically, one per parameter, when creating the new test. + NOTE: Casting may be necessary. + See the test config for the list of parameters specific to the test. + ----------------------------------- + SETTING OUTPUTS: + ----------------------------------- + When the test has ended (error or success), this method must be called in order to return to pshell: + + test.sendFeedback(ret,success) + + ret string, a text summarizing the result of the test. + success bool, True = test successful. False = test failed. + ----------------------------------- + LOG INFO: + ----------------------------------- + when some information must be shown on the log on pshell, use the following line: + test.log('text to log') + """ + + ########## Example (can be removed) ###### + + # print the list of parameters passed. If any error, stop and send feedback. + # test.log("Example - Test name: " + test.getName()) + # test.log("Example - Device name: " + test.getDeviceName() ) + try: + test.log("-------------------------------------------") + test.log("Running test with the following parameters:") + test.printParams() + # If present, use the parameters here below for your test script. + # These parameters were automatically generated: you might need to change the casting. + delay = float(test.getParam('delay')) ; expectedVal = float(test.getParam('expectedVal')) ; setVal = float(test.getParam('setVal')) ; mask = float(test.getParam('mask')) ; + except: + # test failed, write the report into the variables ret and success and send feedback: + import traceback + ret = 'Could not retrieve testing parameters - ' + traceback.format_exc() + success = False + test.sendFeedback(ret, success) + return + + # now try with data from real device: this part will most probably fail: correct the PV names with existing ones. + try: + # set up connection to channels. "type" of data can be "d" (= double), "l" (= long). + pv_motor_sta = Channel(test.getDeviceName() + ':ao' , type='d') + pv_motor_val = Channel(test.getDeviceName() + ':ai' , type='d') + except: + # prepare return information: return text: + import traceback + ret = 'Unable to create channel - ' + traceback.format_exc() + # prepare return information: return success: + success = False + # send return information: + test.sendFeedback(ret, success) + return + # send a command to a channel (it is translated to a caput): uncomment this line below to try it + #pv_motor_com.put(1.0, timeout=None) # optionally, a timeout can be given. + pv_motor_val.put(float(setVal)) + # get value (it is translated to a caget): + motor_sta = float(pv_motor_sta.get()) + + # Closing channels: all channels that were opened with Channel() must be closed before exit: + pv_motor_sta.close() + pv_motor_val.close() + + # IMPORTANT: if the test was successful, write the report into the variables ret and success. + # for example, write the following: + if motor_sta <= expectedVal: + ret = "Test successful, val returned: " + str(motor_sta) + " is below limit: " + str(expectedVal) + success = True + else: + ret = "Test failed, val received: " + str(motor_sta) + " is above the limit: " + str(expectedVal) + success = False + # once the test is finished, no need to do anything. The code below yours will do the rest. + ################ End of Example ########## + +################ END OF YOUR CODE ################ +###### Final - DO NOT MODIFY THE CODE BELOW ###### + + # just in case the feedback was forgotten. + test.sendFeedback(ret, success) + except (KeyboardInterrupt): + # user stop error handler. + import traceback + ret = 'Test stopped by user.' + success = False + test.sendFeedback(ret, success) + except: + # generic error handler. + import traceback + ret = traceback.format_exc() + success = False + test.sendFeedback(ret, success) + + +# launch the test. +startTest(test, device, parameters) + +################ END OF Final #################### +#### IF NEEDED, ADD YOUR FUNCTIONS HERE BELOW #### +# Indent to end left +# def yourCustomFunction: diff --git a/script/tests/tests/sad/sdd/.config b/script/tests/tests/sad/sdd/.config new file mode 100644 index 0000000..f9b5eaf --- /dev/null +++ b/script/tests/tests/sad/sdd/.config @@ -0,0 +1,4 @@ +#Tue Jan 12 09&17&43 CET 2016 +name=sdd +parameters=examplePar1&"2"&"This is the parameter n.1 with unit [unit]";examplePar2&"4.5"&"This is the parameter n.2 with unit [unit]"; +description=ad diff --git a/script/tests/tests/sad/sdd/help.html b/script/tests/tests/sad/sdd/help.html new file mode 100644 index 0000000..97ef6ab --- /dev/null +++ b/script/tests/tests/sad/sdd/help.html @@ -0,0 +1,15 @@ + + + +

Description

+ad +

Parameters

+examplePar1 This is the parameter n.1 with unit [unit]
+examplePar2 This is the parameter n.2 with unit [unit]
+ +

Contact

+Marco Boccioli
+Tel. 3078 + + + diff --git a/script/tests/tests/sad/sdd/sdd.py b/script/tests/tests/sad/sdd/sdd.py new file mode 100644 index 0000000..409511e --- /dev/null +++ b/script/tests/tests/sad/sdd/sdd.py @@ -0,0 +1,149 @@ +# Test name: sdd +# ad +# Copyright (c) 2015 Paul Scherrer Institute. All rights reserved. + +###### Init - DO NOT MODIFY THE CODE BELOW ###### +global sys, inspect, os, traceback +import sys, inspect, os, traceback + + +def startTest(testName, DEVICE, params): + """ + Main method running the test + """ + # by default, assume the test failed + ret = 'Test failed' + status = False + # plot name to be given to the scan. Use: scan.setPlotTitle(plotName) + plotName = DEVICE + ' - ' + testName + # put the whole custom code under try/catch + try: + # get the path of this script + testPath = inspect.getfile(inspect.currentframe()) + # init the testing tool class. It can be sued in the following ways: + test = TestingTool(testName, testPath, DEVICE, params) + +################ END OF Init ##################### +######### WRITE YOUR CODE HERE BELOW ############# + + """ + All the code in this section ###..YOUR CODE..### can be modified/deleted. + It must be indented to the same level as this comment + ----------------------------------- + GETTING INPUTS: + If needed, the following variables are available: + testPath string, path of this test file + testName string, name of this test + DEVICE string, device for which the test must run (typically it is the beginning of a process variable name) + ----------------------------------- + GETTING TEST PARAMETERS: + if you need to get parameters for the test, use (casting may be necessary): + myParamValue = test.getParam('myParamName') + see the test config for the list of parameters specific to the test. + ----------------------------------- + SETTING OUTPUTS: + ret string, a text summarizing the result of the test. It must be set before the end of your code. + success bool, True = test successful. It must be set before the end of your code. + test.sendFeedback(ret,success) method that ends the testing script and gives the report to the calling application. + Examples: + + whenever the code must quit (i.e. after an error), you must end with: + ret = 'here is some info on what failed on the test' + success = False + test.sendFeedback(ret, success) + + whenever the code is finished successfully, you must end with: + ret = 'here is some info on the success of the test' + success = True + test.sendFeedback(ret, success) + ----------------------------------- + LOG INFO: + when some information must be shown on the log, use: + test.log('test to log') + """ + + ########## Example (can be removed) ###### + # print the list of parameters passed. If any error, stop and send feedback + test.log("Example - Test name: " + testName) + test.log("Example - Device name: " + DEVICE) + try: + test.log("Running test with the following parameters:") + test.log(params) + # If present, use the parameters here below for your test script. You might need to change the casting + examplePar1 = float(test.getParam('examplePar1')) ; examplePar2 = float(test.getParam('examplePar2')) ; + except: + ret = 'Could not retrieve testing parameters - ' + traceback.format_exc() + success = False + test.sendFeedback(ret, success) + return + + # loop to read channels for a while and plot the channels values. + # initialise plot tab with 2 plots + scan = ManualScan(['sample'], ['Motor Status (MSTA)', 'Motor Position (VAL)']) + # set plot name(tab title) + scan.setPlotTitle(plotName) + # start plots. See further below how to add points to the plots + scan.start() + + # IMPORTANT: if the test failed, write the report into the variables ret and success. + # for example, write the following: + ret = "Example - Error, the test failed because...." + success = False + # set up connection to channels. "type" of data can be "d" (= double), "l" (= long) + try: + pv_motor_msta = Channel(DEVICE + ':MOTOR.MSTA', type='d') + pv_motor_val = Channel(DEVICE + ':MOTOR.VAL', type='d') + except: + # prepare return information: return text + ret = 'Unable to create channel - ' + traceback.format_exc() + # prepare return information: return success + success = False + # send return information + test.sendFeedback(ret, success) + return + # take 100 samples of the channels + for sample in range(0, 100): + readback1 = sample #the x axis + sleep(0.1) # Settling time + # get value + motor_msta = pv_motor_msta.get() + # get value + motor_val = pv_motor_val.get() + # add values to plot + scan.append([readback1], [readback1], [motor_msta, motor_val]) + + # Closing channels + pv_motor_msta.close() + pv_motor_val.close() + + # IMPORTANT: if the test was successful, write the report into the variables ret and success. + # for example, write the following: + ret = "Example - Test successful, here some detail: ..." + success = True + test.sendFeedback(ret, success) + # once the test is finished, no need to do anything. The code below yours will do the rest. + ################ End of Example ########## + +################ END OF YOUR CODE ################ +###### Final - DO NOT MODIFY THE CODE BELOW ###### + + # just in case the feedback was forgotten + test.sendFeedback(ret, success) + except (KeyboardInterrupt): + # user stop error handler + ret = 'Test stopped by user.' + success = False + test.sendFeedback(ret, success) + except: + # generic error handler + ret = traceback.format_exc() + success = False + test.sendFeedback(ret, success) + + +# launch the test +startTest(test, device, parameters) + +################ END OF Final #################### +#### IF NEEDED, ADD YOUR FUNCTIONS HERE BELOW #### +# def yourCustomFunction: