CARMA C++
SubarrayTrackerThread.h
Go to the documentation of this file.
1 
10 #ifndef CARMA_SUBARRAY_TRACKER_THREAD_H
11 #define CARMA_SUBARRAY_TRACKER_THREAD_H
12 
13 #include <vector>
14 #include <sys/time.h>
15 #include "carma/monitor/WeatherSubsystem.h"
17 
19 
24 
25 
26 namespace carma {
27 
28 namespace util {
29 
30 class PeriodicTimer;
31 
32 }
33 
34 namespace control {
35 
36 
57 
58 public:
59 
60  static const unsigned long
61  TRACKER_DEFAULT_UPDATE_INTERVAL = 20; //in seconds
62  static const unsigned long
63  TRACKER_DEFAULT_WEATHER_UPDATE_INTERVAL = 4 * 60; //in seconds (4 min)
64  //In seconds (8 min)
65  static const unsigned long
66  TRACKER_DEFAULT_ANTENNA_TRACK_UPDATE_INTERVAL = 8 * 60;
67 
68 // TESTING ONLY TO SPEED UP TRACKING CYCLE!
69 // static const unsigned long
70 // TRACKER_DEFAULT_ANTENNA_TRACK_UPDATE_INTERVAL = 1 * 60;
71 
72 
93  explicit TrackerThread (
94  SubarrayControlImpl & saCI,
95  monitor::CarmaMonitorSystem & carmaMonitor,
96  const unsigned long period = TRACKER_DEFAULT_UPDATE_INTERVAL,
97  const unsigned long antennaWeatherPeriod =
98  TRACKER_DEFAULT_WEATHER_UPDATE_INTERVAL,
99  const unsigned long delayEngineWeatherPeriod =
100  TRACKER_DEFAULT_WEATHER_UPDATE_INTERVAL,
101  const unsigned long antennaTrackPeriod =
102  TRACKER_DEFAULT_ANTENNA_TRACK_UPDATE_INTERVAL );
103 
107  ~TrackerThread();
108 
115  long getTrackerPeriod () const ;
116 
123  long getAntennaTrackPeriod () const ;
124 
131  long getAntennaWeatherPeriod () const ;
132 
140  long getDelayEngineWeatherPeriod () const ;
141 
148  double getInterpolationInterval () const ;
149 
157  double getAntInterpolationInterval () const ;
158 
164  void setLastAntUpdate(double mjd);
165 
169  double getLastAntUpdate( ) const;
170 
177  void setLastIntferUpdate(double mjd);
178 
183  double getLastIntferUpdate( ) const;
184 
191 
195  void operator()();
196 
203  void updateTracking();
204 
205  private:
206 
214  struct ::timeval getNextTimerInstant() const ;
215 
221  monitor::CarmaMonitorSystem & carmaMonitor_;
222 
228  const unsigned long period_;
229 
236  const unsigned long antennaWeatherPeriod_;
237 
244  const unsigned long delayEngineWeatherPeriod_;
245 
253  const unsigned long antennaTrackPeriod_;
254 
262  const unsigned long antennaWeatherCycleCount_;
263 
271  const unsigned long delayEngineWeatherCycleCount_;
272 
280  const unsigned long antennaTrackCycleCount_;
281 
288  const double interpInterval_;
289 
290  double lastAntUpdate_;
291  double lastIntferUpdate_;
292 
297  struct ::timeval nextFiringTime_;
298 
302  util::PeriodicTimer * timer_;
303 
304  SubarrayControlImpl & saCI_;
305 
312  void updateWeatherSafely();
313 
314  // Weather data.
316  services::Temperature airTemp_;
317  services::Temperature dewTemp_;
318  services::Pressure atmPressure_;
319  services::Velocity windSpeed_;
320  // 0 degrees = north, 90 degrees = east
321  services::Angle windDirection_;
322  double relHumid_;
323 };
324 
325 
326 } // End namespace carma::control
327 } // End namespace carma
328 
329 
330 #endif // CARMA_SUBARRAY_TRACKER_THREAD_H
double getInterpolationInterval() const
Returns interferometry interpolation interval as a fraction of a day.
Carma control interface server implementation.
long getTrackerPeriod() const
Returns tracker thread period - set during construction.
Representation of Pressure.
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
TrackerThread(SubarrayControlImpl &saCI, monitor::CarmaMonitorSystem &carmaMonitor, const unsigned long period=TRACKER_DEFAULT_UPDATE_INTERVAL, const unsigned long antennaWeatherPeriod=TRACKER_DEFAULT_WEATHER_UPDATE_INTERVAL, const unsigned long delayEngineWeatherPeriod=TRACKER_DEFAULT_WEATHER_UPDATE_INTERVAL, const unsigned long antennaTrackPeriod=TRACKER_DEFAULT_ANTENNA_TRACK_UPDATE_INTERVAL)
Constructor.
The Velocity class can represent an velocity in any units.
Definition: Velocity.h:42
long getDelayEngineWeatherPeriod() const
Returns delay engine weather update period - set during construction.
void setLastIntferUpdate(double mjd)
Set time of last interferometry sky position update.
void updateTracking()
Calls updateTracking on each antenna, and then calls computeDelay on delay engine.
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
long getAntennaWeatherPeriod() const
Returns antenna weather update period - set during construction.
monitor::CarmaMonitorSystem & getMonitorSystem() const
Returns internal CARMA Monitor System object.
carma/services/Temperature.h Representation of Temperature
double getAntInterpolationInterval() const
Returns antenna tracking interpolation interval as a fraction of a day.
The Angle class can represent any angle in any units.
Definition: Angle.h:38
Constants and methods having to do with the earth&#39;s atmosphere (e.g.
Representation of Velocity in any units.
void setLastAntUpdate(double mjd)
Set time of last antenna tracking position update.
Timer object that fires at a fixed rate.
Definition: PeriodicTimer.h:23
long getAntennaTrackPeriod() const
Returns antenna tracker thread period - set during construction.
The Delay Engine.