Index: firmware/App/Controllers/ConcentratePumps.c =================================================================== diff -u -r336c209c89879d63f7d2078124dcbbfb3f01cef9 -r6743b1ba8056267f3a1669a3773c9f9995c0a788 --- firmware/App/Controllers/ConcentratePumps.c (.../ConcentratePumps.c) (revision 336c209c89879d63f7d2078124dcbbfb3f01cef9) +++ firmware/App/Controllers/ConcentratePumps.c (.../ConcentratePumps.c) (revision 6743b1ba8056267f3a1669a3773c9f9995c0a788) @@ -509,7 +509,13 @@ */ if ( ( CONCENTRATE_PUMP_MIN_SPEED <= targetSpeed_ml_min ) && ( targetSpeed_ml_min <= CONCENTRATE_PUMP_MAX_SPEED ) ) { - concentratePumps[ pumpId ].pumpTargetSpeed = targetSpeed_ml_min; + F32 targetWithCalMLPM = pow( targetSpeed_ml_min, 4 ) * concentratePumpsCalRecord.concentratePumps[ (CAL_DATA_DG_PUMPS_T)pumpId ].fourthOrderCoeff + + pow( targetSpeed_ml_min, 3 ) * concentratePumpsCalRecord.concentratePumps[ (CAL_DATA_DG_PUMPS_T)pumpId ].thirdOrderCoeff + + pow( targetSpeed_ml_min, 2 ) * concentratePumpsCalRecord.concentratePumps[ (CAL_DATA_DG_PUMPS_T)pumpId ].secondOrderCoeff + + targetSpeed_ml_min * concentratePumpsCalRecord.concentratePumps[ (CAL_DATA_DG_PUMPS_T)pumpId ].gain + + concentratePumpsCalRecord.concentratePumps[ (CAL_DATA_DG_PUMPS_T)pumpId ].offset; + + concentratePumps[ pumpId ].pumpTargetSpeed = targetWithCalMLPM; } else if ( targetSpeed_ml_min < CONCENTRATE_PUMP_MIN_SPEED ) { @@ -953,14 +959,7 @@ } else if ( FALSE == isPumpPulseWidthOut ) { - F32 speedMLPM = ( US_PER_SECOND / pulseWidthInMicroSeconds ) * CONCENTRATE_PUMP_VOLUME_PER_PULSE * SEC_PER_MIN; - F32 speedMLPMWithCal = pow( speedMLPM, 4 ) * concentratePumpsCalRecord.concentratePumps[ (CAL_DATA_DG_PUMPS_T)pumpId ].fourthOrderCoeff + - pow( speedMLPM, 3 ) * concentratePumpsCalRecord.concentratePumps[ (CAL_DATA_DG_PUMPS_T)pumpId ].thirdOrderCoeff + - pow( speedMLPM, 2 ) * concentratePumpsCalRecord.concentratePumps[ (CAL_DATA_DG_PUMPS_T)pumpId ].secondOrderCoeff + - speedMLPM * concentratePumpsCalRecord.concentratePumps[ (CAL_DATA_DG_PUMPS_T)pumpId ].gain + - concentratePumpsCalRecord.concentratePumps[ (CAL_DATA_DG_PUMPS_T)pumpId ].offset; - - concentratePumps[ pumpId ].measuredPumpSpeed.data = speedMLPMWithCal; + concentratePumps[ pumpId ].measuredPumpSpeed.data = ( US_PER_SECOND / pulseWidthInMicroSeconds ) * CONCENTRATE_PUMP_VOLUME_PER_PULSE * SEC_PER_MIN; } // If pulse width is out of range capture pump out of range, pumpId and pulse width Index: firmware/App/Services/PIControllers.c =================================================================== diff -u -r7d4711edd7b40cd3e29f43e766f79a8a09586fe9 -r6743b1ba8056267f3a1669a3773c9f9995c0a788 --- firmware/App/Services/PIControllers.c (.../PIControllers.c) (revision 7d4711edd7b40cd3e29f43e766f79a8a09586fe9) +++ firmware/App/Services/PIControllers.c (.../PIControllers.c) (revision 6743b1ba8056267f3a1669a3773c9f9995c0a788) @@ -209,6 +209,12 @@ controller->controlSignal += ( controller->Kp * controller->errorSignal ); controller->controlSignal = RANGE( controller->controlSignal, controller->uMin, controller->uMax ); + if ( ( PI_CONTROLLER_ID_RO_PUMP_FLOW == controllerID ) || ( PI_CONTROLLER_ID_RO_PUMP_MAX_PRES == controllerID ) ) + { + SEND_EVENT_WITH_2_F32_DATA( DG_EVENT_PI_CONTROL_1, controller->errorSignal, controller->errorSum ) + SEND_EVENT_WITH_2_F32_DATA( DG_EVENT_PI_CONTROL_2, controlSignalBeforeWindup, controller->controlSignal ) + } + result = controller->controlSignal; } else