/************************************************************************** * * Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. * * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * * @file ConcentratePumps.c * * @author (last) Quang Nguyen * @date (last) 30-Sep-2020 * * @author (original) Quang Nguyen * @date (original) 30-Sep-2020 * ***************************************************************************/ #include #include "ConcentratePumps.h" #include "FPGA.h" #include "PersistentAlarm.h" #include "SystemCommMessages.h" #include "TaskGeneral.h" /** * @addtogroup ConcentratePumps * @{ */ // ********** private definitions ********** #define CONCENTRATE_PUMP_ON_CONTROL 0x1A ///< Configuration to turn on concentrate pump with 8 microsteps. #define CONCENTRATE_PUMP_OFF_CONTROL 0x3A ///< Configuration to turn off concentrate pump. #define CONCENTRATE_PUMP_FORWARD_DIR 0x1 ///< Concentrate pump forward direction configuration. #define CONCENTRATE_PUMP_REVERSE_DIR 0x0 ///< Concentrate pump reverse direction configuration. #define CONCENTRATE_PUMP_SPEED_INCREMENT 8.0 ///< Speed increase (mL/min) when controlling concentrate pump to target step speed. #define CONCENTRATE_PUMP_MIN_SPEED 3.0 ///< Minimum speed for concentrate pump in mL per min. #define CONCENTRATE_PUMP_MAX_SPEED 49.0 ///< Maximum speed for concentrate pump in mL per min. #define CONCENTRATE_PUMP_ERROR_TOLERANCE 0.02 ///< Measured speed needs to be within 2% of commanded speed. #define CONCENTRATE_PUMP_ZERO_FLOW_RATE 0xFFFF ///< Pulse width value when zero flow rate or pump is off. #define CONCENTRATE_PUMP_VOLUME_PER_REV 0.15 ///< Volume output every revolution (mL). #define CONCENTRATE_PUMP_PULSE_PER_REV 4.0 ///< Number of pulses generate for every revolution. #define CONCENTRATE_PUMP_STEP_PER_REV 200.0 ///< Number of steps for every revolution. #define CONCENTRATE_PUMP_HALL_SENSE_PERIOD_RESOLUTION 100.0 ///< Hall sense period resolution in microseconds. #define CONCENTRATE_PUMP_MICRO_STEPS_PER_STEP 8.0 ///< Number of micro-steps ( fractions of step) per step. #define CONCENTRATE_PUMP_STEP_PERIOD_RESOLUTION ( 0.5 / ( US_PER_SECOND * SEC_PER_MIN ) ) ///< Convert step period resolution (0.5 us) to minute. /// Volume output per pulse. #define CONCENTRATE_PUMP_VOLUME_PER_PULSE ( CONCENTRATE_PUMP_VOLUME_PER_REV / CONCENTRATE_PUMP_PULSE_PER_REV ) #define CONCENTRATE_PUMP_DATA_PUBLISH_INTERVAL ( 500 / TASK_GENERAL_INTERVAL ) ///< Interval (ms/task time) at which the concentrate pump is monitored. #define CONCENTRATE_PUMP_CONTROL_INTERVAL ( 500 / TASK_GENERAL_INTERVAL ) ///< Interval (ms/task time) at which the concentrate pump is controlled. #define CONCENTRATE_PUMP_SPEED_CONTROL_PERSISTENCE_PERIOD ( 5 * MS_PER_SECOND ) ///< Persistence period for concentrate pump speed control error. /// Enumeration of concentrate pump states. typedef enum ConcentratePumpState { CONCENTRATE_PUMP_OFF_STATE = 0, ///< Concentrate pump off state CONCENTRATE_PUMP_ON_STATE, ///< Concentrate pump on state NUM_OF_CONCENTRATE_PUMP_STATES ///< Number of concentrate pump states } CONCENTRATE_PUMP_STATE_T; /// Concentrate pump data structure typedef struct { U32 controlTimerCounter; ///< Timer counter to perform control on concentrate pump CONCENTRATE_PUMP_STATE_T execState; ///< Concentrate pump execute current state BOOL hasTurnOnPumpsBeenRequested; ///< Flag indicates a request to turn concentrate pumps on F32 pumpTargetSpeed; ///< Target concentrate pumps' speed (mL/min) F32 currentPumpSpeed; ///< Current controlled concentrate pumps' speed (mL/min) OVERRIDE_F32_T measuredPumpSpeed; ///< Measured concentrate pump speed (mL/min) U16 togglePeriodCount; ///< Converted pump speed (mL/min) to toggle period counts (0.5 uS increment counts per step) U08 direction; ///< Concentrate pump motor direction void ( *control )( U08 ); ///< Concentrate pump FPGA control function pointer void ( *setStepSpeed )( U16 ); ///< Concentrate pump FPGA set step speed function pointer } CONCENTRATE_PUMP_T; // ********** private data ********** static U32 concentratePumpMonitorTimerCounter; ///< Timer counter to perform monitor on concentrate pump. /// Concentrate pump data publish interval. static OVERRIDE_U32_T concentratePumpDataPublishInterval = { CONCENTRATE_PUMP_DATA_PUBLISH_INTERVAL, CONCENTRATE_PUMP_DATA_PUBLISH_INTERVAL, 0, 0 }; static CONCENTRATE_PUMP_T concentratePumps[ NUM_OF_CONCENTRATE_PUMPS ]; ///< Array of concentrate pumps' data structure. // ********** private function prototypes ********** static void stopConcentratePump( CONCENTRATE_PUMPS_T pumpId ); static CONCENTRATE_PUMP_STATE_T handleConcentratePumpOffState( CONCENTRATE_PUMPS_T pumpId ); static void stepConcentratePumpToTargetSpeed( CONCENTRATE_PUMPS_T pumpId ); static CONCENTRATE_PUMP_STATE_T handleConcentratePumpOnState( CONCENTRATE_PUMPS_T pumpId ); static U32 getPublishConcentratePumpDataInterval( void ); static void calcMeasuredPumpsSpeed( CONCENTRATE_PUMPS_T pumpId, U16 pulseWidthCount ); static F32 getMeasuredPumpSpeed( CONCENTRATE_PUMPS_T pumpId ); /*********************************************************************//** * @brief * The initConcentratePump function initializes the ConcentratePumps module. * @details Inputs: none * @details Outputs: ConcentratePumps module initialized * @return none *************************************************************************/ void initConcentratePump( void ) { CONCENTRATE_PUMPS_T pumpId; concentratePumpMonitorTimerCounter = 0; concentratePumps[ CONCENTRATEPUMPS_CP1 ].control = &setFPGACP1Control; concentratePumps[ CONCENTRATEPUMPS_CP1 ].setStepSpeed = &setFPGACP1SetStepSpeed; concentratePumps[ CONCENTRATEPUMPS_CP2 ].control = &setFPGACP2Control; concentratePumps[ CONCENTRATEPUMPS_CP2 ].setStepSpeed = &setFPGACP2SetStepSpeed; for ( pumpId = CONCENTRATEPUMPS_CP1; pumpId < NUM_OF_CONCENTRATE_PUMPS; ++pumpId ) { concentratePumps[ pumpId ].controlTimerCounter = 0; concentratePumps[ pumpId ].execState = CONCENTRATE_PUMP_OFF_STATE; concentratePumps[ pumpId ].hasTurnOnPumpsBeenRequested = FALSE; concentratePumps[ pumpId ].pumpTargetSpeed = 0.0; concentratePumps[ pumpId ].direction = CONCENTRATE_PUMP_FORWARD_DIR; stopConcentratePump( pumpId ); } initPersistentAlarm( ALARM_ID_CP1_SPEED_CONTROL_ERROR, CONCENTRATE_PUMP_SPEED_CONTROL_PERSISTENCE_PERIOD, CONCENTRATE_PUMP_SPEED_CONTROL_PERSISTENCE_PERIOD ); initPersistentAlarm( ALARM_ID_CP2_SPEED_CONTROL_ERROR, CONCENTRATE_PUMP_SPEED_CONTROL_PERSISTENCE_PERIOD, CONCENTRATE_PUMP_SPEED_CONTROL_PERSISTENCE_PERIOD ); } /*********************************************************************//** * @brief * The execConcentratePumpMonitor function executes the concentrate pump monitor. * @details Inputs: none * @details Outputs: publish concentrate pump data * @return none *************************************************************************/ void execConcentratePumpMonitor( void ) { if ( ++concentratePumpMonitorTimerCounter >= getPublishConcentratePumpDataInterval() ) { CONCENTRATE_PUMP_DATA_T data; calcMeasuredPumpsSpeed( CONCENTRATEPUMPS_CP1, getFPGACP1HallSensePulseWidth() ); calcMeasuredPumpsSpeed( CONCENTRATEPUMPS_CP2, getFPGACP2HallSensePulseWidth() ); data.cp1CurrentSpeed = concentratePumps[ CONCENTRATEPUMPS_CP1 ].currentPumpSpeed; data.cp1MeasuredSpeed = getMeasuredPumpSpeed( CONCENTRATEPUMPS_CP1 ); data.cp2CurrentSpeed = concentratePumps[ CONCENTRATEPUMPS_CP2 ].currentPumpSpeed; data.cp2MeasuredSpeed = getMeasuredPumpSpeed( CONCENTRATEPUMPS_CP2 ); F32 const cp1Error = fabs( getMeasuredPumpSpeed( CONCENTRATEPUMPS_CP1 ) - concentratePumps[ CONCENTRATEPUMPS_CP1 ].currentPumpSpeed ) / concentratePumps[ CONCENTRATEPUMPS_CP1 ].currentPumpSpeed; F32 const cp2Error = fabs( getMeasuredPumpSpeed( CONCENTRATEPUMPS_CP2 ) - concentratePumps[ CONCENTRATEPUMPS_CP2 ].currentPumpSpeed ) / concentratePumps[ CONCENTRATEPUMPS_CP2 ].currentPumpSpeed; #ifndef DISABLE_DIALYSATE_CHECK checkPersistentAlarm( ALARM_ID_CP1_SPEED_CONTROL_ERROR, cp1Error > CONCENTRATE_PUMP_ERROR_TOLERANCE, cp1Error, CONCENTRATE_PUMP_ERROR_TOLERANCE ); checkPersistentAlarm( ALARM_ID_CP2_SPEED_CONTROL_ERROR, cp2Error > CONCENTRATE_PUMP_ERROR_TOLERANCE, cp2Error, CONCENTRATE_PUMP_ERROR_TOLERANCE ); #endif concentratePumpMonitorTimerCounter = 0U; broadcastConcentratePumpData( &data ); } } /*********************************************************************//** * @brief * The execConcentratePumpController function executes the concentrate pump controller. * @details Inputs: execState * @details Outputs: execState * @return none *************************************************************************/ void execConcentratePumpController( void ) { CONCENTRATE_PUMPS_T pumpId; for ( pumpId = CONCENTRATEPUMPS_CP1; pumpId < NUM_OF_CONCENTRATE_PUMPS; ++pumpId ) { switch ( concentratePumps[ pumpId ].execState ) { case CONCENTRATE_PUMP_OFF_STATE: concentratePumps[ pumpId ].execState = handleConcentratePumpOffState( pumpId ); break; case CONCENTRATE_PUMP_ON_STATE: concentratePumps[ pumpId ].execState = handleConcentratePumpOnState( pumpId ); break; default: SET_ALARM_WITH_2_U32_DATA( ALARM_ID_DG_SOFTWARE_FAULT, SW_FAULT_ID_CONCENTRATE_PUMP_EXEC_INVALID_STATE, pumpId ) concentratePumps[ pumpId ].execState = CONCENTRATE_PUMP_OFF_STATE; break; } } } /*********************************************************************//** * @brief * The requestConcentratePumpsOn function requests the module to turn on * the concentrate pumps. * @details Inputs: none * @details Outputs: set flag isPumpOnRequested to TRUE * @param pumpId concentrate pump id * @return none *************************************************************************/ void requestConcentratePumpsOn( CONCENTRATE_PUMPS_T pumpId ) { if ( pumpId < NUM_OF_CONCENTRATE_PUMPS ) { concentratePumps[ pumpId ].hasTurnOnPumpsBeenRequested = TRUE; } else { SET_ALARM_WITH_2_U32_DATA( ALARM_ID_DG_SOFTWARE_FAULT, SW_FAULT_ID_CONCENTRATE_PUMP_INVALID_PUMP_ID, pumpId ); } } /*********************************************************************//** * @brief * The requestConcentratePumpsOff function requests the module to turn off * the concentrate pumps. * @details Inputs: none * @details Outputs: set flag isPumpOffRequested to TRUE * @param pumpId concentrate pump id * @return none *************************************************************************/ void requestConcentratePumpsOff( CONCENTRATE_PUMPS_T pumpId ) { if ( pumpId < NUM_OF_CONCENTRATE_PUMPS ) { concentratePumps[ pumpId ].hasTurnOnPumpsBeenRequested = FALSE; concentratePumps[ pumpId ].pumpTargetSpeed = 0.0; } else { SET_ALARM_WITH_2_U32_DATA( ALARM_ID_DG_SOFTWARE_FAULT, SW_FAULT_ID_CONCENTRATE_PUMP_INVALID_PUMP_ID, pumpId ); } } /*********************************************************************//** * @brief * The setConcentratePumpTargetSpeed function sets the target step speed based on * given speed in mL/min to specified concentrate pump. * @details Inputs: none * @details Outputs: set target step speed for given pump * @param pumpId pump id to set step speed * @param targetSpeed_ml_min target speed in mL/min * @return none *************************************************************************/ void setConcentratePumpTargetSpeed( CONCENTRATE_PUMPS_T pumpId, F32 targetSpeed_ml_min ) { if ( pumpId < NUM_OF_CONCENTRATE_PUMPS ) { if ( targetSpeed_ml_min >= 0.0 ) { concentratePumps[ pumpId ].direction = CONCENTRATE_PUMP_FORWARD_DIR; } else { concentratePumps[ pumpId ].direction = CONCENTRATE_PUMP_REVERSE_DIR; targetSpeed_ml_min *= -1.0; } if ( ( CONCENTRATE_PUMP_MIN_SPEED <= targetSpeed_ml_min ) && ( targetSpeed_ml_min <= CONCENTRATE_PUMP_MAX_SPEED ) ) { concentratePumps[ pumpId ].pumpTargetSpeed = targetSpeed_ml_min; } else { SET_ALARM_WITH_2_U32_DATA( ALARM_ID_DG_SOFTWARE_FAULT, SW_FAULT_ID_CONCENTRATE_PUMP_SPEED_OUT_OF_RANGE, targetSpeed_ml_min ) } } else { SET_ALARM_WITH_2_U32_DATA( ALARM_ID_DG_SOFTWARE_FAULT, SW_FAULT_ID_CONCENTRATE_PUMP_INVALID_PUMP_ID, pumpId ); } } /*********************************************************************//** * @brief * The stopConcentratePump function sets the concentrate pump step speed to zero * and turns off concentrate pumps. * @details Inputs: none * @details Outputs: targetPumpSpeed[], currentPumpSpeed[], turn concentrate pumps off * @param pumpId concentrate pump id * @return none *************************************************************************/ static void stopConcentratePump( CONCENTRATE_PUMPS_T pumpId ) { concentratePumps[ pumpId ].currentPumpSpeed = 0.0; concentratePumps[ pumpId ].measuredPumpSpeed.data = 0.0; concentratePumps[ pumpId ].control( CONCENTRATE_PUMP_OFF_CONTROL ); concentratePumps[ pumpId ].setStepSpeed( CONCENTRATE_PUMP_ZERO_FLOW_RATE ); } /*********************************************************************//** * @brief * The handleConcentratePumpOffState function turns on concentrate pumps and * switch to on state upon request. * @details Inputs: none * @details Outputs: concentrate pumps turn on * @param pumpId concentrate pump id * @return state *************************************************************************/ static CONCENTRATE_PUMP_STATE_T handleConcentratePumpOffState( CONCENTRATE_PUMPS_T pumpId ) { CONCENTRATE_PUMP_STATE_T state = CONCENTRATE_PUMP_OFF_STATE; if ( TRUE == concentratePumps[ pumpId ].hasTurnOnPumpsBeenRequested ) { U08 const controlValue = ( CONCENTRATE_PUMP_ON_CONTROL | concentratePumps[ pumpId ].direction ); concentratePumps[ pumpId ].control( controlValue ); state = CONCENTRATE_PUMP_ON_STATE; } return state; } /*********************************************************************//** * @brief * The stepConcentratePumpToTargetSpeed function steps current step speed * toward target speed with predefined step increase. * @details Inputs: none * @details Outputs: currentPumpSpeed[] * @param pumpId concentrate pump id to increase current step speed * @return none *************************************************************************/ static void stepConcentratePumpToTargetSpeed( CONCENTRATE_PUMPS_T pumpId ) { F32 const currentToTargetDiff = fabs( concentratePumps[ pumpId ].pumpTargetSpeed - concentratePumps[ pumpId ].currentPumpSpeed ); F32 speedIncrease; if ( currentToTargetDiff > NEARLY_ZERO ) { if ( currentToTargetDiff > CONCENTRATE_PUMP_SPEED_INCREMENT ) { speedIncrease = CONCENTRATE_PUMP_SPEED_INCREMENT; } else { speedIncrease = currentToTargetDiff; } // Subtract current speed when target speed is smaller if ( concentratePumps[ pumpId ].pumpTargetSpeed < concentratePumps[ pumpId ].currentPumpSpeed ) { speedIncrease *= -1.0; } concentratePumps[ pumpId ].currentPumpSpeed += speedIncrease; } if ( concentratePumps[ pumpId ].currentPumpSpeed > NEARLY_ZERO ) { F32 const timePerStep = CONCENTRATE_PUMP_VOLUME_PER_REV / ( concentratePumps[ pumpId ].currentPumpSpeed * CONCENTRATE_PUMP_STEP_PER_REV ) ; F32 const stepPeriodCounts = timePerStep / ( CONCENTRATE_PUMP_STEP_PERIOD_RESOLUTION * CONCENTRATE_PUMP_MICRO_STEPS_PER_STEP ); concentratePumps[ pumpId ].togglePeriodCount = (U16)( stepPeriodCounts + 0.5 ); } else { concentratePumps[ pumpId ].togglePeriodCount = CONCENTRATE_PUMP_ZERO_FLOW_RATE; } } /*********************************************************************//** * @brief * The handleConcentratePumpOnState function turns off concentrate pumps switch * to off state upon request. While in on state, the function controls concentrate * pumps to a target step speed. * @details Inputs: currentPumpSpeed[] * @details Outputs: control concentrate pumps to target step speed * @param pumpId concentrate pump id * @return state *************************************************************************/ static CONCENTRATE_PUMP_STATE_T handleConcentratePumpOnState( CONCENTRATE_PUMPS_T pumpId ) { CONCENTRATE_PUMP_STATE_T state = CONCENTRATE_PUMP_ON_STATE; if ( ++concentratePumps[ pumpId ].controlTimerCounter >= CONCENTRATE_PUMP_CONTROL_INTERVAL ) { concentratePumps[ pumpId ].controlTimerCounter = 0; stepConcentratePumpToTargetSpeed( pumpId ); concentratePumps[ pumpId ].setStepSpeed( concentratePumps[ pumpId ].togglePeriodCount ); } if ( FALSE == concentratePumps[ pumpId ].hasTurnOnPumpsBeenRequested ) { state = CONCENTRATE_PUMP_OFF_STATE; stopConcentratePump( pumpId ); } return state; } /*********************************************************************//** * @brief * The getPublishConcentratePumpDataInterval function gets the concentrate pump * data publication interval. * @details Inputs: concentratePumpDataPublishInterval * @details Outputs: none * @return the current concentrate pump data publication interval (in ms). *************************************************************************/ static U32 getPublishConcentratePumpDataInterval( void ) { U32 result = concentratePumpDataPublishInterval.data; if ( OVERRIDE_KEY == concentratePumpDataPublishInterval.override ) { result = concentratePumpDataPublishInterval.ovData; } return result; } /*********************************************************************//** * @brief * The calcMeasuredPumpsSpeed function calculates the concentrate pump flow * rate using the hall sense pulse width count. * @details Inputs: none * @details Outputs: measuredPumpSpeed * @param pumpId concentrate pump id to increase current step speed * @param pulseWidthCount hall sense pulse width count reading from FPGA * @return none *************************************************************************/ static void calcMeasuredPumpsSpeed( CONCENTRATE_PUMPS_T pumpId, U16 pulseWidthCount ) { F32 const pulseWidthInSecond = (F32)( pulseWidthCount * CONCENTRATE_PUMP_HALL_SENSE_PERIOD_RESOLUTION ) / US_PER_SECOND; concentratePumps[ pumpId ].measuredPumpSpeed.data = ( 1 / pulseWidthInSecond ) * CONCENTRATE_PUMP_VOLUME_PER_PULSE * SEC_PER_MIN; if ( CONCENTRATE_PUMP_ZERO_FLOW_RATE == pulseWidthCount ) { concentratePumps[ pumpId ].measuredPumpSpeed.data = 0.0; } } /*********************************************************************//** * @brief * The getMeasuredPumpSpeed function gets the measured concentrate pump flow rate. * @details Inputs: measuredPumpSpeed * @details Outputs: none * @param pumpId concentrate pump id to increase current step speed * @return the current concentrate pump flow rate (in mL/min). *************************************************************************/ static F32 getMeasuredPumpSpeed( CONCENTRATE_PUMPS_T pumpId ) { F32 result = 0.0; if ( pumpId < NUM_OF_CONCENTRATE_PUMPS ) { result = concentratePumps[ pumpId ].measuredPumpSpeed.data; if ( OVERRIDE_KEY == concentratePumps[ pumpId ].measuredPumpSpeed.override ) { result = concentratePumps[ pumpId ].measuredPumpSpeed.ovData; } } else { SET_ALARM_WITH_2_U32_DATA( ALARM_ID_DG_SOFTWARE_FAULT, SW_FAULT_ID_CONCENTRATE_PUMP_INVALID_PUMP_ID, pumpId ); } return result; } /************************************************************************* * TEST SUPPORT FUNCTIONS *************************************************************************/ /*********************************************************************//** * @brief * The testSetConcentratePumpDataPublishIntervalOverride function overrides the * concentrate pump data publish interval. * @details Inputs: none * @details Outputs: concentratePumpDataPublishInterval * @param value override concentrate pump data publish interval with (in ms) * @return TRUE if override successful, FALSE if not *************************************************************************/ BOOL testSetConcentratePumpDataPublishIntervalOverride( U32 value ) { BOOL result = FALSE; if ( TRUE == isTestingActivated() ) { U32 intvl = value / TASK_GENERAL_INTERVAL; result = TRUE; concentratePumpDataPublishInterval.ovData = intvl; concentratePumpDataPublishInterval.override = OVERRIDE_KEY; } return result; } /*********************************************************************//** * @brief * The testResetConcentratePumpDataPublishIntervalOverride function resets the * override of the concentrate pump data publish interval. * @details Inputs: none * @details Outputs: concentratePumpDataPublishInterval * @return TRUE if override reset successful, FALSE if not *************************************************************************/ BOOL testResetConcentratePumpDataPublishIntervalOverride( void ) { BOOL result = FALSE; if ( TRUE == isTestingActivated() ) { result = TRUE; concentratePumpDataPublishInterval.override = OVERRIDE_RESET; concentratePumpDataPublishInterval.ovData = concentratePumpDataPublishInterval.ovInitData; } return result; } /*********************************************************************//** * @brief * The testSetConcentratePumpTargetSpeedOverride function overrides the target * speed value of given concentrate pump id. * @details Inputs: none * @details Outputs: targetPumpSpeed[] * @param pumpId concentrate pump id * @param value override concentrate pump target speed * @return TRUE if override successful, FALSE if not *************************************************************************/ BOOL testSetConcentratePumpTargetSpeedOverride( U32 pumpId, F32 value ) { BOOL result = FALSE; if ( pumpId < NUM_OF_CONCENTRATE_PUMPS && isTestingActivated() ) { F32 const absSpeed = fabs( value ); if ( ( CONCENTRATE_PUMP_MIN_SPEED <= absSpeed ) && ( absSpeed <= CONCENTRATE_PUMP_MAX_SPEED ) ) { result = TRUE; setConcentratePumpTargetSpeed( (CONCENTRATE_PUMPS_T)pumpId, value ); } } return result; } /*********************************************************************//** * @brief * The testSetConcentratePumpMeasuredSpeedOverride function overrides the * measured speed value of given concentrate pump id. * @details Inputs: none * @details Outputs: measuredPumpSpeed[] * @param pumpId concentrate pump id * @param value override concentrate pump measured speed * @return TRUE if override successful, FALSE if not *************************************************************************/ BOOL testSetConcentratePumpMeasuredSpeedOverride( U32 pumpId, F32 value ) { BOOL result = FALSE; if ( ( pumpId < NUM_OF_CONCENTRATE_PUMPS ) && isTestingActivated() ) { result = TRUE; concentratePumps[ pumpId ].measuredPumpSpeed.ovData = value; concentratePumps[ pumpId ].measuredPumpSpeed.override = OVERRIDE_KEY; } return result; } /*********************************************************************//** * @brief * The testResetConcentratePumpMeasuredSpeedOverride function resets the * measured speed value of given concentrate pump id. * @details Inputs: none * @details Outputs: measuredPumpSpeed[] * @param pumpId concentrate pump id * @return TRUE if override successful, FALSE if not *************************************************************************/ BOOL testResetConcentratePumpMeasuredSpeedOverride( U32 pumpId ) { BOOL result = FALSE; if ( ( pumpId < NUM_OF_CONCENTRATE_PUMPS ) && isTestingActivated() ) { result = TRUE; concentratePumps[ pumpId ].measuredPumpSpeed.ovData = 0.0; concentratePumps[ pumpId ].measuredPumpSpeed.override = OVERRIDE_RESET; } return result; } /**@}*/