diff --git a/MAC/Deployment/data/OTDB/createPICfile b/MAC/Deployment/data/OTDB/createPICfile index d0598df2e771383c283336643ed948d605dd8fc7..9499acea4dfb029a293958333ccaf6b427b4b4f9 100755 --- a/MAC/Deployment/data/OTDB/createPICfile +++ b/MAC/Deployment/data/OTDB/createPICfile @@ -80,33 +80,40 @@ filledLine = re.compile("^[^#].*", re.MULTILINE) ringDict = {} for line in filledLine.findall(open(RingFile).read()): ringDict[line[0]] = line +print "ringDict =", ringDict # construct a list with all ring_station combinations ringStations = [] +stations = [] for line in filledLine.findall(open(StationFile).read()): (name, stationID, stnType, long, lat, height, \ nrRSP, nrTBB, nrLBA, nrHBA, HBAsplit, LBAcal ) = line.split() ringStations.append(ringDict[stnType]+"_"+name) + stations.append(name) +print "ringStations =", ringStations +print "stations =", stations -# open outputfile and write top-node +# open outputfile and write top-node of PIC outputFile = open(ResultFile, "w") -print >> outputFile, "21 PIC.state" +print >> outputFile, "21 LOFAR_PIC.state" +print >> outputFile, "21 LOFAR_PermSW.state" -# construct the station-view from the central database +# construct the rings and the stations from the central database # ??? ??? C P ???_PIC_@???@ ringStationMask="" -central=re.compile("^\w+[ \t]+[^ \t]+[ \t]+C[ \t]+P[ \t]([A-Za-z_]+_PIC_@.*)", \ +central=re.compile("^\w+[ \t]+[^ \t]+[ \t]+C[ \t]+P[ \t]([A-Za-z_]+_(?:PIC|PermSW)_@.*)", \ re.IGNORECASE | re.MULTILINE) for line in central.findall(open(PVSSbasefile).read()): if line.find("@station@") >= 0: ringStationMask=line.replace("LOFAR_","") - for RS in ringStations: + for RS in stations: print >> outputFile, \ - "21 "+line.replace("LOFAR_","").replace("@ring@_@station@", RS)+".state" + "21 "+line.replace("@ring@_@station@", RS)+".state" elif line.find("@ring@") >= 0: for ring in ringDict.keys(): print >> outputFile, \ - "21 "+line.replace("LOFAR_","").replace("@ring@", ringDict[ring])+".state"# for all expandable lines + "21 "+line.replace("@ring@", ringDict[ring])+".state" +# for all expandable lines # generate the hardware on each station for line in filledLine.findall(open(StationFile).read()): @@ -114,13 +121,12 @@ for line in filledLine.findall(open(StationFile).read()): nrRSP, nrTBB, nrLBA, nrHBA, HBAsplit, LBAcal ) = line.split() # Find all expandable hardware elements on a station. The line syntax is: - # ??? ??? S P ???_PIC_@???@ - # we are only interested in the @???@ part. - station=re.compile("^\w+[ \t]+[^ \t]+[ \t]+S[ \t]+P[ \t][A-Za-z_]+_PIC(_@.*)", \ + # ??? ??? S P ???_PIC_@...@ + # we are only interested in the @...@ part. + station=re.compile("^\w+[ \t]+[^ \t]+[ \t]+S[ \t]+P[ \t][A-Za-z_]+_PIC_(@.*)", \ re.IGNORECASE | re.MULTILINE) for line in station.findall(open(PVSSbasefile).read()): - prefix = ringStationMask.replace("@ring@", ringDict[stnType]). \ - replace("@station@", name) + prefix="@station@:LOFAR_PIC_".replace("@station@", name) if line.find("@rcu@") >= 0: expandRCUMarker(prefix+line, int(nrRSP)) elif line.find("@RSPBoard@") >= 0: @@ -131,6 +137,20 @@ for line in filledLine.findall(open(StationFile).read()): expandSubrackMarker(prefix+line, int(nrRSP)) elif line.find("@cabinet@") >= 0: expandCabinetMarker(prefix+line, int(nrRSP)) -# for all expandable lines + # for all expandable lines + + software=re.compile("^\w+[ \t]+[^ \t]+[ \t]+S[ \t]+P[ \t]([A-Za-z_]+_PermSW_.*)", \ + re.IGNORECASE | re.MULTILINE) + for line in software.findall(open(PVSSbasefile).read()): + print >> outputFile, \ + "21 %s:%s.state" % (name, line) + #for all stations + + + + + + + outputFile.close() diff --git a/MAC/Deployment/data/StaticMetaData/StationInfo b/MAC/Deployment/data/StaticMetaData/StationInfo index b15cfeeb9d5d1e35abe2a00c2ae6f4eb47fb59ab..b6571dbef104b71f7d64d45e4657d040588317f0 100644 --- a/MAC/Deployment/data/StaticMetaData/StationInfo +++ b/MAC/Deployment/data/StaticMetaData/StationInfo @@ -11,4 +11,5 @@ CS001 1 C 6.8673859 52.91092509 50.621 4 2 16 16 No No CS008 8 C 6.868848183 52.91392684 50.612 4 0 16 16 No No CS010 10 C 6.8690294 52.9129392 54.10 12 3 48 48 No No CS016 16 C 6.8735352 52.91250243 50.316 4 0 16 16 No No +RS002 102 R 6.0000000 52.00000000 50.000 4 0 16 16 Yes No DE001 200 E 6.883956633 50.523318927778 358.449 24 12 96 4 No No diff --git a/MAC/Deployment/data/bin/Makefile.am b/MAC/Deployment/data/bin/Makefile.am index e21645ab83d74f95801f67203e5401598302938b..aef41a4a7902526e34536b1b7fbb8d038c62a6ab 100644 --- a/MAC/Deployment/data/bin/Makefile.am +++ b/MAC/Deployment/data/bin/Makefile.am @@ -1,5 +1,5 @@ -bin_PROGRAMS = load_OTDB_comps load_PICtree +bin_PROGRAMS = load_OTDB_comps load_PICtree PVSS2SAS load_OTDB_comps_SOURCES = load_OTDB_comps.cc load_OTDB_comps_DEPENCIES = $(LOFAR_DEPEND) @@ -9,4 +9,8 @@ load_PICtree_SOURCES = load_PICtree.cc load_PICtree_DEPENCIES = $(LOFAR_DEPEND) load_PICtree_LDADD = +PVSS2SAS_SOURCES = PVSS2SAS.cc +PVSS2SAS_DEPENCIES = $(LOFAR_DEPEND) +PVSS2SAS_LDADD = + include $(top_srcdir)/Makefile.common diff --git a/MAC/Deployment/data/bin/PVSS2SAS.cc b/MAC/Deployment/data/bin/PVSS2SAS.cc new file mode 100644 index 0000000000000000000000000000000000000000..1da4f1a57a9c742352c4b788de5c4bf7c81f0255 --- /dev/null +++ b/MAC/Deployment/data/bin/PVSS2SAS.cc @@ -0,0 +1,38 @@ +//# PVSS2SAS: translate PVSS DPname to SAS DPname +//# +//# Copyright (C) 2008 +//# ASTRON (Netherlands Foundation for Research in Astronomy) +//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl +//# +//# This program is free software; you can redistribute it and/or modify +//# it under the terms of the GNU General Public License as published by +//# the Free Software Foundation; either version 2 of the License, or +//# (at your option) any later version. +//# +//# This program is distributed in the hope that it will be useful, +//# but WITHOUT ANY WARRANTY; without even the implied warranty of +//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +//# GNU General Public License for more details. +//# +//# You should have received a copy of the GNU General Public License +//# along with this program; if not, write to the Free Software +//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +//# +//# $Id$ + +//# Always #include <lofar_config.h> first! +#include <lofar_config.h> + +//# Includes +#include <ostream> +using namespace std; +#include <Common/LofarTypes.h> +#include <APL/APLCommon/StationInfo.h> + +using namespace LOFAR::Deployment; + +int main (int argc, char* argv[]) { + cout << PVSS2SASname(argv[1]) << endl; + return (0); +} +