nidas  v1.2-1520
CSAT3_Sonic.h
Go to the documentation of this file.
1 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 4; tab-width: 4; -*-
2 // vim: set shiftwidth=4 softtabstop=4 expandtab:
3 /*
4  ********************************************************************
5  ** NIDAS: NCAR In-situ Data Acquistion Software
6  **
7  ** 2006, Copyright University Corporation for Atmospheric Research
8  **
9  ** This program is free software; you can redistribute it and/or modify
10  ** it under the terms of the GNU General Public License as published by
11  ** the Free Software Foundation; either version 2 of the License, or
12  ** (at your option) any later version.
13  **
14  ** This program is distributed in the hope that it will be useful,
15  ** but WITHOUT ANY WARRANTY; without even the implied warranty of
16  ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  ** GNU General Public License for more details.
18  **
19  ** The LICENSE.txt file accompanying this software contains
20  ** a copy of the GNU General Public License. If it is not found,
21  ** write to the Free Software Foundation, Inc.,
22  ** 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23  **
24  ********************************************************************
25 */
26 
27 #ifndef NIDAS_DYNLD_ISFF_CSAT3_SONIC_H
28 #define NIDAS_DYNLD_ISFF_CSAT3_SONIC_H
29 
30 #include "Wind3D.h"
31 #include "CS_Krypton.h"
32 
33 class TimetagAdjuster;
34 
35 namespace nidas { namespace dynld { namespace isff {
36 
45 class CSAT3_Sonic: public Wind3D
46 {
47 public:
48 
49  CSAT3_Sonic();
50 
51  ~CSAT3_Sonic();
52 
67  void open(int flags) throw(nidas::util::IOException,
69 
74  float correctTcForPathCurvature(float tc,
75  float u, float v, float w);
76 
77  bool process(const Sample* samp,std::list<const Sample*>& results)
78  throw();
79 
81 
101  static const float GAMMA_R;
102 
106  std::string getSerialNumber(const std::string& str,
107  std::string::size_type & index );
108 
109 protected:
110 
111  void checkSampleTags() throw(nidas::util::InvalidParameterException);
112 
113 private:
114 
118  bool terminalMode() throw(nidas::util::IOException);
119 
123  bool dataMode() throw(nidas::util::IOException);
124 
139  std::string querySonic(int& acqrate, char& osc, std::string& serialNumber,
140  std::string& revsion, int& rtsIndep, int& recSep)
141  throw(nidas::util::IOException);
142 
143  const char* getRateCommand(int rate,bool overSample) const;
144 
145  std::string sendRateCommand(const char* cmd)
146  throw(nidas::util::IOException);
147 
151  size_t _windInLen;
152 
157  size_t _totalInLen;
158 
163 
169 
174 
179 
181 
182  int _nttsave;
183 
184  int _counter;
185 
186  std::vector<short> _swapBuf;
187 
188  int _rate;
189 
191 
192  std::string _serialNumber;
193 
194  std::string _sonicLogFile;
195 
204 
209 
215 
221 
227 
234 
236 
240  CSAT3_Sonic(const CSAT3_Sonic&);
241 
245  CSAT3_Sonic& operator=(const CSAT3_Sonic&);
246 };
247 
248 }}} // namespace nidas namespace dynld namespace isff
249 
250 #endif
void parseParameters()
Parse the list of nidas::core::Parameter that are associated with this sensor.
Definition: CSAT3_Sonic.cc:773
A class for performing the common processes on wind data from a 3D sonic anemometer.
Definition: Wind3D.h:49
bool terminalMode()
Definition: CSAT3_Sonic.cc:537
std::vector< short > _swapBuf
Definition: CSAT3_Sonic.h:186
unsigned int dsm_sample_id_t
Definition: Sample.h:63
bool _checkConfiguration
Whether to log the sonic parameters and set the rate in the open method.
Definition: CSAT3_Sonic.h:226
dsm_time_t _ttlast
Last time tag.
Definition: CSAT3_Sonic.h:208
long long dsm_time_t
Posix time in microseconds, the number of non-leap microseconds since 1970 Jan 1 00:00 UTC...
Definition: Sample.h:61
bool process(const Sample *samp, std::list< const Sample * > &results)
Process a raw sample, which in this case means do a sscanf on the character string contents...
Definition: CSAT3_Sonic.cc:590
int _consecutiveOpenFailures
Counter of how many times a open fails because it could&#39;t query the sonic serial number, and then get recognizable samples.
Definition: CSAT3_Sonic.h:220
void open(int flags)
Open the serial port connected to this sonic.
Definition: CSAT3_Sonic.cc:359
Adjust time tags of fixed delta-T time series to correct for irregular latency in the assignments of ...
Definition: TimetagAdjuster.h:45
float correctTcForPathCurvature(float tc, float u, float v, float w)
No correction for path curvature is needed on the CSAT, so this method just returns an unchanged tc...
Definition: CSAT3_Sonic.cc:583
A class for making sense of data from a Campbell Scientific Inc CSAT3 3D sonic anemometer.
Definition: CSAT3_Sonic.h:45
void checkSampleTags()
Check the SampleTags that are defined for this sensor.
Definition: CSAT3_Sonic.cc:825
std::string getSerialNumber(const std::string &str, std::string::size_type &index)
Get serial number field and its index in &quot;??&quot; query output.
Definition: CSAT3_Sonic.cc:141
bool _nanIfDiag
Set winds and virtual temperature to NaN if diagnostic value is non-zero?
Definition: CSAT3_Sonic.h:214
CSAT3_Sonic()
Definition: CSAT3_Sonic.cc:52
static const float GAMMA_R
Conversion factor from speed of sound squared to Kelvin.
Definition: CSAT3_Sonic.h:101
int _spikeIndex
If user requests despike variables, e.g.
Definition: CSAT3_Sonic.h:168
dsm_sample_id_t _windSampleId
Output sample id of the wind sample.
Definition: CSAT3_Sonic.h:173
nidas::core::TimetagAdjuster * _ttadjuster
Definition: CSAT3_Sonic.h:235
std::string querySonic(int &acqrate, char &osc, std::string &serialNumber, std::string &revsion, int &rtsIndep, int &recSep)
Send a &quot;??CR&quot; string, and read the response, parsing out the acquisition rate, osc parameter...
Definition: CSAT3_Sonic.cc:163
std::string sendRateCommand(const char *cmd)
Definition: CSAT3_Sonic.cc:297
int _gapDtUsecs
This is a limit for the inter-sample delta-T.
Definition: CSAT3_Sonic.h:203
~CSAT3_Sonic()
Definition: CSAT3_Sonic.cc:76
int _counter
Definition: CSAT3_Sonic.h:184
Interface to a data sample.
Definition: Sample.h:189
std::vector< SampleTag * > _extraSampleTags
Sample tags of extra &quot;serializer&quot; values.
Definition: CSAT3_Sonic.h:178
std::string _serialNumber
Definition: CSAT3_Sonic.h:192
static float rate
Definition: sing.cc:53
int _nttsave
Definition: CSAT3_Sonic.h:182
bool dataMode()
Definition: CSAT3_Sonic.cc:84
Definition: IOException.h:37
size_t _windInLen
expected input sample length of basic CSAT3 record.
Definition: CSAT3_Sonic.h:151
Class describing a group of variables that are sampled and handled together.
Definition: SampleTag.h:87
dsm_time_t _timetags[2]
Definition: CSAT3_Sonic.h:180
bool _oversample
Definition: CSAT3_Sonic.h:190
int _rate
Definition: CSAT3_Sonic.h:188
int _windNumOut
Requested number of output wind variables.
Definition: CSAT3_Sonic.h:162
bool _checkCounter
Whether to check the counter in the data samples in order to detect missing samples.
Definition: CSAT3_Sonic.h:233
size_t _totalInLen
expected input sample length of basic CSAT3 record, with any additional fields added by NCAR/EOL &quot;ser...
Definition: CSAT3_Sonic.h:157
const char * getRateCommand(int rate, bool overSample) const
Definition: CSAT3_Sonic.cc:326
std::string _sonicLogFile
Definition: CSAT3_Sonic.h:194
Definition: InvalidParameterException.h:35