LRAUV  revA
CBIT.h
Go to the documentation of this file.
1 
12 #ifndef CBIT_H_
13 #define CBIT_H_
14 
17 #include "io/LPC3Reg.h"
18 #include "io/AnalogToDigital.h"
21 
22 #define NUM_BATTSA Batt_Ocean_ServerIF::NUM_BATTSA
23 #define NUM_BATTSB Batt_Ocean_ServerIF::NUM_BATTSB
24 
27 
38 class CBIT : public SyncTestComponent
39 {
40 public:
41 
42  CBIT( const Module* module );
43 
44  virtual ~CBIT();
45 
47  void initialize( void );
48 
50  void run();
51 
53  void uninitialize( void );
54 
56  virtual ConfigURI getConfigURI( ConfigOption configOption ) const;
57 
58 protected:
59 
60  // Slate input setting variables
61 
64 
67 
68  // For Onboard pressure/humidity and other components
75 
83 
84 
85  // Slate output variables
86 
89 
92 
93  // State of shore power - True == ON False == OFF
95 
97 
98  // Ground fault current
105 
106  // Emperical Fault Classifier writers
110 
111  // Configuration Readers
112  ConfigReader* abortDepthCfgReader_; // Depth at which we drop the weight. Should be greater than all depth envelopes
113  ConfigReader* stopDepthCfgReader_; // Depth at which we stop the mission. Should be greater than all depth envelopes and less than abort depth
115  ConfigReader* pressureThresholdCfgReader_; // Onboard pressure must measure greater than this offset from 1 ATM
116  ConfigReader* tempThresholdCfgReader_; // Only need to use kelvin for temperature deltas
118  ConfigReader* abortDepthTimeoutCfgReader_; // If this time has elapsed and we're still below abort depth, drop the weight, end the mission.
119  ConfigReader* battFailReportCfgReader_; // Report main battery failover at this multiple
120  ConfigReader* envTimeoutCfgReader_; // If this time has elapsed and pressure or humidity are still above threshold, end the mission.
121  ConfigReader* faultClassifierCfgReader_; // Runs the empirical fault classifier as part of CBIT if true
122  ConfigReader* elevOffsetCalcCfgReader_; // Runs the empirical fault classifier's elevator offset calculator as part of CBIT if true
123  ConfigReader* battTempThresholdCfgReader_; // The allowable threshold for battery temperature
124  ConfigReader* gfChan0ThresholdCfgReader_; // Current above baseline that triggers a ground fault
125  ConfigReader* gfChan1ThresholdCfgReader_; // Current above baseline that triggers a ground fault
126  ConfigReader* gfChan2ThresholdCfgReader_; // Current above baseline that triggers a ground fault
127  ConfigReader* gfChan4ThresholdCfgReader_; // Current above baseline that triggers a ground fault
128  ConfigReader* gfChan5ThresholdCfgReader_; // Current above baseline that triggers a ground fault
129  ConfigReader* gfScanTimeoutCfgReader_; // How often to scan for ground faults
130 
131 private:
132  // Note that the copy constructor below is private and not given a body.
133  // Any attempt to call it will return a compiler error.
134  CBIT( const CBIT& old ); // disallow copy constructor
135 
136  friend class IBIT;
137  friend class SBIT;
138 
139  // Is the WDT initialized properly?
141 
142  // Runs the empirical fault classifier to detect anomolies
143  // in vertical control
144  void empiricalFaultClassification( void );
145 
146  // initialize vehicle config variables
147  bool readConfig( void );
148 
149  // WDT and heartbeat
150  void assertVitals( void );
151 
152  void checkBackplanePower( void );
153  void checkCriticals( void );
154  void checkDepth( void );
155 
156  void checkLeak( void );
157  // Makes sure location is real
158  void checkLocation( void );
159  void checkMainBattery( void );
160  void handleComponentFaults( void );
161  void monitorBatteryTemps( void );
162  void monitorCFCard( void );
163  void monitorEnvironmentals( void );
164  void monitorShorePower( void );
165 
166  // initiate GF scanning
167  void scanGFChan( void );
168 
169  // Makes the appropriate log entry
170  void reportGFFault( Str faultTxt );
171 
172  // Allows access to set timeout
173  static void SetGFScanForce( bool forceVal );
174 
175 
176  // Holds the time of when abort/stop depth was reached
180 
181  // Holds the time of when environmental (pressure, humidity) failure was detected
184 
185  // Holds the time of when battery threshold failure was detected
188 
189  // Holds the time of when GF scanning was started
193  static bool GFScanForce_; // Used to force a scan immediately
194 
195  // Holds the time of when location was last checked to exist
198  bool nanLocationActive_; // True if location has been detected as nan
200 
201  // Are we using hardware?
203 
204  // True if we have reached abort depth and are taking action
207 
208  // True if we have reached stop depth and are taking action
211 
212 
213  // True if we have detected water and have taken action
215 
216  // Variable is incremented each time water is detected, and decremented until 0 each time there isn't water detected.
218 
219  // True if we have detected a main battery failure and are taking action
221 
222  // True if we have detected a load control backplane power loss and can't restore power.
224 
225  // Number of times battery fail signal has been detected not-asserted->asserted
227 
228  // Multiple of failures at which to report the battery failures to the user (e.g. 10 reports the first and every multiple of 10x after).
230 
231  // True if we have detected an over threshold value for humidity or pressure
234 
235  // True if we have detected an over threshold value for battery data
237 
238  // For storing "baseline" environmental data
240  float samples_;
241 
242  // True if the CF card is missing and we are taking action
244 
245  // indicates a GF scan is ongoing
247 
248  // indicates a GF fault has already been reported
250 
251 
252  typedef enum
253  {
254  CHAN_5_SCAN, // Activate and read chan 5 - 0
261  CALCULATE, // Determine GF and write values
262  } GFSequence;
263 
265 
267 
268  // Channel to read GF value
270 
271  // Holds the time of when last fault classifier debug messege was published
276 
277  // EFC
285 
286  // EOM
290 
291 
292 
294 
295  struct BattPack
296  {
297  // Constructor
298  BattPack();
299 
300  // The battery voltage
301  float voltage_;
303 
304  // The battery current
305  float current_;
307 
308  // The battery temp
309  float temp_;
311  };
312 
314  // Array to store the battery packs and their associated writers
316 
317 
319  float abortDepth_;
320  float stopDepth_;
328 
329 };
330 
331 #endif /*CBIT_H_*/
DataReader * battCurrentReader_
Definition: CBIT.h:306
int elevOffsetCounter_
Definition: CBIT.h:287
GFChan
Ground fault channel definitions.
Definition: LPC3Reg.h:243
void initialize(void)
Initialize function.
Definition: CBIT.cpp:154
DataWriter * binnedDepthRateWriter_
Definition: CBIT.h:108
bool cfMissing_
Definition: CBIT.h:243
float samples_
Definition: CBIT.h:240
double bitTempThreshold_
Definition: CBIT.h:323
float empiricalFaultBinSum_
Definition: CBIT.h:279
Contains the SyncComponent class definition.
Timestamp gfStartTime_
Definition: CBIT.h:190
ConfigReader * gfChan5ThresholdCfgReader_
Definition: CBIT.h:128
void monitorBatteryTemps(void)
Definition: CBIT.cpp:867
bool battThresholdFailed_
Definition: CBIT.h:236
void monitorCFCard(void)
Definition: CBIT.cpp:905
ConfigReader * gfScanTimeoutCfgReader_
Definition: CBIT.h:129
A DataAccessor that reads values from the Slate Contains a default dataValue that must not be NULL...
Definition: UniversalDataReader.h:26
void checkMainBattery(void)
Definition: CBIT.cpp:535
DataReader * speedCmdReader_
Definition: CBIT.h:72
float gfChan5Threshold_
Definition: CBIT.h:326
float gfChan4Threshold_
Definition: CBIT.h:326
bool stopDepthActive_
Definition: CBIT.h:209
bool cbitVehicleOpen_
Definition: CBIT.h:325
DataWriter * gfChan4CurrentWriter_
Definition: CBIT.h:102
DataWriter * gfChan2CurrentWriter_
Definition: CBIT.h:101
DataWriter * gfScanActiveWriter_
Definition: CBIT.h:96
bool nanLocationActive_
Definition: CBIT.h:198
void scanGFChan(void)
Definition: CBIT.cpp:989
A DataAccessor that reads values from the Slate Contains a default dataValue that must not be NULL...
Definition: DataReader.h:30
BattPack battPacks_[NUM_BATTSA+NUM_BATTSB]
Definition: CBIT.h:315
UniversalDataReader * elevatorAngleReader_
Definition: CBIT.h:79
LPC3Reg::GFChan gfChan_
Definition: CBIT.h:266
UniversalDataReader * pitchReader_
Definition: CBIT.h:82
Timestamp debugEFCTimestamp_
Definition: CBIT.h:272
A DataAccessor that writes values to the Slate via its associated DataElement.
Definition: UniversalDataWriter.h:24
Specifies the interface details for the VerticalControl component in the ControlModule.
void uninitialize(void)
Uninit function.
Definition: CBIT.cpp:313
bool runFaultClassifier_
Definition: CBIT.h:274
Timestamp locationCheckStartTime_
Definition: CBIT.h:196
double bitPressureThreshold_
Definition: CBIT.h:322
float gfChan0Threshold_
Definition: CBIT.h:326
virtual ~CBIT()
Definition: CBIT.cpp:149
float gfCurrent3_
Definition: CBIT.h:293
DataWriter * shorepowerWriter_
Definition: CBIT.h:94
double empiricalFaultDepth_
Definition: CBIT.h:282
DataReader * temperatureReader_
Definition: CBIT.h:71
Contains the ComponentRegistry class declaration.
DataReader * battTempReader_
Definition: CBIT.h:310
float gfChan2Threshold_
Definition: CBIT.h:326
Definition: CBIT.h:261
Contains the AnalogToDigital class declaration.
int battFailReport_
Definition: CBIT.h:229
DataReader * empiricalFaultElevOffsetReader_
Definition: CBIT.h:74
ConfigReader * abortDepthTimeoutCfgReader_
Definition: CBIT.h:118
Timespan class, represents a delta of time.
Definition: Timestamp.h:248
bool wdtInitialized_
Definition: CBIT.h:140
ConfigReader * gfChan0ThresholdCfgReader_
Definition: CBIT.h:124
float gfCurrent5_
Definition: CBIT.h:293
GFSequence
Definition: CBIT.h:252
bool gfScanInProgress_
Definition: CBIT.h:246
int waterDetectionCount_
Definition: CBIT.h:217
void run()
The actual "payload" of the component.
Definition: CBIT.cpp:263
GFSequence gfScan_
Definition: CBIT.h:264
DataReader * tmpTempReader_
Definition: CBIT.h:313
UniversalDataReader * depthRateReader_
Definition: CBIT.h:78
float empiricalFaultEleTmp_
Definition: CBIT.h:280
void monitorEnvironmentals(void)
Definition: CBIT.cpp:923
bool abortDepthActive_
Definition: CBIT.h:205
float gfChan1Threshold_
Definition: CBIT.h:326
Timestamp empiricalFaultTimestamp_
Definition: CBIT.h:284
A DataAccessor that writes values to the Slate via its associated DataElement.
Definition: DataWriter.h:27
Definition: ElementURI.h:166
void empiricalFaultClassification(void)
Definition: CBIT.cpp:561
Timestamp envFailStartTime_
Definition: CBIT.h:182
ConfigReader * envTimeoutCfgReader_
Definition: CBIT.h:120
BattPack()
Definition: CBIT.cpp:1201
bool readConfig(void)
Definition: CBIT.cpp:221
void checkBackplanePower(void)
Definition: CBIT.cpp:367
static void SetGFScanForce(bool forceVal)
Definition: CBIT.cpp:1194
Definition: CBIT.h:257
void assertVitals(void)
Definition: CBIT.cpp:346
int empiricalFaultCounter_
Definition: CBIT.h:278
float gfCurrent4_
Definition: CBIT.h:293
Definition: CBIT.h:259
void reportGFFault(Str faultTxt)
Definition: CBIT.cpp:1184
UniversalDataWriter * faultWriter_
Sets the generic fault flag.
Definition: CBIT.h:88
void checkLocation(void)
Definition: CBIT.cpp:503
Timestamp battThresholdFailStartTime_
Definition: CBIT.h:186
ConfigReader * elevOffsetCalcCfgReader_
Definition: CBIT.h:122
ConfigReader * faultClassifierCfgReader_
Definition: CBIT.h:121
Timespan gfScanTimeout_
Definition: CBIT.h:191
Abstract Base class for components that run towards the end of the computation cycle, evaluating how well everything performed.
Definition: SyncComponent.h:264
float stopDepth_
Definition: CBIT.h:320
Module is the abstract base class for a collection of Component objects that can be contained in a lo...
Definition: Module.h:45
DataWriter * gfChan5CurrentWriter_
Definition: CBIT.h:103
ConfigReader * battFailReportCfgReader_
Definition: CBIT.h:119
float elevOffsetEleTmp_
Definition: CBIT.h:289
This class allows one to control loads on a load controller channel.
Definition: AnalogToDigital.h:22
Timestamp abortStartTime_
Definition: CBIT.h:177
int empiricalFaultPositiveFlagCount_
Definition: CBIT.h:283
void checkDepth(void)
Definition: CBIT.cpp:412
Replacement for standard template class string.
Definition: Str.h:12
UniversalDataWriter * leakFaultWriter_
Sets the leak fault flag.
Definition: CBIT.h:91
float current_
Definition: CBIT.h:305
float gfCurrent2_
Definition: CBIT.h:293
Timespan gfChanSetupTimeout_
Definition: CBIT.h:192
Definition: CBIT.h:295
The SBIT built-in-test component provides monitoring of vehicle health at startup.
Definition: SBIT.h:31
bool envExcursionFault_
Definition: CBIT.h:233
UniversalDataReader * depthReader_
Platform depth, lat/lon.
Definition: CBIT.h:77
Timespan locationCheckTimeout_
Definition: CBIT.h:197
float empiricalFaultPitchTmp_
Definition: CBIT.h:281
Specifies the interface details for the Batt_Ocean_Server component in the SensorModule.
ConfigReader * stopDepthCfgReader_
Definition: CBIT.h:113
ConfigReader * abortDepthCfgReader_
Definition: CBIT.h:112
float gfCurrent1_
Definition: CBIT.h:293
ConfigReader * tempThresholdCfgReader_
Definition: CBIT.h:116
Definition: ConfigReader.h:13
Timespan envFailTimeout_
Definition: CBIT.h:183
ConfigReader * humidityThresholdCfgReader_
Definition: CBIT.h:114
bool previouslyBelowStop_
Definition: CBIT.h:210
virtual ConfigURI getConfigURI(ConfigOption configOption) const
Should return [myNamespace]::SIMULATE_HARDWARE, or [myNamespace]::POWER, etc.
Definition: CBIT.cpp:340
Definition: CBIT.h:256
DataReader * humidityReader_
Definition: CBIT.h:70
DataReader * clearLeakFaultCmdReader_
When true (non-zero), clears the leak fault flag.
Definition: CBIT.h:66
ConfigReader * gfChan4ThresholdCfgReader_
Definition: CBIT.h:127
bool runElevOffsetCalc_
Definition: CBIT.h:275
UniversalDataReader * latitudeReader_
Definition: CBIT.h:80
bool clearCounterEOM_
Definition: CBIT.h:288
void checkLeak(void)
Definition: CBIT.cpp:469
DataWriter * empiricalFaultElevOffsetWriter_
Definition: CBIT.h:109
Timespan battThresholdFailTimeout_
Definition: CBIT.h:187
float temp_
Definition: CBIT.h:309
DataReader * verticalModeReader_
Definition: CBIT.h:73
The IBIT built-in-test component provides monitoring of vehicle health on demand. ...
Definition: IBIT.h:31
DataReader * battVoltageReader_
Definition: CBIT.h:302
#define NUM_BATTSA
Definition: CBIT.h:22
bool previouslyBelowAbort_
Definition: CBIT.h:206
ConfigReader * gfChan1ThresholdCfgReader_
Definition: CBIT.h:125
DataWriter * gfChanOpenCurrentWriter_
Definition: CBIT.h:104
float gfCurrent0_
Definition: CBIT.h:293
static bool GFScanForce_
Definition: CBIT.h:193
DataWriter * empericalFaultDetectedWriter_
Definition: CBIT.h:107
bool envFailed_
Definition: CBIT.h:232
Contains the LPC3Reg class declaration.
Timespan debugEFCTimeout_
Definition: CBIT.h:273
double bitHumidityThreshold_
Definition: CBIT.h:321
Definition: CBIT.h:254
ConfigReader * pressureThresholdCfgReader_
Definition: CBIT.h:115
CBIT(const Module *module)
Definition: CBIT.cpp:31
Definition: CBIT.h:255
float avgHumidity_
Definition: CBIT.h:239
Timespan abortDepthTimeout_
Definition: CBIT.h:179
DataWriter * gfChan1CurrentWriter_
Definition: CBIT.h:100
double battTempThreshold_
Definition: CBIT.h:324
DataWriter * gfChan0CurrentWriter_
Definition: CBIT.h:99
int battFailCounts_
Definition: CBIT.h:226
bool waterDetectedCriticalSet_
Definition: CBIT.h:214
bool gfReported_
Definition: CBIT.h:249
void checkCriticals(void)
Definition: CBIT.cpp:398
Definition: CBIT.h:258
ConfigReader * battTempThresholdCfgReader_
Definition: CBIT.h:123
ConfigOption
Definition: Component.h:456
Timestamp stopDepthStartTime_
Definition: CBIT.h:178
bool batteryFailed_
Definition: CBIT.h:220
DataReader * clearFaultCmdReader_
When true (non-zero), clears the generic fault flag.
Definition: CBIT.h:63
bool nanLocationReported_
Definition: CBIT.h:199
bool backplaneFailed_
Definition: CBIT.h:223
DataReader * pressureReader_
Definition: CBIT.h:69
void handleComponentFaults(void)
Definition: CBIT.cpp:788
ConfigReader * gfChan2ThresholdCfgReader_
Definition: CBIT.h:126
#define NUM_BATTSB
Definition: CBIT.h:23
AnalogToDigital adGFCurrent_
Definition: CBIT.h:269
float gfCurrentOpen_
Definition: CBIT.h:293
float abortDepth_
*----------------— vehicle parameters -----------------------—*/
Definition: CBIT.h:319
float voltage_
Definition: CBIT.h:301
bool useHardware_
Definition: CBIT.h:202
void monitorShorePower(void)
Definition: CBIT.cpp:975
Represents absolute times.
Definition: Timestamp.h:31
UniversalDataReader * longitudeReader_
Definition: CBIT.h:81
The CBIT built-in-test (CBIT) component provides monitoring of vehicle health during a mission...
Definition: CBIT.h:38
ConfigReader * vehicleOpenCfgReader_
Definition: CBIT.h:117
Definition: CBIT.h:260