nidas v1.2.3
DSMAnalogSensor.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 ** 2004, 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#ifndef NIDAS_DYNLD_RAF_DSMANALOGSENSOR_H
27#define NIDAS_DYNLD_RAF_DSMANALOGSENSOR_H
28
33
34namespace nidas { namespace dynld { namespace raf {
35
36using namespace nidas::core;
37
41class DSMAnalogSensor : public A2DSensor {
42
43public:
44
47
52
57
64 void open(int flags);
65
71 void close();
72
78 void init();
79
80 void printStatus(std::ostream& ostr) throw();
81
83
87 void setGainBipolar(int ichan, int gain, int bipolar);
88
89 void getDefaultConversion(int ichan, float& intercept, float& slope) const;
90
94 void setConversionCorrection(int ichan, float corIntercept, float corSlope);
95
101 bool process(const Sample*,std::list<const Sample*>& result)
102 throw();
103
107 void validate();
108
114 float getTemp();
115
117 {
118 return USECS_PER_MSEC;
119 }
120
121 void executeXmlRpc(XmlRpc::XmlRpcValue& params, XmlRpc::XmlRpcValue& result)
122 throw();
123
124 void getA2DSetup(XmlRpc::XmlRpcValue& params, XmlRpc::XmlRpcValue& result)
125 throw();
126
127 void testVoltage(XmlRpc::XmlRpcValue& params, XmlRpc::XmlRpcValue& result)
128 throw();
129
135 {
136 return _initialConverter;
137 }
138
146 {
147 return _finalConverter;
148 }
149
150protected:
151
153
155
156 bool processTemperature(const Sample*, std::list<const Sample*>& result) throw();
157
167 int readFilterFile(const std::string& name,unsigned short* coefs,
168 int nexpect);
169
174
180
186
190 static const float DEGC_PER_CNT;
192
199 float voltageActual(float voltageMeasured);
200
201 inline float SecondPoly(float x, const float c[]) const
202 { return(c[0] + x * (c[1] + x * c[2])); }
203
209
214 static const int N_COEFF = 3;
215
220 static const int N_G4_VDC = 9;
221
227
233
234private:
235
238
241
242};
243
244}}} // namespace nidas namespace dynld namespace raf
245
246#endif
Virtual class with methods for performing conversions from integer A2D counts to floating point volta...
Definition A2DConverter.h:61
An interface to an IO device.
Definition IODevice.h:42
A scanner of sample data.
Definition SampleScanner.h:74
Class describing a group of variables that are sampled and handled together.
Definition SampleTag.h:88
Interface to a data sample.
Definition Sample.h:190
Virtual base class for supporting sensors attached to an A2D.
Definition A2DSensor.h:46
Support for the PC104 A2D, developed at NCAR EOL.
Definition DSMAnalogSensor.h:41
void getA2DSetup(XmlRpc::XmlRpcValue &params, XmlRpc::XmlRpcValue &result)
Definition DSMAnalogSensor.cc:594
static const int N_COEFF
How many different Voltages were measured at each temperature in the chamber.
Definition DSMAnalogSensor.h:214
int getInt32TimeTagUsecs() const
Definition DSMAnalogSensor.h:116
float voltageActual(float voltageMeasured)
Given a measured voltage and using the A/D temperature, perform a lookup using two dimentional interp...
Definition DSMAnalogSensor.cc:510
void init()
Called prior to any call to process().
Definition DSMAnalogSensor.cc:202
A2DConverter * _finalConverter
Definition DSMAnalogSensor.h:154
bool processTemperature(const Sample *, std::list< const Sample * > &result)
Definition DSMAnalogSensor.cc:376
void close()
Close the device connected to the sensor.
Definition DSMAnalogSensor.cc:197
float _currentTemperature
Capture the current A/D board temperature, so we can do a temperature drift compensation to all the r...
Definition DSMAnalogSensor.h:208
void setConversionCorrection(int ichan, float corIntercept, float corSlope)
void validate()
Definition DSMAnalogSensor.cc:539
DSMAnalogSensor()
Definition DSMAnalogSensor.cc:64
void getDefaultConversion(int ichan, float &intercept, float &slope) const
Get the default linear conversion for a channel.
Definition DSMAnalogSensor.cc:272
IODevice * buildIODevice()
Definition DSMAnalogSensor.cc:85
A2DConverter * getInitialConverter() const
Initial A2DConverter, containing the default conversion from counts to volts based on the gain and bi...
Definition DSMAnalogSensor.h:134
void testVoltage(XmlRpc::XmlRpcValue &params, XmlRpc::XmlRpcValue &result)
Definition DSMAnalogSensor.cc:620
enum irigClockRates _temperatureRate
Rate of requested A2D board temperature, as an IRIG enumerated rate.
Definition DSMAnalogSensor.h:185
SampleScanner * buildSampleScanner()
Definition DSMAnalogSensor.cc:90
float SecondPoly(float x, const float c[]) const
Definition DSMAnalogSensor.h:201
int getMaxNumChannels() const
Definition DSMAnalogSensor.h:82
int _deltatUsec
The output delta t, 1/rate, in microseconds.
Definition DSMAnalogSensor.h:173
~DSMAnalogSensor()
Definition DSMAnalogSensor.cc:77
void setGainBipolar(int ichan, int gain, int bipolar)
Definition DSMAnalogSensor.cc:248
static const float TemperatureChamberVoltagesGain4[N_G4_VDC]
Temperature Chamber for 0-5 volts was done every half volt.
Definition DSMAnalogSensor.h:226
const SampleTag * _temperatureTag
Pointer to temperature SampleTag if user has asked for it, otherwise NULL.
Definition DSMAnalogSensor.h:179
void executeXmlRpc(XmlRpc::XmlRpcValue &params, XmlRpc::XmlRpcValue &result)
Method invoked when the DSMEngineIntf XmlRpcServer receives a "SensorAction" request,...
Definition DSMAnalogSensor.cc:573
float getTemp()
Get the current temperature.
Definition DSMAnalogSensor.cc:335
A2DConverter * _initialConverter
Definition DSMAnalogSensor.h:152
void printStatus(std::ostream &ostr)
Definition DSMAnalogSensor.cc:342
int readFilterFile(const std::string &name, unsigned short *coefs, int nexpect)
Read a filter file containing coefficients for an Analog Devices A2D chip.
Definition DSMAnalogSensor.cc:207
DSMAnalogSensor(const DSMAnalogSensor &)
No copying.
static const float TemperatureTableGain4[N_G4_VDC][N_COEFF]
Table of coefficients for 0 to 5 Volts.
Definition DSMAnalogSensor.h:231
void open(int flags)
Open the device connected to the sensor.
Definition DSMAnalogSensor.cc:96
static const int N_G4_VDC
How many different temperature stages were measured in the chamber.
Definition DSMAnalogSensor.h:220
static const float DEGC_PER_CNT
Conversion factor from 16 bit raw temperature to degC.
Definition DSMAnalogSensor.h:190
A2DConverter * getFinalConverter() const
Final A2DConverter, updated from the CalFile, applied after the initial conversion,...
Definition DSMAnalogSensor.h:145
bool process(const Sample *, std::list< const Sample * > &result)
Process a raw sample, which in this case means unpack the A2D data buffer into individual samples and...
Definition DSMAnalogSensor.cc:399
DSMAnalogSensor & operator=(const DSMAnalogSensor &)
No assignment.
irigClockRates
Enumeration of the callback rates supported by this module.
Definition irigclock.h:52
The essential core classes of nidas.
Definition A2DConverter.h:31
Root namespace for the NCAR In-Situ Data Acquisition Software.
Definition A2DConverter.h:31
#define NUM_NCAR_A2D_CHANNELS
Definition ncar_a2d.h:55
#define USECS_PER_MSEC
Definition types.h:115