diff --git a/.gitattributes b/.gitattributes
index bad2cfbb9a3fbf14378dfd60b3989ccede2b5a3f..67e0b19e68a0c259561494e273fdc949aca2aab1 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -1365,13 +1365,20 @@ StationTest/test/beamformertest/beamformertest_HBA_RCU192.sh -text
 StationTest/test/beamformertest/beamformertest_HBA_RCU96.sh -text
 StationTest/test/beamformertest/beamformertest_LBA_RCU192.sh -text
 StationTest/test/beamformertest/beamformertest_LBA_RCU96.sh -text
+StationTest/test/beamformertest/beamformertest_LBHLBL_RCU96.sh -text
+StationTest/test/envcontroltest/tempctrl_V100.py -text
 StationTest/test/hbatest/gold/hba_modem1.gold -text
 StationTest/test/hbatest/gold/hba_modem2.gold -text
 StationTest/test/hbatest/gold/hba_modem3.gold -text
+StationTest/test/hbatest/hbaelementtest.py -text
 StationTest/test/hbatest/realdelaytest.sh -text
-StationTest/test/subbandstatistics/subbandstatistics_hba.sh -text
-StationTest/test/subbandstatistics/subbandstatistics_lbh.sh -text
-StationTest/test/subbandstatistics/subbandstatistics_lbl.sh -text
+StationTest/test/subbandstatistics/subbandstatistics_hba-5.sh -text
+StationTest/test/subbandstatistics/subbandstatistics_hba-6.sh -text
+StationTest/test/subbandstatistics/subbandstatistics_hba-7.sh -text
+StationTest/test/subbandstatistics/subbandstatistics_lbh-3.sh -text
+StationTest/test/subbandstatistics/subbandstatistics_lbh-4.sh -text
+StationTest/test/subbandstatistics/subbandstatistics_lbl-1.sh -text
+StationTest/test/subbandstatistics/subbandstatistics_lbl-2.sh -text
 StationTest/test/systemnoise/systemnoise_hba.sh -text
 StationTest/test/systemnoise/systemnoise_lbh.sh -text
 StationTest/test/systemnoise/systemnoise_lbl.sh -text
diff --git a/StationTest/test/beamformertest/beamformertest_LBHLBL_RCU96.sh b/StationTest/test/beamformertest/beamformertest_LBHLBL_RCU96.sh
new file mode 100644
index 0000000000000000000000000000000000000000..f64297af0d2e76962dc7c98c2716d55a9d9e814f
--- /dev/null
+++ b/StationTest/test/beamformertest/beamformertest_LBHLBL_RCU96.sh
@@ -0,0 +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
+
diff --git a/StationTest/test/envcontroltest/tempctrl_V100.py b/StationTest/test/envcontroltest/tempctrl_V100.py
new file mode 100644
index 0000000000000000000000000000000000000000..3257ce044592a7063849380b710b7d51e078a685
--- /dev/null
+++ b/StationTest/test/envcontroltest/tempctrl_V100.py
@@ -0,0 +1,455 @@
+#!/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 = 0
+doCheckDoors = 0
+
+#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.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/hbaelementtest.py b/StationTest/test/hbatest/hbaelementtest.py
new file mode 100644
index 0000000000000000000000000000000000000000..4520fd76212cc9feb224176f9cc8b56598fe6b11
--- /dev/null
+++ b/StationTest/test/hbatest/hbaelementtest.py
@@ -0,0 +1,165 @@
+""" script for testing the HBA elements
+Andre 21 April 2009
+The reading and plotting part of SST data was done by
+Gijs, 16 april 2009
+Usage:
+first argument: subband number within sst data
+second argument: number of RCUs to test
+e.g.
+
+python hbaelementtest.py 155 96
+
+"""
+# INIT
+
+import array
+import operator
+import os
+import time
+import sys
+import time
+
+# Read directory with the files to processs	
+def open_dir(dirname) :
+	files = filter(os.path.isfile, os.listdir('.'))
+	#files.sort(key=lambda x: os.path.getmtime(x))
+ 	return files
+
+def rm_files(dir_name,file) :
+        cmdstr = 'rm ' + file
+	os.popen(cmdstr)
+	return
+
+def rec_stat(dirname,num_rcu) :
+	os.popen("rspctl --statistics --duration=10 --integration=10 --select=0:" + str(num_rcu-1) + " 2>/dev/null")
+        return
+
+# Open file for processsing
+def open_file(files, file_nr) :
+        # check if file is data file, no junk
+	if files[file_nr][-3:] == 'dat':
+		file_name = files[file_nr]
+		fileinfo = os.stat(file_name)
+		size = int(fileinfo.st_size)
+		f=open(file_name,'rb')
+		max_frames = size/(512*8)
+		frames_to_process=max_frames
+    		rcu_nr = int(files[file_nr][-6:-4])
+		#print 'File nr ' + str(file_nr) + ' RCU nr ' + str(rcu_nr) + '  ' + files[file_nr][-6:-4]
+	else :
+		frames_to_process=0
+		f=open(files[file_nr],'rb')
+		rcu_nr = 0
+	return f, frames_to_process, rcu_nr	
+
+# Read single frame from file	
+def read_frame(f):
+	sst_data = array.array('d')	  	
+	sst_data.fromfile(f,512)
+	sst_data = sst_data.tolist()
+	return sst_data
+
+
+# Main loop
+def main() :
+	sub_time=[]
+	sub_file=[]
+	dir_name = './hbadatatest/' #Work directory will be cleaned
+  	rmfile = '*.log'
+	hba_elements=16
+        factor=1000
+ 	ctrl_string='='
+	# read in arguments
+        if len(sys.argv) < 2 :
+	        subband_nr=155
+        else :
+		subband_nr = int(sys.argv[1])
+        print ' Dir name is ' + dir_name
+        if len(sys.argv) < 3 :
+	        num_rcu=96
+        else :
+		num_rcu = int(sys.argv[2])
+        print ' Number of RCUs is ' + str(num_rcu)
+        # init log file
+        f_log = file('HBA_elements.log', 'w')
+        f_log.write(' ************ \n \n LOG File for HBA element test \n \n *************** \n \n')
+        f_logfac = file('HBA_factors.log', 'w')
+	# initialize data arrays
+	ref_data=range(0, num_rcu)
+	meet_data=range(0, num_rcu)
+	os.chdir(dir_name)
+	#os.popen("rspctl --clock=200")
+	#print 'Clock is set to 200 MHz'
+        #time.sleep(10)
+        #---------------------------------------------
+	# capture reference data (all HBA elements off)
+        rm_files(dir_name,'*')
+        os.popen("rspctl --rcumode=5 2>/dev/null")
+        for ind in range(hba_elements) :
+		ctrl_string=ctrl_string + '2,'
+	strlength=len(ctrl_string)
+        ctrl_string=ctrl_string[0:strlength-1]
+	cmd_str='rspctl --hbadelay' + ctrl_string + ' 2>/dev/null'
+        os.popen(cmd_str)
+        time.sleep(10)
+        print 'Capture reference data'
+        rec_stat(dir_name,num_rcu)
+	#rm_files(dir_name,rmfile)
+        # get list of all files in dir_name
+ 	files = open_dir(dir_name)
+        # start processing the reference measurement
+	for file_cnt in range(len(files)) :
+		f, frames_to_process, rcu_nr  = open_file(files, file_cnt)
+                if frames_to_process > 0 : 
+		   sst_data = read_frame(f)
+                   sst_subband = sst_data[subband_nr]
+		   ref_data[rcu_nr] = sst_subband
+		   #if rcu_nr==0:
+		   #	print ' waarde is ' + str(sst_subband)
+		f.close
+        #---------------------------------------------
+        # capture hba element data for all elements
+
+        for element in range(hba_elements) :
+        	rm_files(dir_name,'*')
+        	ctrl_string='='
+        	for ind in range(hba_elements) :
+                        if ind == element:
+				ctrl_string=ctrl_string + '128,'
+			else:	
+				ctrl_string=ctrl_string + '2,'
+		strlength=len(ctrl_string)
+        	ctrl_string=ctrl_string[0:strlength-1]
+		cmd_str='rspctl --hbadelay' + ctrl_string + ' 2>/dev/null'
+        	os.popen(cmd_str)
+		time.sleep(10)
+        	print 'Capture HBA element ' + str(element+1) + ' data'
+        	rec_stat(dir_name,num_rcu)
+		#rm_files(dir_name,rmfile)
+        	# get list of all files in dir_name
+ 		files = open_dir(dir_name)
+        
+        	# start processing the element measurements
+		for file_cnt in range(len(files)) :
+			f, frames_to_process, rcu_nr  = open_file(files, file_cnt)
+                	if frames_to_process > 0 : 
+		   		sst_data = read_frame(f)
+                   		sst_subband = sst_data[subband_nr]
+		   		meet_data[rcu_nr] = sst_subband
+		   		#if rcu_nr==0:
+		   		#	print ' waarde is ' + str(sst_subband)
+			f.close
+		for rcuind in range(num_rcu) :
+			#print 'factor: ' + str(meet_data[rcuind]/ref_data[rcuind]) + ' RCU: ' + str(rcuind)
+                        f_logfac.write(str(element+1) + ' ' + str(rcuind) + ' ' + str(round(meet_data[rcuind]/ref_data[rcuind])) + '\n')  
+			if meet_data[rcuind] < factor*ref_data[rcuind] :        
+				if rcuind == 0 :
+					tilenumb=0
+				else:
+					tilenumb=int(rcuind/2)
+                                f_log.write('Element ' + str(element+1) + ', Tile ' + str(tilenumb) + ' in RCU: ' + str(rcuind)+ ' factor: ' + str(round(meet_data[rcuind]/ref_data[rcuind])) + '\n')  
+
+        f_log.close
+	f_logfac.close
+
+main()
diff --git a/StationTest/test/subbandstatistics/subbandstatistics_hba-5.sh b/StationTest/test/subbandstatistics/subbandstatistics_hba-5.sh
new file mode 100644
index 0000000000000000000000000000000000000000..3a4dccd380d64f46d7096032a8c982640b68d510
--- /dev/null
+++ b/StationTest/test/subbandstatistics/subbandstatistics_hba-5.sh
@@ -0,0 +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 $!
+
diff --git a/StationTest/test/subbandstatistics/subbandstatistics_hba-6.sh b/StationTest/test/subbandstatistics/subbandstatistics_hba-6.sh
new file mode 100644
index 0000000000000000000000000000000000000000..40fed79adbb36a6e5e473394ef09e9a365e4bf1f
--- /dev/null
+++ b/StationTest/test/subbandstatistics/subbandstatistics_hba-6.sh
@@ -0,0 +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 $!
diff --git a/StationTest/test/subbandstatistics/subbandstatistics_hba-7.sh b/StationTest/test/subbandstatistics/subbandstatistics_hba-7.sh
new file mode 100644
index 0000000000000000000000000000000000000000..8cc6825e5f6ff776bdcf2446342cd61100995040
--- /dev/null
+++ b/StationTest/test/subbandstatistics/subbandstatistics_hba-7.sh
@@ -0,0 +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 $!
+
diff --git a/StationTest/test/subbandstatistics/subbandstatistics_lbh.sh b/StationTest/test/subbandstatistics/subbandstatistics_lbh-3.sh
similarity index 76%
rename from StationTest/test/subbandstatistics/subbandstatistics_lbh.sh
rename to StationTest/test/subbandstatistics/subbandstatistics_lbh-3.sh
index 29ef85d3c0c5f5a402012f5e14e2e31c5e05696a..d6c050f5245025869e496232fbc738feda82e486 100644
--- a/StationTest/test/subbandstatistics/subbandstatistics_lbh.sh
+++ b/StationTest/test/subbandstatistics/subbandstatistics_lbh-3.sh
@@ -1,7 +1,7 @@
 #!/bin/sh
-# 1.0 subband statistics LBL test 
+# 1.0 subband statistics LBH test 
 # 15-05-09, M.J Norden
-# LBL input with antennas
+# LBH input with antennas
 
 rspctl --specinv=0
 rspctl --rcuprsg=0
diff --git a/StationTest/test/subbandstatistics/subbandstatistics_lbh-4.sh b/StationTest/test/subbandstatistics/subbandstatistics_lbh-4.sh
new file mode 100644
index 0000000000000000000000000000000000000000..1d5ed2c05419750d57efa99394cb5c580406a84c
--- /dev/null
+++ b/StationTest/test/subbandstatistics/subbandstatistics_lbh-4.sh
@@ -0,0 +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 $!
+
diff --git a/StationTest/test/subbandstatistics/subbandstatistics_lbl.sh b/StationTest/test/subbandstatistics/subbandstatistics_lbl-1.sh
similarity index 100%
rename from StationTest/test/subbandstatistics/subbandstatistics_lbl.sh
rename to StationTest/test/subbandstatistics/subbandstatistics_lbl-1.sh
diff --git a/StationTest/test/subbandstatistics/subbandstatistics_hba.sh b/StationTest/test/subbandstatistics/subbandstatistics_lbl-2.sh
similarity index 70%
rename from StationTest/test/subbandstatistics/subbandstatistics_hba.sh
rename to StationTest/test/subbandstatistics/subbandstatistics_lbl-2.sh
index 3b4943f1a433e7ef55fe02fef8ca1fe4df8265f5..8208b8a0f5c1e08570493b7a7ec2ba00f9e0e68e 100644
--- a/StationTest/test/subbandstatistics/subbandstatistics_hba.sh
+++ b/StationTest/test/subbandstatistics/subbandstatistics_lbl-2.sh
@@ -3,14 +3,14 @@
 # 15-05-09, M.J Norden
 # LBL input with antennas
 
-rspctl --specinv=1
+rspctl --specinv=0
 rspctl --rcuprsg=0
 rspctl --wg=0
-rspctl --rcumode=5 
+rspctl --rcumode=2 
 sleep 2
 
 echo ==========================
-echo "Subband Statistics HBA" `hostname -s`
+echo "Subband Statistics LBL" `hostname -s`
 echo ==========================
 rspctl --stati& 
 sleep 20 && kill $!