CARMA C++
MonitorSystem.h
Go to the documentation of this file.
1 #ifndef CARMA_MONITOR_MONITORSYSTEM_H
2 #define CARMA_MONITOR_MONITORSYSTEM_H
3 
20 #include <string>
21 #include <vector>
22 #include <iomanip>
23 #include <ios>
24 
26 // To get the default queueDepth...
28 
29 namespace carma {
30  namespace monitor {
31 
32 // Forward class declarations
33 class AntennaCommon;
34 class AstroSubsystem;
35 class BimaSubsystem;
36 class C3gMax8PipelineSubsystem;
37 class C3gMax23PipelineSubsystem;
38 class CarmaSlcBandSubsystem;
39 class Carma3GBandSubsystem;
40 class CentralIfSubsystem;
41 class ControlSubsystem;
42 class DataflowSubsystem;
43 class DelayEngineSubsystem;
44 class FaultSubsystem;
45 class ImrSubsystem;
46 class AlarmSubsystem;
47 class LineLengthSubsystem;
48 class LoberotatorSubsystem;
49 class LoRefSubsystem;
50 class MasterClockSubsystem;
51 class OpacityMonitorSubsystem;
52 class OvroSubsystem;
53 class PhaseMonitorSubsystem;
54 class ProjectDatabaseManagerSubsystem;
55 class SignalPathSubsystem;
56 class SldcSubsystem;
57 class SlPipelineSubsystem;
58 class SystemStatusSubsystem;
59 class SzaSubsystem;
60 class TestSubsystem;
61 class VlbiSubsystem;
62 class WbdcSubsystem;
63 class WbcBandSubsystem;
64 class WbPipelineSubsystem;
65 class WeatherSubsystem;
66 class WbDataflowSubsystem;
67 class SlDataflowSubsystem;
68 class C3gDataflowSubsystem;
69 class WbRemapperSubsystem;
70 class SlRemapperSubsystem;
71 class C3gRemapperSubsystem;
72 
73 class SystemFrameBuffer;
74 class SubsystemFrame;
75 
82 public:
83 
91  MonitorSystem(const std::string& systemName, long nSubsystems,
92  long nMonitorPoints, long nSamples,
93  int queueDepth=SubsystemFrameBuffer::kDefaultQueueDepth);
94 
98  virtual ~MonitorSystem() ;
99 
112  AntennaCommon& antennaCommon( int index ) const;
113 
117  AstroSubsystem& astro( ) const { return astro_; }
118 
123  BimaSubsystem& bima(int index) const { return *(bimas_.at( index )); }
124 
128  C3gMax8PipelineSubsystem& c3gMax8Pipeline( ) const { return c3gMax8Pipeline_; }
129 
133  C3gMax23PipelineSubsystem& c3gMax23Pipeline( ) const { return c3gMax23Pipeline_; }
134 
138  CentralIfSubsystem& centralIf() const { return centralIf_; }
139 
143  ControlSubsystem& control() const { return control_; }
144 
148  DataflowSubsystem& dataflow() const { return dataflow_; }
149 
153  DelayEngineSubsystem& delay() const { return delayEngine_; }
154 
158  FaultSubsystem & fault( ) const;
159 
163  ImrSubsystem& imr() const { return imr_; };
164 
168  AlarmSubsystem& alarm() const { return alarm_; }
169 
173  LineLengthSubsystem& lineLength() const { return lineLength_; }
174 
178  LoberotatorSubsystem& loberotator() const { return loberotator_; }
179 
183  LoRefSubsystem& loRef() const { return loRef_; }
184 
188  MasterClockSubsystem& masterclock() const { return masterclock_; }
189 
193  OpacityMonitorSubsystem& opacityMonitor() const { return opacityMonitor_; }
194 
199  OvroSubsystem& ovro(int index) const { return *(ovros_.at( index )); }
200 
204  PhaseMonitorSubsystem& phaseMonitor() const { return phaseMonitor_; }
205 
209  ProjectDatabaseManagerSubsystem& projectDatabaseManager()
210  const { return projectDatabaseManager_; }
211 
215  SignalPathSubsystem & signalPath() const { return signalPath_; };
216 
221  CarmaSlcBandSubsystem & carmaSlcBand( const int index ) const {
222  return *(carmaSlcBands_.at( index ));
223  }
224 
228  int getCarmaSlcBandCount() const ;
229 
234  Carma3GBandSubsystem & carma3gBand( const int index ) const {
235  return *(carma3gBands_.at( index ));
236  }
237 
241  int getCarma3gBandCount() const ;
242 
246  SldcSubsystem& sldc() const { return sldc_; }
247 
251  SlPipelineSubsystem& slPipeline() const { return slPipeline_; }
252 
256  SystemStatusSubsystem& systemStatus() const { return systemStatus_; }
257 
262  SzaSubsystem& sza(int index) const { return *(szas_.at( index )); }
263 
268  WbcBandSubsystem & wbcBand( const int index ) const {
269  return *(wbcBands_.at(index));
270  }
271 
275  int getWbcBandCount() const ;
276 
280  WbdcSubsystem& wbdc() const { return wbdc_; }
281 
285  WbPipelineSubsystem& wbPipeline() const { return wbPipeline_; }
286 
290  WeatherSubsystem& weather() const { return weather_; }
291 
295  TestSubsystem& test() const { return test_; }
296 
300  VlbiSubsystem& vlbi() const { return vlbi_; }
301 
306  WbDataflowSubsystem & wbDataflow(const int index) const
307  {
308  return *( wbDataflow_.at(index) );
309  }
310 
315  WbRemapperSubsystem & wbRemapper(const int index) const
316  {
317  return *( wbRemapper_.at(index) );
318  }
319 
324  SlDataflowSubsystem & slDataflow(const int index) const
325  {
326  return *( slDataflow_.at(index) );
327  }
328 
333  C3gDataflowSubsystem & c3gDataflow(const int index) const
334  {
335  return *( c3gDataflow_.at(index) );
336  }
337 
342  SlRemapperSubsystem & slRemapper(const int index) const
343  {
344  return *( slRemapper_.at(index) );
345  }
346 
351  C3gRemapperSubsystem & c3gRemapper(const int index) const
352  {
353  return *( c3gRemapper_.at(index) );
354  }
355 
359  SystemFrameBuffer& systemFrameBuffer() const { return systemFrameBuffer_; }
360 
368  virtual std::string transportStatisticsToString (bool canonical = false) const;
369 
376  std::string addTransportTimesAsString (std::ostringstream o) const ;
377 
386  bool isCurrent () const;
387 
393  long getNumValidSubsystems () const;
394 
401  void resetQueue () ;
402 
403  /*
404  * Overridden methods of abstract MonitorSystemContainer methods.
405  * Documentation supplied by base class.
406  */
407  virtual unsigned int read();
408  virtual bool readNewest();
409  virtual bool readNewestIfStale();
410  virtual bool readNewestConditionalCopy();
411  virtual void write();
412  virtual int getFrameCount() const;
413 
420  double getCollatorWriteDelay() const;
421 
430  double getCollatorWriteTime() const;
431 
440  void setRawReadTime( double mjdTimestamp );
441  void setRawReadTime( );
442 
451  double getRawReadTime() const;
452 
461  void setFinalWriteTime( double mjdTimestamp );
462  void setFinalWriteTime( );
463 
472  double getFinalWriteTime() const;
473 
479  void resetTimes ();
480 
486  long getTotalNumSubsystems() const;
487 
494  long getTotalNumMonitorPoints() const;
495 
502  long getTotalNumMonitorSamples() const;
503 
510  size_t getTotalMonitorSystemSize() const;
511 
518  long getMaxNumMonitorPoints() const;
519 
526  long getMaxNumMonitorSamples() const;
527 
534  size_t getMaxMonitorSystemSize() const;
535 
542  long getActualNumSubsystems() const;
543 
550  long getActualNumMonitorPoints() const;
551 
559  long getActualNumMonitorPoints (const MonitorValueType type) const;
560 
569 
576  long getActualNumMonitorSamples() const;
577 
586 
593  size_t getActualMonitorSystemSize() const;
594 
601  long getAllocatedNumSubsystems() const;
602 
609  long getAllocatedNumMonitorPoints() const;
610 
617  long getAllocatedNumMonitorSamples() const;
618 
625  size_t getAllocatedMonitorSystemSize() const;
626 
634  long getCountedNumMonitorPoints() const;
635 
643  long getCountedNumMonitorSamples() const;
644 
652  size_t getCountedMonitorSystemSize() const;
653 
659  SystemFrameBuffer& getSystemFrameBuffer() const;
660 
665  MonitorSubsystem & getChildSubsystem( int index ) const;
666 
667 protected:
668 
669  SubsystemFrame & getChildSubsystemFrame( int index ) const;
670 
671 private:
672  /* Storage
673  * Order of construction is critical - storage (in the form of
674  * SystemFrameBuffer) must be constructed first, or the subsystems
675  * will not have space to exist, and construction of all
676  * subsequent members will fail.
677  * The order of storage intialization is determined by the order
678  * of declaration below, *not* by the order of the constructor
679  * initialization list.
680  */
681  SystemFrameBuffer& systemFrameBuffer_;
682 
683  // Subsystems
684  AstroSubsystem& astro_;
685  std::vector<BimaSubsystem*> bimas_;
686  C3gMax8PipelineSubsystem& c3gMax8Pipeline_;
687  C3gMax23PipelineSubsystem& c3gMax23Pipeline_;
688  CentralIfSubsystem& centralIf_;
689  ControlSubsystem& control_;
690  DataflowSubsystem& dataflow_;
691  DelayEngineSubsystem& delayEngine_;
692  ImrSubsystem& imr_;
693  AlarmSubsystem& alarm_;
694  LineLengthSubsystem& lineLength_;
695  LoberotatorSubsystem& loberotator_;
696  LoRefSubsystem& loRef_;
697  MasterClockSubsystem& masterclock_;
698  OpacityMonitorSubsystem& opacityMonitor_;
699  std::vector<OvroSubsystem*> ovros_;
700  PhaseMonitorSubsystem& phaseMonitor_;
701  ProjectDatabaseManagerSubsystem& projectDatabaseManager_;
702  ::std::vector< CarmaSlcBandSubsystem * > carmaSlcBands_;
703  ::std::vector< Carma3GBandSubsystem * > carma3gBands_;
704  SignalPathSubsystem & signalPath_;
705  SldcSubsystem& sldc_;
706  SlPipelineSubsystem& slPipeline_;
707  SystemStatusSubsystem& systemStatus_;
708  ::std::vector< SzaSubsystem * > szas_;
709  TestSubsystem& test_;
710  VlbiSubsystem& vlbi_;
711  ::std::vector< WbcBandSubsystem * > wbcBands_;
712  WbdcSubsystem& wbdc_;
713  WbPipelineSubsystem& wbPipeline_;
714  WeatherSubsystem& weather_;
715  FaultSubsystem & fault_;
716  ::std::vector< WbDataflowSubsystem * > wbDataflow_;
717  ::std::vector< SlDataflowSubsystem * > slDataflow_;
718  ::std::vector< C3gDataflowSubsystem * > c3gDataflow_;
719  ::std::vector< WbRemapperSubsystem * > wbRemapper_;
720  ::std::vector< SlRemapperSubsystem * > slRemapper_;
721  ::std::vector< C3gRemapperSubsystem * > c3gRemapper_;
722 };
723 
724 
725 //------------------------------------------------------------------
726 
727 
728 class RawCarmaMonitorSystem;
729 
738 protected:
739 
745  CarmaMonitorSystem( std::string name,
746  int queueDepth );
747 
748 public:
749 
754 
755 
761  explicit CarmaMonitorSystem(const RawCarmaMonitorSystem& raw) ;
762 
783  void synchronize (const CarmaMonitorSystem& src) ;
784 
785 };
786 
792 
793 public:
794 
802 
803 };
804 
813 public:
814 
819 };
820 
821 
822 
823 
824 } } // End namespace carma::monitor
825 
826 
827 inline carma::monitor::FaultSubsystem &
829 {
830  return fault_;
831 }
832 
833 
834 #endif
long getMaxNumMonitorSamples() const
Capacity related method - returns total allocated monitor sample capacity across all subsystems...
WbPipelineSubsystem & wbPipeline() const
Get reference to the wideband line pipeline subsystem.
short MonitorValueType
Enumeration of possible types for monitor point values.
SzaSubsystem & sza(int index) const
Get reference to sza antenna subsystem.
MonitorSubsystem & getChildSubsystem(int index) const
Get underlying subsystem by index.
LineLengthSubsystem & lineLength() const
Get reference to the lineLength subsystem.
OpacityMonitorSubsystem & opacityMonitor() const
Get reference to the opacityMonitor subsystem.
void resetTimes()
Resets collator write time - call clearAllTimes to conform to name of similar routine in ::carma:moni...
SystemFrameBuffer & systemFrameBuffer() const
Get reference to the underlying storage.
long getCountedNumMonitorPoints() const
Capacity usage related method - returns number of monitor points present across all subsystems - numb...
C3gMax23PipelineSubsystem & c3gMax23Pipeline() const
Get reference to carma 23 station 3g correlator pipeline.
void resetQueue()
Moves read pointer beyond top of queue so a read will block until the next write. ...
virtual bool readNewestConditionalCopy()
If new data is available it is copied from the queue into the monitor system.
AstroSubsystem & astro() const
Get reference to an Astro container.
CentralIfSubsystem & centralIf() const
Get reference to the centalIF subsystem.
long getActualNumMonitorSamples() const
Capacity related method - returns actual # of monitor samples across all subsystems.
size_t getCountedMonitorSystemSize() const
Capacity usage related method - returns total size counted, in bytes across all subsystems.
double getRawReadTime() const
Gets MJD when this system frame was actually read by the fault system.
The monitor system for the Control subsystem.
long getNumValidSubsystems() const
Returns number of valid subsystems.
WeatherSubsystem & weather() const
Get reference to the weather subsystem.
VlbiSubsystem & vlbi() const
Get reference to the vlbi subsystem.
C3gDataflowSubsystem & c3gDataflow(const int index) const
Carma3GBandSubsystem & carma3gBand(const int index) const
Get reference to a CARMA3G correlator band subsystem.
SlPipelineSubsystem & slPipeline() const
Get reference to the spectral line pipeline subsystem.
The monitor system for the WbPipeline subsystem.
long getTotalNumMonitorSamples() const
Capacity related method - returns total monitor sample capacity across all subsystems.
BimaSubsystem & bima(int index) const
Get reference to a bima antenna subsystem.
double getCollatorWriteDelay() const
Delay offset (in seconds) from the corrected UTC half-second when the System frame is written to IPQ ...
AlarmSubsystem & alarm() const
Get reference to the alarm subsystem.
LoRefSubsystem & loRef() const
Get reference to the LOref subsystem.
bool isCurrent() const
Returns true if the monitor subsystem contains data that is current.
WbdcSubsystem & wbdc() const
Get reference to wideband downconverter subsystem.
MasterClockSubsystem & masterclock() const
Get reference to the masterclock subsystem.
virtual ~MonitorSystem()
Destructor.
double getFinalWriteTime() const
Gets MJD when this system frame was actually read by the fault system.
TestSubsystem & test() const
Get reference to the test subsystem.
ImrSubsystem & imr() const
Get reference to imr subsystem.
Monitor system container interface definition.
The monitor system for the C3gMax8Pipeline subsystem.
CarmaMonitorSystem()
Full monitor system with all subsystems.
long getActualNumMultiSampleMonitorPoints() const
Capacity usage related method - returns actual # of monitor points with multiple samples across all s...
virtual unsigned int read()
Reads oldest unread data from the IPQ into the local set of monitor points.
WbcBandSubsystem & wbcBand(const int index) const
Get reference to a wideband correlator band subsystem.
CarmaSlcBandSubsystem & carmaSlcBand(const int index) const
Get reference to a spectral line correlator band subsystem.
long getTotalNumMonitorPoints() const
Capacity related method - returns total monitor point capacity across all subsystems.
SystemStatusSubsystem & systemStatus() const
Get reference to the system status subsystem.
FaultSubsystem & fault() const
Get reference to fault subsystem.
long getActualNumSubsystems() const
Capacity usage related method - returns actual number of subsystems allocated.
SlDataflowSubsystem & slDataflow(const int index) const
This is the full Carma monitor system before fault system processing and immediately following collat...
MonitorSystem(const std::string &systemName, long nSubsystems, long nMonitorPoints, long nSamples, int queueDepth=SubsystemFrameBuffer::kDefaultQueueDepth)
Constructor base subsystem configuration.
std::string addTransportTimesAsString(std::ostringstream o) const
Dumps transport statistics as a table, with write delays, and transport/write times printed out as do...
virtual std::string transportStatisticsToString(bool canonical=false) const
Dumps transport statistics as a table, with write delays, and transport/write times printed out as do...
This is the Final Carma Monitor system after monitor point values from the correlator pipeline have b...
WbDataflowSubsystem & wbDataflow(const int index) const
Class for managing IPQ for monitor subsystem.
long getActualNumMonitorPoints() const
Capacity usage related method - returns actual # of monitor points across all subsystems.
A generic monitor subsystem base class.
RawCarmaMonitorSystem()
Full monitor system with all subsystems, before fault processing.
SlRemapperSubsystem & slRemapper(const int index) const
DataflowSubsystem & dataflow() const
Get reference to the control subsystem.
The monitor system for the SlPipeline subsystem.
ProjectDatabaseManagerSubsystem & projectDatabaseManager() const
Get reference to the projectdatabase manager subsystem.
C3gMax8PipelineSubsystem & c3gMax8Pipeline() const
Get reference to carma 8 station 3g correlator pipeline.
long getMaxNumMonitorPoints() const
Capacity usage related method - returns total allocated monitor point capacity across all subsystems...
long getAllocatedNumMonitorPoints() const
Capacity usage related method - returns allocated monitor point capacity across all subsystems...
int getCarma3gBandCount() const
Get the number of carma3g bands.
double getCollatorWriteTime() const
MJD when this system frame was actually written to the IPQ.
virtual bool readNewest()
Reads in the newest data from the IPQ into the local set of monitor points.
long getAllocatedNumMonitorSamples() const
Capacity related method - returns total monitor sample capacity across all subsystems.
Monitor system base class.
Definition: MonitorSystem.h:81
WbRemapperSubsystem & wbRemapper(const int index) const
virtual bool readNewestIfStale()
Reads in data from the IPQ into the local set of monitor points if data is stale, that is...
size_t getTotalMonitorSystemSize() const
Capacity related method - returns total size available in bytes across all subsystems.
DelayEngineSubsystem & delay() const
Get reference to the delay engine subsystem.
AntennaCommon & antennaCommon(int index) const
Get reference to an AntennaCommon container in an ovro or bima or sza subsystem.
size_t getActualMonitorSystemSize() const
Capacity usage related method - returns actual size used in bytes across all subsystems.
Frame containing monitor points for a monitor subsystem frame.
virtual int getFrameCount() const
Get the frame count for the last read frame.
long getCountedNumMonitorSamples() const
Capacity related method - returns number of monitor samples counted across all subsystems.
PhaseMonitorSubsystem & phaseMonitor() const
Get reference to the phase monitor subsystem.
SldcSubsystem & sldc() const
Get reference to the spectral line downconverter subsystem.
The monitor system for the C3gMax23Pipeline subsystem.
int getCarmaSlcBandCount() const
Get the number of carmaSlcBands.
OvroSubsystem & ovro(int index) const
Get reference to ovro antenna subsystem.
LoberotatorSubsystem & loberotator() const
Get reference to the loberotator subsystem.
SignalPathSubsystem & signalPath() const
Get reference to the signal path subsystem.
SystemFrameBuffer & getSystemFrameBuffer() const
Get the underlying SystemFrameBuffer.
int getWbcBandCount() const
Get the number of wbcBands.
long getAllocatedNumSubsystems() const
Capacity usage related method - returns total number of subsystems allocated.
C3gRemapperSubsystem & c3gRemapper(const int index) const
virtual void write()
Write out the monitor point data values.
void synchronize(const CarmaMonitorSystem &src)
Method to synchronize this object with another CarmaMonitorSystem object.
ControlSubsystem & control() const
Get reference to the control subsystem.
size_t getMaxMonitorSystemSize() const
Capacity usage related method - returns total size allocated in bytes across all subsystems.
size_t getAllocatedMonitorSystemSize() const
Capacity usage related method - returns total size allocated in bytes across all subsystems.
Abstract MonitorSubsystem base class.
FinalCarmaMonitorSystem()
Full monitor system with all subsystems.
long getTotalNumSubsystems() const
Capacity related method - returns total subsystem capacity.