123
Fork of LG by
Diff: DevicePLCS.h
- Revision:
- 198:78dd6d14d108
- Parent:
- 197:7a05523bf588
diff -r 7a05523bf588 -r 78dd6d14d108 DevicePLCS.h --- a/DevicePLCS.h Wed Oct 19 10:55:05 2016 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,219 +0,0 @@ -#ifndef __DEVICE_PLCS_H__ -#define __DEVICE_PLCS_H__ - -//Path length control system phase feedback typedefs -typedef struct _DevicePLCSFeedbackTransferFunction { - uint32_t points; //Number of actual control points (up to 16) - int32_t raw[16]; //Feedback raw value - volts in 16.16 format - int32_t normalized[16];//Feedback normalized value - -1...+1 in 16.16 format -} DevicePLCSFeedbackTransferFunction; - -typedef struct _DevicePLCSFeedbackSettings { - uint8_t input; //Take ISACS input as feedback - uint8_t output; //Take ISACS output as feedback - DevicePLCSFeedbackTransferFunction transfer; -} DevicePLCSFeedbackSettings; - -typedef struct _DevicePLCSFeedbackState { - uint8_t input; //Take ISACS input as feedback - uint8_t output; //Take ISACS output as feedback - int32_t voltage; //Feedback - volts in 16.16 format -} DevicePLCSFeedbackState; - -typedef struct _DevicePLCSFeedback { - DevicePLCSFeedbackSettings settings; - DevicePLCSFeedbackState state; -} DevicePLCSFeedback; - -//Path length control system reference typedefs -typedef struct _DevicePLCSReferenceSettings { - uint8_t sequencer; //Take sequencer as reference (and ISACS amplitude/output as feedback) - uint8_t delta; //Take delta as reference (and ISACS amplitude/output delta as feedback) -} DevicePLCSReferenceSettings; - -typedef struct _DevicePLCSReferenceState { - uint8_t sequencer; //Take sequencer as reference (and ISACS amplitude/output as feedback) - uint8_t delta; //Take delta as reference (and ISACS amplitude/output delta as feedback) -} DevicePLCSReferenceState; - -typedef struct _DevicePLCSReference { - DevicePLCSReferenceSettings settings; - DevicePLCSReferenceState state; -} DevicePLCSReference; - -//Path length control system detector typedefs -typedef struct _DevicePLCSDetectorState { - int32_t in[2]; //Detector inputs: reference, feedback -1...+1 in 16.16 format - int32_t out; //Detector output: -1...+1 in 16.16 format -} DevicePLCSDetectorState; - -typedef struct _DevicePLCSDetector { - DevicePLCSDetectorState state; -} DevicePLCSDetector; - -//Path length control system bias typedefs -typedef struct _DevicePLCSBiasTransferFunction { - uint32_t points; //Number of actual control points (up to 16) - int32_t raw[16]; //Raw bias value - dimensionless units - int32_t normalized[16]; //Normalized bias value - -0.5...+0.5 of lambda in 16.16 format -} DevicePLCSBiasTransferFunction; - -typedef struct _DevicePLCSBiasSettings { - DevicePLCSBiasTransferFunction transfer; -} DevicePLCSBiasSettings; - -typedef struct _DevicePLCSBiasState { - uint32_t raw; //Raw bias value - -0.5...+0.5 in 16.16 format - int32_t sum; - int32_t counter; - int32_t average; //Average bias value - -0.5...+0.5 in 16.16 format -} DevicePLCSBiasState; - -typedef struct _DevicePLCSBias { - DevicePLCSBiasSettings settings; - DevicePLCSBiasState state; -} DevicePLCSBias; - -//Path length control system regulator typedefs -typedef struct _DevicePLCSCorrectionTransferFunction { - uint32_t points; //Number of actual control points (up to 16) - int32_t error[16]; //Regulator error value - degrees in 16.16 format - int32_t correction[16]; //Regulator correction value - -1...+1 in 16.16 format -} DevicePLCSCorrectionTransferFunction; - -typedef struct _DevicePLCSRegulatorSettings { - uint8_t enabled; - int32_t reference; //Reference bias - signed 16.16 format - int32_t scale; //Regulator scale factor - signed 16.16 format - DevicePLCSCorrectionTransferFunction transfer; -} DevicePLCSRegulatorSettings; - -typedef struct _DevicePLCSRegulatorState { - uint8_t enabled; - int32_t reference; //Reference bias - signed 16.16 format - int32_t scale; //Regulator scale factor - signed 16.16 format - int32_t error; //Regulator error - signed 16.16 format - int32_t correction;//Output correction - signed 16.16 format -} DevicePLCSRegulatorState; - -typedef struct _DevicePLCSRegulator { - DevicePLCSRegulatorSettings settings; - DevicePLCSRegulatorState state; -} DevicePLCSRegulator; - -//Path length control reset typedefs -typedef struct _DevicePLCSResetTemperatureFunction { - uint32_t points; //Number of actual control points (up to 16) - int32_t temperature[16]; //Output reset temperature value - centigrade, 16.16 format - int32_t trigger[16]; //Output reset trigger level value - volts, 16.16 format - int32_t voltage[16]; //Output reset target level value - volts, 16.16 format - Delete this!!! - int32_t target[16]; //Output reset target level value - volts, 16.16 format - Use this!!! - int32_t duration[16]; //Output reset duration value - seconds, 16.16 format -} DevicePLCSResetTemperatureFunction; - -typedef struct _DevicePLCSResetDirectionSettings { - DevicePLCSResetTemperatureFunction environment; -} DevicePLCSResetDirectionSettings; - -typedef struct _DevicePLCSResetDirectionState { - int32_t trigger; //Output reset trigger level value - volts, 16.16 format - int32_t target; //Output reset target level value - volts, 16.16 format - int32_t duration; //Output reset duration value - seconds, 16.16 format -} DevicePLCSResetDirectionState; - -typedef struct _DevicePLCSResetDirection { - DevicePLCSResetDirectionSettings settings; - DevicePLCSResetDirectionState state; -} DevicePLCSResetDirection; - -typedef struct _DevicePLCSResetState { - int32_t countdown; //Output reset countdown - seconds, 16.16 format - int32_t voltage; //Output reset target level value - volts, 16.16 format -} DevicePLCSResetState; - -typedef struct _DevicePLCSReset { - //DevicePLCSResetSettings settings; //Delete this!!! - DevicePLCSResetDirection up; - DevicePLCSResetDirection down; - DevicePLCSResetState state; -} DevicePLCSReset; - -//Path length control system output ( = DAC + amplifier + control unit + heater/piezo) typedefs -typedef struct _DevicePLCSOutputStart { - int32_t voltage; //Output voltage in signed 16.16 fixed point format -} DevicePLCSOutputStart; - -typedef struct _DevicePLCSOutputTransferFunction { - uint32_t points; //Number of actual control points (up to 16) - int32_t voltage[16]; //Output voltage control points in signed 16.16 fixed point format - int32_t code[16]; //DAC code control points -} DevicePLCSOutputTransferFunction; - -typedef struct _DevicePLCSOutputSettings { - uint8_t enabled; //Enable DAC output - uint8_t sequencer; //Enable sequencer output summation - DevicePLCSOutputStart start; - DevicePLCSOutputTransferFunction transfer; -} DevicePLCSOutputSettings; - -typedef struct _DevicePLCSOutputState { - uint8_t enabled; //Enable DAC output - uint8_t sequencer; //Enable sequencer output summation - int32_t voltage; //Voltage output - uint32_t code; //Code output -} DevicePLCSOutputState; - -typedef struct _DevicePLCSOutput { - DevicePLCSOutputSettings settings; - DevicePLCSOutputState state; -} DevicePLCSOutput; - -//Path length control system typedefs -// Information signal amplitude ADC: device.controller.SSP.ADC[4] -// Path length control system DAC: device.controller.SSP.DAC[1] -typedef struct _DevicePathLengthControlSystem { - DevicePLCSFeedback feedback; - DevicePLCSReference reference; - DevicePLCSDetector detector; - DevicePLCSBias bias; - DevicePLCSRegulator regulator; - DevicePLCSReset reset; - DevicePLCSOutput output; -} DevicePathLengthControlSystem; - -//Path length control system functions -void InitPathLengthControlSystemDefaultSettings(void); -void InitPathLengthControlSystemState(void); -void DeviceStartPLCS(void); - -void plcsProcess(void); - -//Compatibility functions section -//WP_reg dac ttf: DAC code in PLCS channel; value: voltage of PLCS; value=(ttf>>4)/2048*(-12)-1.3; Range -13.2V...10.7V -int16_t var_WP_reg(void); - -//WP_pll = WP_PhaseDetectorRate( WP_Phase_Det, time_1_Sec) -int16_t var_WP_pll(void); - -//WP_ref s16 PLCS reference -uint16_t param_WP_ref(void); - -//WP_scl s16 PLCS gain factor (1.15) 5..20 -uint16_t param_WP_scl(void); - -//WP_mdy s16 PLCS reset delay in 10kHz cycles -uint16_t param_WP_mdy(void); - -//WP_rup dac ttf:PLCS maximum DAC code in heater channel; value:minimal voltage on the heater; value=(ttf>>4)/2048*(-12)-1.3; Range -13.2V...10.7V -uint16_t param_WP_rup(void); - -//WP_rdw dac ttf:PLCS minimum DAC code in heater channel; value:maximal voltage on the heater; value=(ttf>>4)/2048*(-12)-1.3; Range -13.2V...10.7V -uint16_t param_WP_rdw(void); - -//WP_reset dac ttf:PLCS DAC code after reset at heating; value:heater voltage after reset at heating; value=(ttf>>4)/2048*(-12)-1.3; Range -13.2V...10.7V -uint16_t param_WP_reset(void); - -//WP_reset2 dac ttf:PLCS DAC code after reset at cooling; value:heater voltage after reset at cooling; value=(ttf>>4)/2048*(-12)-1.3 -uint16_t param_WP_reset2(void); - -#endif /* __DEVICE_PLCS_H__ */ \ No newline at end of file