From cdaf95dc9b133ea23d90f28e86139513a72f2330 Mon Sep 17 00:00:00 2001 From: Ruud Overeem <overeem@astron.nl> Date: Tue, 27 Jan 2009 12:50:14 +0000 Subject: [PATCH] Bug 1306: We need the values of the shortest cables iso the longest ones. --- .../include/APL/RTCCommon/RCUCables.h | 12 ++-- MAC/APL/RTCCommon/src/RCUCables.cc | 30 ++++++---- MAC/APL/RTCCommon/test/tRCUCables.cc | 4 +- MAC/APL/RTCCommon/test/tRCUCables.stdout | 60 +++++++++---------- 4 files changed, 55 insertions(+), 51 deletions(-) diff --git a/MAC/APL/RTCCommon/include/APL/RTCCommon/RCUCables.h b/MAC/APL/RTCCommon/include/APL/RTCCommon/RCUCables.h index 43c7a3ad82a..5e84e199625 100644 --- a/MAC/APL/RTCCommon/include/APL/RTCCommon/RCUCables.h +++ b/MAC/APL/RTCCommon/include/APL/RTCCommon/RCUCables.h @@ -63,10 +63,10 @@ public: float getDelay(int rcuNr, int rcuMode) const; // Returns the largest attenuation in dB when operation in the given rcumode. - float getLargestAtt (int rcuMode) const; + float getSmallestAtt (int rcuMode) const; // Returns the largest delay in ns when operation in the given rcumode. - float getLargestDelay(int rcuMode) const; + float getSmallestDelay(int rcuMode) const; private: // Default construction and Copying is not allowed. @@ -78,10 +78,10 @@ private: static const int MAX_RCU_MODE = 7; //# Data members - float itsLargestLBAdelay; - float itsLargestHBAdelay; - int itsLargestLBAlen; - int itsLargestHBAlen; + float itsSmallestLBAdelay; + float itsSmallestHBAdelay; + int itsSmallestLBAlen; + int itsSmallestHBAlen; CableAttenuation* itsCableAtts; blitz::Array<int, 2> itsCableLengths; diff --git a/MAC/APL/RTCCommon/src/RCUCables.cc b/MAC/APL/RTCCommon/src/RCUCables.cc index abef0fcbe13..45d345977ab 100644 --- a/MAC/APL/RTCCommon/src/RCUCables.cc +++ b/MAC/APL/RTCCommon/src/RCUCables.cc @@ -33,13 +33,17 @@ namespace LOFAR { using namespace blitz; -#define MAX2(a,b) ((a) > (b) ? (a) : (b)) +#define MIN2(a,b) ((a) < (b) ? (a) : (b)) // // Constructor // RCUCables::RCUCables(const string& attFilename, const string& delayFilename) : - itsCableAtts(new CableAttenuation(attFilename)) + itsSmallestLBAdelay(10000.0), + itsSmallestHBAdelay(10000.0), + itsSmallestLBAlen (10000), + itsSmallestHBAlen (10000), + itsCableAtts (new CableAttenuation(attFilename)) { #define EXPECTED_NR_COLUMNS 7 @@ -89,11 +93,11 @@ RCUCables::RCUCables(const string& attFilename, const string& delayFilename) : itsCableDelays (rcuNr, 1) = LBHdelay; itsCableDelays (rcuNr, 2) = HBAdelay; - // keep track of longest cable in LBA and HBA group. - itsLargestLBAlen = MAX2(itsLargestLBAlen , MAX2(LBLlen, LBHlen)); - itsLargestHBAlen = MAX2(itsLargestHBAlen , HBAlen); - itsLargestLBAdelay = MAX2(itsLargestLBAdelay, MAX2(LBLdelay, LBHdelay)); - itsLargestHBAdelay = MAX2(itsLargestHBAdelay, HBAdelay); + // keep track of shortest cable in LBA and HBA group. + itsSmallestLBAlen = MIN2(itsSmallestLBAlen , MIN2(LBLlen, LBHlen)); + itsSmallestHBAlen = MIN2(itsSmallestHBAlen , HBAlen); + itsSmallestLBAdelay = MIN2(itsSmallestLBAdelay, MIN2(LBLdelay, LBHdelay)); + itsSmallestHBAdelay = MIN2(itsSmallestHBAdelay, HBAdelay); // update admin and go on prevRcuNr++; @@ -104,8 +108,8 @@ RCUCables::RCUCables(const string& attFilename, const string& delayFilename) : ASSERTSTR(prevRcuNr != -1, "File " << delayFilename << " does not contain valid information"); LOG_DEBUG_STR("Found cable specs for " << prevRcuNr << " RCUs"); - LOG_DEBUG_STR("Longest LBA cable is " << itsLargestLBAlen << "m"); - LOG_DEBUG_STR("Longest HBA cable is " << itsLargestHBAlen << "m"); + LOG_DEBUG_STR("Shortest LBA cable is " << itsSmallestLBAlen << "m"); + LOG_DEBUG_STR("Shortest HBA cable is " << itsSmallestHBAlen << "m"); LOG_TRACE_STAT_STR(itsCableDelays); } @@ -155,15 +159,15 @@ float RCUCables::getDelay(int rcuNr, int rcuMode) const } // Returns the largest attenuation in dB when operation in the given rcumode. -float RCUCables::getLargestAtt (int rcuMode) const +float RCUCables::getSmallestAtt (int rcuMode) const { - return (itsCableAtts->getAttenuation((rcuMode < 5) ? itsLargestLBAlen : itsLargestHBAlen, rcuMode)); + return (itsCableAtts->getAttenuation((rcuMode < 5) ? itsSmallestLBAlen : itsSmallestHBAlen, rcuMode)); } // Returns the largest delay in ns when operation in the given rcumode. -float RCUCables::getLargestDelay(int rcuMode) const +float RCUCables::getSmallestDelay(int rcuMode) const { - return (rcuMode < 5 ? (rcuMode == 0) ? 0.0 : itsLargestLBAdelay : itsLargestHBAdelay); + return (rcuMode < 5 ? (rcuMode == 0) ? 0.0 : itsSmallestLBAdelay : itsSmallestHBAdelay); } } // namespace RTC diff --git a/MAC/APL/RTCCommon/test/tRCUCables.cc b/MAC/APL/RTCCommon/test/tRCUCables.cc index 5e3137ff347..199c2836289 100644 --- a/MAC/APL/RTCCommon/test/tRCUCables.cc +++ b/MAC/APL/RTCCommon/test/tRCUCables.cc @@ -41,10 +41,10 @@ int main (int argc, char* argv[]) RCUCables RC1("tRCUCables.in_CableAtts", "tRCUCables.in_1"); // Note: test it in 4 loops iso 1 because the results are easier to interpret than. for (int rcuMode = 0; rcuMode <= 7; rcuMode++) { - LOG_DEBUG_STR("Largest delay for mode " << rcuMode << ": " << RC1.getLargestDelay(rcuMode)); + LOG_DEBUG_STR("Smallest delay for mode " << rcuMode << ": " << RC1.getSmallestDelay(rcuMode)); } for (int rcuMode = 0; rcuMode <= 7; rcuMode++) { - LOG_DEBUG_STR("Largest atten for mode " << rcuMode << ": " << RC1.getLargestAtt (rcuMode)); + LOG_DEBUG_STR("Smallest atten for mode " << rcuMode << ": " << RC1.getSmallestAtt (rcuMode)); } for (int rcuMode = 0; rcuMode <= 7; rcuMode++) { LOG_DEBUG_STR("Delay for RCU 5 in mode " << rcuMode << ": " << RC1.getDelay(5, rcuMode)); diff --git a/MAC/APL/RTCCommon/test/tRCUCables.stdout b/MAC/APL/RTCCommon/test/tRCUCables.stdout index 8c25e61d5e1..267b82c1388 100644 --- a/MAC/APL/RTCCommon/test/tRCUCables.stdout +++ b/MAC/APL/RTCCommon/test/tRCUCables.stdout @@ -11,26 +11,26 @@ DEBUG MAC.APL.RTCCommon - 8 x 5 -4.24 -6.82 -7.21 -9.7 -11.06 -4.46 -7.19 -7.58 -10.18 -11.61 ] [CableAttenuation.cc:105] -DEBUG MAC.APL.RTCCommon - Reading cable-delays from file: ./tRCUCables.in_1 [RCUCables.cc:50] -DEBUG MAC.APL.RTCCommon - Found cable specs for 191 RCUs [RCUCables.cc:106] -DEBUG MAC.APL.RTCCommon - Longest LBA cable is 80m [RCUCables.cc:107] -DEBUG MAC.APL.RTCCommon - Longest HBA cable is 115m [RCUCables.cc:108] -DEBUG MAC.APL.RTCCommon - Largest delay for mode 0: 0 [tRCUCables.cc:44] -DEBUG MAC.APL.RTCCommon - Largest delay for mode 1: 326.964 [tRCUCables.cc:44] -DEBUG MAC.APL.RTCCommon - Largest delay for mode 2: 326.964 [tRCUCables.cc:44] -DEBUG MAC.APL.RTCCommon - Largest delay for mode 3: 326.964 [tRCUCables.cc:44] -DEBUG MAC.APL.RTCCommon - Largest delay for mode 4: 326.964 [tRCUCables.cc:44] -DEBUG MAC.APL.RTCCommon - Largest delay for mode 5: 465.525 [tRCUCables.cc:44] -DEBUG MAC.APL.RTCCommon - Largest delay for mode 6: 465.525 [tRCUCables.cc:44] -DEBUG MAC.APL.RTCCommon - Largest delay for mode 7: 465.525 [tRCUCables.cc:44] -DEBUG MAC.APL.RTCCommon - Largest atten for mode 0: 0 [tRCUCables.cc:47] -DEBUG MAC.APL.RTCCommon - Largest atten for mode 1: -3.32 [tRCUCables.cc:47] -DEBUG MAC.APL.RTCCommon - Largest atten for mode 2: -3.32 [tRCUCables.cc:47] -DEBUG MAC.APL.RTCCommon - Largest atten for mode 3: -3.32 [tRCUCables.cc:47] -DEBUG MAC.APL.RTCCommon - Largest atten for mode 4: -3.32 [tRCUCables.cc:47] -DEBUG MAC.APL.RTCCommon - Largest atten for mode 5: -8.35 [tRCUCables.cc:47] -DEBUG MAC.APL.RTCCommon - Largest atten for mode 6: -9.7 [tRCUCables.cc:47] -DEBUG MAC.APL.RTCCommon - Largest atten for mode 7: -10.18 [tRCUCables.cc:47] +DEBUG MAC.APL.RTCCommon - Reading cable-delays from file: ./tRCUCables.in_1 [RCUCables.cc:54] +DEBUG MAC.APL.RTCCommon - Found cable specs for 191 RCUs [RCUCables.cc:110] +DEBUG MAC.APL.RTCCommon - Shortest LBA cable is 50m [RCUCables.cc:111] +DEBUG MAC.APL.RTCCommon - Shortest HBA cable is 115m [RCUCables.cc:112] +DEBUG MAC.APL.RTCCommon - Smallest delay for mode 0: 0 [tRCUCables.cc:44] +DEBUG MAC.APL.RTCCommon - Smallest delay for mode 1: 199.257 [tRCUCables.cc:44] +DEBUG MAC.APL.RTCCommon - Smallest delay for mode 2: 199.257 [tRCUCables.cc:44] +DEBUG MAC.APL.RTCCommon - Smallest delay for mode 3: 199.257 [tRCUCables.cc:44] +DEBUG MAC.APL.RTCCommon - Smallest delay for mode 4: 199.257 [tRCUCables.cc:44] +DEBUG MAC.APL.RTCCommon - Smallest delay for mode 5: 465.525 [tRCUCables.cc:44] +DEBUG MAC.APL.RTCCommon - Smallest delay for mode 6: 465.525 [tRCUCables.cc:44] +DEBUG MAC.APL.RTCCommon - Smallest delay for mode 7: 465.525 [tRCUCables.cc:44] +DEBUG MAC.APL.RTCCommon - Smallest atten for mode 0: 0 [tRCUCables.cc:47] +DEBUG MAC.APL.RTCCommon - Smallest atten for mode 1: -2.05 [tRCUCables.cc:47] +DEBUG MAC.APL.RTCCommon - Smallest atten for mode 2: -2.05 [tRCUCables.cc:47] +DEBUG MAC.APL.RTCCommon - Smallest atten for mode 3: -2.05 [tRCUCables.cc:47] +DEBUG MAC.APL.RTCCommon - Smallest atten for mode 4: -2.05 [tRCUCables.cc:47] +DEBUG MAC.APL.RTCCommon - Smallest atten for mode 5: -8.35 [tRCUCables.cc:47] +DEBUG MAC.APL.RTCCommon - Smallest atten for mode 6: -9.7 [tRCUCables.cc:47] +DEBUG MAC.APL.RTCCommon - Smallest atten for mode 7: -10.18 [tRCUCables.cc:47] DEBUG MAC.APL.RTCCommon - Delay for RCU 5 in mode 0: 0 [tRCUCables.cc:50] DEBUG MAC.APL.RTCCommon - Delay for RCU 5 in mode 1: 199.257 [tRCUCables.cc:50] DEBUG MAC.APL.RTCCommon - Delay for RCU 5 in mode 2: 199.257 [tRCUCables.cc:50] @@ -60,8 +60,8 @@ DEBUG MAC.APL.RTCCommon - 8 x 5 -4.24 -6.82 -7.21 -9.7 -11.06 -4.46 -7.19 -7.58 -10.18 -11.61 ] [CableAttenuation.cc:105] -DEBUG MAC.APL.RTCCommon - Reading cable-delays from file: ./tRCUCables.in_2 [RCUCables.cc:50] -DEBUG APL.RTCCommon.EXCEPTION - Assertion: rcuNr == prevRcuNr + 1; Expected line with rcuNr 0 [RCUCables.cc:76] +DEBUG MAC.APL.RTCCommon - Reading cable-delays from file: ./tRCUCables.in_2 [RCUCables.cc:54] +DEBUG APL.RTCCommon.EXCEPTION - Assertion: rcuNr == prevRcuNr + 1; Expected line with rcuNr 0 [RCUCables.cc:80] INFO MAC.APL.RTCCommon - Expected exception:Assertion: rcuNr == prevRcuNr + 1; Expected line with rcuNr 0 [tRCUCables.cc:60] DEBUG MAC.APL.RTCCommon - Reading attenuations from file: ./tRCUCables.in_CableAtts [CableAttenuation.cc:47] DEBUG MAC.APL.RTCCommon - Cable lenghts: 5 @@ -76,8 +76,8 @@ DEBUG MAC.APL.RTCCommon - 8 x 5 -4.24 -6.82 -7.21 -9.7 -11.06 -4.46 -7.19 -7.58 -10.18 -11.61 ] [CableAttenuation.cc:105] -DEBUG MAC.APL.RTCCommon - Reading cable-delays from file: ./tRCUCables.in_3 [RCUCables.cc:50] -DEBUG APL.RTCCommon.EXCEPTION - Assertion: rcuNr == prevRcuNr + 1; Expected line with rcuNr 10 [RCUCables.cc:76] +DEBUG MAC.APL.RTCCommon - Reading cable-delays from file: ./tRCUCables.in_3 [RCUCables.cc:54] +DEBUG APL.RTCCommon.EXCEPTION - Assertion: rcuNr == prevRcuNr + 1; Expected line with rcuNr 10 [RCUCables.cc:80] INFO MAC.APL.RTCCommon - Expected exception:Assertion: rcuNr == prevRcuNr + 1; Expected line with rcuNr 10 [tRCUCables.cc:67] DEBUG MAC.APL.RTCCommon - Reading attenuations from file: ./tRCUCables.in_CableAtts [CableAttenuation.cc:47] DEBUG MAC.APL.RTCCommon - Cable lenghts: 5 @@ -92,10 +92,10 @@ DEBUG MAC.APL.RTCCommon - 8 x 5 -4.24 -6.82 -7.21 -9.7 -11.06 -4.46 -7.19 -7.58 -10.18 -11.61 ] [CableAttenuation.cc:105] -DEBUG MAC.APL.RTCCommon - Reading cable-delays from file: ./tRCUCables.in_4 [RCUCables.cc:50] +DEBUG MAC.APL.RTCCommon - Reading cable-delays from file: ./tRCUCables.in_4 [RCUCables.cc:54] DEBUG APL.RTCCommon.EXCEPTION - Assertion: false; Cablelength 81 is not a legal cablelength:5 [ 50 80 85 115 130 ] [CableAttenuation.cc:134] -DEBUG APL.RTCCommon.EXCEPTION - Assertion: itsCableAtts->isLegalLength(LBHlen); LBH cablelength 81 is not allowed [RCUCables.cc:81] +DEBUG APL.RTCCommon.EXCEPTION - Assertion: itsCableAtts->isLegalLength(LBHlen); LBH cablelength 81 is not allowed [RCUCables.cc:85] INFO MAC.APL.RTCCommon - Expected exception:Assertion: itsCableAtts->isLegalLength(LBHlen); LBH cablelength 81 is not allowed [tRCUCables.cc:74] DEBUG MAC.APL.RTCCommon - Reading attenuations from file: ./tRCUCables.in_CableAtts [CableAttenuation.cc:47] DEBUG MAC.APL.RTCCommon - Cable lenghts: 5 @@ -110,8 +110,8 @@ DEBUG MAC.APL.RTCCommon - 8 x 5 -4.24 -6.82 -7.21 -9.7 -11.06 -4.46 -7.19 -7.58 -10.18 -11.61 ] [CableAttenuation.cc:105] -DEBUG MAC.APL.RTCCommon - Reading cable-delays from file: ./tRCUCables.in_5 [RCUCables.cc:50] -DEBUG APL.RTCCommon.EXCEPTION - Assertion: rcuNr >= 0 && rcuNr < MAX_RCUS; RCUNumber 192 not in range [0..191] [RCUCables.cc:77] +DEBUG MAC.APL.RTCCommon - Reading cable-delays from file: ./tRCUCables.in_5 [RCUCables.cc:54] +DEBUG APL.RTCCommon.EXCEPTION - Assertion: rcuNr >= 0 && rcuNr < MAX_RCUS; RCUNumber 192 not in range [0..191] [RCUCables.cc:81] INFO MAC.APL.RTCCommon - Expected exception:Assertion: rcuNr >= 0 && rcuNr < MAX_RCUS; RCUNumber 192 not in range [0..191] [tRCUCables.cc:82] DEBUG MAC.APL.RTCCommon - Reading attenuations from file: ./tRCUCables.in_CableAtts [CableAttenuation.cc:47] DEBUG MAC.APL.RTCCommon - Cable lenghts: 5 @@ -126,6 +126,6 @@ DEBUG MAC.APL.RTCCommon - 8 x 5 -4.24 -6.82 -7.21 -9.7 -11.06 -4.46 -7.19 -7.58 -10.18 -11.61 ] [CableAttenuation.cc:105] -DEBUG MAC.APL.RTCCommon - Reading cable-delays from file: ./tRCUCables.in_6 [RCUCables.cc:50] -DEBUG APL.RTCCommon.EXCEPTION - Assertion: nrArgs == EXPECTED_NR_COLUMNS; Expected 7 fields on line: 5 50 199.2573 80 [RCUCables.cc:78] +DEBUG MAC.APL.RTCCommon - Reading cable-delays from file: ./tRCUCables.in_6 [RCUCables.cc:54] +DEBUG APL.RTCCommon.EXCEPTION - Assertion: nrArgs == EXPECTED_NR_COLUMNS; Expected 7 fields on line: 5 50 199.2573 80 [RCUCables.cc:82] INFO MAC.APL.RTCCommon - Expected exception:Assertion: nrArgs == EXPECTED_NR_COLUMNS; Expected 7 fields on line: 5 50 199.2573 80 [tRCUCables.cc:89] -- GitLab