nidas v1.2.3
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
33class TimetagAdjuster;
34
35namespace nidas { namespace dynld { namespace isff {
36
45class CSAT3_Sonic: public Wind3D
46{
47public:
48
50
52
67 void open(int flags);
68
73 float correctTcForPathCurvature(float tc,
74 float u, float v, float w);
75
76 bool process(const Sample* samp,std::list<const Sample*>& results);
77
78 void parseParameters();
79
99 static const float GAMMA_R;
100
104 std::string getSerialNumber(const std::string& str,
105 std::string::size_type & index );
106
107protected:
108
109 void checkSampleTags();
110
111private:
112
116 bool terminalMode();
117
121 bool dataMode();
122
137 std::string querySonic(int& acqrate, char& osc, std::string& serialNumber,
138 std::string& revsion, int& rtsIndep, int& recSep);
139
140 const char* getRateCommand(int rate,bool overSample) const;
141
142 std::string sendRateCommand(const char* cmd);
143
148
154
159
165
170
174 std::vector<SampleTag*> _extraSampleTags;
175
177
179
181
182 std::vector<short> _swapBuf;
183
184 int _rate;
185
187
188 std::string _serialNumber;
189
190 std::string _sonicLogFile;
191
200
205
211
217
223
230
232
237
242};
243
244}}} // namespace nidas namespace dynld namespace isff
245
246#endif
Interface to a data sample.
Definition Sample.h:190
Adjust time tags of fixed delta-T time series to correct for irregular latency in the assignments of ...
Definition TimetagAdjuster.h:45
A class for making sense of data from a Campbell Scientific Inc CSAT3 3D sonic anemometer.
Definition CSAT3_Sonic.h:46
static const float GAMMA_R
Conversion factor from speed of sound squared to Kelvin.
Definition CSAT3_Sonic.h:99
bool dataMode()
Definition CSAT3_Sonic.cc:84
size_t _windInLen
expected input sample length of basic CSAT3 record.
Definition CSAT3_Sonic.h:147
nidas::core::TimetagAdjuster * _ttadjuster
Definition CSAT3_Sonic.h:231
std::string getSerialNumber(const std::string &str, std::string::size_type &index)
Get serial number field and its index in "??" query output.
Definition CSAT3_Sonic.cc:141
std::string _sonicLogFile
Definition CSAT3_Sonic.h:190
int _nttsave
Definition CSAT3_Sonic.h:178
~CSAT3_Sonic()
Definition CSAT3_Sonic.cc:76
dsm_time_t _ttlast
Last time tag.
Definition CSAT3_Sonic.h:204
CSAT3_Sonic & operator=(const CSAT3_Sonic &)
No assignment.
const char * getRateCommand(int rate, bool overSample) const
Definition CSAT3_Sonic.cc:324
bool _checkCounter
Whether to check the counter in the data samples in order to detect missing samples.
Definition CSAT3_Sonic.h:229
std::vector< SampleTag * > _extraSampleTags
Sample tags of extra "serializer" values.
Definition CSAT3_Sonic.h:174
bool _oversample
Definition CSAT3_Sonic.h:186
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:587
std::string _serialNumber
Definition CSAT3_Sonic.h:188
std::vector< short > _swapBuf
Definition CSAT3_Sonic.h:182
bool _nanIfDiag
Set winds and virtual temperature to NaN if diagnostic value is non-zero?
Definition CSAT3_Sonic.h:210
std::string sendRateCommand(const char *cmd)
Definition CSAT3_Sonic.cc:296
dsm_time_t _timetags[2]
Definition CSAT3_Sonic.h:176
int _rate
Definition CSAT3_Sonic.h:184
bool _checkConfiguration
Whether to log the sonic parameters and set the rate in the open method.
Definition CSAT3_Sonic.h:222
std::string querySonic(int &acqrate, char &osc, std::string &serialNumber, std::string &revsion, int &rtsIndep, int &recSep)
Send a "??CR" string, and read the response, parsing out the acquisition rate, osc parameter,...
Definition CSAT3_Sonic.cc:163
int _windNumOut
Requested number of output wind variables.
Definition CSAT3_Sonic.h:158
void parseParameters()
Parse the list of nidas::core::Parameter that are associated with this sensor.
Definition CSAT3_Sonic.cc:769
void open(int flags)
Open the serial port connected to this sonic.
Definition CSAT3_Sonic.cc:357
CSAT3_Sonic()
Definition CSAT3_Sonic.cc:52
int _consecutiveOpenFailures
Counter of how many times a open fails because it could't query the sonic serial number,...
Definition CSAT3_Sonic.h:216
int _spikeIndex
If user requests despike variables, e.g.
Definition CSAT3_Sonic.h:164
CSAT3_Sonic(const CSAT3_Sonic &)
No copying.
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:580
bool terminalMode()
Definition CSAT3_Sonic.cc:534
dsm_sample_id_t _windSampleId
Output sample id of the wind sample.
Definition CSAT3_Sonic.h:169
int _counter
Definition CSAT3_Sonic.h:180
int _gapDtUsecs
This is a limit for the inter-sample delta-T.
Definition CSAT3_Sonic.h:199
size_t _totalInLen
expected input sample length of basic CSAT3 record, with any additional fields added by NCAR/EOL "ser...
Definition CSAT3_Sonic.h:153
void checkSampleTags()
Check the SampleTags that are defined for this sensor.
Definition CSAT3_Sonic.cc:821
A class for performing the common processes on wind data from a 3D sonic anemometer.
Definition Wind3D.h:50
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:62
unsigned int dsm_sample_id_t
Definition Sample.h:64
Root namespace for the NCAR In-Situ Data Acquisition Software.
Definition A2DConverter.h:31
static float rate
Definition sing.cc:53