Skip to content
Snippets Groups Projects
Commit 2f2f8a5a authored by Arthur Coolen's avatar Arthur Coolen
Browse files

Bug1365: renamed Z into H for height values. Added missing values out of new...

Bug1365: renamed Z into H for height values. Added missing values out of new ITRF2005 AntennaField config files
parent 487f4ecc
Branches
Tags
No related merge requests found
...@@ -31,17 +31,17 @@ PANEL,-1 -1 1013 750 N "_3DFace" 0 ...@@ -31,17 +31,17 @@ PANEL,-1 -1 1013 750 N "_3DFace" 0
bool fill=true; bool fill=true;
for (int i=0; i<=1;i++) { for (int i=0; i<=1;i++) {
if (dpConnect(\"updatePositions\",fill,sysName+\"remoteStation.\"+arrayList.text(i)+\".centerOL\", if (dpConnect(\"updatePositions\",fill,sysName+\"remoteStation.\"+arrayList.text(i)+\".centerX\",
sysName+\"remoteStation.\"+arrayList.text(i)+\".centerNB\", sysName+\"remoteStation.\"+arrayList.text(i)+\".centerY\",
sysName+\"remoteStation.\"+arrayList.text(i)+\".centerH\", sysName+\"remoteStation.\"+arrayList.text(i)+\".centerZ\",
sysName+\"remoteStation.N_RSPBoards\", sysName+\"remoteStation.N_RSPBoards\",
sysName+\"remoteStation.N_TBBoards\", sysName+\"remoteStation.N_TBBoards\",
sysName+\"remoteStation.N_LBAS\", sysName+\"remoteStation.N_LBAS\",
sysName+\"remoteStation.N_HBAS\", sysName+\"remoteStation.N_HBAS\",
sysName+\"remoteStation.HBA_Split\", sysName+\"remoteStation.HBA_Split\",
sysName+\"remoteStation.wide_LBAS\", sysName+\"remoteStation.wide_LBAS\",
sysName+\"remoteStation.\"+arrayList.text(i)+\".centerOL:_online.._invalid\") == -1) { sysName+\"remoteStation.\"+arrayList.text(i)+\".centerX:_online.._invalid\") == -1) {
LOG_DEBUG(\"LOFAR_Netherlands.pnl:main| couldn't connect to \"+sysName+\"remoteStation.\"+arrayList.text(i)+\".centerOL \"+ getLastError()); LOG_DEBUG(\"LOFAR_Netherlands.pnl:main| couldn't connect to \"+sysName+\"remoteStation.\"+arrayList.text(i)+\".centerX \"+ getLastError());
} }
if (fill) { if (fill) {
...@@ -71,9 +71,9 @@ void doAction(string aDP, string anAction) { ...@@ -71,9 +71,9 @@ void doAction(string aDP, string anAction) {
} }
} }
void updatePositions(string dp1, float cOL, void updatePositions(string dp1, float cX,
string dp2, float cNB, string dp2, float cY,
string dp3, float cH, string dp3, float cZ,
string dp4, int nrsp, string dp4, int nrsp,
string dp5, int ntbb, string dp5, int ntbb,
string dp6, int nlbas, string dp6, int nlbas,
...@@ -96,23 +96,23 @@ void updatePositions(string dp1, float cOL, ...@@ -96,23 +96,23 @@ void updatePositions(string dp1, float cOL,
HBASplit=hbasplit; HBASplit=hbasplit;
WideLBAs=widelbas; WideLBAs=widelbas;
dyn_string unsortOL=dpNames(sysName+txt+\"*.deltaX;\",\"Antenna\"); dyn_string unsortX=dpNames(sysName+txt+\"*.deltaX;\",\"Antenna\");
dyn_string unsortNB=dpNames(sysName+txt+\"*.deltaY;\",\"Antenna\"); dyn_string unsortY=dpNames(sysName+txt+\"*.deltaY;\",\"Antenna\");
dyn_string unsortH= dpNames(sysName+txt+\"*.deltaH;\",\"Antenna\"); dyn_string unsortZ= dpNames(sysName+txt+\"*.deltaZ;\",\"Antenna\");
dyn_string OL=unsortOL; dyn_string X=unsortX;
dyn_string NB=unsortNB; dyn_string Y=unsortY;
dyn_string H=unsortH; dyn_string Z=unsortZ;
// since we have Antenna's with 1 digit and 2 digits we need to resort the dynstrings here, otherwise we get them as: // since we have Antenna's with 1 digit and 2 digits we need to resort the dynstrings here, otherwise we get them as:
// HBA0 HBA1 HBA10 HBA11-HBA19 HBA 2 HBA 20 etc // HBA0 HBA1 HBA10 HBA11-HBA19 HBA 2 HBA 20 etc
// //
for (int i=1; i<= dynlen(unsortOL);i++) { for (int i=1; i<= dynlen(unsortX);i++) {
string ant = strsplit(unsortOL[i],\":.\" )[2]; string ant = strsplit(unsortX[i],\":.\" )[2];
int idx = substr(ant,3); int idx = substr(ant,3);
OL[idx+1]=unsortOL[i]; X[idx+1]=unsortX[i];
NB[idx+1]=unsortNB[i]; Y[idx+1]=unsortY[i];
H[idx+1]=unsortH[i]; Z[idx+1]=unsortZ[i];
} }
...@@ -120,12 +120,12 @@ void updatePositions(string dp1, float cOL, ...@@ -120,12 +120,12 @@ void updatePositions(string dp1, float cOL,
// found match, save found strings and redraw screen // found match, save found strings and redraw screen
centerOL = cOL; centerX = cX;
centerNB = cNB; centerY = cY;
centerH = cH; centerZ = cZ;
dpGet(OL,antennaOffsetsOL); dpGet(X,antennaOffsetsX);
dpGet(NB,antennaOffsetsNB); dpGet(Y,antennaOffsetsY);
dpGet(H,antennaOffsetsH); dpGet(Z,antennaOffsetsZ);
...@@ -157,12 +157,12 @@ bool HBASplit=false; ...@@ -157,12 +157,12 @@ bool HBASplit=false;
bool WideLBAs=false; bool WideLBAs=false;
float centerOL; float centerX;
float centerNB; float centerY;
float centerH; float centerZ;
dyn_float antennaOffsetsOL; dyn_float antennaOffsetsX;
dyn_float antennaOffsetsNB; dyn_float antennaOffsetsY;
dyn_float antennaOffsetsH; dyn_float antennaOffsetsZ;
string strPanelName; string strPanelName;
string strModuleName; string strModuleName;
...@@ -207,9 +207,9 @@ void redraw(string mode) { ...@@ -207,9 +207,9 @@ void redraw(string mode) {
} }
// determine max values and calculate scaling factors // determine max values and calculate scaling factors
for (int i=1; i<= dynlen(antennaOffsetsOL); i++) { for (int i=1; i<= dynlen(antennaOffsetsX); i++) {
if ( maxXOffsetValue < fabs(antennaOffsetsOL[i]) ) maxXOffsetValue = fabs(antennaOffsetsOL[i]); if ( maxXOffsetValue < fabs(antennaOffsetsX[i]) ) maxXOffsetValue = fabs(antennaOffsetsX[i]);
if ( maxYOffsetValue < fabs(antennaOffsetsNB[i]) ) maxYOffsetValue = fabs(antennaOffsetsNB[i]); if ( maxYOffsetValue < fabs(antennaOffsetsY[i]) ) maxYOffsetValue = fabs(antennaOffsetsY[i]);
} }
LOG_DEBUG(\"Station.pnl:redraw|mainpanel_midX: \"+mainpanel_midX); LOG_DEBUG(\"Station.pnl:redraw|mainpanel_midX: \"+mainpanel_midX);
...@@ -246,7 +246,7 @@ void redraw(string mode) { ...@@ -246,7 +246,7 @@ void redraw(string mode) {
// now start adding symbols to panel // now start adding symbols to panel
int ref = 1; int ref = 1;
for (int i = 1; i <= dynlen(antennaOffsetsOL); i++ ) { for (int i = 1; i <= dynlen(antennaOffsetsX); i++ ) {
int XRCU; int XRCU;
int YRCU; int YRCU;
if (i-1 < NRSP*8/2) { if (i-1 < NRSP*8/2) {
...@@ -266,17 +266,17 @@ void redraw(string mode) { ...@@ -266,17 +266,17 @@ void redraw(string mode) {
dynAppend(g_RCUList,YRCU); dynAppend(g_RCUList,YRCU);
} }
refNames[ref]=\"ant\"+(ref); refNames[ref]=\"ant\"+(ref);
xPos_AddSymbol = (mainpanel_midX+shiftFactorX) + (antennaOffsetsOL[i] * expandFactorX); xPos_AddSymbol = (mainpanel_midX+shiftFactorX) + (antennaOffsetsX[i] * expandFactorX);
yPos_AddSymbol = (mainpanel_midY+shiftFactorY) - (antennaOffsetsNB[i] * expandFactorY); yPos_AddSymbol = (mainpanel_midY+shiftFactorY) - (antennaOffsetsY[i] * expandFactorY);
if ( addSymbol( strModuleName, // Stay in this modul if ( addSymbol( strModuleName, // Stay in this modul
\"\", // Name of this panel \"\", // Name of this panel
addPanelName, // Panel to add addPanelName, // Panel to add
refNames[ref], // Ref of the addedPanel refNames[ref], // Ref of the addedPanel
makeDynString( \"$aNr:\" + (i-1) , // Define all $values makeDynString( \"$aNr:\" + (i-1) , // Define all $values
\"$aOL:\" + antennaOffsetsOL[i] , \"$aX:\" + antennaOffsetsX[i] ,
\"$aNB:\" + antennaOffsetsNB[i] , \"$aY:\" + antennaOffsetsY[i] ,
\"$aH:\" + antennaOffsetsH[i]), // of particular addedpanel \"$aZ:\" + antennaOffsetsZ[i]), // of particular addedpanel
xPos_AddSymbol, // Xpos of the AddedSymbol xPos_AddSymbol, // Xpos of the AddedSymbol
yPos_AddSymbol, // Ypos of the AddedSymbol yPos_AddSymbol, // Ypos of the AddedSymbol
0, // angle 0, // angle
...@@ -302,38 +302,38 @@ void updateField() { ...@@ -302,38 +302,38 @@ void updateField() {
// Check if the update concerns the current view // Check if the update concerns the current view
string txt= arrayList.text(arrayList.number()); string txt= arrayList.text(arrayList.number());
dyn_string unsortOL=dpNames(sysName+txt+\"*.deltaX;\",\"Antenna\"); dyn_string unsortX=dpNames(sysName+txt+\"*.deltaX;\",\"Antenna\");
dyn_string unsortNB=dpNames(sysName+txt+\"*.deltaY;\",\"Antenna\"); dyn_string unsortY=dpNames(sysName+txt+\"*.deltaY;\",\"Antenna\");
dyn_string unsortH= dpNames(sysName+txt+\"*.deltaH;\",\"Antenna\"); dyn_string unsortZ= dpNames(sysName+txt+\"*.deltaZ;\",\"Antenna\");
dyn_string OL=unsortOL; dyn_string X=unsortX;
dyn_string NB=unsortNB; dyn_string Y=unsortY;
dyn_string H=unsortH; dyn_string Z=unsortZ;
// since we have Antenna's with 1 digit and 2 digits we need to resort the dynstrings here, otherwise we get them as: // since we have Antenna's with 1 digit and 2 digits we need to resort the dynstrings here, otherwise we get them as:
// HBA0 HBA1 HBA10 HBA11-HBA19 HBA 2 HBA 20 etc // HBA0 HBA1 HBA10 HBA11-HBA19 HBA 2 HBA 20 etc
// //
for (int i=1; i<= dynlen(unsortOL);i++) { for (int i=1; i<= dynlen(unsortX);i++) {
string ant = strsplit(unsortOL[i],\":.\" )[2]; string ant = strsplit(unsortX[i],\":.\" )[2];
int idx = substr(ant,3); int idx = substr(ant,3);
OL[idx+1]=unsortOL[i]; X[idx+1]=unsortX[i];
NB[idx+1]=unsortNB[i]; Y[idx+1]=unsortY[i];
H[idx+1]=unsortH[i]; Z[idx+1]=unsortZ[i];
} }
string field=sysName+\"remoteStation.\"+txt; string field=sysName+\"remoteStation.\"+txt;
if (dpExists(field+\".centerOL:_online.._value\")) { if (dpExists(field+\".centerX:_online.._value\")) {
// found match, save found strings and redraw screen // found match, save found strings and redraw screen
dpGet(field+\".centerOL:_online.._value\",centerOL, dpGet(field+\".centerX:_online.._value\",centerX,
field+\".centerNB:_online.._value\",centerNB, field+\".centerY:_online.._value\",centerY,
field+\".centerH:_online.._value\",centerH); field+\".centerZ:_online.._value\",centerZ);
dpGet(OL,antennaOffsetsOL); dpGet(X,antennaOffsetsX);
dpGet(NB,antennaOffsetsNB); dpGet(Y,antennaOffsetsY);
dpGet(H,antennaOffsetsH); dpGet(Z,antennaOffsetsZ);
dpGet(sysName+\"remoteStation.N_RSPBoards\",NRSP); dpGet(sysName+\"remoteStation.N_RSPBoards\",NRSP);
dpGet(sysName+\"remoteStation.N_TBBoards\",NTBB); dpGet(sysName+\"remoteStation.N_TBBoards\",NTBB);
dpGet(sysName+\"remoteStation.N_LBAS\",NLBA); dpGet(sysName+\"remoteStation.N_LBAS\",NLBA);
...@@ -343,7 +343,7 @@ void updateField() { ...@@ -343,7 +343,7 @@ void updateField() {
redraw(txt); redraw(txt);
} else { } else {
LOG_ERROR(\"Station.pnl:updateField|Error, couldn't find:\"+field+\".centerOL:_online.._value\"); LOG_ERROR(\"Station.pnl:updateField|Error, couldn't find:\"+field+\".centerOX:_online.._value\");
} }
} }
......
...@@ -4,10 +4,10 @@ LANG:1 4 aHBA ...@@ -4,10 +4,10 @@ LANG:1 4 aHBA
LANG:6 0 LANG:6 0
LANG:30 0 LANG:30 0
PANEL,-1 -1 241 145 N "_3DFace" 4 PANEL,-1 -1 241 145 N "_3DFace" 4
"$aH"
"$aNB"
"$aNr" "$aNr"
"$aOL" "$aX"
"$aY"
"$aZ"
"main() "main()
{ {
baseDP = g_currentDatapoint; baseDP = g_currentDatapoint;
...@@ -53,9 +53,9 @@ PANEL,-1 -1 241 145 N "_3DFace" 4 ...@@ -53,9 +53,9 @@ PANEL,-1 -1 241 145 N "_3DFace" 4
strToolTip += \"---------\"; strToolTip += \"---------\";
strToolTip += \" (HBA\" + curHBA + \")\"; strToolTip += \" (HBA\" + curHBA + \")\";
strToolTip += \"\\n diff from centerOL:\" + $aOL; strToolTip += \"\\n diff from centerOL:\" + $aX;
strToolTip += \"\\n diff from centerNB:\" + $aNB; strToolTip += \"\\n diff from centerNB:\" + $aY;
strToolTip += \"\\n diff from centerH:\" + $aH; strToolTip += \"\\n diff from centerH:\" + $aZ;
antennaHighlight.toolTipText = strToolTip; antennaHighlight.toolTipText = strToolTip;
aNr.toolTipText = strToolTip; aNr.toolTipText = strToolTip;
......
...@@ -4,10 +4,10 @@ LANG:1 4 aLBA ...@@ -4,10 +4,10 @@ LANG:1 4 aLBA
LANG:6 0 LANG:6 0
LANG:30 0 LANG:30 0
PANEL,-1 -1 241 145 N "_3DFace" 4 PANEL,-1 -1 241 145 N "_3DFace" 4
"$aH"
"$aNB"
"$aNr" "$aNr"
"$aOL" "$aX"
"$aY"
"$aZ"
"main() "main()
{ {
baseDP = g_currentDatapoint; baseDP = g_currentDatapoint;
...@@ -53,9 +53,9 @@ PANEL,-1 -1 241 145 N "_3DFace" 4 ...@@ -53,9 +53,9 @@ PANEL,-1 -1 241 145 N "_3DFace" 4
strToolTip += \"---------\"; strToolTip += \"---------\";
strToolTip += \" (LBA\" + curLBA + \")\"; strToolTip += \" (LBA\" + curLBA + \")\";
strToolTip += \"\\n diff from centerOL:\" + $aOL; strToolTip += \"\\n diff from centerOL:\" + $aX;
strToolTip += \"\\n diff from centerNB:\" + $aNB; strToolTip += \"\\n diff from centerNB:\" + $aY;
strToolTip += \"\\n diff from centerH:\" + $aH; strToolTip += \"\\n diff from centerH:\" + $aZ;
antennaHighlight.toolTipText = strToolTip; antennaHighlight.toolTipText = strToolTip;
aNr.toolTipText = strToolTip; aNr.toolTipText = strToolTip;
......
//# readStationConfigs.ctl //# readStationConfigs.ctl
//# //#
//# Copyright (C) 2007-2008 //# Copyright (C) 2007-2008
//# ASTRON (Netherlands Foundation for Research in Astronomy) //# ASTRON (Netherlands Foundation for Research in Astronomy)
//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl //# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl
//# //#
//# This program is free software; you can redistribute it and/or modify //# 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 //# it under the terms of the GNU General Public License as published by
//# the Free Software Foundation; either version 2 of the License, or //# the Free Software Foundation; either version 2 of the License, or
//# (at your option) any later version. //# (at your option) any later version.
//# //#
//# This program is distributed in the hope that it will be useful, //# This program is distributed in the hope that it will be useful,
//# but WITHOUT ANY WARRANTY; without even the implied warranty of //# but WITHOUT ANY WARRANTY; without even the implied warranty of
//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
//# GNU General Public License for more details. //# GNU General Public License for more details.
//# //#
//# You should have received a copy of the GNU General Public License //# You should have received a copy of the GNU General Public License
//# along with this program; if not, write to the Free Software //# along with this program; if not, write to the Free Software
//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA //# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//# //#
//# $Id$ //# $Id$
#uses "GCFCommon.ctl" #uses "GCFCommon.ctl"
/** /**
* Controller that will be run once during station startup. * Controller that will be run once during station startup.
* it will search for different conf files in /opt/lofar/etc/ * it will search for different conf files in /opt/lofar/etc/
* and will fill the pvss database types for those config files. * and will fill the pvss database types for those config files.
* For now we have: * For now we have:
* AntennaArrays.conf. * AntennaArrays.conf.
* This will be used to fill: Antenna deltaX deltaY and deltaH fields for * This will be used to fill: Antenna deltaX deltaY and deltaH fields for
* LBA and HBA antenna configurations. * LBA and HBA antenna configurations.
* *
* Allowed for now are : LBA-HBA When LBA is missing LBA_X will be used * Allowed for now are : LBA-HBA When LBA is missing LBA_X will be used
* (if available) * (if available)
* *
* The files contain fieldcenter coordinates in OL-NB-Height * The files contain fieldcenter coordinates in OL-NB-Height
* and Antenna positions in OL-NB-Height Offsets from the fieldCenter. * and Antenna positions in OL-NB-Height Offsets from the fieldCenter.
* As FieldCenter now the GPS coordinates are taken, this is not correct * As FieldCenter now the GPS coordinates are taken, this is not correct
* *
* For future compatibility we have to consider other earth coordinates also * For future compatibility we have to consider other earth coordinates also
* RemoteStation.conf * RemoteStation.conf
* This will fill the RemoteStation point with all data available for this station. * This will fill the RemoteStation point with all data available for this station.
* *
*/ */
main() global dyn_string dynStr_fileContent;
{ global int index=1;
global bool bDebug = false;
bool showDebug = true; global bool norVecLBAFound=false;
bool foundLBA = false; global bool norVecHBA0Found=false;
global bool norVecHBA1Found=false;
bool bDebug = false; global bool rotMatLBAFound=false;
int nr_ofAnt = 0, global bool rotMatHBA0Found=false;
index = 1, global bool rotMatHBA1Found=false;
OL = 1, // ArrayIndexnumber of dda_splittedLinesAntConfFile global bool centerLBAFound=false;
NB = 2, // ArrayIndexnumber of dda_splittedLinesAntConfFile global bool centerHBAFound=false;
H = 3; // ArrayIndexnumber of dda_splittedLinesAntConfFile; global bool deltasLBAFound=false;
global bool deltasHBAFound=false;
string strCurConfig; global bool centerHBA0Found=false;
global bool centerHBA1Found=false;
string strDataDir = "";
if (isdir("/opt/lofar/etc/") ) {
strDataDir = "/opt/lofar/etc/"; main()
} else if ( isdir ("d:/data/CS20_CS001/data/configs/") ) { {
strDataDir = "d:/data/CS20_CS001/data/configs/";
} else { bool foundLBA = false;
DebugN("Could not find datadir to work with, leaving and no antenne data read.");
return; string strCurConfig;
}
string strDataDir = "";
string strAntArrayConfFile = strDataDir+"AntennaArrays.conf"; if (isdir("/opt/lofar/etc/") ) {
string strRemoteStationConfFile = strDataDir+"RemoteStation.conf"; strDataDir = "/opt/lofar/etc/";
} else if ( isdir ("d:/data/CS20_CS001/data/configs/") ) {
dyn_string dynStr_fileContent; strDataDir = "d:/data/CS20_CS001/data/configs/";
} else {
// DebugN("Could not find datadir to work with, leaving and no antenne data read.");
// AntennaArray cycle return;
// }
dynStr_fileContent = lto_getFile_asDynStr(strAntArrayConfFile);
// string strAntArrayConfFile = strDataDir+"AntennaArrays.conf";
while (dynlen(dynStr_fileContent) > 3 && index < dynlen(dynStr_fileContent)) { string strAntArrayConfFile = strDataDir+"AntennaField.conf";
float centerOL, string strRemoteStationConfFile = strDataDir+"RemoteStation.conf";
centerNB,
centerH;
dyn_float antConfFileOL; //
dyn_float antConfFileNB; // AntennaArray cycle
dyn_float antConfFileH; //
// read ConfigurationName dynStr_fileContent = lto_getFile_asDynStr(strAntArrayConfFile);
string str;
sscanf(dynStr_fileContent[index++],"%s",str);
if (strlen(str) > 0 && str[0] != " " && str[0] != "#") { while (dynlen(dynStr_fileContent) > 3 && index < dynlen(dynStr_fileContent)) {
strCurConfig=strtoupper(str);
Debug("readStationConfigs.ctl:main|Reading Config for: "+strCurConfig); // read ConfigurationName
string str1="",str2="";
sscanf(dynStr_fileContent[index++],"%s %s",str1,str2);
// read fieldcenter if (strlen(str1) <= 0 || str1[0] == " " || str1[0] == "#") {
sscanf(dynStr_fileContent[index++],"%*d %*s %f %f %f",centerOL,centerNB,centerH); continue;
if (bDebug) DebugN("Reading Config for center OL,NB,H:" + centerOL + " " + centerNB + " " + centerH); }
// read nr of antennas if (bDebug) DebugN("working on: ",dynStr_fileContent[index-1]);
sscanf(dynStr_fileContent[index++],"%d",nr_ofAnt); if (bDebug) DebugN("str1: ",str1," str2: ",str2);
if (bDebug) DebugN("Nr of Antenna's in this Config: "+nr_ofAnt);
if (strtoupper(str1) == "NORMAL_VECTOR" ) {
// Select on allowed configurations if (strtoupper(str2) != "LBA" && strtoupper(str2) != "HBA0" && strtoupper(str2) != "HBA1") {
if (strCurConfig == "LBA" || DebugN("readStationConfigs.ctl | Unknown NORMAL_VECTOR target found: ", str2);
strCurConfig == "HBA" || continue;
(strCurConfig == "LBA_X" && !foundLBA) } else {
) { // read Normal Vector
DebugN("--> will be read"); processNormalVector(strtoupper(str2));
bool splitArray=false; //LBAXarray is 48 lines, 1st col(x3) contains 0-47 2ndco(x3) contain 48-96 }
if (strCurConfig == "LBA") foundLBA=true; } else if (strtoupper(str1) == "ROTATION_MATRIX" ) {
if (strCurConfig == "LBA_X") { if (strtoupper(str2) != "LBA" && strtoupper(str2) != "HBA0" && strtoupper(str2) != "HBA1") {
strCurConfig="LBA"; DebugN("readStationConfigs.ctl | Unknown ROTATION_MATRIX target found: ", str2);
splitArray=true; continue;
} } else {
// read Rotation Matrix
processRotationMatrix(strtoupper(str2));
for (int ix = index; ix < nr_ofAnt + index; ix++ ) }
{ } else if (strtoupper(str1) == "LBA" || strtoupper(str1) == "HBA") {
strCurConfig=strtoupper(str1);
float deltaOL;
float deltaNB; // read fieldcenter
float deltaH; processFieldCenter(strCurConfig);
float deltaOL2;
float deltaNB2; // read field Deltas
float deltaH2; processFieldDeltas(strCurConfig);
} else if (strtoupper(str1) == "HBA0" || strtoupper(str1)=="HBA1") {
// read new line of delta's // read fieldcenter
if (splitArray) { processFieldCenter(strtoupper(str1));
sscanf(dynStr_fileContent[ix],"%lf %lf %lf %lf %lf %lf",deltaOL,deltaNB,deltaH,deltaOL2,deltaNB2,deltaH2); } else {
} else { DebugN(str1," -----> Unknown, will not be read");
sscanf(dynStr_fileContent[ix],"%lf %lf %lf",deltaOL,deltaNB,deltaH); }
} }
if (bDebug) DebugN("OL :"+deltaOL+ " NB: "+ deltaNB+ " H: "+deltaH);
if (bDebug) DebugN("ix: " + ix + " index: " + index); if (!norVecLBAFound ) {
if (bDebug) DebugN("Filling array at index: "+ (ix+1-index)); DebugN("Error? NORMAL_VECTOR for LBA not found.");
antConfFileOL[(ix+1-index)] = deltaOL; }
antConfFileNB[(ix+1-index)] = deltaNB; if (!norVecHBA0Found ) {
antConfFileH[(ix+1-index)] = deltaH; DebugN("Error? NORMAL_VECTOR for HBA0 not found.");
if (splitArray) { }
if (bDebug) DebugN("OL2 :"+deltaOL2+ " NB2: "+ deltaNB2+ " H2: "+deltaH2); if (!norVecHBA1Found ) {
if (bDebug) DebugN("Filling array at index: "+ (ix+1-index+48)); DebugN("Error? NORMAL_VECTOR for HBA1 not found.");
antConfFileOL[(ix+1-index+48)] = deltaOL2; }
antConfFileNB[(ix+1-index+48)] = deltaNB2; if (!rotMatLBAFound ) {
antConfFileH[(ix+1-index+48)] = deltaH2; DebugN("Error? ROTATION_MATRIX for LBA not found.");
} }
} if (!rotMatHBA0Found ) {
DebugN("Error? ROTATION_MATRIX for HBA0 not found.");
if (bDebug) DebugN("antConfFileOL: "+antConfFileOL); }
if (!rotMatHBA1Found ) {
// All the reading has been done. DebugN("Error? ROTATION_MATRIX for HBA1 not found.");
dpSet("remoteStation."+strCurConfig+".centerOL",centerOL, }
"remoteStation."+strCurConfig+".centerNB",centerNB, if (!centerLBAFound ) {
"remoteStation."+strCurConfig+".centerH",centerH); DebugN("Error? FieldCenter for LBA not found.");
}
int ix=nr_ofAnt; if (!centerHBAFound ) {
if (splitArray) ix *= 2; DebugN("Error? FieldCenter for HBA not found.");
for (int i=1; i<= ix;i++) { }
string ant=(i-1); if (!deltasLBAFound ) {
dpSet(strCurConfig+ant+".deltaX",antConfFileOL[i], DebugN("Error? Deltas for LBA not found.");
strCurConfig+ant+".deltaY",antConfFileNB[i], }
strCurConfig+ant+".deltaH",antConfFileH[i]); if (!deltasHBAFound ) {
} DebugN("Error? Deltas for HBA not found.");
} else { }
DebugN("--> will be skipped");
}
index +=nr_ofAnt+1;
} //
} // RemoteStation cycle
//
//
// RemoteStation cycle dynStr_fileContent = lto_getFile_asDynStr(strRemoteStationConfFile);
// if (bDebug) DebugN("fileContent: "+dynStr_fileContent);
dynStr_fileContent = lto_getFile_asDynStr(strRemoteStationConfFile); for (index=1;index <= dynlen(dynStr_fileContent);index++) {
if (bDebug) DebugN("fileContent: "+dynStr_fileContent); if (strpos(dynStr_fileContent[index],"RS.STATION_ID")>-1) {
dyn_string value = strsplit(dynStr_fileContent[index],"=");
for (index=1;index <= dynlen(dynStr_fileContent);index++) { if (dynlen(value) > 1) {
if (strpos(dynStr_fileContent[index],"RS.STATION_ID")>-1) { dpSet("remoteStation.stationID",value[2]);
dyn_string value = strsplit(dynStr_fileContent[index],"="); }
if (dynlen(value) > 1) { }
dpSet("remoteStation.stationID",value[2]);
} if (strpos(dynStr_fileContent[index],"RS.N_RSPBOARDS")>-1) {
} dyn_string value = strsplit(dynStr_fileContent[index],"=");
if (dynlen(value) > 1) {
if (strpos(dynStr_fileContent[index],"RS.N_RSPBOARDS")>-1) { dpSet("remoteStation.N_RSPBoards",value[2]);
dyn_string value = strsplit(dynStr_fileContent[index],"="); }
if (dynlen(value) > 1) { }
dpSet("remoteStation.N_RSPBoards",value[2]);
} if (strpos(dynStr_fileContent[index],"RS.N_TBBOARDS")>-1) {
} dyn_string value = strsplit(dynStr_fileContent[index],"=");
if (dynlen(value) > 1) {
if (strpos(dynStr_fileContent[index],"RS.N_TBBOARDS")>-1) { dpSet("remoteStation.N_TBBoards",value[2]);
dyn_string value = strsplit(dynStr_fileContent[index],"="); }
if (dynlen(value) > 1) { }
dpSet("remoteStation.N_TBBoards",value[2]);
} if (strpos(dynStr_fileContent[index],"RS.N_LBAS")>-1) {
} dyn_string value = strsplit(dynStr_fileContent[index],"=");
if (dynlen(value) > 1) {
if (strpos(dynStr_fileContent[index],"RS.N_LBAS")>-1) { dpSet("remoteStation.N_LBAS",value[2]);
dyn_string value = strsplit(dynStr_fileContent[index],"="); }
if (dynlen(value) > 1) { }
dpSet("remoteStation.N_LBAS",value[2]);
} if (strpos(dynStr_fileContent[index],"RS.N_HBAS")>-1) {
} dyn_string value = strsplit(dynStr_fileContent[index],"=");
if (dynlen(value) > 1) {
if (strpos(dynStr_fileContent[index],"RS.N_HBAS")>-1) { dpSet("remoteStation.N_HBAS",value[2]);
dyn_string value = strsplit(dynStr_fileContent[index],"="); }
if (dynlen(value) > 1) { }
dpSet("remoteStation.N_HBAS",value[2]);
} if (strpos(dynStr_fileContent[index],"RS.HBA_SPLIT")>-1) {
} dyn_string value = strsplit(dynStr_fileContent[index],"=");
if (dynlen(value) > 1) {
if (strpos(dynStr_fileContent[index],"RS.HBA_SPLIT")>-1) { if (substr(value[2],0,1) == "N" ||
dyn_string value = strsplit(dynStr_fileContent[index],"="); substr(value[2],0,1) == "n" ||
if (dynlen(value) > 1) { substr(value[2],0,1) == "F" ||
if (substr(value[2],0,1) == "N" || substr(value[2],0,1) == "f") {
substr(value[2],0,1) == "n" || dpSet("remoteStation.HBA_Split",false);
substr(value[2],0,1) == "F" || } else {
substr(value[2],0,1) == "f") { dpSet("remoteStation.HBA_Split",true);
dpSet("remoteStation.HBA_Split",false); }
} else { }
dpSet("remoteStation.HBA_Split",true); }
}
}
} if (strpos(dynStr_fileContent[index],"RS.WIDE_LBAS")>-1) {
dyn_string value = strsplit(dynStr_fileContent[index],"=");
if (dynlen(value) > 1) {
if (strpos(dynStr_fileContent[index],"RS.WIDE_LBAS")>-1) { if (substr(value[2],0,1) == "N" ||
dyn_string value = strsplit(dynStr_fileContent[index],"="); substr(value[2],0,1) == "n" ||
if (dynlen(value) > 1) { substr(value[2],0,1) == "F" ||
if (substr(value[2],0,1) == "N" || substr(value[2],0,1) == "f") {
substr(value[2],0,1) == "n" || dpSet("remoteStation.wide_LBAS",false);
substr(value[2],0,1) == "F" || } else {
substr(value[2],0,1) == "f") { dpSet("remoteStation.wide_LBAS",true);
dpSet("remoteStation.wide_LBAS",false); }
} else { }
dpSet("remoteStation.wide_LBAS",true); }
} }
} }
}
}
} dyn_string lto_getFile_asDynStr(string aFileName) {
// Local vars
dyn_string lto_getFile_asDynStr(string aFileName) dyn_string aFile_asDynStr; // dyn_string returnvalue
{ string aFile_asStr;
// Local vars
dyn_string aFile_asDynStr; // dyn_string returnvalue file f; // our file
string aFile_asStr; int err; // error code
file f; // our file f=fopen(aFileName,"r"); // open for reading
int err; // error code if (f > 0)
{
f=fopen(aFileName,"r"); // open for reading err=ferror(f); // export error
if (f > 0)
{ if (err!=0)
err=ferror(f); // export error {
DebugN("readStationConfigs.ctl:lto_getFile_asDynStr|Error during read no. " + err);
if (err!=0) }
{ else
DebugN("readStationConfigs.ctl:lto_getFile_asDynStr|Error during read no. " + err); {
} if ( fileToString (aFileName, aFile_asStr) )
else {
{ aFile_asDynStr = strsplit(aFile_asStr, "\n");
if ( fileToString (aFileName, aFile_asStr) ) }
{ }
aFile_asDynStr = strsplit(aFile_asStr, "\n"); fclose(f); // close file
} } else {
} DebugN("readStationConfigs.ctl:lto_getFile_asDynStr|Error opening file: " + aFileName);
fclose(f); // close file }
} else {
DebugN("readStationConfigs.ctl:lto_getFile_asDynStr|Error opening file: " + aFileName); return aFile_asDynStr;
} }
return aFile_asDynStr; void processNormalVector(string aS) {
} float fX=0,fY=0,fZ=0;
sscanf(dynStr_fileContent[index++],"%*d %*s %lf %lf %lf",fX,fY,fZ);
if (bDebug) DebugN("Reading NORMAL_VECTOR "+aS+" X,Y,Z :" + fX + " " + fY + " " + fZ);
if (aS == "LBA" ) {
norVecLBAFound=true;
dpSet("remoteStation.LBA.NormalVector.X",fX,
"remoteStation.LBA.NormalVector.Y",fY,
"remoteStation.LBA.NormalVector.Z",fZ);
} else if (aS == "HBA0") {
norVecHBA0Found=true;
dpSet("remoteStation.HBA.HBA0.NormalVector.X",fX,
"remoteStation.HBA.HBA0.NormalVector.Y",fY,
"remoteStation.HBA.HBA0.NormalVector.Z",fZ);
} else if (aS == "HBA1") {
norVecHBA1Found=true;
dpSet("remoteStation.HBA.HBA1.NormalVector.X",fX,
"remoteStation.HBA.HBA1.NormalVector.Y",fY,
"remoteStation.HBA.HBA1.NormalVector.Z",fZ);
}
}
void processRotationMatrix(string aS) {
dyn_float fX,fY,fZ;
int nr_rows=0;
// read nr of rows
sscanf(dynStr_fileContent[index++],"%d",nr_rows);
if (bDebug) DebugN("index: "+(index-1)+" nr_rows: "+nr_rows);
for (int i = 1; i <= nr_rows; i++) {
sscanf(dynStr_fileContent[index++],"%lf %lf %lf",fX[i],fY[i],fZ[i]);
if (bDebug) DebugN("Reading rotationMatrix "+aS+"line "+i+" X,Y,Z:" + fX[i] + " " + fY[i] + " " + fZ[i]);
}
index++;
if (aS == "LBA" ) {
rotMatLBAFound=true;
dpSet("remoteStation.LBA.RotationMatrix.X",fX,
"remoteStation.LBA.RotationMatrix.Y",fY,
"remoteStation.LBA.RotationMatrix.Z",fZ);
} else if (aS == "HBA0") {
rotMatHBA0Found=true;
dpSet("remoteStation.HBA.HBA0.RotationMatrix.X",fX,
"remoteStation.HBA.HBA0.RotationMatrix.Y",fY,
"remoteStation.HBA.HBA0.RotationMatrix.Z",fZ);
} else if (aS == "HBA1") {
rotMatHBA1Found=true;
dpSet("remoteStation.HBA.HBA1.RotationMatrix.X",fX,
"remoteStation.HBA.HBA1.RotationMatrix.Y",fY,
"remoteStation.HBA.HBA1.RotationMatrix.Z",fZ);
}
}
void processFieldCenter(string aS) {
float fX=0,fY=0,fZ=0;
sscanf(dynStr_fileContent[index++],"%*d %*s %lf %lf %lf",fX,fY,fZ);
if (bDebug) DebugN("Reading fieldcenter "+aS+"X,Y,Z:" + fX + " " + fY + " " + fZ);
if (aS== "LBA") {
centerLBAFound=true;
dpSet("remoteStation."+aS+".centerX",fX,
"remoteStation."+aS+".centerY",fY,
"remoteStation."+aS+".centerZ",fZ);
} else if (aS == "HBA") {
centerHBAFound=true;
dpSet("remoteStation."+aS+".centerX",fX,
"remoteStation."+aS+".centerY",fY,
"remoteStation."+aS+".centerZ",fZ);
} else if (aS == "HBA0") {
centerHBA0Found=true;
dpSet("remoteStation.HBA.HBA0.centerX",fX,
"remoteStation.HBA.HBA0.centerY",fY,
"remoteStation.HBA.HBA0.centerZ",fZ);
} else if (aS == "HBA1") {
centerHBA1Found=true;
dpSet("remoteStation.HBA.HBA1.centerX",fX,
"remoteStation.HBA.HBA1.centerY",fY,
"remoteStation.HBA.HBA1.centerZ",fZ);
}
}
void processFieldDeltas(string aS) {
int nr_ofAnt = 0;
float deltaX;
float deltaY;
float deltaZ;
dyn_float antConfFileX;
dyn_float antConfFileY;
dyn_float antConfFileZ;
if (aS== "LBA") {
deltasLBAFound=true;
} else if (aS == "HBA") {
deltasHBAFound=true;
}
// read nr of antennas
sscanf(dynStr_fileContent[index++],"%d",nr_ofAnt);
if (bDebug) DebugN("Nr of Antenna's in this Config: "+nr_ofAnt);
DebugN(aS,"--> will be read");
for (int ix = index; ix < nr_ofAnt + index; ix++ ) {
// read new line of delta's
sscanf(dynStr_fileContent[ix],"%lf %lf %lf",deltaX,deltaY,deltaZ);
if (bDebug) DebugN("X :"+deltaX+ " Y: "+ deltaY+ " Z: "+deltaZ);
if (bDebug) DebugN("ix: " + ix + " index: " + index);
if (bDebug) DebugN("Filling array at index: "+ (ix+1-index));
antConfFileX[(ix+1-index)] = deltaX;
antConfFileY[(ix+1-index)] = deltaY;
antConfFileZ[(ix+1-index)] = deltaZ;
}
int ix=nr_ofAnt;
for (int i=1; i<= ix;i++) {
string ant=(i-1);
dpSet(aS+ant+".deltaX",antConfFileX[i],
aS+ant+".deltaY",antConfFileY[i],
aS+ant+".deltaZ",antConfFileZ[i]);
}
index +=nr_ofAnt+1;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment