CARMA C++
PipelineMonitorInput.h
1 #ifndef CARMA_MONITOR_PIPELINE_MONITOR_INPUT_H
2 #define CARMA_MONITOR_PIPELINE_MONITOR_INPUT_H
3 
4 #include "carma/util/types.h"
5 
6 #include "carma/monitor/CorrDesignation.h"
8 #include "carma/monitor/SignalPathSubsystem.h"
9 #include "carma/util/types.h"
10 
11 #include <map>
12 #include <vector>
13 #include <set>
14 
15 
16 namespace carma {
17 namespace monitor {
18 
19 class MonitorSystem;
20 class AntennaCommon;
21 class ControlBandPoints;
22 class MonitorPointFloat;
23 class NoiseStatusMonitorPointEnum;
24 
25 typedef PolarizationMonitorPointEnum PolMPE;
26 typedef PolarizationMonitorPointEnum::POLARIZATION PolType;
27 typedef std::pair< int, PolType > AntPolPair;
28 typedef std::pair< int, PolType > BandPolPair;
29 typedef std::pair< int, int > BandInputPair;
30 
31 class PipelineMonitorInput {
32 public:
33 
40  PipelineMonitorInput( MonitorCorrelatorDesignation corrDes );
41 
45  ~PipelineMonitorInput( );
46 
56  bool waitForInput( carma::util::frameType frame );
57 
62  std::vector< int > getMappedAstroBandNumbers( ) const;
63 
67  std::set< int > getMappedAntennaNumbers( ) const;
68 
72  std::set< int > getMappedInputNumbers( ) const;
73 
78  std::set< PolType > getMappedPols( int astroBandNo ) const;
79 
84  std::vector< AntPolPair > getMappedAntPolPairs( int astroBandNo ) const;
85 
89  std::vector< BandPolPair > getMappedBandPolPairs( ) const;
90 
94  std::vector< BandInputPair >
95  getMappedAstroBandInputPairs( int carmaAntNo ) const;
96 
100  bool signalPathMapped( int astroBandNo ) const;
101 
105  bool signalPathMapped( int astroBandNo, const AntPolPair & antPol ) const;
106 
111  AntPolPair getAntPolPair( int astroBandNo, int astroInputNo ) const;
112 
117  int getAstroInputNo( int astroBandNo, const AntPolPair & antPol ) const;
118 
122  carma::util::frameType frameCount( ) const;
123 
130  std::pair< bool, bool > isRxInSideband( int astroBandNo,
131  const AntPolPair & antPol,
132  bool usb ) const;
133 
141  const AntennaCommon & antennaCommon( int carmaAntNo ) const;
142  const ControlBandPoints & controlBandPoints( int astroBandNo ) const;
143  const MonitorPointFloat & totalPower( int astroBandNo,
144  const AntPolPair & antPol) const;
145  const NoiseStatusMonitorPointEnum & noiseStatus(
146  MonitorCorrelatorDesignation corrDes ) const;
147  const MonitorPointByte & blankStatus(
148  int astroBandNo,
149  const AntPolPair & antPol ) const;
150 
151  const WeatherSubsystem & weather( ) const;
152  const ControlSubsystem & control( ) const;
153  BandInputPair getCorrBandInputPair( int astroBandNo,
154  const AntPolPair & antPol ) const;
155 
161  MonitorCorrelatorDesignation getAntCorrDes( int carmaAntNo ) const;
162 
170  MonitorCorrelatorDesignation getAntSubarrayCorrDes( int carmaAntNo ) const;
171 
176  int getExpectedChannels( int astroBandNo ) const;
177 
182  bool astroBandOnline( int astroBandNo ) const;
183 
188  void getCorrInfo(int astroBandNo, int astroBandInput,
189  MonitorCorrelatorDesignation& corrDes, int& corrBandNo, int& corrBandInputNo);
190 
191  bool isManuallyFlagged(int astroBandNo, int astroBandInput1, int astroBandInput2);
192 
196  const carma::monitor::CarmaMonitorSystem & getCarmaMonitorSystem() const;
197 
198 private:
199 
200  struct MapDetails;
201 
202  // Too many different maps here - consolidate this into the SPM class.
203  typedef std::map< int, MapDetails > AstroInputMap;
204  typedef std::map< int, AstroInputMap > AstroBandInputMap;
205 
206  // This is a reverse multimap to get fast lookups on ant/pol
207  // This can go away if we modify the above to be pure input based.
208  typedef std::multimap< AntPolPair, int > AntPolInputMultimap;
209  typedef std::map< int, AntPolInputMultimap > AstroBandAntPolInputMap;
210 
211  // Keyed on absolute carma antenna number.
212  typedef std::map< int, std::vector< BandInputPair > > AntAstroPairs;
213 
214  void internalSpmUpdate();
215  void internalAstrobandUpdate(
216  const SignalPathSubsystem::Astroband & astroband,
217  const int astroBandNo );
218 
219  void flagInputs(MonitorCorrelatorDesignation corrDes, int bandNo, int inputNo1, int inputNo2, int nMaxBand);
220  void rebuildControlMap(MonitorCorrelatorDesignation corrDes) ;
221  void rebuildControlMaps() ;
222  void clearControlMap(MonitorCorrelatorDesignation corrDes);
223  void clearControlMaps() ;
224  void internalControlUpdate();
225 
226  const MapDetails & getMapDetails( int astroBandNo,
227  const AntPolPair & antPol ) const;
228 
229  const MapDetails & getMapDetails( int astroBandNo,
230  int astroInputNo ) const;
231 
232  AstroBandInputMap astroMapping_;
233  AstroBandAntPolInputMap antPolMapping_;
234  std::map< int, std::set< PolType > > astroBandPolMapping_;
235  std::set< int > mappedAnts_;
236  std::set< int > mappedInputs_;
237  AntAstroPairs mappedAntAstroPairs_;
238 
239  typedef std::map< int, std::set< int > > AstroBandCorrBandMap;
240  AstroBandCorrBandMap astroBandCorrBands_;
241 
242  int lastMappingUpdate_;
243 
244  const MonitorCorrelatorDesignation corrDes_;
245 
247 
248  std::map<MonitorCorrelatorDesignation, std::map<int, std::map<int, std::map<int, bool> > > > flagMap_;
249 };
250 
251 }} // namespace carma::monitor
252 #endif
The monitor system base class.
unsigned int frameType
Half second frames since Jan 1, 2000.
Definition: types.h:29
Various type definitions for util classes.