Index: firmware/App/Drivers/ConductivitySensors.c =================================================================== diff -u -re9a789e5cf3e0da840ccd0227fdd482ab5ed338d -r0ad3c0f2ae387408c3ec608c0ac186c801591ee2 --- firmware/App/Drivers/ConductivitySensors.c (.../ConductivitySensors.c) (revision e9a789e5cf3e0da840ccd0227fdd482ab5ed338d) +++ firmware/App/Drivers/ConductivitySensors.c (.../ConductivitySensors.c) (revision 0ad3c0f2ae387408c3ec608c0ac186c801591ee2) @@ -126,6 +126,7 @@ static U32 getTemperatureSensorErrorCount( CONDUCTIVITY_SENSORS_T sensor ); static BOOL monitorCalDataReads( CONDUCTIVITY_SENSORS_T sensorId ); static BOOL checkConductivityCoefficientRanges( CONDUCTIVITY_SENSORS_T sensorId ); +static void calculateConductivityUpdatedStandard( CONDUCTIVITY_SENSORS_T sensorNum, BOOL isFPSensor ); static void calculateConductivityUpdatedStandardTempCompensated( CONDUCTIVITY_SENSORS_T sensorNum, BOOL isFPSensor ); static void calculateTemperature( CONDUCTIVITY_SENSORS_T sensorNum ); static void calculateResistance( CONDUCTIVITY_SENSORS_T sensorNum, BOOL isFPSensor ); @@ -557,6 +558,7 @@ { isFPSensor = TRUE; } + calculateConductivityUpdatedStandard( sensor, isFPSensor ); calculateConductivityUpdatedStandardTempCompensated( sensor, isFPSensor ); } @@ -1002,6 +1004,40 @@ /*********************************************************************//** * @brief + * The calculateConductivityUpdatedStandard function calculates the conductivity value. + * @details \b Inputs: conductivitySensorCoefficients - Conductivity Coefficients + * @details \b Inputs: conductivitySensorStatus - Raw measurement values + * @details \b Outputs: conductivitySensorStatus - calculated conductivity value + * @param sensorNum - Conductivity sensor index value. + * @param isFPSensor - T/F if sensor is on FP hardware. + * @return + *************************************************************************/ +static void calculateConductivityUpdatedStandard( CONDUCTIVITY_SENSORS_T sensorNum, BOOL isFPSensor ) +{ + F64 calculatedConductivity = 0.0; + F64 alpha = 0.0; + F64 k = 0.0; + + if ( TRUE == isFPSensor ) + { + alpha = conductivitySensorCoefficients[ sensorNum ].alpha_low; + k = conductivitySensorCoefficients[ sensorNum ].K_low; + } + else + { + alpha = conductivitySensorCoefficients[ sensorNum ].alpha_high; + k = conductivitySensorCoefficients[ sensorNum ].K_high; + } + calculateResistance( sensorNum, isFPSensor ); + calculateTemperature( sensorNum ); + + calculatedConductivity = ( ( k / conductivitySensorStatus[ sensorNum ].calculatedResistance ) * + ( 1 + ( alpha * ( COND_TEMP_OFFSET - conductivitySensorStatus[ sensorNum ].calculatedTemperature ) ) ) ); + currentConductivityReadings[ sensorNum ].data = calculatedConductivity * SIEMENS_TO_MICROSIEMENS_CONVERSION; +} + +/*********************************************************************//** + * @brief * The calculateConductivityUpdatedStandardTempCompensated function calculates the conductivity value with temperature compensation. * @details \b Inputs: conductivitySensorCoefficients - Conductivity Coefficients * @details \b Inputs: conductivitySensorStatus - Raw measurement values