123

Dependencies:   mbed

Fork of LG by igor Apu

Revision:
177:672ef279c8e0
Parent:
173:7f938afb0447
Child:
183:c7a9c309086c
--- a/DeviceISACS.h	Thu Jun 30 09:04:22 2016 +0000
+++ b/DeviceISACS.h	Sun Jul 03 13:40:48 2016 +0000
@@ -11,8 +11,8 @@
 //Information signal amplitude control system input ( = ADC - low pass filter - code - voltage) typedefs
 typedef struct _DeviceISACSInputTransferFunction {
   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
+  int32_t V[16];       //Input voltage control points - V in signed 16.16 fixed point format
+  int32_t raw[16];     //Input voltage control points - DAC code
 } DeviceISACSInputTransferFunction;
 
 typedef struct _DeviceISACSInputSettings {
@@ -20,9 +20,9 @@
 } DeviceISACSInputSettings;
 
 typedef struct _DeviceISACSInputState {
-  int32_t voltage;
-  int32_t sum;
-  int32_t average;
+  int32_t sum;         //Sum of cycle current measurements - ADC code - updates 32 times per cycle
+  int32_t raw;         //Average input - ADC code - updates 1 time per cycle
+  int32_t V;           //Average input - volts in 16.16 format - updates 1 time per cycle
 } DeviceISACSInputState;
 
 typedef struct _DeviceISACSInput {
@@ -33,26 +33,30 @@
 //Information signal amplitude control system output ( = DAC + amplifier + control unit + hfo) typedefs
 typedef struct _DeviceISACSOutputTransferFunction {
   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 voltage[16]; //Output voltage control points - V in signed 16.16 fixed point format
   int32_t code[16];    //DAC code control points
 } DeviceISACSOutputTransferFunction;
 
 typedef struct _DeviceISACSOutputStart {
-  uint32_t voltage;    //Output voltage
+  int32_t voltage;    //Output - volts in 16.16 format
 } DeviceISACSOutputStart;
 
 typedef struct _DeviceISACSOutputReset {
-  uint32_t voltage;    //Output voltage
+  int32_t voltage;    //Output - volts in 16.16 format
 } DeviceISACSOutputReset;
 
 typedef struct _DeviceISACSOutputSettings {
+  uint32_t max; //Maximum output voltage in 16.16 format. TODO: max(temperature
+  uint32_t min; //Minimum output voltage in 16.16 format. TODO: max(temperature
   DeviceISACSOutputTransferFunction transfer;
   DeviceISACSOutputStart start;
   DeviceISACSOutputReset reset;
 } DeviceISACSOutputSettings;
 
 typedef struct _DeviceISACSOutputState {
-  int32_t voltage;     //Output value - constant for measurement cycle
+  uint32_t max; //Maximum output voltage in 16.16 format
+  uint32_t min; //Minimum output voltage in 16.16 format
+  int32_t voltage;     //Output - volts in 16.16 format - updates 1 time per cycle
 } DeviceISACSOutputState;
 
 typedef struct _DeviceISACSOutput {
@@ -61,23 +65,31 @@
 } DeviceISACSOutput;
 
 //Information signal amplitude control system regulator typedefs
+typedef struct _DeviceISACSCorrectionTransferFunction {
+  uint32_t points;        //Number of actual control points (up to 16)
+  int32_t error[16];      //Regulator error - V in signed 16.16 fixed point format
+  int32_t correction[16]; //Output correction - -1...+1 in signed 16.16 fixed point format
+} DeviceISACSCorrectionTransferFunction;
+
 typedef struct _DeviceISACSRegulatorConditionSettings {
   uint8_t enabled;
-  uint32_t reference;  //signed 16.16 format reference voltage
-  uint32_t scale;      //signed 16.16 format regulator scale factor
+  int32_t reference;  //Reference input - volts in 16.16 format
+  int32_t scale;      //Regulator scale factor - dimensionless units in signed 16.16 format
 } DeviceISACSRegulatorConditionSettings;
 
 typedef struct _DeviceISACSRegulatorSettings {
-  DeviceISACSRegulatorConditionSettings start;   //settings for PLCS system in start condition
-  DeviceISACSRegulatorConditionSettings regular; //settings for PLCS system in normal condition
-  DeviceISACSRegulatorConditionSettings reset;   //settings for PLCS system in reset condition
+  DeviceISACSRegulatorConditionSettings start;    //Regulator settings for ISACS system in start condition
+  DeviceISACSRegulatorConditionSettings regular;  //Regulator settings for ISACS system in normal condition
+  DeviceISACSRegulatorConditionSettings reset;    //Regulator settings for ISACS system in reset condition
+  DeviceISACSCorrectionTransferFunction transfer; //Regulator correction function
 } DeviceISACSRegulatorSettings;
 
 typedef struct _DeviceISACSRegulatorState {
   uint8_t enabled;
-  uint32_t reference; //signed 16.16 format reference voltage
-  uint32_t scale;     //signed 16.16 format regulator scale factor
-  uint32_t error;     //signed 16.16 format regulator error
+  int32_t reference; //Reference input - volts in 16.16 format
+  int32_t error;     //Regulator error - volts in signed 16.16 format
+  int32_t scale;     //Regulator scale factor - dimensionless units in signed 16.16 format
+  int32_t correction; //Output correction - V in signed 16.16 fixed point format
 } DeviceISACSRegulatorState;
 
 typedef struct _DeviceISACSRegulator {
@@ -90,7 +102,6 @@
 //  Information signal amplitude control system DAC: device.controller.SSP.DAC[0]
 typedef struct _DeviceISACS {
   DeviceISACSPotentiometers potentiometers;
-  //DeviceISASAmplifier amplifier;
   DeviceISACSInput input;
   DeviceISACSRegulator regulator;
   DeviceISACSOutput output;