Waveform filter programs

◆ convert_sidiode_volts_to_kelvin_with_correction()

double DDAS3::convert_sidiode_volts_to_kelvin_with_correction ( double  volts)

Definition at line 192 of file sigscale.cc.

References A, ND, TRANGE_100K, TRANGE_12K, TRANGE_24K, TRANGE_475K, VL, and VU.

Referenced by convert_to_display_units().

193  {
194  double x, t, v, vl, vu;
195  int i, nd, range;
196 
197 
198  if ( volts < 0.24963 )
199  // clip value to 410K if out of range e.g.sensor unplugged
200  return 410.0 ;
201 
202  // Coefficients table ends at 1.4K
203  if ( volts > 1.698120 )
204  // clip value to 1.4K if out of range //changed 09/08
205  return 1.40 ;
206 
207  // std::cout << "\n\nDEBUG in SIDIODE4: " << volts << std::endl;
208 
209  if ( volts > VU[TRANGE_12K] ) range = 0 ;
210  else if ( volts>VU[TRANGE_24K ] && volts<=VU[TRANGE_12K ] ) range = 0;
211  else if ( volts>VU[TRANGE_100K] && volts<=VU[TRANGE_24K ] ) range = 1;
212  else if ( volts>VU[TRANGE_475K] && volts<=VU[TRANGE_100K] ) range = 2;
213  else /*volts<=VU[TRANGE_475K]*/ range = 3;
214 
215  v = volts;
216  vl = VL[range];
217  vu = VU[range];
218  nd = ND[range];
219  x = ((v-vl)-(vu-v))/(vu-vl);
220 
221  if ( x <= -1.0 || x >= 1.0 ) x = 0 ; /* error condition */
222 
223  t = 0.0;
224  for( i=0; i<nd; i++ )
225  t = t + A[range][i]*cos(i*acos(x));
226 
227  return t;
228  } // double convert_sidiode_volts_to_kelvin_with_correction(double volts)
const int ND[4]
Definition: sigscale.cc:84
const double A[4][12]
Definition: sigscale.cc:85
#define TRANGE_24K
Definition: sigscale.cc:97
const double VU[4]
Definition: sigscale.cc:83
#define TRANGE_475K
Definition: sigscale.cc:99
const double VL[4]
Definition: sigscale.cc:82
#define TRANGE_100K
Definition: sigscale.cc:98
#define TRANGE_12K
Definition: sigscale.cc:96
Here is the caller graph for this function: