libRBR  v1.2.3
RBR instrument communication API
Data Structures | Macros | Enumerations | Functions
RBRDynamicCorrection.h File Reference

Library for salinity dynamic correction. More...

#include <stdint.h>
Include dependency graph for RBRDynamicCorrection.h:

Go to the source code of this file.

Data Structures

struct  RBRDynamicCorrectionParams
 
struct  RBRDynamicCorrectionMeasurement
 
struct  RBRDynamicCorrectionResult
 

Macros

#define DCORR_MAX_LAG_ARRAY   20
 Define the maximum amount of lag permitted.
 
#define DCORR_T_DELAY   0.35f
 Define the C-T lag adjustment delay (in seconds)
 
#define DCORR_ALPHA   0.041f
 Define the magnitude of short-term thermal mass correction (unitless)
 
#define DCORR_ALPHA_A   0.00323f
 Define the 'a' ascent-rate fit coefficient for alpha (unitless)
 
#define DCORR_ALPHA_E   -1.03f
 Define the 'e' ascent-rate fit coefficient for alpha (unitless)
 
#define DCORR_TAU   8.11f
 Define the time constant of short-term thermal mass correction (seconds)
 
#define DCORR_TAU_A   4.93f
 Define the 'a' ascent-rate fit coefficient for alpha (unitless)
 
#define DCORR_TAU_E   -0.26f
 Define the 'e' ascent-rate fit coefficient for alpha (unitless)
 
#define DCORR_CT_COEFF   0.97e-2f
 Define the magnitude of long-term thermal mass correction (unitless)
 
#define DCORR_CT_COEFF_A   0.00139f
 Define the 'a' ascent-rate fit coefficient for ctcoeff (unitless)
 
#define DCORR_CT_COEFF_E   -1.00f
 Define the 'e' ascent-rate fit coefficient for ctcoeff (unitless)
 
#define DCORR_VP_MIN   0.03f
 Define the minimum for the range for ascent rate as pressure/time (dbar/sec)
 
#define DCORR_VP_MAX   0.45f
 Define the minimum for the range for ascent rate as pressure/time (dbar/sec)
 
#define DCORR_VP_FC   0.04f
 Define the filter cutoff frequency for ascent rate as pressure/time (Hz)
 

Enumerations

enum  RBRDynamicCorrectionError {
  RBR_DCORR_SUCCESS = 0, RBR_DCORR_INVALID_SAMPLING_RATE, RBR_DCORR_NOT_VALID_YET, DYN_CORR_CORRUPTED,
  DYN_CORR_BAD_PARAMS, DYN_CORR_UNKNOWN_ERROR
}
 Errors which can be returned from dynamic correction algorithm. More...
 

Functions

RBRDynamicCorrectionError RBRDynamicCorrection_init (RBRDynamicCorrectionParams *params, float Fs, float t_delay, float alpha_a, float alpha_e, float tau_a, float tau_e, float ctcoeff_a, float ctcoeff_e, float Vp_min, float Vp_max, float Vp_fc)
 Initialize the dynamic correction algorithm. More...
 
RBRDynamicCorrectionError RBRDynamicCorrection_update_Fs (RBRDynamicCorrectionParams *params, float Fs)
 Change the sampling rate for the algorithm. More...
 
RBRDynamicCorrectionError RBRDynamicCorrection_addMeasurement (RBRDynamicCorrectionParams *params, const RBRDynamicCorrectionMeasurement *measIn, RBRDynamicCorrectionResult *corrMeasOut)
 Feed a new measurement in the algorithm.
More...
 

Detailed Description

Library for salinity dynamic correction.

Enumeration Type Documentation

◆ RBRDynamicCorrectionError

Errors which can be returned from dynamic correction algorithm.

Algorithm will return error codes in lieu of data values; data will be passed back to the caller via out pointers. This allows for predictable and consistent error checking by the caller.

Enumerator
RBR_DCORR_SUCCESS 

No error.

RBR_DCORR_INVALID_SAMPLING_RATE 

Invalid sampling rate for given parameters

RBR_DCORR_NOT_VALID_YET 

Insufficient data injected in function to provide a result

DYN_CORR_CORRUPTED 

Invalid correction (could be related to previous input)

DYN_CORR_BAD_PARAMS 

Invalid parameters (initialization failure)

DYN_CORR_UNKNOWN_ERROR 

Other error

Function Documentation

◆ RBRDynamicCorrection_addMeasurement()

RBRDynamicCorrectionError RBRDynamicCorrection_addMeasurement ( RBRDynamicCorrectionParams params,
const RBRDynamicCorrectionMeasurement measIn,
RBRDynamicCorrectionResult corrMeasOut 
)

Feed a new measurement in the algorithm.

Return a corrected output (with proper time delay to align with all correction results)

Parameters
paramsParameters for dynamic correction algorithm
measInInput measurements for algorithm
corrMeasOutOutput corrected measurements (time aligned)
Returns
error code (0 = no error)

◆ RBRDynamicCorrection_init()

RBRDynamicCorrectionError RBRDynamicCorrection_init ( RBRDynamicCorrectionParams params,
float  Fs,
float  t_delay,
float  alpha_a,
float  alpha_e,
float  tau_a,
float  tau_e,
float  ctcoeff_a,
float  ctcoeff_e,
float  Vp_min,
float  Vp_max,
float  Vp_fc 
)

Initialize the dynamic correction algorithm.

Initialize the algorithm for the given sampling rate.

Parameters
paramsParameters for dynamic correction algorithm
Fssampling rate (Samples/sec)
t_delaydefault value DCORR_T_DELAY used as input
alpha_adefault value DCORR_ALPHA_A used as input
alpha_edefault value DCORR_ALPHA_E used as input
tau_adefault value DCORR_TAU_A used as input
tau_edefault value DCORR_TAU_E used as input
ctcoeff_adefault value DCORR_COEFF_A used as input
ctcoeff_edefault value DCORR_COEFF_E used as input
Vp_mindefault value DCORR_VP_MIN used as input
Vp_maxdefault value DCORR_VP_MAX used as input
Vp_fcdefault value DCORR_VP_FC used as input
Returns
error code (0 = no error)

◆ RBRDynamicCorrection_update_Fs()

RBRDynamicCorrectionError RBRDynamicCorrection_update_Fs ( RBRDynamicCorrectionParams params,
float  Fs 
)

Change the sampling rate for the algorithm.

Parameters
paramsParameters for dynamic correction algorithm
Fssampling rate (Samples/sec)
Returns
error code (0 = no error)