diff --git a/StationTest/power_ctrl.py b/StationTest/power_ctrl.py index ef920befcdf4f0b706861ec12d95ad5e14c45da7..e7379846d366e3b418f03cd44bb79d389131d2ec 100644 --- a/StationTest/power_ctrl.py +++ b/StationTest/power_ctrl.py @@ -1,163 +1,163 @@ -#!/usr/bin/python - -import socket -import time -import struct - -VERSION = '1.0.0' # version of this script - -## select HOST and action - -#HOST = '192.168.178.111' # Home EC -#HOST = '10.151.19.2' # CS010c EC -#HOST = '10.151.134.3' # RS106c EC -#HOST = '10.151.162.3' # RS302c EC -#HOST = '10.151.66.3' # CS030c EC -#HOST = '10.151.161.3' # CS301c EC -HOST = '10.87.2.239' # ASTRON EC on desk PD - - -## to see active state set all to 0 -# select only 1 -doReset48V = 0 -doPowerOn48V = 0 -doPowerOff48V = 0 -# select only 1 -doResetLCU = 0 -doPowerOnLCU = 0 -doPowerOffLCU = 0 - - - -## DO NOT CHANGE THINGS BELOW THIS LINE ## -## ------------------------------------ ## - - - -# === TCP PROTOCOL from controller === -PORT = 10000 # Gateway port -ecSck = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - -EC_NONE = 0 -EC_STATUS = 1 -EC_SET_48 = 20 -EC_RESET_48 = 22 -EC_SET_230 = 25 -EC_RESET_230 = 27 -EC_SET_SECOND = 115 - -PWR_OFF = 0 -PWR_ON = 1 -LCU = 230 - -#--------------------------------------- -# connect to station EC_controller -def connectToHost(): - print "connecting to %s on port %d\n" %(HOST, PORT) - ecSck.connect((HOST, PORT)) - ecSck.settimeout(5.0) -#--------------------------------------- -def disconnectHost(): - ecSck.close() -#--------------------------------------- -def sendCmd(cmdId=EC_NONE, cab=-1, value=0): - if (cmdId == EC_NONE): - return (false) - cmd = struct.pack('hhh', cmdId, cab, int(value)) - ecSck.send(cmd) -#--------------------------------------- -def recvAck(): - data = ecSck.recv(6) - header = struct.unpack('hhh', data) - cmdId = header[0] - status = header[1] - PLSize = header[2] - if (PLSize > 0): - data = ecSck.recv(PLSize) - fmt = 'h' * int(PLSize / 2) - PL = struct.unpack(fmt, data) - else: - PL = [] - return (cmdId, status, PL) -#--------------------------------------- -def setSecond(sec=0): - sendCmd(EC_SET_SECOND, 0, sec) - (cmdId, status, PL) = recvAck() -#--------------------------------------- -def waitForSync(): - while ((time.gmtime()[5] % 10) != 7): - time.sleep(0.5) - time.sleep(1.0) -#--------------------------------------- -def waitForUpdate(): - while ((time.gmtime()[5] % 10) != 3): - time.sleep(0.5) - time.sleep(1.0) -#--------------------------------------- -def printPowerState(): - state = ('OFF','ON') - sendCmd(EC_STATUS) - (cmdId, status, PL) = recvAck() - print 'power 48V state = %s' %(state[(PL[28] & 1)]) - print 'power LCU state = %s' %(state[(PL[28] >> 1)]) -#--------------------------------------- -def setPower(pwr=-1, state=PWR_ON): - waitForSync() - if ((pwr == 48) or (pwr == -1)): - sendCmd(EC_SET_48, 0, state) - (cmdId, status, PL) = recvAck() - print 'Power Set 48V to %d' %(state) - if ((pwr == LCU) or (pwr == -1)): - sendCmd(EC_SET_230, 0, state) - (cmdId, status, PL) = recvAck() - print 'Power Set LCU to %d' %(state) - waitForUpdate() - printPowerState() - print '' -#--------------------------------------- -def resetPower(pwr=-1): - waitForSync() - if ((pwr == 48) or (pwr == -1)): - sendCmd(EC_RESET_48, 0, 0) - (cmdId, status, PL) = recvAck() - print 'PowerReset 48V' - if ((pwr == LCU) or (pwr == -1)): - sendCmd(EC_RESET_230, 0, 0) - (cmdId, status, PL) = recvAck() - print 'PowerReset LCU' - waitForUpdate() - printPowerState() - waitForUpdate() - printPowerState() - print '' - -##======================================================================= -## start of main program -##======================================================================= -if ((doReset48V + doPowerOn48V + doPowerOff48V) > 1): - print 'error more than 1 48V cmd selected' - exit(-1) -if ((doResetLCU + doPowerOnLCU + doPowerOffLCU) > 1): - print 'error more than 1 LCU cmd selected' - exit(-1) - -connectToHost() -time.sleep(1.0) -setSecond(int(time.gmtime()[5])) -## do not change if statements -printPowerState() -print '' -if (doReset48V == 1): - resetPower(48) -if (doResetLCU == 1): - resetPower(LCU) -if (doPowerOn48V == 1): - setPower(48,PWR_ON) -if (doPowerOff48V == 1): - setPower(48,PWR_OFF) -if (doPowerOnLCU == 1): - setPower(LCU,PWR_ON) -if (doPowerOffLCU == 1): - setPower(LCU,PWR_OFF) - -disconnectHost() +#!/usr/bin/python + +import socket +import time +import struct + +VERSION = '1.0.0' # version of this script + +## select HOST and action + +#HOST = '192.168.178.111' # Home EC +#HOST = '10.151.19.2' # CS010c EC +#HOST = '10.151.134.3' # RS106c EC +#HOST = '10.151.162.3' # RS302c EC +#HOST = '10.151.66.3' # CS030c EC +#HOST = '10.151.161.3' # CS301c EC +HOST = '10.87.2.239' # ASTRON EC on desk PD + + +## to see active state set all to 0 +# select only 1 +doReset48V = 0 +doPowerOn48V = 0 +doPowerOff48V = 0 +# select only 1 +doResetLCU = 0 +doPowerOnLCU = 0 +doPowerOffLCU = 0 + + + +## DO NOT CHANGE THINGS BELOW THIS LINE ## +## ------------------------------------ ## + + + +# === TCP PROTOCOL from controller === +PORT = 10000 # Gateway port +ecSck = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + +EC_NONE = 0 +EC_STATUS = 1 +EC_SET_48 = 20 +EC_RESET_48 = 22 +EC_SET_230 = 25 +EC_RESET_230 = 27 +EC_SET_SECOND = 115 + +PWR_OFF = 0 +PWR_ON = 1 +LCU = 230 + +#--------------------------------------- +# connect to station EC_controller +def connectToHost(): + print "connecting to %s on port %d\n" %(HOST, PORT) + ecSck.connect((HOST, PORT)) + ecSck.settimeout(5.0) +#--------------------------------------- +def disconnectHost(): + ecSck.close() +#--------------------------------------- +def sendCmd(cmdId=EC_NONE, cab=-1, value=0): + if (cmdId == EC_NONE): + return (false) + cmd = struct.pack('hhh', cmdId, cab, int(value)) + ecSck.send(cmd) +#--------------------------------------- +def recvAck(): + data = ecSck.recv(6) + header = struct.unpack('hhh', data) + cmdId = header[0] + status = header[1] + PLSize = header[2] + if (PLSize > 0): + data = ecSck.recv(PLSize) + fmt = 'h' * int(PLSize / 2) + PL = struct.unpack(fmt, data) + else: + PL = [] + return (cmdId, status, PL) +#--------------------------------------- +def setSecond(sec=0): + sendCmd(EC_SET_SECOND, 0, sec) + (cmdId, status, PL) = recvAck() +#--------------------------------------- +def waitForSync(): + while ((time.gmtime()[5] % 10) != 7): + time.sleep(0.5) + time.sleep(1.0) +#--------------------------------------- +def waitForUpdate(): + while ((time.gmtime()[5] % 10) != 3): + time.sleep(0.5) + time.sleep(1.0) +#--------------------------------------- +def printPowerState(): + state = ('OFF','ON') + sendCmd(EC_STATUS) + (cmdId, status, PL) = recvAck() + print 'power 48V state = %s' %(state[(PL[28] & 1)]) + print 'power LCU state = %s' %(state[(PL[28] >> 1)]) +#--------------------------------------- +def setPower(pwr=-1, state=PWR_ON): + waitForSync() + if ((pwr == 48) or (pwr == -1)): + sendCmd(EC_SET_48, 0, state) + (cmdId, status, PL) = recvAck() + print 'Power Set 48V to %d' %(state) + if ((pwr == LCU) or (pwr == -1)): + sendCmd(EC_SET_230, 0, state) + (cmdId, status, PL) = recvAck() + print 'Power Set LCU to %d' %(state) + waitForUpdate() + printPowerState() + print '' +#--------------------------------------- +def resetPower(pwr=-1): + waitForSync() + if ((pwr == 48) or (pwr == -1)): + sendCmd(EC_RESET_48, 0, 0) + (cmdId, status, PL) = recvAck() + print 'PowerReset 48V' + if ((pwr == LCU) or (pwr == -1)): + sendCmd(EC_RESET_230, 0, 0) + (cmdId, status, PL) = recvAck() + print 'PowerReset LCU' + waitForUpdate() + printPowerState() + waitForUpdate() + printPowerState() + print '' + +##======================================================================= +## start of main program +##======================================================================= +if ((doReset48V + doPowerOn48V + doPowerOff48V) > 1): + print 'error more than 1 48V cmd selected' + exit(-1) +if ((doResetLCU + doPowerOnLCU + doPowerOffLCU) > 1): + print 'error more than 1 LCU cmd selected' + exit(-1) + +connectToHost() +time.sleep(1.0) +setSecond(int(time.gmtime()[5])) +## do not change if statements +printPowerState() +print '' +if (doReset48V == 1): + resetPower(48) +if (doResetLCU == 1): + resetPower(LCU) +if (doPowerOn48V == 1): + setPower(48,PWR_ON) +if (doPowerOff48V == 1): + setPower(48,PWR_OFF) +if (doPowerOnLCU == 1): + setPower(LCU,PWR_ON) +if (doPowerOffLCU == 1): + setPower(LCU,PWR_OFF) + +disconnectHost() diff --git a/StationTest/test/beamformertest/beamformertest_HBA_RCU192.sh b/StationTest/test/beamformertest/beamformertest_HBA_RCU192.sh index e7d680734fc03455bd4d80003e1281c58cf4f58d..5a0b4d6fac4cf051f891595c6113e85bcb21b699 100644 --- a/StationTest/test/beamformertest/beamformertest_HBA_RCU192.sh +++ b/StationTest/test/beamformertest/beamformertest_HBA_RCU192.sh @@ -1,18 +1,18 @@ -# beamformer test for 192 rcu's in LBA mode (LBH input) -# twentyfour antenna's per beam, four beams -# object zenith -# version 1.3 23 maa 2009 M.J.Norden - -killall beamctl - -beamctl --array=HBA --rcumode=5 --rcus=0:47 --subbands=100:139 --beamlets=0:39 --direction=0,0,LOFAR_LMN& -beamctl --array=HBA --rcumode=5 --rcus=48:95 --subbands=150:189 --beamlets=50:89 --direction=0,0,LOFAR_LMN& -beamctl --array=HBA --rcumode=5 --rcus=96:143 --subbands=200:239 --beamlets=100:139 --direction=0,0,LOFAR_LMN& -beamctl --array=HBA --rcumode=5 --rcus=144:191 --subbands=250:289 --beamlets=150:189 --direction=0,0,LOFAR_LMN& - -sleep 5 -rspctl --wg=0 -rspctl --rcuprsg=0 -rspctl --rcuenable=1 -rspctl --rcumode=5 - +# beamformer test for 192 rcu's in LBA mode (LBH input) +# twentyfour antenna's per beam, four beams +# object zenith +# version 1.3 23 maa 2009 M.J.Norden + +killall beamctl + +beamctl --array=HBA --rcumode=5 --rcus=0:47 --subbands=100:139 --beamlets=0:39 --direction=0,0,LOFAR_LMN& +beamctl --array=HBA --rcumode=5 --rcus=48:95 --subbands=150:189 --beamlets=50:89 --direction=0,0,LOFAR_LMN& +beamctl --array=HBA --rcumode=5 --rcus=96:143 --subbands=200:239 --beamlets=100:139 --direction=0,0,LOFAR_LMN& +beamctl --array=HBA --rcumode=5 --rcus=144:191 --subbands=250:289 --beamlets=150:189 --direction=0,0,LOFAR_LMN& + +sleep 5 +rspctl --wg=0 +rspctl --rcuprsg=0 +rspctl --rcuenable=1 +rspctl --rcumode=5 + diff --git a/StationTest/test/beamformertest/beamformertest_HBA_RCU96.sh b/StationTest/test/beamformertest/beamformertest_HBA_RCU96.sh index efed62fd4549ab4e598b284c820a97633cbb8165..49bea318deb1c93fcb12962dde49db54ce546483 100644 --- a/StationTest/test/beamformertest/beamformertest_HBA_RCU96.sh +++ b/StationTest/test/beamformertest/beamformertest_HBA_RCU96.sh @@ -1,18 +1,18 @@ -# beamformer test for 96 rcu's in HBA mode (HBA input) -# twentyfour antenna's per beam, four beams -# object zenith -# version 1.3 23 maa 2009 M.J.Norden - -killall beamctl - -beamctl --array=DUMMY48 --rcumode=5 --rcus=0:23 --subbands=100:139 --beamlets=0:39 --direction=0,0,LOFAR_LMN& -beamctl --array=DUMMY48 --rcumode=5 --rcus=24:47 --subbands=150:189 --beamlets=50:89 --direction=0,0,LOFAR_LMN& -beamctl --array=DUMMY48 --rcumode=5 --rcus=48:71 --subbands=200:239 --beamlets=100:139 --direction=0,0,LOFAR_LMN& -beamctl --array=DUMMY48 --rcumode=5 --rcus=72:96 --subbands=250:289 --beamlets=150:189 --direction=0,0,LOFAR_LMN& - -sleep 5 -rspctl --wg=0 -rspctl --rcuprsg=0 -rspctl --rcuenable=1 -rspctl --rcumode=5 -sleep 1 +# beamformer test for 96 rcu's in HBA mode (HBA input) +# twentyfour antenna's per beam, four beams +# object zenith +# version 1.3 23 maa 2009 M.J.Norden + +killall beamctl + +beamctl --array=DUMMY48 --rcumode=5 --rcus=0:23 --subbands=100:139 --beamlets=0:39 --direction=0,0,LOFAR_LMN& +beamctl --array=DUMMY48 --rcumode=5 --rcus=24:47 --subbands=150:189 --beamlets=50:89 --direction=0,0,LOFAR_LMN& +beamctl --array=DUMMY48 --rcumode=5 --rcus=48:71 --subbands=200:239 --beamlets=100:139 --direction=0,0,LOFAR_LMN& +beamctl --array=DUMMY48 --rcumode=5 --rcus=72:96 --subbands=250:289 --beamlets=150:189 --direction=0,0,LOFAR_LMN& + +sleep 5 +rspctl --wg=0 +rspctl --rcuprsg=0 +rspctl --rcuenable=1 +rspctl --rcumode=5 +sleep 1 diff --git a/StationTest/test/beamformertest/beamformertest_LBA_RCU192.sh b/StationTest/test/beamformertest/beamformertest_LBA_RCU192.sh index e7d680734fc03455bd4d80003e1281c58cf4f58d..5a0b4d6fac4cf051f891595c6113e85bcb21b699 100644 --- a/StationTest/test/beamformertest/beamformertest_LBA_RCU192.sh +++ b/StationTest/test/beamformertest/beamformertest_LBA_RCU192.sh @@ -1,18 +1,18 @@ -# beamformer test for 192 rcu's in LBA mode (LBH input) -# twentyfour antenna's per beam, four beams -# object zenith -# version 1.3 23 maa 2009 M.J.Norden - -killall beamctl - -beamctl --array=HBA --rcumode=5 --rcus=0:47 --subbands=100:139 --beamlets=0:39 --direction=0,0,LOFAR_LMN& -beamctl --array=HBA --rcumode=5 --rcus=48:95 --subbands=150:189 --beamlets=50:89 --direction=0,0,LOFAR_LMN& -beamctl --array=HBA --rcumode=5 --rcus=96:143 --subbands=200:239 --beamlets=100:139 --direction=0,0,LOFAR_LMN& -beamctl --array=HBA --rcumode=5 --rcus=144:191 --subbands=250:289 --beamlets=150:189 --direction=0,0,LOFAR_LMN& - -sleep 5 -rspctl --wg=0 -rspctl --rcuprsg=0 -rspctl --rcuenable=1 -rspctl --rcumode=5 - +# beamformer test for 192 rcu's in LBA mode (LBH input) +# twentyfour antenna's per beam, four beams +# object zenith +# version 1.3 23 maa 2009 M.J.Norden + +killall beamctl + +beamctl --array=HBA --rcumode=5 --rcus=0:47 --subbands=100:139 --beamlets=0:39 --direction=0,0,LOFAR_LMN& +beamctl --array=HBA --rcumode=5 --rcus=48:95 --subbands=150:189 --beamlets=50:89 --direction=0,0,LOFAR_LMN& +beamctl --array=HBA --rcumode=5 --rcus=96:143 --subbands=200:239 --beamlets=100:139 --direction=0,0,LOFAR_LMN& +beamctl --array=HBA --rcumode=5 --rcus=144:191 --subbands=250:289 --beamlets=150:189 --direction=0,0,LOFAR_LMN& + +sleep 5 +rspctl --wg=0 +rspctl --rcuprsg=0 +rspctl --rcuenable=1 +rspctl --rcumode=5 + diff --git a/StationTest/test/beamformertest/beamformertest_LBA_RCU96.sh b/StationTest/test/beamformertest/beamformertest_LBA_RCU96.sh index 7e511aa58193a7506b32a4898f5aad03527d7fce..2a5a03c3a5ce1e2bb684205cea989a72fb36de1e 100644 --- a/StationTest/test/beamformertest/beamformertest_LBA_RCU96.sh +++ b/StationTest/test/beamformertest/beamformertest_LBA_RCU96.sh @@ -1,19 +1,19 @@ -# beamformermformer test for 96 rcu's in LBA mode (LBL & LBH input) -# two antennas per beam, four beams -# object zenith -# version 1.3 23 maa 2009 M.J.Norden - -killall beamctl - -beamctl --array=DUMMY48 --rcumode=3 --rcus=0 --subbands=100:139 --beamlets=0:39 --direction=0,0,LOFAR_LMN& -beamctl --array=DUMMY48 --rcumode=3 --rcus=0:47 --subbands=150:189 --beamlets=50:89 --direction=0,0,LOFAR_LMN& -beamctl --array=DUMMY48 --rcumode=1 --rcus=48 --subbands=200:239 --beamlets=100:139 --direction=0,0,LOFAR_LMN& -beamctl --array=DUMMY48 --rcumode=1 --rcus=48:95 --subbands=250:289 --beamlets=150:189 --direction=0,0,LOFAR_LMN& - -sleep 5 -rspctl --wg=0 -rspctl --rcuprsg=0 -rspctl --rcuenable=1 -rspctl --rcumode=3 --sel=0:95 -rspctl --rcumode=1 --sel=48:95 - +# beamformermformer test for 96 rcu's in LBA mode (LBL & LBH input) +# two antennas per beam, four beams +# object zenith +# version 1.3 23 maa 2009 M.J.Norden + +killall beamctl + +beamctl --array=DUMMY48 --rcumode=3 --rcus=0 --subbands=100:139 --beamlets=0:39 --direction=0,0,LOFAR_LMN& +beamctl --array=DUMMY48 --rcumode=3 --rcus=0:47 --subbands=150:189 --beamlets=50:89 --direction=0,0,LOFAR_LMN& +beamctl --array=DUMMY48 --rcumode=1 --rcus=48 --subbands=200:239 --beamlets=100:139 --direction=0,0,LOFAR_LMN& +beamctl --array=DUMMY48 --rcumode=1 --rcus=48:95 --subbands=250:289 --beamlets=150:189 --direction=0,0,LOFAR_LMN& + +sleep 5 +rspctl --wg=0 +rspctl --rcuprsg=0 +rspctl --rcuenable=1 +rspctl --rcumode=3 --sel=0:95 +rspctl --rcumode=1 --sel=48:95 + diff --git a/StationTest/test/beamformertest/beamformertest_LBHLBL_RCU96.sh b/StationTest/test/beamformertest/beamformertest_LBHLBL_RCU96.sh index f64297af0d2e76962dc7c98c2716d55a9d9e814f..a28f2d290691201844bf694aca4667acc2523a11 100644 --- a/StationTest/test/beamformertest/beamformertest_LBHLBL_RCU96.sh +++ b/StationTest/test/beamformertest/beamformertest_LBHLBL_RCU96.sh @@ -1,23 +1,23 @@ -# beamformermformer test for 96 rcu's in LBA mode (LBL & LBH input) -# two antennas per beam, four beams -# object zenith -# version 1.4 15 may 2009 M.J.Norden - -killall beamctl - -rspctl --splitter=1 -sleep 2 - -beamctl --array=LBAINNER --rcumode=3 --rcus=0:1 --subbands=280:333 --beamlets=0:53 --direction=0,0,LOFAR_LMN& -beamctl --array=LBAINNER --rcumode=3 --rcus=0:47 --subbands=280:333 --beamlets=54:107 --direction=0,0,LOFAR_LMN& -beamctl --array=LBAOUTER --rcumode=1 --rcus=47:48 --subbands=280:333 --beamlets=108:161 --direction=0,0,LOFAR_LMN& -beamctl --array=LBAOUTER --rcumode=1 --rcus=48:95 --subbands=280:333 --beamlets=162:215 --direction=0,0,LOFAR_LMN& - -sleep 5 -rspctl --wg=0 -rspctl --rcuprsg=0 -rspctl --rcuenable=1 -rspctl --rcumode=3 --sel=0:47 -sleep 3 -rspctl --rcumode=1 --sel=48:95 - +# beamformermformer test for 96 rcu's in LBA mode (LBL & LBH input) +# two antennas per beam, four beams +# object zenith +# version 1.4 15 may 2009 M.J.Norden + +killall beamctl + +rspctl --splitter=1 +sleep 2 + +beamctl --array=LBAINNER --rcumode=3 --rcus=0:1 --subbands=280:333 --beamlets=0:53 --direction=0,0,LOFAR_LMN& +beamctl --array=LBAINNER --rcumode=3 --rcus=0:47 --subbands=280:333 --beamlets=54:107 --direction=0,0,LOFAR_LMN& +beamctl --array=LBAOUTER --rcumode=1 --rcus=47:48 --subbands=280:333 --beamlets=108:161 --direction=0,0,LOFAR_LMN& +beamctl --array=LBAOUTER --rcumode=1 --rcus=48:95 --subbands=280:333 --beamlets=162:215 --direction=0,0,LOFAR_LMN& + +sleep 5 +rspctl --wg=0 +rspctl --rcuprsg=0 +rspctl --rcuenable=1 +rspctl --rcumode=3 --sel=0:47 +sleep 3 +rspctl --rcumode=1 --sel=48:95 + diff --git a/StationTest/test/envcontroltest/power_ctrl.py b/StationTest/test/envcontroltest/power_ctrl.py index ef920befcdf4f0b706861ec12d95ad5e14c45da7..e7379846d366e3b418f03cd44bb79d389131d2ec 100644 --- a/StationTest/test/envcontroltest/power_ctrl.py +++ b/StationTest/test/envcontroltest/power_ctrl.py @@ -1,163 +1,163 @@ -#!/usr/bin/python - -import socket -import time -import struct - -VERSION = '1.0.0' # version of this script - -## select HOST and action - -#HOST = '192.168.178.111' # Home EC -#HOST = '10.151.19.2' # CS010c EC -#HOST = '10.151.134.3' # RS106c EC -#HOST = '10.151.162.3' # RS302c EC -#HOST = '10.151.66.3' # CS030c EC -#HOST = '10.151.161.3' # CS301c EC -HOST = '10.87.2.239' # ASTRON EC on desk PD - - -## to see active state set all to 0 -# select only 1 -doReset48V = 0 -doPowerOn48V = 0 -doPowerOff48V = 0 -# select only 1 -doResetLCU = 0 -doPowerOnLCU = 0 -doPowerOffLCU = 0 - - - -## DO NOT CHANGE THINGS BELOW THIS LINE ## -## ------------------------------------ ## - - - -# === TCP PROTOCOL from controller === -PORT = 10000 # Gateway port -ecSck = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - -EC_NONE = 0 -EC_STATUS = 1 -EC_SET_48 = 20 -EC_RESET_48 = 22 -EC_SET_230 = 25 -EC_RESET_230 = 27 -EC_SET_SECOND = 115 - -PWR_OFF = 0 -PWR_ON = 1 -LCU = 230 - -#--------------------------------------- -# connect to station EC_controller -def connectToHost(): - print "connecting to %s on port %d\n" %(HOST, PORT) - ecSck.connect((HOST, PORT)) - ecSck.settimeout(5.0) -#--------------------------------------- -def disconnectHost(): - ecSck.close() -#--------------------------------------- -def sendCmd(cmdId=EC_NONE, cab=-1, value=0): - if (cmdId == EC_NONE): - return (false) - cmd = struct.pack('hhh', cmdId, cab, int(value)) - ecSck.send(cmd) -#--------------------------------------- -def recvAck(): - data = ecSck.recv(6) - header = struct.unpack('hhh', data) - cmdId = header[0] - status = header[1] - PLSize = header[2] - if (PLSize > 0): - data = ecSck.recv(PLSize) - fmt = 'h' * int(PLSize / 2) - PL = struct.unpack(fmt, data) - else: - PL = [] - return (cmdId, status, PL) -#--------------------------------------- -def setSecond(sec=0): - sendCmd(EC_SET_SECOND, 0, sec) - (cmdId, status, PL) = recvAck() -#--------------------------------------- -def waitForSync(): - while ((time.gmtime()[5] % 10) != 7): - time.sleep(0.5) - time.sleep(1.0) -#--------------------------------------- -def waitForUpdate(): - while ((time.gmtime()[5] % 10) != 3): - time.sleep(0.5) - time.sleep(1.0) -#--------------------------------------- -def printPowerState(): - state = ('OFF','ON') - sendCmd(EC_STATUS) - (cmdId, status, PL) = recvAck() - print 'power 48V state = %s' %(state[(PL[28] & 1)]) - print 'power LCU state = %s' %(state[(PL[28] >> 1)]) -#--------------------------------------- -def setPower(pwr=-1, state=PWR_ON): - waitForSync() - if ((pwr == 48) or (pwr == -1)): - sendCmd(EC_SET_48, 0, state) - (cmdId, status, PL) = recvAck() - print 'Power Set 48V to %d' %(state) - if ((pwr == LCU) or (pwr == -1)): - sendCmd(EC_SET_230, 0, state) - (cmdId, status, PL) = recvAck() - print 'Power Set LCU to %d' %(state) - waitForUpdate() - printPowerState() - print '' -#--------------------------------------- -def resetPower(pwr=-1): - waitForSync() - if ((pwr == 48) or (pwr == -1)): - sendCmd(EC_RESET_48, 0, 0) - (cmdId, status, PL) = recvAck() - print 'PowerReset 48V' - if ((pwr == LCU) or (pwr == -1)): - sendCmd(EC_RESET_230, 0, 0) - (cmdId, status, PL) = recvAck() - print 'PowerReset LCU' - waitForUpdate() - printPowerState() - waitForUpdate() - printPowerState() - print '' - -##======================================================================= -## start of main program -##======================================================================= -if ((doReset48V + doPowerOn48V + doPowerOff48V) > 1): - print 'error more than 1 48V cmd selected' - exit(-1) -if ((doResetLCU + doPowerOnLCU + doPowerOffLCU) > 1): - print 'error more than 1 LCU cmd selected' - exit(-1) - -connectToHost() -time.sleep(1.0) -setSecond(int(time.gmtime()[5])) -## do not change if statements -printPowerState() -print '' -if (doReset48V == 1): - resetPower(48) -if (doResetLCU == 1): - resetPower(LCU) -if (doPowerOn48V == 1): - setPower(48,PWR_ON) -if (doPowerOff48V == 1): - setPower(48,PWR_OFF) -if (doPowerOnLCU == 1): - setPower(LCU,PWR_ON) -if (doPowerOffLCU == 1): - setPower(LCU,PWR_OFF) - -disconnectHost() +#!/usr/bin/python + +import socket +import time +import struct + +VERSION = '1.0.0' # version of this script + +## select HOST and action + +#HOST = '192.168.178.111' # Home EC +#HOST = '10.151.19.2' # CS010c EC +#HOST = '10.151.134.3' # RS106c EC +#HOST = '10.151.162.3' # RS302c EC +#HOST = '10.151.66.3' # CS030c EC +#HOST = '10.151.161.3' # CS301c EC +HOST = '10.87.2.239' # ASTRON EC on desk PD + + +## to see active state set all to 0 +# select only 1 +doReset48V = 0 +doPowerOn48V = 0 +doPowerOff48V = 0 +# select only 1 +doResetLCU = 0 +doPowerOnLCU = 0 +doPowerOffLCU = 0 + + + +## DO NOT CHANGE THINGS BELOW THIS LINE ## +## ------------------------------------ ## + + + +# === TCP PROTOCOL from controller === +PORT = 10000 # Gateway port +ecSck = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + +EC_NONE = 0 +EC_STATUS = 1 +EC_SET_48 = 20 +EC_RESET_48 = 22 +EC_SET_230 = 25 +EC_RESET_230 = 27 +EC_SET_SECOND = 115 + +PWR_OFF = 0 +PWR_ON = 1 +LCU = 230 + +#--------------------------------------- +# connect to station EC_controller +def connectToHost(): + print "connecting to %s on port %d\n" %(HOST, PORT) + ecSck.connect((HOST, PORT)) + ecSck.settimeout(5.0) +#--------------------------------------- +def disconnectHost(): + ecSck.close() +#--------------------------------------- +def sendCmd(cmdId=EC_NONE, cab=-1, value=0): + if (cmdId == EC_NONE): + return (false) + cmd = struct.pack('hhh', cmdId, cab, int(value)) + ecSck.send(cmd) +#--------------------------------------- +def recvAck(): + data = ecSck.recv(6) + header = struct.unpack('hhh', data) + cmdId = header[0] + status = header[1] + PLSize = header[2] + if (PLSize > 0): + data = ecSck.recv(PLSize) + fmt = 'h' * int(PLSize / 2) + PL = struct.unpack(fmt, data) + else: + PL = [] + return (cmdId, status, PL) +#--------------------------------------- +def setSecond(sec=0): + sendCmd(EC_SET_SECOND, 0, sec) + (cmdId, status, PL) = recvAck() +#--------------------------------------- +def waitForSync(): + while ((time.gmtime()[5] % 10) != 7): + time.sleep(0.5) + time.sleep(1.0) +#--------------------------------------- +def waitForUpdate(): + while ((time.gmtime()[5] % 10) != 3): + time.sleep(0.5) + time.sleep(1.0) +#--------------------------------------- +def printPowerState(): + state = ('OFF','ON') + sendCmd(EC_STATUS) + (cmdId, status, PL) = recvAck() + print 'power 48V state = %s' %(state[(PL[28] & 1)]) + print 'power LCU state = %s' %(state[(PL[28] >> 1)]) +#--------------------------------------- +def setPower(pwr=-1, state=PWR_ON): + waitForSync() + if ((pwr == 48) or (pwr == -1)): + sendCmd(EC_SET_48, 0, state) + (cmdId, status, PL) = recvAck() + print 'Power Set 48V to %d' %(state) + if ((pwr == LCU) or (pwr == -1)): + sendCmd(EC_SET_230, 0, state) + (cmdId, status, PL) = recvAck() + print 'Power Set LCU to %d' %(state) + waitForUpdate() + printPowerState() + print '' +#--------------------------------------- +def resetPower(pwr=-1): + waitForSync() + if ((pwr == 48) or (pwr == -1)): + sendCmd(EC_RESET_48, 0, 0) + (cmdId, status, PL) = recvAck() + print 'PowerReset 48V' + if ((pwr == LCU) or (pwr == -1)): + sendCmd(EC_RESET_230, 0, 0) + (cmdId, status, PL) = recvAck() + print 'PowerReset LCU' + waitForUpdate() + printPowerState() + waitForUpdate() + printPowerState() + print '' + +##======================================================================= +## start of main program +##======================================================================= +if ((doReset48V + doPowerOn48V + doPowerOff48V) > 1): + print 'error more than 1 48V cmd selected' + exit(-1) +if ((doResetLCU + doPowerOnLCU + doPowerOffLCU) > 1): + print 'error more than 1 LCU cmd selected' + exit(-1) + +connectToHost() +time.sleep(1.0) +setSecond(int(time.gmtime()[5])) +## do not change if statements +printPowerState() +print '' +if (doReset48V == 1): + resetPower(48) +if (doResetLCU == 1): + resetPower(LCU) +if (doPowerOn48V == 1): + setPower(48,PWR_ON) +if (doPowerOff48V == 1): + setPower(48,PWR_OFF) +if (doPowerOnLCU == 1): + setPower(LCU,PWR_ON) +if (doPowerOffLCU == 1): + setPower(LCU,PWR_OFF) + +disconnectHost() diff --git a/StationTest/test/envcontroltest/tempctrl_V100.py b/StationTest/test/envcontroltest/tempctrl_V100.py index af433933818f103d490f792a0faa837c0c3c2397..75292ba147464673343bb2926be3693a8e2cc2ee 100644 --- a/StationTest/test/envcontroltest/tempctrl_V100.py +++ b/StationTest/test/envcontroltest/tempctrl_V100.py @@ -1,456 +1,456 @@ -#!/usr/bin/python - -import socket -import time -import struct - -VERSION = '1.0.0' # version of this script - -#== change only next settings ========================== -printToScreen = 1 -printToFile = 0 -printDataToFile = 0 # save setpoint, temp, humidity to data.txt - -# select mode -doCheckFans = 1 -doCheckDoors = 1 - -#HOST = '192.168.178.111' # Home TempControl -#HOST = '10.151.19.2' # CS010c TempControl -#HOST = '10.151.134.3' # RS106c TempControl -#HOST = '10.151.162.3' # RS302c TempControl -#HOST = '10.151.66.3' # CS030c TempControl -#HOST = '10.151.39.3' # CS021c TempControl -HOST = '10.151.177.3' # CS401c TempControl -#HOST = '10.151.68.3' # CS032c TempControl -#HOST = '10.151.161.3' # CS301c TempControl -#HOST = '10.87.2.239' # ASTRON TempControl on desk PD - -#======================================================= - -PORT = 10000 # Gateway port -ecSck = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - -# === TCP PROTOCOL from controller === -EC_NONE = 0 -EC_STATUS = 1 -EC_SETTINGS = 2 -EC_CTRL_TEMP = 3 -EC_VERSION = 5 -EC_SET_MODE = 10 -EC_SET_TEMP = 15 - -EC_SET_DOOR_CTRL = 50 -EC_SET_HUM_CTRL = 52 - -EC_SET_MAX_TEMP = 100 -EC_SET_MIN_TEMP = 101 -EC_SET_MAXMAX_TEMP = 102 -EC_SET_MINMIN_TEMP = 103 -EC_SET_MAX_HUM = 105 -EC_SET_MAXMAX_HUM = 106 -EC_SET_CTRL_SPAN = 110 -EC_SET_MAX_CHANGE = 111 - -EC_SET_SECOND = 115 -EC_SET_FANS = 116 - -MODE_OFF = 0 -MODE_ON = 1 -MODE_AUTO = 2 -MODE_MANUAL = 3 -MODE_STARTUP = 4 - - -# used variables -cabs =(0,1,3) # cabs in station -version = 0 # EC version -#--------------------------------------- -# open files if needed -if (printToFile == 1): - #(hostname, aliaslist, ipaddrlist) = socket.gethostbyaddr(HOST) - #stationname = hostname.split('.')[0] - #print stationname - filename = "tempctrl.txt" - f = open(filename, mode='w') -#--------------------------------------- -def closeFile(): - if (printToFile == 1): - f.close() -#--------------------------------------- -# print information to screen or file -def printInfo(info): - if (printToScreen == 1): - print info - - if (printToFile == 1): - f.write(info) - f.write('\n') -#--------------------------------------- -# connect to station EC_controller -def connectToHost(): - info = "connecting to %s on port %d" %(HOST, PORT) - printInfo(info) - ecSck.connect((HOST, PORT)) - ecSck.settimeout(5.0) -#--------------------------------------- -def disconnectHost(): - ecSck.close() -#--------------------------------------- -def sendCmd(cmdId=EC_NONE, cab=-1, value=0): - if (cmdId == EC_NONE): - return (false) - cmd = struct.pack('hhh', cmdId, cab, int(value)) - ecSck.send(cmd) -#--------------------------------------- -def recvAck(): - data = ecSck.recv(6) - header = struct.unpack('hhh', data) - cmdId = header[0] - status = header[1] - PLSize = header[2] - if (PLSize > 0): - data = ecSck.recv(PLSize) - fmt = 'h' * int(PLSize / 2) - PL = struct.unpack(fmt, data) - else: - PL = [] - return (cmdId, status, PL) -#--------------------------------------- -def setSecond(sec=0): - sendCmd(EC_SET_SECOND, 0, sec) - (cmdId, status, PL) = recvAck() -#--------------------------------------- -def waitForSync(): - while ((time.gmtime()[5] % 10) != 7): - time.sleep(0.5) - time.sleep(1.0) -#--------------------------------------- -def waitForUpdate(): - while ((time.gmtime()[5] % 10) != 3): - time.sleep(0.5) - time.sleep(1.0) -#--------------------------------------- -def setMode(cab=-1, mode=MODE_AUTO): - sendCmd(EC_SET_MODE, cab, mode) - (cmdId, status, PL) = recvAck() - printInfo('SetMode cab %d to %d' %(cab, mode)) -#--------------------------------------- -## mode 1 = moving setpoint -## mode 2 = constant setpoint, preset to 25.0 C -def setControlMode(cab=-1, mode=1): - sendCmd(EC_SET_CTRL_MODE, cab, mode) - (cmdId, status, PL) = recvAck() - printInfo('SetControlMode cab %d to %d' %(cab, mode)) -#--------------------------------------- -## search for new setpoint, works only in control mmode 1 -def seekNewSetpoint(cab=-1): - if (version < 102): - printInfo('to use this function update firmware') - return - sendCmd(EC_SET_MODE, cab, MODE_STARTUP) - (cmdId, status, PL) = recvAck() - printInfo('Find newSetpoint cab %d' %(cab)) -#--------------------------------------- -## set seek time in minutes -def setSeekTime(cab=-1, time=60): - sendCmd(EC_SET_SEEK_TIME, cab, time) - (cmdId, status, PL) = recvAck() - printInfo('SetTemperature cab %d to %4.2f' %(cab,temp)) -#--------------------------------------- -## set max temperature change in given seek time -def setSeekChange(cab=-1, temp=5.0): - temperature = int(temp * 100.) - sendCmd(EC_SET_SEEK_CHANGE, cab, temperature) - (cmdId, status, PL) = recvAck() - printInfo('SetTemperature cab %d to %4.2f' %(cab,temp)) -#--------------------------------------- -## set new setpoint, works only in manual mode -def setTemperature(cab=-1, temp=20.0): - temperature = int(temp * 100.) - sendCmd(EC_SET_TEMP, cab, temperature) - (cmdId, status, PL) = recvAck() - printInfo('SetTemperature cab %d to %4.2f' %(cab,temp)) -#--------------------------------------- -## set new setpoint, works only in manual mode -def setFans(cab=-1, fans=0x0f): - sendCmd(EC_SET_FANS, cab, fans) - (cmdId, status, PL) = recvAck() - printInfo('SetFans cab %d to %X' %(cab,fans)) -#--------------------------------------- -## set door control to on(1) or off(0) -def setDoorControl(cab=-1, state=1): - sendCmd(EC_SET_DOOR_CTRL, cab, state) - (cmdId, status, PL) = recvAck() - printInfo('SetDoorControl cab %d to %d' %(cab, state)) -#--------------------------------------- -## set hum control to on(1) or off(0) -def setHumControl(cab=-1, state=1): - sendCmd(EC_SET_HUM_CTRL, cab, state) - (cmdId, status, PL) = recvAck() - printInfo('SetHumidityControl cab %d to %d' %(cab, state)) -#--------------------------------------- -def getVersion(): - sendCmd(EC_VERSION) - (cmdId, status, PL) = recvAck() - version = int((PL[0]*100)+(PL[1]*10)+PL[2]) - printInfo('EC software version %d.%d.%d' %(PL)) - return version -#--------------------------------------- -def getStatus(): - ec_mode = ('OFF','ON','AUTO','MANUAL','STARTUP','ABSENT') - fan = ('. . . .','. . . .','. 2 . .','1 2 . .',\ - '. . 3 .','. . . .','. 2 3 .','1 2 3 .',\ - '. . . .','. . . .','. . . .','. . . .',\ - '. . 3 4','. . . .','. 2 3 4','1 2 3 4') - heater = ('off','on') - door = ('closed','front_open','back_open','open') - - # get information from EC - sendCmd(EC_CTRL_TEMP) - (cmdId, status, PL1) = recvAck() - - sendCmd(EC_STATUS) - (cmdId, status, PL2) = recvAck() - - # fill lines with data - lines = [] - lines.append(' |') - lines.append('mode |') - lines.append('status |') - lines.append('set point |') - lines.append('temperature |') - lines.append('humidity |') - lines.append('fans |') - lines.append('doors |') - lines.append('heater |') - - for cab in cabs: - lines[0] += ' cab-%1d |' %(cab) - lines[1] += '%11s |' %(ec_mode[PL2[(cab*7)]]) - lines[2] += '%11X |' %(PL2[(cab*7)+1]) - lines[3] += '%11.2f |' %(PL1[cab]/100.) - lines[4] += '%11.2f |' %(PL2[(cab*7)+2]/100.) - lines[5] += '%11.2f |' %(PL2[(cab*7)+3]/100.) - lines[6] += '%11s |' %(fan[(PL2[(cab*7)+4]&0x0f)]) - lines[7] += '%11s |' %(door[(PL2[(cab*7)+5]&0x03)]) - if (cab != 3): - lines[8] += '%11s |' %('none') - else: - lines[8] += '%11s |' %(heater[PL2[(cab*7)+6]]) - - # print lines to screen or file, see printInfo - printInfo('=== Station status ===') - for line in lines: - printInfo(line) - printInfo(' ') - # print data to df if selected - if (printDataToFile == 1): - df = open("data.txt", mode='a') - for cab in cabs: - df.write(' %3.2f %3.2f %3.2f' %\ - (PL1[cab]/100., PL2[(cab*7)+2]/100., PL2[(cab*7)+3]/100.)) - df.write('\n') - df.close() - -#--------------------------------------- -def getControlTemp(): - sendCmd(EC_CTRL_TEMP) - (cmdId, status, PL) = recvAck() - lines = [] - lines.append(' |') - lines.append('min control temp |') - - for cab in cabs: - lines[0] += ' cab-%1d |' %(cab) - lines[1] += '%9.2f |' %(PL[cab]/100.) -#--------------------------------------- -def getSettings(): - sendCmd(EC_SETTINGS) - (cmdId, status, PL) = recvAck() - - # fill lines with data - lines = [] - lines.append(' |') - lines.append('min control temp |') - lines.append('max control temp |') - lines.append('minmin temp |') - lines.append('maxmax temp |') - lines.append('max humidity |') - lines.append('maxmax humidity |') - lines.append('max day change |') - lines.append('control span |') - - for cab in cabs: - lines[0] += ' cab-%1d |' %(cab) - lines[1] += '%9.2f |' %(PL[(cab*8)+0]/100.) - lines[2] += '%9.2f |' %(PL[(cab*8)+1]/100.) - lines[3] += '%9.2f |' %(PL[(cab*8)+2]/100.) - lines[4] += '%9.2f |' %(PL[(cab*8)+3]/100.) - lines[5] += '%9.2f |' %(PL[(cab*8)+4]/100.) - lines[6] += '%9.2f |' %(PL[(cab*8)+5]/100.) - lines[7] += '%9.2f |' %(PL[(cab*8)+6]/100.) - lines[8] += '%9.2f |' %(PL[(cab*8)+7]/100.) - - # print lines to screen or file, see printInfo - printInfo('=== Station settings ===') - for line in lines: - printInfo(line) - printInfo(' ') -#--------------------------------------- -def checkFans(): - setMode(cab=-1, mode=MODE_ON) - # fans and vane check - printInfo('Fan and Vane check') - setFans(-1,0) # turn off all fans - time.sleep(15.0) - - # check all cabinets - for cab in cabs: - # turn on fans in front door - waitForSync() - setFans(cab,2) - waitForSync() - setFans(cab,3) - - # check vane state - waitForUpdate() - waitForUpdate() - sendCmd(EC_STATUS) - (cmdId, status, PL) = recvAck() - if (PL[(cab * 7) + 4] & 0x10): - printInfo('Fans and vane of cab-%d front OK' %(cab)) - else: - printInfo('Fans or vane of cab-%d front NOT OK' %(cab)) - setFans(-1,0) # turn off all fans - - # turn on fans in back door - waitForSync() - setFans(cab,4) - waitForSync() - setFans(cab,12) - - # check vane state - waitForUpdate() - waitForUpdate() - sendCmd(EC_STATUS) - (cmdId, status, PL) = recvAck() - if (PL[(cab * 7) + 4] & 0x20): - printInfo('Fans and vane of cab-%d back OK' %(cab)) - else: - printInfo('Fans or vane of cab-%d back NOT OK' %(cab)) - setFans(-1,0) # turn off all fans - setMode(cab=0, mode=MODE_AUTO) -#--------------------------------------- -def checkDoors(): - printInfo('Door contact check') - printInfo('Close doors and press last doorcontact') - - doorOpenCheck = 0 - doorCloseCheck = 0 - - doorsOpen = 6 - cycles = 0 - while ((doorsOpen > 0) and (cycles < 6)): - doorsOpen = 0 - waitForUpdate() - sendCmd(EC_STATUS) - (cmdId, status, PL) = recvAck() - for cab in range(4): - if (cab == 2): - continue - if (PL[(cab * 7) + 5] & 1): - doorsOpen += 1 - if (PL[(cab * 7) + 5] & 2): - doorsOpen += 1 - cycles += 1 - printInfo('doors closed=%d' %(6 - doorsOpen)) - if (doorsOpen == 0): - printInfo('all doors are closed, Open all doors') - doorCloseCheck = 1 - else: - printInfo('not all doors are closed') - - doorsOpen = 0 - cycles = 0 - while ((doorsOpen < 6) and (cycles < 6)): - doorsOpen = 0 - waitForUpdate() - sendCmd(EC_STATUS) - (cmdId, status, PL) = recvAck() - for cab in range(4): - if (cab == 2): - continue - if (PL[(cab * 7) + 5] & 1): - doorsOpen += 1 - if (PL[(cab * 7) + 5] & 2): - doorsOpen += 1 - - cycles += 1 - printInfo('doors open=%d' %(doorsOpen)) - if (doorsOpen == 6): - printInfo('all doors are open') - doorOpenCheck = 1 - else: - printInfo('not all doors are open') - - - if (doorOpenCheck and doorCloseCheck): - printInfo('all door contacs OK') - else: - printInfo('door contact failure') - -##======================================================================= -## start of main program -##======================================================================= -## do not delete next lines -connectToHost() -time.sleep(1.0) -setSecond(int(time.gmtime()[5])) -# version is used to check if function is available in firmware -version = getVersion() -##----------------------------------------------------------------------- -## playground -## cab = -1(all) or 0,1,3 - -if (doCheckFans == 1): - checkFans() -if (doCheckDoors == 1): - checkDoors() - -## search for new setpoint -#seekNewSetpoint() - -## set cab to manual mode -#setMode(cab=0, mode=MODE_MANUAL) - -## set cab to temperature, only posible in manual mode -#setTemperature(cab=-1,temp=25.0) - -## set cab to auto -#setMode(cab=-1, mode=MODE_AUTO) - -## turn on fans of cab -## fans=bitfield(0000,0010,0011,0100,0110,0111,1100,1110,1111) -## lsb = fan1 -#setFans(cab=0,fans=0x07) - -## set door control on(1) or off(0) -#setDoorControl(cab=-1,state=1) - -## get controller settings -getSettings() - -stop = False -while (not stop): - waitForUpdate() - printInfo('====== %s ====================' %(time.asctime()) ) - getStatus() - -##---------------------------------------------------------------------- -## do not delete next lines -disconnectHost() -closeFile() - - - +#!/usr/bin/python + +import socket +import time +import struct + +VERSION = '1.0.0' # version of this script + +#== change only next settings ========================== +printToScreen = 1 +printToFile = 0 +printDataToFile = 0 # save setpoint, temp, humidity to data.txt + +# select mode +doCheckFans = 1 +doCheckDoors = 1 + +#HOST = '192.168.178.111' # Home TempControl +#HOST = '10.151.19.2' # CS010c TempControl +#HOST = '10.151.134.3' # RS106c TempControl +#HOST = '10.151.162.3' # RS302c TempControl +#HOST = '10.151.66.3' # CS030c TempControl +#HOST = '10.151.39.3' # CS021c TempControl +HOST = '10.151.177.3' # CS401c TempControl +#HOST = '10.151.68.3' # CS032c TempControl +#HOST = '10.151.161.3' # CS301c TempControl +#HOST = '10.87.2.239' # ASTRON TempControl on desk PD + +#======================================================= + +PORT = 10000 # Gateway port +ecSck = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + +# === TCP PROTOCOL from controller === +EC_NONE = 0 +EC_STATUS = 1 +EC_SETTINGS = 2 +EC_CTRL_TEMP = 3 +EC_VERSION = 5 +EC_SET_MODE = 10 +EC_SET_TEMP = 15 + +EC_SET_DOOR_CTRL = 50 +EC_SET_HUM_CTRL = 52 + +EC_SET_MAX_TEMP = 100 +EC_SET_MIN_TEMP = 101 +EC_SET_MAXMAX_TEMP = 102 +EC_SET_MINMIN_TEMP = 103 +EC_SET_MAX_HUM = 105 +EC_SET_MAXMAX_HUM = 106 +EC_SET_CTRL_SPAN = 110 +EC_SET_MAX_CHANGE = 111 + +EC_SET_SECOND = 115 +EC_SET_FANS = 116 + +MODE_OFF = 0 +MODE_ON = 1 +MODE_AUTO = 2 +MODE_MANUAL = 3 +MODE_STARTUP = 4 + + +# used variables +cabs =(0,1,3) # cabs in station +version = 0 # EC version +#--------------------------------------- +# open files if needed +if (printToFile == 1): + #(hostname, aliaslist, ipaddrlist) = socket.gethostbyaddr(HOST) + #stationname = hostname.split('.')[0] + #print stationname + filename = "tempctrl.txt" + f = open(filename, mode='w') +#--------------------------------------- +def closeFile(): + if (printToFile == 1): + f.close() +#--------------------------------------- +# print information to screen or file +def printInfo(info): + if (printToScreen == 1): + print info + + if (printToFile == 1): + f.write(info) + f.write('\n') +#--------------------------------------- +# connect to station EC_controller +def connectToHost(): + info = "connecting to %s on port %d" %(HOST, PORT) + printInfo(info) + ecSck.connect((HOST, PORT)) + ecSck.settimeout(5.0) +#--------------------------------------- +def disconnectHost(): + ecSck.close() +#--------------------------------------- +def sendCmd(cmdId=EC_NONE, cab=-1, value=0): + if (cmdId == EC_NONE): + return (false) + cmd = struct.pack('hhh', cmdId, cab, int(value)) + ecSck.send(cmd) +#--------------------------------------- +def recvAck(): + data = ecSck.recv(6) + header = struct.unpack('hhh', data) + cmdId = header[0] + status = header[1] + PLSize = header[2] + if (PLSize > 0): + data = ecSck.recv(PLSize) + fmt = 'h' * int(PLSize / 2) + PL = struct.unpack(fmt, data) + else: + PL = [] + return (cmdId, status, PL) +#--------------------------------------- +def setSecond(sec=0): + sendCmd(EC_SET_SECOND, 0, sec) + (cmdId, status, PL) = recvAck() +#--------------------------------------- +def waitForSync(): + while ((time.gmtime()[5] % 10) != 7): + time.sleep(0.5) + time.sleep(1.0) +#--------------------------------------- +def waitForUpdate(): + while ((time.gmtime()[5] % 10) != 3): + time.sleep(0.5) + time.sleep(1.0) +#--------------------------------------- +def setMode(cab=-1, mode=MODE_AUTO): + sendCmd(EC_SET_MODE, cab, mode) + (cmdId, status, PL) = recvAck() + printInfo('SetMode cab %d to %d' %(cab, mode)) +#--------------------------------------- +## mode 1 = moving setpoint +## mode 2 = constant setpoint, preset to 25.0 C +def setControlMode(cab=-1, mode=1): + sendCmd(EC_SET_CTRL_MODE, cab, mode) + (cmdId, status, PL) = recvAck() + printInfo('SetControlMode cab %d to %d' %(cab, mode)) +#--------------------------------------- +## search for new setpoint, works only in control mmode 1 +def seekNewSetpoint(cab=-1): + if (version < 102): + printInfo('to use this function update firmware') + return + sendCmd(EC_SET_MODE, cab, MODE_STARTUP) + (cmdId, status, PL) = recvAck() + printInfo('Find newSetpoint cab %d' %(cab)) +#--------------------------------------- +## set seek time in minutes +def setSeekTime(cab=-1, time=60): + sendCmd(EC_SET_SEEK_TIME, cab, time) + (cmdId, status, PL) = recvAck() + printInfo('SetTemperature cab %d to %4.2f' %(cab,temp)) +#--------------------------------------- +## set max temperature change in given seek time +def setSeekChange(cab=-1, temp=5.0): + temperature = int(temp * 100.) + sendCmd(EC_SET_SEEK_CHANGE, cab, temperature) + (cmdId, status, PL) = recvAck() + printInfo('SetTemperature cab %d to %4.2f' %(cab,temp)) +#--------------------------------------- +## set new setpoint, works only in manual mode +def setTemperature(cab=-1, temp=20.0): + temperature = int(temp * 100.) + sendCmd(EC_SET_TEMP, cab, temperature) + (cmdId, status, PL) = recvAck() + printInfo('SetTemperature cab %d to %4.2f' %(cab,temp)) +#--------------------------------------- +## set new setpoint, works only in manual mode +def setFans(cab=-1, fans=0x0f): + sendCmd(EC_SET_FANS, cab, fans) + (cmdId, status, PL) = recvAck() + printInfo('SetFans cab %d to %X' %(cab,fans)) +#--------------------------------------- +## set door control to on(1) or off(0) +def setDoorControl(cab=-1, state=1): + sendCmd(EC_SET_DOOR_CTRL, cab, state) + (cmdId, status, PL) = recvAck() + printInfo('SetDoorControl cab %d to %d' %(cab, state)) +#--------------------------------------- +## set hum control to on(1) or off(0) +def setHumControl(cab=-1, state=1): + sendCmd(EC_SET_HUM_CTRL, cab, state) + (cmdId, status, PL) = recvAck() + printInfo('SetHumidityControl cab %d to %d' %(cab, state)) +#--------------------------------------- +def getVersion(): + sendCmd(EC_VERSION) + (cmdId, status, PL) = recvAck() + version = int((PL[0]*100)+(PL[1]*10)+PL[2]) + printInfo('EC software version %d.%d.%d' %(PL)) + return version +#--------------------------------------- +def getStatus(): + ec_mode = ('OFF','ON','AUTO','MANUAL','STARTUP','ABSENT') + fan = ('. . . .','. . . .','. 2 . .','1 2 . .',\ + '. . 3 .','. . . .','. 2 3 .','1 2 3 .',\ + '. . . .','. . . .','. . . .','. . . .',\ + '. . 3 4','. . . .','. 2 3 4','1 2 3 4') + heater = ('off','on') + door = ('closed','front_open','back_open','open') + + # get information from EC + sendCmd(EC_CTRL_TEMP) + (cmdId, status, PL1) = recvAck() + + sendCmd(EC_STATUS) + (cmdId, status, PL2) = recvAck() + + # fill lines with data + lines = [] + lines.append(' |') + lines.append('mode |') + lines.append('status |') + lines.append('set point |') + lines.append('temperature |') + lines.append('humidity |') + lines.append('fans |') + lines.append('doors |') + lines.append('heater |') + + for cab in cabs: + lines[0] += ' cab-%1d |' %(cab) + lines[1] += '%11s |' %(ec_mode[PL2[(cab*7)]]) + lines[2] += '%11X |' %(PL2[(cab*7)+1]) + lines[3] += '%11.2f |' %(PL1[cab]/100.) + lines[4] += '%11.2f |' %(PL2[(cab*7)+2]/100.) + lines[5] += '%11.2f |' %(PL2[(cab*7)+3]/100.) + lines[6] += '%11s |' %(fan[(PL2[(cab*7)+4]&0x0f)]) + lines[7] += '%11s |' %(door[(PL2[(cab*7)+5]&0x03)]) + if (cab != 3): + lines[8] += '%11s |' %('none') + else: + lines[8] += '%11s |' %(heater[PL2[(cab*7)+6]]) + + # print lines to screen or file, see printInfo + printInfo('=== Station status ===') + for line in lines: + printInfo(line) + printInfo(' ') + # print data to df if selected + if (printDataToFile == 1): + df = open("data.txt", mode='a') + for cab in cabs: + df.write(' %3.2f %3.2f %3.2f' %\ + (PL1[cab]/100., PL2[(cab*7)+2]/100., PL2[(cab*7)+3]/100.)) + df.write('\n') + df.close() + +#--------------------------------------- +def getControlTemp(): + sendCmd(EC_CTRL_TEMP) + (cmdId, status, PL) = recvAck() + lines = [] + lines.append(' |') + lines.append('min control temp |') + + for cab in cabs: + lines[0] += ' cab-%1d |' %(cab) + lines[1] += '%9.2f |' %(PL[cab]/100.) +#--------------------------------------- +def getSettings(): + sendCmd(EC_SETTINGS) + (cmdId, status, PL) = recvAck() + + # fill lines with data + lines = [] + lines.append(' |') + lines.append('min control temp |') + lines.append('max control temp |') + lines.append('minmin temp |') + lines.append('maxmax temp |') + lines.append('max humidity |') + lines.append('maxmax humidity |') + lines.append('max day change |') + lines.append('control span |') + + for cab in cabs: + lines[0] += ' cab-%1d |' %(cab) + lines[1] += '%9.2f |' %(PL[(cab*8)+0]/100.) + lines[2] += '%9.2f |' %(PL[(cab*8)+1]/100.) + lines[3] += '%9.2f |' %(PL[(cab*8)+2]/100.) + lines[4] += '%9.2f |' %(PL[(cab*8)+3]/100.) + lines[5] += '%9.2f |' %(PL[(cab*8)+4]/100.) + lines[6] += '%9.2f |' %(PL[(cab*8)+5]/100.) + lines[7] += '%9.2f |' %(PL[(cab*8)+6]/100.) + lines[8] += '%9.2f |' %(PL[(cab*8)+7]/100.) + + # print lines to screen or file, see printInfo + printInfo('=== Station settings ===') + for line in lines: + printInfo(line) + printInfo(' ') +#--------------------------------------- +def checkFans(): + setMode(cab=-1, mode=MODE_ON) + # fans and vane check + printInfo('Fan and Vane check') + setFans(-1,0) # turn off all fans + time.sleep(15.0) + + # check all cabinets + for cab in cabs: + # turn on fans in front door + waitForSync() + setFans(cab,2) + waitForSync() + setFans(cab,3) + + # check vane state + waitForUpdate() + waitForUpdate() + sendCmd(EC_STATUS) + (cmdId, status, PL) = recvAck() + if (PL[(cab * 7) + 4] & 0x10): + printInfo('Fans and vane of cab-%d front OK' %(cab)) + else: + printInfo('Fans or vane of cab-%d front NOT OK' %(cab)) + setFans(-1,0) # turn off all fans + + # turn on fans in back door + waitForSync() + setFans(cab,4) + waitForSync() + setFans(cab,12) + + # check vane state + waitForUpdate() + waitForUpdate() + sendCmd(EC_STATUS) + (cmdId, status, PL) = recvAck() + if (PL[(cab * 7) + 4] & 0x20): + printInfo('Fans and vane of cab-%d back OK' %(cab)) + else: + printInfo('Fans or vane of cab-%d back NOT OK' %(cab)) + setFans(-1,0) # turn off all fans + setMode(cab=0, mode=MODE_AUTO) +#--------------------------------------- +def checkDoors(): + printInfo('Door contact check') + printInfo('Close doors and press last doorcontact') + + doorOpenCheck = 0 + doorCloseCheck = 0 + + doorsOpen = 6 + cycles = 0 + while ((doorsOpen > 0) and (cycles < 6)): + doorsOpen = 0 + waitForUpdate() + sendCmd(EC_STATUS) + (cmdId, status, PL) = recvAck() + for cab in range(4): + if (cab == 2): + continue + if (PL[(cab * 7) + 5] & 1): + doorsOpen += 1 + if (PL[(cab * 7) + 5] & 2): + doorsOpen += 1 + cycles += 1 + printInfo('doors closed=%d' %(6 - doorsOpen)) + if (doorsOpen == 0): + printInfo('all doors are closed, Open all doors') + doorCloseCheck = 1 + else: + printInfo('not all doors are closed') + + doorsOpen = 0 + cycles = 0 + while ((doorsOpen < 6) and (cycles < 6)): + doorsOpen = 0 + waitForUpdate() + sendCmd(EC_STATUS) + (cmdId, status, PL) = recvAck() + for cab in range(4): + if (cab == 2): + continue + if (PL[(cab * 7) + 5] & 1): + doorsOpen += 1 + if (PL[(cab * 7) + 5] & 2): + doorsOpen += 1 + + cycles += 1 + printInfo('doors open=%d' %(doorsOpen)) + if (doorsOpen == 6): + printInfo('all doors are open') + doorOpenCheck = 1 + else: + printInfo('not all doors are open') + + + if (doorOpenCheck and doorCloseCheck): + printInfo('all door contacs OK') + else: + printInfo('door contact failure') + +##======================================================================= +## start of main program +##======================================================================= +## do not delete next lines +connectToHost() +time.sleep(1.0) +setSecond(int(time.gmtime()[5])) +# version is used to check if function is available in firmware +version = getVersion() +##----------------------------------------------------------------------- +## playground +## cab = -1(all) or 0,1,3 + +if (doCheckFans == 1): + checkFans() +if (doCheckDoors == 1): + checkDoors() + +## search for new setpoint +#seekNewSetpoint() + +## set cab to manual mode +#setMode(cab=0, mode=MODE_MANUAL) + +## set cab to temperature, only posible in manual mode +#setTemperature(cab=-1,temp=25.0) + +## set cab to auto +#setMode(cab=-1, mode=MODE_AUTO) + +## turn on fans of cab +## fans=bitfield(0000,0010,0011,0100,0110,0111,1100,1110,1111) +## lsb = fan1 +#setFans(cab=0,fans=0x07) + +## set door control on(1) or off(0) +#setDoorControl(cab=-1,state=1) + +## get controller settings +getSettings() + +stop = False +while (not stop): + waitForUpdate() + printInfo('====== %s ====================' %(time.asctime()) ) + getStatus() + +##---------------------------------------------------------------------- +## do not delete next lines +disconnectHost() +closeFile() + + + diff --git a/StationTest/test/hbatest/modemtest.sh b/StationTest/test/hbatest/modemtest.sh index b5edd54aac871b581a28dbed9961c9a99e7694b1..09a2800dfdf81ad0d7c0808b6e194de8f043a231 100644 --- a/StationTest/test/hbatest/modemtest.sh +++ b/StationTest/test/hbatest/modemtest.sh @@ -1,65 +1,65 @@ -#!/bin/bash -# -# Send delays from RCU to HBA and compare results with the expected golden result. -# To verify modem communication between RCU and HBA -# -# Version 1.0 13 feb 2009 M.J.Norden - -rm -f hba_modem*.log -rm -f hba_modem*.diff - -declare ontime=4 - -let hbamode=5 - -eval "rspctl --rcumode=$hbamode" - -echo "The rcumode is "$hbamode -sleep 2 - -echo "rspctl --hbadelays=1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16" -eval "rspctl --hbadelays=1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16" -sleep $ontime - -rspctl --realdelays > hba_modem1.log -diff hba_modem1.log gold/hba_modem1.gold > hba_modem1.diff - -if [ -e hba_modem1.log ] && [ -e gold/hba_modem1.gold ] && [ -e hba_modem1.diff ] && ! [ -s hba_modem1.diff ]; then - # The files exists AND the diff has size 0 - echo "HBA modem test went OK" -else - rspctl --realdelays - echo "HBA modem test went wrong" -fi - -echo "rspctl --hbadelays=0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0" -eval "rspctl --hbadelays=0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0" -sleep $ontime - -rspctl --realdelays > hba_modem2.log -diff hba_modem2.log gold/hba_modem2.gold > hba_modem2.diff - -if [ -e hba_modem2.log ] && [ -e gold/hba_modem2.gold ] && [ -e hba_modem2.diff ] && ! [ -s hba_modem2.diff ]; then - # The files exists AND the diff has size 0 - echo "HBA modem test went OK" -else - rspctl --realdelays - echo "HBA modem test went wrong" -fi - -echo "rspctl --hbadelays=253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253" -eval "rspctl --hbadelays=253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253" -sleep $ontime - -rspctl --realdelays > hba_modem3.log -diff hba_modem3.log gold/hba_modem3.gold > hba_modem3.diff - -if [ -e hba_modem3.log ] && [ -e gold/hba_modem3.gold ] && [ -e hba_modem3.diff ] && ! [ -s hba_modem3.diff ]; then - # The files exists AND the diff has size 0 - echo "HBA modem test went OK" -else - rspctl --realdelays - echo "HBA modem test went wrong" -fi - - +#!/bin/bash +# +# Send delays from RCU to HBA and compare results with the expected golden result. +# To verify modem communication between RCU and HBA +# +# Version 1.0 13 feb 2009 M.J.Norden + +rm -f hba_modem*.log +rm -f hba_modem*.diff + +declare ontime=4 + +let hbamode=5 + +eval "rspctl --rcumode=$hbamode" + +echo "The rcumode is "$hbamode +sleep 2 + +echo "rspctl --hbadelays=1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16" +eval "rspctl --hbadelays=1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16" +sleep $ontime + +rspctl --realdelays > hba_modem1.log +diff hba_modem1.log gold/hba_modem1.gold > hba_modem1.diff + +if [ -e hba_modem1.log ] && [ -e gold/hba_modem1.gold ] && [ -e hba_modem1.diff ] && ! [ -s hba_modem1.diff ]; then + # The files exists AND the diff has size 0 + echo "HBA modem test went OK" +else + rspctl --realdelays + echo "HBA modem test went wrong" +fi + +echo "rspctl --hbadelays=0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0" +eval "rspctl --hbadelays=0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0" +sleep $ontime + +rspctl --realdelays > hba_modem2.log +diff hba_modem2.log gold/hba_modem2.gold > hba_modem2.diff + +if [ -e hba_modem2.log ] && [ -e gold/hba_modem2.gold ] && [ -e hba_modem2.diff ] && ! [ -s hba_modem2.diff ]; then + # The files exists AND the diff has size 0 + echo "HBA modem test went OK" +else + rspctl --realdelays + echo "HBA modem test went wrong" +fi + +echo "rspctl --hbadelays=253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253" +eval "rspctl --hbadelays=253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253" +sleep $ontime + +rspctl --realdelays > hba_modem3.log +diff hba_modem3.log gold/hba_modem3.gold > hba_modem3.diff + +if [ -e hba_modem3.log ] && [ -e gold/hba_modem3.gold ] && [ -e hba_modem3.diff ] && ! [ -s hba_modem3.diff ]; then + # The files exists AND the diff has size 0 + echo "HBA modem test went OK" +else + rspctl --realdelays + echo "HBA modem test went wrong" +fi + + diff --git a/StationTest/test/subbandstatistics/subbandstatistics_hba-5.sh b/StationTest/test/subbandstatistics/subbandstatistics_hba-5.sh index 3a4dccd380d64f46d7096032a8c982640b68d510..1429c1adcffcd7358b8f4fc972090a292b755994 100644 --- a/StationTest/test/subbandstatistics/subbandstatistics_hba-5.sh +++ b/StationTest/test/subbandstatistics/subbandstatistics_hba-5.sh @@ -1,17 +1,17 @@ -#!/bin/sh -# 1.0 subband statistics HBA test -# 15-05-09, M.J Norden -# HBA input with antennas - -rspctl --specinv=1 -rspctl --rcuprsg=0 -rspctl --wg=0 -rspctl --rcumode=5 -sleep 2 - -echo ========================== -echo "Subband Statistics HBA rcumode=5" `hostname -s` -echo ========================== -rspctl --stati& -sleep 20 && kill $! - +#!/bin/sh +# 1.0 subband statistics HBA test +# 15-05-09, M.J Norden +# HBA input with antennas + +rspctl --specinv=1 +rspctl --rcuprsg=0 +rspctl --wg=0 +rspctl --rcumode=5 +sleep 2 + +echo ========================== +echo "Subband Statistics HBA rcumode=5" `hostname -s` +echo ========================== +rspctl --stati& +sleep 20 && kill $! + diff --git a/StationTest/test/subbandstatistics/subbandstatistics_hba-6.sh b/StationTest/test/subbandstatistics/subbandstatistics_hba-6.sh index 40fed79adbb36a6e5e473394ef09e9a365e4bf1f..e0364837a592353565ad71a05fcc17ca4b206cff 100644 --- a/StationTest/test/subbandstatistics/subbandstatistics_hba-6.sh +++ b/StationTest/test/subbandstatistics/subbandstatistics_hba-6.sh @@ -1,20 +1,20 @@ -#!/bin/sh -# 1.0 subband statistics HBA test -# 15-05-09, M.J Norden -# HBA input with antennas - - -echo "Set the clock speed at 160MHz (rspctl --clock=160)" -echo "Before you run this test!!" - -rspctl --specinv=0 -rspctl --rcuprsg=0 -rspctl --wg=0 -rspctl --rcumode=6 -sleep 2 - -echo ========================== -echo "Subband Statistics HBA rcumode=6" `hostname -s` -echo ========================== -rspctl --stati& -sleep 20 && kill $! +#!/bin/sh +# 1.0 subband statistics HBA test +# 15-05-09, M.J Norden +# HBA input with antennas + + +echo "Set the clock speed at 160MHz (rspctl --clock=160)" +echo "Before you run this test!!" + +rspctl --specinv=0 +rspctl --rcuprsg=0 +rspctl --wg=0 +rspctl --rcumode=6 +sleep 2 + +echo ========================== +echo "Subband Statistics HBA rcumode=6" `hostname -s` +echo ========================== +rspctl --stati& +sleep 20 && kill $! diff --git a/StationTest/test/subbandstatistics/subbandstatistics_hba-7.sh b/StationTest/test/subbandstatistics/subbandstatistics_hba-7.sh index 8cc6825e5f6ff776bdcf2446342cd61100995040..300325f3f681fa00b37381dd7f2705808736b71d 100644 --- a/StationTest/test/subbandstatistics/subbandstatistics_hba-7.sh +++ b/StationTest/test/subbandstatistics/subbandstatistics_hba-7.sh @@ -1,17 +1,17 @@ -#!/bin/sh -# 1.0 subband statistics HBA test -# 15-05-09, M.J Norden -# HBA input with antennas - -rspctl --specinv=0 -rspctl --rcuprsg=0 -rspctl --wg=0 -rspctl --rcumode=7 -sleep 2 - -echo ========================== -echo "Subband Statistics HBA rcumode=7" `hostname -s` -echo ========================== -rspctl --stati& -sleep 20 && kill $! - +#!/bin/sh +# 1.0 subband statistics HBA test +# 15-05-09, M.J Norden +# HBA input with antennas + +rspctl --specinv=0 +rspctl --rcuprsg=0 +rspctl --wg=0 +rspctl --rcumode=7 +sleep 2 + +echo ========================== +echo "Subband Statistics HBA rcumode=7" `hostname -s` +echo ========================== +rspctl --stati& +sleep 20 && kill $! + diff --git a/StationTest/test/subbandstatistics/subbandstatistics_lbh-3.sh b/StationTest/test/subbandstatistics/subbandstatistics_lbh-3.sh index d6c050f5245025869e496232fbc738feda82e486..173b0dfdd96b382f5bd6ed2347d38f4d51991444 100644 --- a/StationTest/test/subbandstatistics/subbandstatistics_lbh-3.sh +++ b/StationTest/test/subbandstatistics/subbandstatistics_lbh-3.sh @@ -1,17 +1,17 @@ -#!/bin/sh -# 1.0 subband statistics LBH test -# 15-05-09, M.J Norden -# LBH input with antennas - -rspctl --specinv=0 -rspctl --rcuprsg=0 -rspctl --wg=0 -rspctl --rcumode=3 -sleep 2 - -echo ========================== -echo "Subband Statistics LBH" `hostname -s` -echo ========================== -rspctl --stati& -sleep 20 && kill $! - +#!/bin/sh +# 1.0 subband statistics LBH test +# 15-05-09, M.J Norden +# LBH input with antennas + +rspctl --specinv=0 +rspctl --rcuprsg=0 +rspctl --wg=0 +rspctl --rcumode=3 +sleep 2 + +echo ========================== +echo "Subband Statistics LBH" `hostname -s` +echo ========================== +rspctl --stati& +sleep 20 && kill $! + diff --git a/StationTest/test/subbandstatistics/subbandstatistics_lbh-4.sh b/StationTest/test/subbandstatistics/subbandstatistics_lbh-4.sh index 1d5ed2c05419750d57efa99394cb5c580406a84c..6eb20db37b42b913c8f242f6e33ffcba7048c8fb 100644 --- a/StationTest/test/subbandstatistics/subbandstatistics_lbh-4.sh +++ b/StationTest/test/subbandstatistics/subbandstatistics_lbh-4.sh @@ -1,17 +1,17 @@ -#!/bin/sh -# 1.0 subband statistics LBH test -# 15-05-09, M.J Norden -# LBH input with antennas - -rspctl --specinv=0 -rspctl --rcuprsg=0 -rspctl --wg=0 -rspctl --rcumode=4 -sleep 2 - -echo ========================== -echo "Subband Statistics LBH" `hostname -s` -echo ========================== -rspctl --stati& -sleep 20 && kill $! - +#!/bin/sh +# 1.0 subband statistics LBH test +# 15-05-09, M.J Norden +# LBH input with antennas + +rspctl --specinv=0 +rspctl --rcuprsg=0 +rspctl --wg=0 +rspctl --rcumode=4 +sleep 2 + +echo ========================== +echo "Subband Statistics LBH" `hostname -s` +echo ========================== +rspctl --stati& +sleep 20 && kill $! + diff --git a/StationTest/test/subbandstatistics/subbandstatistics_lbl-1.sh b/StationTest/test/subbandstatistics/subbandstatistics_lbl-1.sh index a5136cf6514624f823198242a62bbc4fc91736eb..90c51740b74fee64189f1479c8ead7339fe6b90a 100644 --- a/StationTest/test/subbandstatistics/subbandstatistics_lbl-1.sh +++ b/StationTest/test/subbandstatistics/subbandstatistics_lbl-1.sh @@ -1,17 +1,17 @@ -#!/bin/sh -# 1.0 subband statistics LBL test -# 15-05-09, M.J Norden -# LBL input with antennas - -rspctl --specinv=0 -rspctl --rcuprsg=0 -rspctl --wg=0 -rspctl --rcumode=1 -sleep 2 - -echo ========================== -echo "Subband Statistics LBL" `hostname -s` -echo ========================== -rspctl --stati& -sleep 20 && kill $! - +#!/bin/sh +# 1.0 subband statistics LBL test +# 15-05-09, M.J Norden +# LBL input with antennas + +rspctl --specinv=0 +rspctl --rcuprsg=0 +rspctl --wg=0 +rspctl --rcumode=1 +sleep 2 + +echo ========================== +echo "Subband Statistics LBL" `hostname -s` +echo ========================== +rspctl --stati& +sleep 20 && kill $! + diff --git a/StationTest/test/subbandstatistics/subbandstatistics_lbl-2.sh b/StationTest/test/subbandstatistics/subbandstatistics_lbl-2.sh index 8208b8a0f5c1e08570493b7a7ec2ba00f9e0e68e..db81bf7b34a17395ae7ac0b341bde642f64cecb8 100644 --- a/StationTest/test/subbandstatistics/subbandstatistics_lbl-2.sh +++ b/StationTest/test/subbandstatistics/subbandstatistics_lbl-2.sh @@ -1,17 +1,17 @@ -#!/bin/sh -# 1.0 subband statistics LBL test -# 15-05-09, M.J Norden -# LBL input with antennas - -rspctl --specinv=0 -rspctl --rcuprsg=0 -rspctl --wg=0 -rspctl --rcumode=2 -sleep 2 - -echo ========================== -echo "Subband Statistics LBL" `hostname -s` -echo ========================== -rspctl --stati& -sleep 20 && kill $! - +#!/bin/sh +# 1.0 subband statistics LBL test +# 15-05-09, M.J Norden +# LBL input with antennas + +rspctl --specinv=0 +rspctl --rcuprsg=0 +rspctl --wg=0 +rspctl --rcumode=2 +sleep 2 + +echo ========================== +echo "Subband Statistics LBL" `hostname -s` +echo ========================== +rspctl --stati& +sleep 20 && kill $! + diff --git a/StationTest/test/systemnoise/systemnoise_hba.sh b/StationTest/test/systemnoise/systemnoise_hba.sh index 920eba1b0ae62751cbec3ef55cf8db736f302693..2735c9d83a62633e0d095ceb1f5137361ae0ad41 100644 --- a/StationTest/test/systemnoise/systemnoise_hba.sh +++ b/StationTest/test/systemnoise/systemnoise_hba.sh @@ -1,21 +1,21 @@ -#!/bin/sh -# 1.0 system noise HBA test -# 15-05-09, M.J Norden -# HBA input with antenna (one antenna biased and one not) - - -rspctl --rcuprsg=0 -rspctl --wg=0 -rspctl --rcumode=5 --sel=0 -rspctl --rcu=0x1007a080 --sel=2 -rspctl --specinv=1 --sel=0,2 -sleep 2 - -echo ========================== -echo "System noise HBA" `hostname -s` -echo ========================== -rspctl --stati --sel=0,2& -sleep 20 && kill $! - -rspctl --specinv=0 - +#!/bin/sh +# 1.0 system noise HBA test +# 15-05-09, M.J Norden +# HBA input with antenna (one antenna biased and one not) + + +rspctl --rcuprsg=0 +rspctl --wg=0 +rspctl --rcumode=5 --sel=0 +rspctl --rcu=0x1007a080 --sel=2 +rspctl --specinv=1 --sel=0,2 +sleep 2 + +echo ========================== +echo "System noise HBA" `hostname -s` +echo ========================== +rspctl --stati --sel=0,2& +sleep 20 && kill $! + +rspctl --specinv=0 + diff --git a/StationTest/test/systemnoise/systemnoise_lbh.sh b/StationTest/test/systemnoise/systemnoise_lbh.sh index f32a7fc2e83be5462f92c0082a3143d9b9e20ca8..ca8e50606017316b19f79a5f2c524b8c4ea87587 100644 --- a/StationTest/test/systemnoise/systemnoise_lbh.sh +++ b/StationTest/test/systemnoise/systemnoise_lbh.sh @@ -1,18 +1,18 @@ -#!/bin/sh -# 1.0 system noise LBH test -# 15-05-09, M.J Norden -# LBH input with antenna (one antenna biased and one not) - - -rspctl --rcuprsg=0 -rspctl --wg=0 -rspctl --rcumode=3 --sel=88 -rspctl --rcu=0x10037880 --sel=89 -sleep 2 - -echo ========================== -echo "System noise LBH" `hostname -s` -echo ========================== -rspctl --stati --sel=88,89& -sleep 20 && kill $! - +#!/bin/sh +# 1.0 system noise LBH test +# 15-05-09, M.J Norden +# LBH input with antenna (one antenna biased and one not) + + +rspctl --rcuprsg=0 +rspctl --wg=0 +rspctl --rcumode=3 --sel=88 +rspctl --rcu=0x10037880 --sel=89 +sleep 2 + +echo ========================== +echo "System noise LBH" `hostname -s` +echo ========================== +rspctl --stati --sel=88,89& +sleep 20 && kill $! + diff --git a/StationTest/test/systemnoise/systemnoise_lbl.sh b/StationTest/test/systemnoise/systemnoise_lbl.sh index 56e9d6fa0c2c8e51bf8637aa12d0bccf7675dbce..da5184d0855c6086a3a28f36628a1dcccdceefaa 100644 --- a/StationTest/test/systemnoise/systemnoise_lbl.sh +++ b/StationTest/test/systemnoise/systemnoise_lbl.sh @@ -1,18 +1,18 @@ -#!/bin/sh -# 1.0 system noise LBL test -# 15-05-09, M.J Norden -# LBL input with antenna (one antenna biased and one not) - - -rspctl --rcuprsg=0 -rspctl --wg=0 -rspctl --rcumode=1 --sel=0 -rspctl --rcu=0x10017880 --sel=1 -sleep 2 - -echo ========================== -echo "System noise LBL" `hostname -s` -echo ========================== -rspctl --stati --sel=0,1& -sleep 20 && kill $! - +#!/bin/sh +# 1.0 system noise LBL test +# 15-05-09, M.J Norden +# LBL input with antenna (one antenna biased and one not) + + +rspctl --rcuprsg=0 +rspctl --wg=0 +rspctl --rcumode=1 --sel=0 +rspctl --rcu=0x10017880 --sel=1 +sleep 2 + +echo ========================== +echo "System noise LBL" `hostname -s` +echo ========================== +rspctl --stati --sel=0,1& +sleep 20 && kill $! + diff --git a/StationTest/test/timing/gps.sh b/StationTest/test/timing/gps.sh index da0b028474af46bbffbd5c1a5e6e35af96d00349..f7592e29412da545fd8933edd9fa876c17de24b4 100644 --- a/StationTest/test/timing/gps.sh +++ b/StationTest/test/timing/gps.sh @@ -1,7 +1,7 @@ -#!/bin/sh -# 1.0 check the GPS reception -# 3-4-09 M.J. Norden - -echo "check GPS reception" -tail -f /var/log/ntpstats/clockstats - +#!/bin/sh +# 1.0 check the GPS reception +# 3-4-09 M.J. Norden + +echo "check GPS reception" +tail -f /var/log/ntpstats/clockstats + diff --git a/StationTest/test/timing/ntpd.sh b/StationTest/test/timing/ntpd.sh index bca2cbd0013342687b67d0336189f6844335d5ee..f600ad0291eb3e36f0c760a1c54797ff580a7826 100644 --- a/StationTest/test/timing/ntpd.sh +++ b/StationTest/test/timing/ntpd.sh @@ -1,7 +1,7 @@ -#!/bin/sh -# 1.0 check the ntpd time demon -# 01-04-09, M.J Norden - -echo "check ntpd server" -/usr/sbin/ntpq -p - +#!/bin/sh +# 1.0 check the ntpd time demon +# 01-04-09, M.J Norden + +echo "check ntpd server" +/usr/sbin/ntpq -p + diff --git a/StationTest/test/timing/ntpd_restart.sh b/StationTest/test/timing/ntpd_restart.sh index 67dbb7e6e1eb1e48d5fa18ad93003bbeee9ab4de..d247ed86557570b0d11e777219034102289b5c82 100644 --- a/StationTest/test/timing/ntpd_restart.sh +++ b/StationTest/test/timing/ntpd_restart.sh @@ -1,7 +1,7 @@ -#!/bin/sh -# 1.0 restart ntpd time demon -# 01-04-09, M.J. Norden - -echo "restart ntpd time server" -sudo /etc/init.d/ntpd restart - +#!/bin/sh +# 1.0 restart ntpd time demon +# 01-04-09, M.J. Norden + +echo "restart ntpd time server" +sudo /etc/init.d/ntpd restart + diff --git a/StationTest/test/timing/pps.sh b/StationTest/test/timing/pps.sh index 6817f221840bb46a3cbe792bb348e5d4117215a9..849e2592dde47553a56d62d01cfc11e4fc44fc60 100644 --- a/StationTest/test/timing/pps.sh +++ b/StationTest/test/timing/pps.sh @@ -1,7 +1,7 @@ -#!/bin/sh -# 1.0 ppsctl check of the pps system -# 31-03-09, M.J Norden - -echo "check 1 puls per second" -sudo ppsctl -m -ta -p/dev/oncore.pps.0 - +#!/bin/sh +# 1.0 ppsctl check of the pps system +# 31-03-09, M.J Norden + +echo "check 1 puls per second" +sudo ppsctl -m -ta -p/dev/oncore.pps.0 + diff --git a/StationTest/test/xcstatistics/waveform-generator-test.sh b/StationTest/test/xcstatistics/waveform-generator-test.sh index 925832026f0b23ea8c98abece8bca61dd2cd22f4..0364411276b11ee142a0c57490eee352e43e1df3 100644 --- a/StationTest/test/xcstatistics/waveform-generator-test.sh +++ b/StationTest/test/xcstatistics/waveform-generator-test.sh @@ -1,48 +1,48 @@ -#!/bin/sh - -echo "Checking for RSP driver" -rspdriver_pid=`swlevel|awk '/RSPDriver/ {print $4}'` -if test "$rspdriver_pid" = "DOWN" ; then - swlevel 2 & sleep 50; - rspdriver_pid=`swlevel|awk '/RSPDriver/ {print $4}'` -fi -echo "RSPDriver has PID $rspdriver_pid"; - -clock=`rspctl --clock 2>&1|grep "Sample frequency"|sed -e 's/.*clock=\(...\)MHz/\1/'` -echo "Clock = $clock MHz" -frequency=`echo "($clock / 4)"|bc -l` - - -station=`hostname -s` -let rspboards=`sed -n 's/^\s*RS\.N_RSPBOARDS\s*=\s*\([0-9][0-9]*\).*$/\1/p' /opt/lofar/etc/RemoteStation.conf` -let nrcus=8*$rspboards -echo "The number of RCUs is "$nrcus - -rspctl --rcuprsg=0 -#rspctl --rspclear -#echo "Wait 50 seconds for clearing the RSPbuffers" -#sleep 50 - -for (( idx = 0; idx < $nrcus ; idx++)) ; do - phaserad=`echo "( $idx * 2 * 3.141592654 ) / $nrcus" | bc -l` - ampl=`echo "0.5 * (1.02^$idx)/(1.02^$nrcus)" | bc -l` - #ampl='echo "0.5 * ($idx)/(1.02^$nrcus)"| bc -l' - echo "Amplitude [$idx]: $ampl" - echo "Phase [$idx]: $phaserad" - rspctl --wg=${frequency}e6 --select=$idx --ampli=$ampl --phase=$phaserad -done - -rspctl --xcsubband=256 -echo ========================== -echo "Amplitudes" `hostname -s` -echo ========================== -rspctl --xcstatistics& -sleep 20 && kill $! - -echo ====================== -echo "Phases" `hostname -s` -echo ====================== -rspctl --xcangle --xcstatistics & -sleep 20 && kill $! - -rspctl --wg=0 +#!/bin/sh + +echo "Checking for RSP driver" +rspdriver_pid=`swlevel|awk '/RSPDriver/ {print $4}'` +if test "$rspdriver_pid" = "DOWN" ; then + swlevel 2 & sleep 50; + rspdriver_pid=`swlevel|awk '/RSPDriver/ {print $4}'` +fi +echo "RSPDriver has PID $rspdriver_pid"; + +clock=`rspctl --clock 2>&1|grep "Sample frequency"|sed -e 's/.*clock=\(...\)MHz/\1/'` +echo "Clock = $clock MHz" +frequency=`echo "($clock / 4)"|bc -l` + + +station=`hostname -s` +let rspboards=`sed -n 's/^\s*RS\.N_RSPBOARDS\s*=\s*\([0-9][0-9]*\).*$/\1/p' /opt/lofar/etc/RemoteStation.conf` +let nrcus=8*$rspboards +echo "The number of RCUs is "$nrcus + +rspctl --rcuprsg=0 +#rspctl --rspclear +#echo "Wait 50 seconds for clearing the RSPbuffers" +#sleep 50 + +for (( idx = 0; idx < $nrcus ; idx++)) ; do + phaserad=`echo "( $idx * 2 * 3.141592654 ) / $nrcus" | bc -l` + ampl=`echo "0.5 * (1.02^$idx)/(1.02^$nrcus)" | bc -l` + #ampl='echo "0.5 * ($idx)/(1.02^$nrcus)"| bc -l' + echo "Amplitude [$idx]: $ampl" + echo "Phase [$idx]: $phaserad" + rspctl --wg=${frequency}e6 --select=$idx --ampli=$ampl --phase=$phaserad +done + +rspctl --xcsubband=256 +echo ========================== +echo "Amplitudes" `hostname -s` +echo ========================== +rspctl --xcstatistics& +sleep 20 && kill $! + +echo ====================== +echo "Phases" `hostname -s` +echo ====================== +rspctl --xcangle --xcstatistics & +sleep 20 && kill $! + +rspctl --wg=0 diff --git a/StationTest/test/xcstatistics/xcstatistics_lbh.sh b/StationTest/test/xcstatistics/xcstatistics_lbh.sh index 9501746897c7fba9cfae4dba1815f5222d178c05..028d17bdb4953475d86228b03a70de301763ff11 100644 --- a/StationTest/test/xcstatistics/xcstatistics_lbh.sh +++ b/StationTest/test/xcstatistics/xcstatistics_lbh.sh @@ -1,26 +1,26 @@ -#!/bin/sh -# 1.3 xcstatistics test to check SerDes Ring with LBH antennas -# 15-05-09, M.J Norden -# LBH input with antenna - - -rspctl --rcuprsg=0 -rspctl --wg=0 -rspctl --rcumode=3 -sleep 2 - -echo "check xcstat and xcangle" - -rspctl --xcsubband=256 -echo ========================== -echo "Amplitudes" `hostname -s` -echo ========================== -rspctl --xcstatistics& -sleep 20 && kill $! - -echo ====================== -echo "Phases" `hostname -s` -echo ====================== -rspctl --xcangle --xcstatistics & -sleep 20 && kill $! - +#!/bin/sh +# 1.3 xcstatistics test to check SerDes Ring with LBH antennas +# 15-05-09, M.J Norden +# LBH input with antenna + + +rspctl --rcuprsg=0 +rspctl --wg=0 +rspctl --rcumode=3 +sleep 2 + +echo "check xcstat and xcangle" + +rspctl --xcsubband=256 +echo ========================== +echo "Amplitudes" `hostname -s` +echo ========================== +rspctl --xcstatistics& +sleep 20 && kill $! + +echo ====================== +echo "Phases" `hostname -s` +echo ====================== +rspctl --xcangle --xcstatistics & +sleep 20 && kill $! + diff --git a/StationTest/test/xcstatistics/xcstatistics_lbl.sh b/StationTest/test/xcstatistics/xcstatistics_lbl.sh index fc00a1ab78cc909583e8c4264e47392027b1b357..553196b840dc548997192e21b27b57dc3b4812e5 100644 --- a/StationTest/test/xcstatistics/xcstatistics_lbl.sh +++ b/StationTest/test/xcstatistics/xcstatistics_lbl.sh @@ -1,26 +1,26 @@ -#!/bin/sh -# 1.3 xcstatistics test to check SerDes Ring with LBL antennas -# 15-05-09, M.J Norden -# LBL input with antenna - - -rspctl --rcuprsg=0 -rspctl --wg=0 -rspctl --rcumode=1 -sleep 2 - -echo "check xcstat and xcangle" - -rspctl --xcsubband=256 -echo ========================== -echo "Amplitudes" `hostname -s` -echo ========================== -rspctl --xcstatistics& -sleep 20 && kill $! - -echo ====================== -echo "Phases" `hostname -s` -echo ====================== -rspctl --xcangle --xcstatistics & -sleep 20 && kill $! - +#!/bin/sh +# 1.3 xcstatistics test to check SerDes Ring with LBL antennas +# 15-05-09, M.J Norden +# LBL input with antenna + + +rspctl --rcuprsg=0 +rspctl --wg=0 +rspctl --rcumode=1 +sleep 2 + +echo "check xcstat and xcangle" + +rspctl --xcsubband=256 +echo ========================== +echo "Amplitudes" `hostname -s` +echo ========================== +rspctl --xcstatistics& +sleep 20 && kill $! + +echo ====================== +echo "Phases" `hostname -s` +echo ====================== +rspctl --xcangle --xcstatistics & +sleep 20 && kill $! +