From e63094b505cc0a3ad9fdb57d8c12cedc964c5c5d Mon Sep 17 00:00:00 2001 From: Martin Gels <gels@astron.nl> Date: Wed, 9 Jul 2008 08:13:04 +0000 Subject: [PATCH] Bug 1005: Added function addkeys_IONodeRSP(), for the selected BGP partition, stations and beamletlist it generated keys like: PIC.Core.IONode[0].RSP = [CS001_RSP0,CS008_RSP0,CS010_RSP0,CS016_RSP0] --- Appl/CEP/CS1/CS1_Run/src/CS1_Parset.py | 58 +++++++++++++++++++++++- Appl/CEP/CS1/CS1_Run/src/CS1_Run.py | 2 + Appl/CEP/CS1/CS1_Run/src/CS1_Stations.py | 6 +++ Appl/CEP/CS1/CS1_Run/src/LOFAR_Parset.py | 8 ++++ Appl/CEP/CS1/CS1_Run/src/OLAP.parset | 6 +++ 5 files changed, 79 insertions(+), 1 deletion(-) diff --git a/Appl/CEP/CS1/CS1_Run/src/CS1_Parset.py b/Appl/CEP/CS1/CS1_Run/src/CS1_Parset.py index f3ae6155e63..0145eca9192 100644 --- a/Appl/CEP/CS1/CS1_Run/src/CS1_Parset.py +++ b/Appl/CEP/CS1/CS1_Run/src/CS1_Parset.py @@ -6,6 +6,7 @@ import sys import copy import string from Numeric import zeros +from CS1_Hosts import * class CS1_Parset(LOFAR_Parset.Parset): @@ -225,7 +226,19 @@ class CS1_Parset(LOFAR_Parset.Parset): sbList.append(b2s[i]) return sbList - + + def nrBeams(self, index): + MAX_BEAMLETS_PER_RSP = 54 + begin = index * MAX_BEAMLETS_PER_RSP + end = begin + MAX_BEAMLETS_PER_RSP-1 + nbeams = 0 + + for i in range(begin, end): + if self.bl2beams[i] != 0: + nbeams += 1 + + return nbeams + def nyquistzoneFromFilter(self, filterName): if filterName == 'LBL_10_80' : return 1 @@ -255,6 +268,49 @@ class CS1_Parset(LOFAR_Parset.Parset): if nBeamlets > self.getInt32('OLAP.nrSubbandsPerFrame'): print 'NrBeamlets(%d)' % nBeamlets + ' > OLAP.nrSubbandsPerFrame(%d)' % self.getInt32('OLAP.nrSubbandsPerFrame') sys.exit(0) + + def addkeys_IONodeRSP(self): + interfaces = IONodes.get(self.partition) + dplists = [[] for i in range(len(interfaces))] + + for s in self.stationList: + dest_ports = self.getStringVector_new('PIC.Core.' + s.getName() + '_RSP.dest.ports') + for dp in dest_ports: + if (dp.find(':') == -1) or (dp[0:5] == 'file:') or (dp[0:5] == 'FILE:'): + found = False + for i in range(0, len(interfaces)): + if not found and self.isDefined('PIC.Core.IONode[%d].RSP' % i): + for sname in self.getStringVector_new('PIC.Core.IONode[%d].RSP' % i): + if sname == s.getName()+ '_RSP%d' % dest_ports.index(dp): + found = True + break + + if not found: + print 'Warning: missing PIC.Core.IONode[x].RSP for station: ' + s.getName() + '_RSP%d("%s")' % (dest_ports.index(dp), dp) + ' in CS1.parset' + else: + if (dp[0:4] == 'udp:') or (dp[0:4] == 'UDP:'): + index = interfaces.index(string.split(dp.strip(dp[0:4]), ':')[0]) + elif (dp[0:4] == 'tcp:') or (dp[0:4] == 'TCP:'): + index = interfaces.index(string.split(dp.strip(dp[0:4]), ':')[0]) + else: + index = interfaces.index(string.split(dp, ':')[0]) + + if self.nrBeams(dest_ports.index(dp)) > 0: + dplists[index].append(s.getName() + '_RSP%d' % dest_ports.index(dp)) + + count = 0 + for dp in dplists: + if self.isDefined('PIC.Core.IONode[%d].RSP' % count): + if len(self.getStringVector_new('PIC.Core.IONode[%d].RSP' % count)) != len(self.stationList): + print 'nrStations in PIC.Core.IONode[%d].RSP' % count + ' must be: %d' % len(self.stationList) + sys.exit(0) + else: + if (len(dp) > 0) and (len(dp) != len(self.stationList)): + print 'Error: manually set PIC.Core.IONode[x].RSP and the station name(s) in CS1.parset' + sys.exit(0) + else: + self['PIC.Core.IONode[%d].RSP' % count] = dp + count += 1 def updateSBValues(self): if self.clock == '160MHz': diff --git a/Appl/CEP/CS1/CS1_Run/src/CS1_Run.py b/Appl/CEP/CS1/CS1_Run/src/CS1_Run.py index 69a1ca00405..d9006d39f86 100755 --- a/Appl/CEP/CS1/CS1_Run/src/CS1_Run.py +++ b/Appl/CEP/CS1/CS1_Run/src/CS1_Run.py @@ -143,6 +143,8 @@ if __name__ == '__main__': parset.setStations(stationList) + #parset.addkeys_IONodeRSP() + # see if we are using fake input if options.fakeinput > 0: parset.setInterval(1, options.runtime+10) diff --git a/Appl/CEP/CS1/CS1_Run/src/CS1_Stations.py b/Appl/CEP/CS1/CS1_Run/src/CS1_Stations.py index 130a98e9571..986e20404a7 100644 --- a/Appl/CEP/CS1/CS1_Run/src/CS1_Stations.py +++ b/Appl/CEP/CS1/CS1_Run/src/CS1_Stations.py @@ -196,9 +196,15 @@ T0 = T0_0 + T0_1 + T0_2 + T0_3 + T0_4 + T0_5 + T0_6 + T0_7 + T0_8 + T0_9 + T0_10 I_43 = [Station('I_43')] I_91 = [Station('I_91')] +CS001 = [Station('CS001')] +CS008 = [Station('CS008')] +CS010 = [Station('CS010')] +CS016 = [Station('CS016')] + # CS0XX_4dipoles_1 = CS0XX_dipole0 + CSXX_dipole4 + CS0XX_dipole8 + CS0XX_dipole12 # CS0XX_4dipoles_2 = CS0XX_dipole2 + CSXX_dipole6 + CS0XX_dipole10 + CS0XX_dipole14 +AllStations = CS001 + CS008 + CS010 + CS016 AllMicroStations = CS010_4us + CS001_4us + CS008_4us + CS016_4us AllDipoles = CS010_4dipoles_1 + CS001_4dipoles_1 + CS008_4dipoles_1 + CS016_4dipoles_1 AllDipolesMixed = CS010_4dipoles_1 + CS001_4dipoles_2 + CS008_4dipoles_2 + CS016_4dipoles_2 diff --git a/Appl/CEP/CS1/CS1_Run/src/LOFAR_Parset.py b/Appl/CEP/CS1/CS1_Run/src/LOFAR_Parset.py index 27c96d0fe00..544b23bf569 100644 --- a/Appl/CEP/CS1/CS1_Run/src/LOFAR_Parset.py +++ b/Appl/CEP/CS1/CS1_Run/src/LOFAR_Parset.py @@ -1,5 +1,6 @@ import os import time +import string class Parset(object): @@ -52,6 +53,13 @@ class Parset(object): # this doesn't support \" in the string return line.split(',') + def getStringVector_new(self, key): + line = self.parameters[key] + line = line.strip('[').rstrip(']') + line = string.replace(line,' ','') + + return line.split(',') + def getInt32Vector(self, key): ln = self.parameters[key] ln_tmp = ln.split('[') diff --git a/Appl/CEP/CS1/CS1_Run/src/OLAP.parset b/Appl/CEP/CS1/CS1_Run/src/OLAP.parset index f8d6edcaf3a..4dbc38d6535 100644 --- a/Appl/CEP/CS1/CS1_Run/src/OLAP.parset +++ b/Appl/CEP/CS1/CS1_Run/src/OLAP.parset @@ -329,6 +329,12 @@ PIC.Core.CS008_us1.RSP = 1 PIC.Core.CS008_us2.RSP = 2 PIC.Core.CS008_us3.RSP = 3 +# BGP +#PIC.Core.CS001_RSP.dest.ports = [udp:10.170.0.130:10010,tcp:10.170.0.129:10011,10.170.0.132:10012,10.170.0.131:10013] +#PIC.Core.CS008_RSP.dest.ports = [tcp:10.170.0.130:10080,10.170.0.129:10081,10.170.0.132:10082,10.170.0.131:10083] +#PIC.Core.CS010_RSP.dest.ports = [file:/data/test,10.170.0.129:10101,10.170.0.132:10102,10.170.0.131:10103] +#PIC.Core.CS016_RSP.dest.ports = [10.170.0.130:10160,10.170.0.129:10161,10.170.0.132:10162,10.170.0.131:10163] + #PIC.Core.CS010_RSP.dest.ports = [10.170.0.106:4346,10.170.0.153:4347,10.170.0.156:4348,10.170.0.155:4349] PIC.Core.CS010_RSP.dest.ports = [10.170.0.154:4346,10.170.0.153:4347,10.170.0.156:4348,10.170.0.155:4349] PIC.Core.CS010_dipole0.RSP = 0 -- GitLab