Index: firmware/App/Monitors/WaterQualityMonitor.c =================================================================== diff -u -r846073b88a25474464d43b4c0e8f300b52021f96 -r0a837501d88e61cf21aa90b9853deda9bf24f98c --- firmware/App/Monitors/WaterQualityMonitor.c (.../WaterQualityMonitor.c) (revision 846073b88a25474464d43b4c0e8f300b52021f96) +++ firmware/App/Monitors/WaterQualityMonitor.c (.../WaterQualityMonitor.c) (revision 0a837501d88e61cf21aa90b9853deda9bf24f98c) @@ -215,6 +215,24 @@ /*********************************************************************//** * @brief + * The getCalculatedRODutyCycle function get the RO calculated dutycycle based on M3 pressure + * @details \b Inputs: none + * @details \b Outputs: none + * @details \b Alarms: none + * @return dutyCyclePct + *************************************************************************/ +F32 getCalculatedRODutyCycle( void ) +{ + F32 pressureP13 = getPressure( P13_PRES ); + // TODO verify the calculated dutycycle unit + // If 58 PSI ≤ P13 < 120 PSI, the currently set P12 duty cycle (% PWM) must be < 0.0065(x^2) - 1.9859(x) + 193.23, where x = measured P13 pressure in PSI + F32 dutyCyclePct = ( ( QUADRATIC_COEFFICIENT * ( pressureP13 * pressureP13 ) ) - ( LINEAR_COEFFICIENT * ( pressureP13 ) ) ) + CONSTANT_TERM; + + return dutyCyclePct; +} + +/*********************************************************************//** + * @brief * The checkROPressures function checks the RO membrane pressure * against the pressure threshold and alarm if the pressure is out of range. * @details \b Inputs: none @@ -229,8 +247,7 @@ F32 currentDutyCyclePct = getCurrentROPumpDutyCyclePCT(); BOOL isFdutyCycleOfRange = FALSE; // TODO verify the calculated dutycycle unit - // If 58 PSI ≤ P13 < 120 PSI, the currently set P12 duty cycle (% PWM) must be < 0.0065(x^2) - 1.9859(x) + 193.23, where x = measured P13 pressure in PSI - F32 calculatedDutyCyclePct = ( ( QUADRATIC_COEFFICIENT * ( pressureP13 * pressureP13 ) ) - ( LINEAR_COEFFICIENT * ( pressureP13 ) ) ) + CONSTANT_TERM; + F32 calculatedDutyCyclePct = getCalculatedRODutyCycle(); if ( ( pressureP13 >= MAX_INLET_RO_PUMP_PRESSURE_WARNING_LOW_PSIG ) && ( pressureP13 < MAX_INLET_RO_PUMP_PRESSURE_WARNING_HIGH_PSIG ) ) {