123
Fork of LG by
Diff: DeviceErrorModel.h
- Revision:
- 174:0f86eedd511c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/DeviceErrorModel.h Sun Jun 26 10:16:39 2016 +0000 @@ -0,0 +1,79 @@ +#ifndef __DEVICE_EM_H__ +#define __DEVICE_EM_H__ + +//Bias model #1 typedefs +// Error = m[0] + m[1] * T + m[2] * dT +typedef struct _DeviceEMBias1Settings { + int32_t enabled; + int32_t m[3]; +} DeviceEMBias1Settings; + +typedef struct _DeviceEMBias1State { + int32_t enabled; + int32_t ppm; //Accumulated angle error - millionth part in signed 16.16 format + int32_t error; //Accumulated angle error - pulses in signed 16.16 format +} DeviceEMBias1State; + +typedef struct _DeviceEMBias1 { + DeviceEMBias1Settings settings; + DeviceEMBias1State state; +} DeviceEMBias1; + +//Bias model #2 typedefs +// Error = f(T), f(T) - piecewise linear interpolation +typedef struct _DeviceEMBias2Function { + int32_t points; + int32_t celsius[16]; //Temperature - celsius in signed 16.16 format + int32_t ppm[16]; //Accumulated angle correction per dither cycle interval - ppm in signed 16.16 format +} DeviceEMBias2Function; + +typedef struct _DeviceEMBias2Settings { + int32_t enabled; + DeviceEMBias2Function tc; +} DeviceEMBias2Settings; + +typedef struct _DeviceEMBias2State { + int32_t enabled; + int32_t ppm; //Accumulated angle error - millionth part in signed 16.16 format + int32_t error; //Accumulated angle error - pulses in signed 16.16 format +} DeviceEMBias2State; + +typedef struct _DeviceEMBias2 { + DeviceEMBias2Settings settings; + DeviceEMBias2State state; +} DeviceEMBias2; + +//Scale error model typedefs +//typedef struct _DeviceEMScale1 { +// DeviceEMScale1Settings settings; +// DeviceEMScale1State state; +//} DeviceEMScale1; + +//Total error model typedefs +typedef struct _DeviceEMErrorSettings { +} DeviceEMErrorSettings; + +typedef struct _DeviceEMErrorState { + int32_t ppm; //Accumulated angle error - millionth part in signed 16.16 format + int32_t correction; //Accumulated angle error - pulses in signed 16.16 format +} DeviceEMErrorState; + +typedef struct _DeviceEMError { + DeviceEMErrorSettings settings; + DeviceEMErrorState state; +} DeviceEMError; + +typedef struct _DeviceEM { + DeviceEMBias1 bias1; //Bias error model #1 + DeviceEMBias2 bias2; //Bias error model #2 + //DeviceEMScale1 scale1; //Scale factor error model #1 + DeviceEMError error; //Total error +} DeviceEM; + +void InitEMDefaultSettings(void); +void InitEMState(void); +void DeviceStartEM(void); + +void emProcess(void); + +#endif /* __DEVICE_EM_H__ */ \ No newline at end of file