CARMA C++
DelayEngine.h
Go to the documentation of this file.
1 
10 #ifndef CARMA_INTERFEROMETRY_DELAYENGINE_H
11 #define CARMA_INTERFEROMETRY_DELAYENGINE_H
12 
16 #include "carma/monitor/DelayEngineSubsystem.h"
21 #include "carma/services/Types.h"
22 
23 #include <vector>
24 
25 
26 namespace carma {
27 
28  namespace services {
29  // forward declarations
30  class Length;
31  class Location;
32  class Pressure;
33  class Temperature;
34  }
35 
36  namespace interferometry {
37 
38  typedef ::std::vector< const carma::monitor::DelayEngineSubsystem * >
39  DelayFrameVec;
104  {
105 
106  public:
108  DelayEngine();
109 
111  ~DelayEngine();
112 
169  void setAntennaCoordinates( unsigned short antennaNo,
170  double x, double y, double z,
171  services::AntennaCoordinateType acType,
172  double axisMis );
179  void setAntennaCoordinates( unsigned short antennaNo,
180  const services::Location & location,
181  const services::Length & axisMis);
187  void setAxisMisalignment( unsigned short antennaNo,
188  const services::Length & axisMis);
210  void setArrayReferencePoint(const services::Location & location);
211 
254  void setAntennaRaDec( unsigned short antennaNo,
255  double mjd,
256  double pntra, double pntdec,
257  double phsra, double phsdec,
258  bool logAction, const std::string& source
259  );
260 
321  void setAntennaLOFreq( unsigned short antennaNo,
322  const services::Frequency & LO1freq);
323 
328  void setAllAntennaLOFreqs( const services::Frequency & LO1freq );
329 
368  void setAntennaAzEl( unsigned short antennaNo,
369  double mjd,
370  double pntaz, double pntel,
371  double phsaz, double phsel
372  );
373 
385  void setWeather( double airTemp,
386  double atmPressure,
387  double relHumid );
388 
395  void setWeather( const services::Temperature & airTemp,
396  const services::Pressure & atmPressure,
397  double relHumid ) ;
398 
399 
413  void setDelayOffset( unsigned short antennaNo, double delay );
414 
424  void setPadDelay( unsigned short antennaNo, double delay );
425 
440  void setAntennaDelays(unsigned short antennaNo, double antDelay,
441  double opticsDelayMM, double opticsDelayCM,
442  double loCableDelayMM, double loCableDelayCM);
443 
455  void setAdjustableDelay( unsigned short antennaNo, double delay );
456 
463  void setRxDelayPol1(unsigned short antennaNo, double delay);
464 
471  void setRxDelayPol2(unsigned short antennaNo, double delay);
472 
482  void useAdjustableDelay( unsigned short antennaNo, bool useit );
483 
493  void useGeometricDelay( unsigned short antennaNo, bool useit );
494 
502  void useHeightDelay( unsigned short antennaNo, bool useit );
503 
513  void useIonosphericDelay( unsigned short antennaNo, bool useit );
514 
524  void useTroposphericDelay( unsigned short antennaNo, bool useit );
525 
535  void useThermalDelay( unsigned short antennaNo, bool useit );
536 
543  DelayFrameVec computeDelays(void);
544 
551  bool selfTest (bool verbose );
552 
556  void testAgainstBima(void);
557 
558  private:
559 
560  // prevent copying and assignment
561  DelayEngine( const DelayEngine& );
562  DelayEngine &operator=( const DelayEngine& );
563 
567  void initialize(void) ;
568 
574  void finishCoordinates(unsigned short antennaNo,
575  double mjd,
576  double raPointingOffset,
577  double decPointingOffset,
578  double raPhaseOffset,
579  double decPhaseOffset,
580  bool isJ2000,
581  const std::string& source
582  );
583 
584  // subroutines to compute various delays
585 
593  double computeTotalFixedDelay(unsigned short antennaNo);
594 
606  double computeTotalDelay(unsigned short antennaNo,
607  DelayInfo & delayInfo,
608  DelayInfo & refPtInfo);
609 
619  double computeAxisDelay(unsigned short antennaNo,
620  DelayInfo & delayInfo);
621 
634  double computeGeometricDelay(unsigned short antennaNo,
635  DelayInfo & delayInfo);
636 
648  double computeHeightDelay(unsigned short antennaNo,
649  DelayInfo & delayInfo);
650 
651 
661  double computeIonosphericDelay(unsigned short antennaNo,
662  DelayInfo & delayInfo);
663 
664  /*
665  * Compute the delay due to thermal changes in the
666  * antenna structure.
667  * @param antennaNo Antenna identification
668  * @param delayInfo The DelayInfo object from which to
669  * use parameters for delay calculation.
670  * @return Thermal delay, nanosec
671  */
672  double computeThermalDelay(unsigned short antennaNo,
673  DelayInfo & delayInfo);
674 
675  /*
676  * Compute the delay due to propogation through the
677  * troposphere. Along the way, this method also calculates
678  * the pathlength and zenith refractivity, which are
679  * Delay Engine monitor points.
680  *
681  * @param antennaNo Antenna identification
682  * @param delayInfo The DelayInfo object from which to
683  * use parameters for delay calculation.
684  * @return Tropospheric delay, nanosec
685  */
686  double computeTroposphericDelay(unsigned short antennaNo,
687  DelayInfo & delayInfo);
688 
699  double computePointingCenterHourAngle(unsigned short antennaNo,
700  const DelayInfo & delayInfo);
701 
712  double computePhaseCenterHourAngle(unsigned short antennaNo,
713  const DelayInfo & delayInfo);
714 
715 
724  void setLocation( unsigned short antennaNo,
725  const DelayInfo & delayInfo );
726 
736  void fillInMonitorPoints(
737  const DelayInfo & delayInfo,
738  monitor::DelayEngineSubsystem & monitorFrame );
739 
740 
744  std::string debugPrint(const DelayInfo & delayInfo);
745 
752  double computeBimaDelay(unsigned short antennaNo,
753  const DelayInfo & delayInfo);
754 
755 
759  void computeDelays(unsigned short antennaNo);
760 
761  //-------------- MEMBER VARIABLES -----------------
762 
763  // units conversion helper
764  carma::services::Units units_;
765 
767  carma::services::Ephemeris ephemeris_;
768 
770  carma::services::AstroTime astroTime_;
771 
774 
775 
779  bool arrayRefPtSet_; // false
780 
788 
799  DelayInfo current_; /* 40 seconds from now */
800  DelayInfo penultimate_; /* 20 seconds from now */
801  DelayInfo antepenultimate_; /* now */
802  DelayInfo modified_; /* intermediate, temporary, to keep
803  * current pristine so that current
804  * can be copied to penultimate when
805  * it is superceded.
806  * modifed always
807  * gets copied to current when
808  * computeDelays()
809  * is called
810  */
811 
812  /* For calculating various delays at the array
813  * at the array reference point, which will be
814  * subtracted from the associated delays at the
815  * antenna.
816  */
817  std::vector<DelayInfo> refPtDelay_;
818 
819  // a container for the current, pen, ante DelayInfos
820  std::vector<DelayInfo> dtriplet_;
821 
822  // for testing purposes against bima code
823  DelayInfo bima_;
824 
828  DelayStatus* delayStatus_;
829 
834  std::vector<double> totalFixedDelay_;
835 
840  std::vector<double> adjustableDelay_;
841 
850  std::vector<double> delayOffset_;
851 
856  std::vector<double> padDelay_;
857 
862  std::vector<double> antDelay_;
866  std::vector<double> opticsDelayMM_;
867  std::vector<double> opticsDelayCM_;
871  std::vector<double> loCableDelayMM_;
872  std::vector<double> loCableDelayCM_;
873 
875  std::vector<double> rxDelayPol1_;
876 
878  std::vector<double> rxDelayPol2_;
879 
880 
881  static const std::string RaDec;
882  static const std::string AzEl;
883 
887  static monitor::DelayEngineSubsystem &
888  ensureAllocated( ::std::auto_ptr< monitor::DelayEngineSubsystem > & );
889 
890  ::std::auto_ptr< monitor::DelayEngineSubsystem > des0_;
891  ::std::auto_ptr< monitor::DelayEngineSubsystem > des1_;
892  ::std::auto_ptr< monitor::DelayEngineSubsystem > des2_;
893 
894  static const unsigned short ANTEPENULTIMATE = 0;
895  static const unsigned short PENULTIMATE = 1;
896  static const unsigned short CURRENT = 2;
897 
898  bool freqSet_;
899  services::Frequency freq_; // GHz
900  };
901  } // namespace interferometry
902 } // namespace carma
903 
904 
905 #endif //CARMA_INTERFEROMETRY_DELAYENGINE_H
This class performs conversions between several different antenna coordinate systems.
void setAxisMisalignment(unsigned short antennaNo, const services::Length &axisMis)
Set the axis misalignment value.
DelayFrameVec computeDelays(void)
Initiation a delay calculation.
void useGeometricDelay(unsigned short antennaNo, bool useit)
Tell the DelayEngine whether to use the geometric delay for a given antenna.
void setAdjustableDelay(unsigned short antennaNo, double delay)
Set the value for the user-definable delay offset.
void setAntennaLOFreq(unsigned short antennaNo, const services::Frequency &LO1freq)
This is the primary method for telling the DelayEngine about the source being tracked.
void setPadDelay(unsigned short antennaNo, double delay)
Set the value for the array-center-to-pad delay.
carma/services/Frequency.h Representation of Frequency.
This class is used to calculate a variety of quantities related to the earth&#39;s atmosphere, such as refractivity, saturated pressure, and pathlength (refractivity integrated through the atmosphere).
Definition: Atmosphere.h:46
void testAgainstBima(void)
Print out the delays from CARMA and BIMA code.
bool selfTest(bool verbose)
Perform an internal selftest to compute a geometric delay for an antenna configuration with a known a...
void useAdjustableDelay(unsigned short antennaNo, bool useit)
Tell the DelayEngine whether to use the adjustable delay for a given antenna.
Various type definitions for services classes.
void useTroposphericDelay(unsigned short antennaNo, bool useit)
Tell the DelayEngine whether to use the tropospheric delay for a given antenna.
This class implements various astronomical time computation routines.
Definition: AstroTime.h:32
Contains a self-consistent set of values for delay parameters.
The Frequency class can represent any frequency in any units.
Definition: Frequency.h:39
Ephemeris wraps the NOVAS library and any other ephemeris related functions into a simple to use clas...
Definition: Ephemeris.h:91
Astronomical Time routines.
void useHeightDelay(unsigned short antennaNo, bool useit)
Tell the DelayEngine whether to use the additional refractive height delay for a given antenna...
The Temperature class represents a temperature in any unit.
Definition: Temperature.h:39
The Pressure class can represent any pressure in any units.
Definition: Pressure.h:38
void setWeather(double airTemp, double atmPressure, double relHumid)
Set the current weather parameters, needed to calculated the tropospheric delay.
Location specifies a location (observatory if you wish) on planet earth, as longitude, latitude, and altitude above sea-level.
Definition: Location.h:32
Constants and methods having to do with the earth&#39;s atmosphere (e.g.
Tagged: Tue May 4 15:49:11 PDT 2004.
void setAntennaAzEl(unsigned short antennaNo, double mjd, double pntaz, double pntel, double phsaz, double phsel)
Tell the DelayEngine parameters required to determine delay information for an antenna pointed to a f...
void setRxDelayPol1(unsigned short antennaNo, double delay)
Set the receiver offset for polarization state 1.
void setRxDelayPol2(unsigned short antennaNo, double delay)
Set the receiver offset for polarization state 2.
void setArrayReferencePoint(const services::Location &location)
The Length class can represent a length in any units.
Definition: Length.h:36
void useIonosphericDelay(unsigned short antennaNo, bool useit)
Tell the DelayEngine whether to use the ionospheric delay for a given antenna.
void setAntennaDelays(unsigned short antennaNo, double antDelay, double opticsDelayMM, double opticsDelayCM, double loCableDelayMM, double loCableDelayCM)
Set the value for the pad-to-antenna, and other antenna specific delays.
Declaration of carma::services::Ephemeris.
void useThermalDelay(unsigned short antennaNo, bool useit)
Tell the DelayEngine whether to use the thermal delay for a given antenna.
void setDelayOffset(unsigned short antennaNo, double delay)
Set the value for the antenna&#39;s delay offset.
DelayEngine interface.
Definition: DelayEngine.h:103
void setAntennaRaDec(unsigned short antennaNo, double mjd, double pntra, double pntdec, double phsra, double phsdec, bool logAction, const std::string &source)
void setAllAntennaLOFreqs(const services::Frequency &LO1freq)
Set the LO1 frequency for all antennas to the same value.
void setAntennaCoordinates(unsigned short antennaNo, double x, double y, double z, services::AntennaCoordinateType acType, double axisMis)
This class is based on the GNU units library.
Definition: Units.h:46
Contains a the status variables for a DelayInfo class.