Index: firmware/App/Controllers/DrainPump.c =================================================================== diff -u -r4daa230ef3173ca71bab91c0c28457e6ac341797 -r5aee05d242962c2f9294577c3ba5015f9342fb83 --- firmware/App/Controllers/DrainPump.c (.../DrainPump.c) (revision 4daa230ef3173ca71bab91c0c28457e6ac341797) +++ firmware/App/Controllers/DrainPump.c (.../DrainPump.c) (revision 5aee05d242962c2f9294577c3ba5015f9342fb83) @@ -54,7 +54,7 @@ #define DRP_CONTROL_MAX_ALLOWED_PPO_PSI 30.0F ///< Drain pump maximum allowed PPo pressure in psi. #define DRP_CONTROL_MAX_ALLOWED_PDR_PSI 40.0F ///< Drain pump maximum allowed PDr pressure in psi. #define DRP_CONTROL_PSI_TO_DAC_P_TERM 0.2F ///< Drain pump psi to DAC conversion. -#define DRP_CONTROL_FLOW_TO_DAC_P_TERM 0.5F ///< Drain pump flow (L/min) to DAC conversion. +#define DRP_CONTROL_FLOW_TO_DAC_P_TERM 100.0F ///< Drain pump flow (L/min) to DAC conversion. #define DRP_CONTROL_PRES_TO_MAX_THRESHOLD_PSI 1.0F ///< Drain pump pressure to maximum pressure threshold in psi. #define DRP_CONTROL_MIN_DAC_CHANGE 1 ///< Drain pump minimum DAC change @@ -66,7 +66,7 @@ #define TOGGLE_PERIOD_RESOLUTION_SECONDS 0.000005F ///< Toggle period to resolution in seconds. #define ROTATIONAL_TO_TOGGLE_PERIOD_CONVERSION 4.0F ///< Rotational to toggle period conversion coefficient. -#define DRAIN_PUMP_P_COEFFICIENT 0.5F ///< P term for drain pump delta pressure control. +#define DRAIN_PUMP_P_COEFFICIENT 100.0F //0.5F ///< P term for drain pump delta pressure control. #define DRAIN_PUMP_I_COEFFICIENT 1.0F ///< I term for drain pump delta pressure control. #define MAX_ALLOWED_OPEN_LOOP_RPM_OUT_OF_RANGE 100 ///< Maximum allowed RPM out of range from target RPM in open loop. @@ -672,6 +672,12 @@ isDrainPumpControlInFlowMode = FALSE; } } + else if ( flowSubLPM > NEARLY_ZERO ) + { + // If measured flow if greater than the target flow, adjust the DAC to lower the flow rate + tempDACSet = (U32)( ( flowSubLPM * DRP_CONTROL_FLOW_TO_DAC_P_TERM ) + FLOAT_TO_INT_ROUNDUP_OFFSET ); + drainPumpDACSet -= ( tempDACSet > 0.0F ? tempDACSet : DRP_CONTROL_MIN_DAC_CHANGE ); + } else { // Get the status of the current pressure readings with respect to their maximum pressures @@ -695,14 +701,6 @@ tempDACSet = (U32)( ( fabs(maxPresPSI) * DRP_CONTROL_PSI_TO_DAC_P_TERM ) + FLOAT_TO_INT_ROUNDUP_OFFSET ); drainPumpDACSet += ( tempDACSet > 0.0F ? tempDACSet : DRP_CONTROL_MIN_DAC_CHANGE ); } - - if ( flowSubLPM > NEARLY_ZERO ) - { - // If measured flow if greater than the target flow, adjust the DAC to lower the flow rate - tempDACSet = (U32)( ( flowSubLPM * DRP_CONTROL_FLOW_TO_DAC_P_TERM ) + FLOAT_TO_INT_ROUNDUP_OFFSET ); - drainPumpDACSet -= ( tempDACSet > 0.0F ? tempDACSet : DRP_CONTROL_MIN_DAC_CHANGE ); - } - } // Check the DAC to make sure it is not out the min and max ranges of the drain pump @@ -777,7 +775,7 @@ drainPumpData.pumpDACSet = drainPumpDACSet; drainPumpData.drainPumpState = (U32)drainPumpState; drainPumpData.drainPumpRPM = getDrainPumpMeasuredRPM(); - drainPumpData.trgtOutletPrsr = targetDrainPumpOutletFlowLPM; + drainPumpData.trgtOutletFlowLPM = targetDrainPumpOutletFlowLPM; drainPumpData.drainPumpCurrentA = getDrainPumpMeasuredCurrentA(); drainPumpData.drainPumpDirection = getDrainPumpMeasuredDirection();