LRAUV  revA
PeakDetectHorizontal.h
Go to the documentation of this file.
1 
12 #ifndef PEAKDETECTTHRESHOLD_H_
13 #define PEAKDETECTTHRESHOLD_H_
14 
15 #include "component/Behavior.h"
16 #include "data/Location.h"
17 
18 class Location;
20 
31 {
32 public:
33 
34  PeakDetectHorizontal( const Str& prefix, const Module* module );
35 
36  virtual ~PeakDetectHorizontal();
37 
39  void initialize( void );
40 
42  bool readParams();
43 
45  bool calcSatisfied();
46 
48  void run();
49 
51  bool isSatisfied();
52 
54  bool runIfUnsatisfied();
55 
57  void uninitialize( void );
58 
60  static Behavior* CreateBehavior( const Str& prefix, const Module* module );
61 
62 protected:
63 
64  // Slate input setting variables
65 
68 
71 
74 
77 
80 
83 
86 
89 
92 
95 
96  // Actual values from settings
97 
99 
101 
103 
105 
107 
109 
111 
112  // Slate input measurements
113 
116 
119 
122 
125 
128 
131 
134 
137 
140 
141  // Argument output variables
147 
149  float detect_;
150  float depth_;
151  float distance_;
152  float latitude_;
153  float longitude_;
156 
158  float peakDetect_;
159 
160  bool inPeak_;
162 
164  {
165  public:
166  PointValue( double init )
167  : time_( init ),
168  latitude_( init ),
169  longitude_( init ),
170  distance_( init ),
171  depth_( init ),
172  value_( init )
173  {}
174  void set( double time, double latitude, double longitude, float distance, float depth, float value )
175  {
176  time_ = time, latitude_ = latitude, longitude_ = longitude, distance_ = distance, depth_ = depth, value_ = value;
177  }
178  double getTime()
179  {
180  return time_;
181  }
182  double getLatitude()
183  {
184  return latitude_;
185  }
186  double getLongitude()
187  {
188  return longitude_;
189  }
190  float getDepth()
191  {
192  return depth_;
193  }
194  float getDistance()
195  {
196  return distance_;
197  }
198  float getValue()
199  {
200  return value_;
201  }
202  void advect( const float bearing, const float distance )
203  {
204  Location::AtBearing( bearing, distance, latitude_, longitude_ );
205  }
206  bool differsFrom( const float depth, const float value )
207  {
208  return depth_ != depth || value_ != value;
209  }
211  {
212  time_ += pv.time_, latitude_ += pv.latitude_, longitude_ += pv.longitude_, distance_ += pv.distance_, depth_ += pv.depth_, value_ += pv.value_;
213  return *this;
214  }
215  PointValue& operator /= ( const int div )
216  {
217  time_ /= div, latitude_ /= div, longitude_ /= div, distance_ /= div, depth_ /= div, value_ /= div;
218  return *this;
219  }
220  protected:
221  double time_;
222  double latitude_;
223  double longitude_;
224  float distance_;
225  float depth_;
226  float value_;
227  };
228 
231 
233 
234  void reportPeak();
235 
236 private:
237 
238  // Note that the copy constructor below is private and not given a body.
239  // Any attempt to call it will return a compiler error.
240  PeakDetectHorizontal( const PeakDetectHorizontal& old ); // disallow copy constructor
241 
242  void initVars();
243 };
244 
245 #endif /*PEAKDETECTTHRESHOLD_H_*/
DataWriter * peakLatitudeWriter_
Definition: PeakDetectHorizontal.h:144
float depth_
Definition: PeakDetectHorizontal.h:225
float longitude_
Definition: PeakDetectHorizontal.h:153
bool readParams()
Read in the parameters for satisfied or runIfUnsatisfied: return true if OK.
Definition: PeakDetectHorizontal.cpp:300
int peakIndex_
Definition: PeakDetectHorizontal.h:161
DataReader * longitudeReader_
Reads longitude.
Definition: PeakDetectHorizontal.h:133
void set(double time, double latitude, double longitude, float distance, float depth, float value)
Definition: PeakDetectHorizontal.h:174
bool isSatisfied()
Just do the satisfied: return true if envelope "satisfied".
Definition: PeakDetectHorizontal.cpp:403
double getLongitude()
Definition: PeakDetectHorizontal.h:186
DataReader * detectInputReader_
The value being detected as a peak (i.e., chl concentration)
Definition: PeakDetectHorizontal.h:115
double longitude_
Definition: PeakDetectHorizontal.h:223
SettingReader * longitudeFromSettingReader_
Sets latitude variable associated with the peak.
Definition: PeakDetectHorizontal.h:76
A DataAccessor that reads values from the Slate Contains a default dataValue that must not be NULL...
Definition: UniversalDataReader.h:26
SettingReader * latitudeFromSettingReader_
Sets latitude variable associated with the peak.
Definition: PeakDetectHorizontal.h:73
float getDistance()
Definition: PeakDetectHorizontal.h:194
bool calcSatisfied()
Perform the satisfied: return true if envelope "satisfied".
Definition: PeakDetectHorizontal.cpp:328
DataReader * latitudeReader_
Reads latitude.
Definition: PeakDetectHorizontal.h:130
Contains the PeakDetectHorizontal Behavior.
Definition: PeakDetectHorizontal.h:30
int filterWidthSetting_
Definition: PeakDetectHorizontal.h:108
double getLatitude()
Definition: PeakDetectHorizontal.h:182
DataWriter * peakDistanceWriter_
Definition: PeakDetectHorizontal.h:146
SettingReader * detectTroughSettingReader_
Sets detectTrough (if true, detect a low value)
Definition: PeakDetectHorizontal.h:82
A DataAccessor that reads values from the Slate Contains a default dataValue that must not be NULL...
Definition: DataReader.h:30
float peakDetect_
Value of the peak when it occurs.
Definition: PeakDetectHorizontal.h:158
DataReader * distanceWrtSeaWaterReader_
Reads distance travelled with respect to sea water.
Definition: PeakDetectHorizontal.h:127
float eastwardVelocity_
Definition: PeakDetectHorizontal.h:154
Definition: PeakDetectHorizontal.h:163
SettingReader * centerPeakSettingReader_
Sets centerPeak.
Definition: PeakDetectHorizontal.h:94
SettingReader * detectFromSettingReader_
Sets variable to detect the peak of (i.e., chl concentration)
Definition: PeakDetectHorizontal.h:67
float depth_
Definition: PeakDetectHorizontal.h:150
int centerPeakSetting_
Definition: PeakDetectHorizontal.h:110
Behavior is the abstract base class for components that implement mission behaviors and commands...
Definition: Behavior.h:32
int detectTroughSetting_
Definition: PeakDetectHorizontal.h:102
int historySize_
Definition: PeakDetectHorizontal.h:232
A DataAccessor that writes values to the Slate via its associated DataElement.
Definition: DataWriter.h:27
float getDepth()
Definition: PeakDetectHorizontal.h:190
const Unit * detectFromBaseUnit_
Definition: PeakDetectHorizontal.h:98
FlexArray< PointValue * > history_
History of data.
Definition: PeakDetectHorizontal.h:230
Contains the Behavior class definition.
float latitude_
Definition: PeakDetectHorizontal.h:152
float northwardVelocity_
Definition: PeakDetectHorizontal.h:155
float getValue()
Definition: PeakDetectHorizontal.h:198
Module is the abstract base class for a collection of Component objects that can be contained in a lo...
Definition: Module.h:45
int advectValuesSetting_
Definition: PeakDetectHorizontal.h:100
void run()
Just do the run: ignore the results of the satisfied.
Definition: PeakDetectHorizontal.cpp:397
SettingReader * advectValuesSettingReader_
Sets advectValues (if true, advect values in space)
Definition: PeakDetectHorizontal.h:79
float distance_
Definition: PeakDetectHorizontal.h:151
PeakDetectHorizontal(const Str &prefix, const Module *module)
Definition: PeakDetectHorizontal.cpp:19
float beginThresholdSetting_
Definition: PeakDetectHorizontal.h:104
void reportPeak()
Definition: PeakDetectHorizontal.cpp:450
Replacement for standard template class string.
Definition: Str.h:12
DataReader * longitudeInputReader_
Reads longitude associated with value.
Definition: PeakDetectHorizontal.h:124
void initialize(void)
Initialize function.
Definition: PeakDetectHorizontal.cpp:73
float detect_
Instantaneous values.
Definition: PeakDetectHorizontal.h:149
bool inPeak_
Definition: PeakDetectHorizontal.h:160
bool differsFrom(const float depth, const float value)
Definition: PeakDetectHorizontal.h:206
void advect(const float bearing, const float distance)
Definition: PeakDetectHorizontal.h:202
SettingReader * offPeakFractionSettingReader_
Sets offPeakFraction.
Definition: PeakDetectHorizontal.h:88
DataReader * latitudeInputReader_
Reads latitude associated with value.
Definition: PeakDetectHorizontal.h:121
DataWriter * peakLongitudeWriter_
Definition: PeakDetectHorizontal.h:145
double getTime()
Definition: PeakDetectHorizontal.h:178
float value_
Definition: PeakDetectHorizontal.h:226
DataReader * eastwardSeaWaterVelocityReader_
Reads eastward sea water velocity.
Definition: PeakDetectHorizontal.h:136
DataReader * depthInputReader_
Reads depth associated with value.
Definition: PeakDetectHorizontal.h:118
DataWriter * peakDetectWriter_
Definition: PeakDetectHorizontal.h:142
PointValue & operator/=(const int div)
Definition: PeakDetectHorizontal.h:215
void uninitialize(void)
Uninit function.
Definition: PeakDetectHorizontal.cpp:440
SettingReader * beginThresholdSettingReader_
Sets beginThreshold.
Definition: PeakDetectHorizontal.h:85
Reads values from mission settings.
Definition: SettingReader.h:26
SettingReader * filterWidthSettingReader_
Sets filterWidth.
Definition: PeakDetectHorizontal.h:91
double latitude_
Definition: PeakDetectHorizontal.h:222
Simple class providing a flexible size array of pointers.
Definition: DataReader.h:19
float offPeakFractionSetting_
Definition: PeakDetectHorizontal.h:106
static Behavior * CreateBehavior(const Str &prefix, const Module *module)
Mission Component factory interface.
Definition: PeakDetectHorizontal.cpp:530
double time_
Definition: PeakDetectHorizontal.h:221
static void AtBearing(const float bearing, const float distance, double &lat, double &lon)
Definition: Location.cpp:348
Wraps a pair of double precision (8-byte) floating point numbers and units for storage in a DataEleme...
Definition: Location.h:38
bool runIfUnsatisfied()
Do the run, and return true if envelope "satisfied".
Definition: PeakDetectHorizontal.cpp:415
virtual ~PeakDetectHorizontal()
Definition: PeakDetectHorizontal.cpp:69
Contains the Location class definition.
SettingReader * depthFromSettingReader_
Sets depth variable associated with the peak.
Definition: PeakDetectHorizontal.h:70
Code that represents an engineering unit.
Definition: Unit.h:24
PointValue(double init)
Definition: PeakDetectHorizontal.h:166
float distance_
Definition: PeakDetectHorizontal.h:224
PointValue & operator+=(const PointValue &pv)
Definition: PeakDetectHorizontal.h:210
DataReader * northwardSeaWaterVelocityReader_
Reads northward sea water velocity.
Definition: PeakDetectHorizontal.h:139
DataWriter * peakDepthWriter_
Definition: PeakDetectHorizontal.h:143