Index: firmware/App/Controllers/AirPump.c =================================================================== diff -u -r4d00373f7c26919f95680581d690e7ef5e997192 -ra25d5c24569e3d77487a75498a4e10dd83ada9c4 --- firmware/App/Controllers/AirPump.c (.../AirPump.c) (revision 4d00373f7c26919f95680581d690e7ef5e997192) +++ firmware/App/Controllers/AirPump.c (.../AirPump.c) (revision a25d5c24569e3d77487a75498a4e10dd83ada9c4) @@ -132,6 +132,8 @@ *************************************************************************/ void execAirPumpController( void ) { + currentAirPumpRPM = getAirPumpMotorRPM(); + switch( currentAirPumpState ) { case AIR_PUMP_STATE_INIT: Index: firmware/App/Controllers/AirTrap.c =================================================================== diff -u -r2075fb989d74d881f2e73c19052aa32fa9d760a6 -ra25d5c24569e3d77487a75498a4e10dd83ada9c4 --- firmware/App/Controllers/AirTrap.c (.../AirTrap.c) (revision 2075fb989d74d881f2e73c19052aa32fa9d760a6) +++ firmware/App/Controllers/AirTrap.c (.../AirTrap.c) (revision a25d5c24569e3d77487a75498a4e10dd83ada9c4) @@ -56,11 +56,11 @@ #define AIR_PUMP_MOTOR_MIN_PWM_OVERRIDE 60 ///< Air pump motor minimum PWM to override. #define AIR_PUMP_MOTOR_MAX_PWM_OVERRIDE 250 ///< Air pump motor maximum PWM to override. #define AIR_PUMP_MOTOR_MAX_PWM 255 ///< Air pump motor maximum PWM. -/// from air pump manufacturer's data for pump current draw based on pump speed and venous pressure mmHg, -/// the currently set air pump duty cycle (raw PWM) = 0.0005x^2 + 0.2313x + 63.667, where x is H14 venous pressure in mmHg before air pump lower event -#define QUADRATIC_COEFFICIENT 0.005F ///< X2 quadratic coefficient -#define LINEAR_COEFFICIENT 0.2313 ///< X linear coefficient -#define CONSTANT_TERM 63.667 ///< Constant term +/// LDT-2384 test formula for air trap lower events for air pump duty cycle based on venous pressure +/// air pump duty cycle (% PWM) = 0.0002x^2 + 0.0925x + 25.467, where x is long filtered H14 venous pressure in mmHg before air trap lower event +#define QUADRATIC_COEFFICIENT 0.0002F ///< X2 quadratic coefficient +#define LINEAR_COEFFICIENT 0.0925F ///< X linear coefficient +#define CONSTANT_TERM 25.467F ///< Constant term /// Defined states for the air trap controller state machine. typedef enum AirTrap_States @@ -343,7 +343,7 @@ *************************************************************************/ F32 getCalculatedAirPumpDutyCycle( void ) { - F32 h14Pressure = getFilteredVenousPressure(); + F32 h14Pressure = getLongFilteredVenousPressure(); // the currently set P12 duty cycle (raw PWM) must be 0.0005x^2 + 0.2313x + 63.667, where x = H14 venous pressure in mmHg before air pump lower event F32 dutyCycle = ( ( QUADRATIC_COEFFICIENT * ( h14Pressure * h14Pressure ) ) - ( LINEAR_COEFFICIENT * ( h14Pressure ) ) ) + CONSTANT_TERM; dutyCycle = ( dutyCycle / AIR_PUMP_MOTOR_MAX_PWM ) * FRACTION_TO_PERCENT_FACTOR; Index: firmware/App/Drivers/GLXferPump.c =================================================================== diff -u -rc8bc16e4ab55a0995f5282bc1b10bd9ee8656a87 -ra25d5c24569e3d77487a75498a4e10dd83ada9c4 --- firmware/App/Drivers/GLXferPump.c (.../GLXferPump.c) (revision c8bc16e4ab55a0995f5282bc1b10bd9ee8656a87) +++ firmware/App/Drivers/GLXferPump.c (.../GLXferPump.c) (revision a25d5c24569e3d77487a75498a4e10dd83ada9c4) @@ -92,6 +92,18 @@ } /*********************************************************************//** +* @brief +* The getAirPumpMotorRPM function reads the air pump RPM from FPGA. +* @details \b Inputs: getAirPumpRPM +* @details \b Outputs: none +* @return air pump motor RPM value. +*************************************************************************/ +U16 getAirPumpMotorRPM( void ) +{ + return getH12AirPumpMotorRPM(); +} + +/*********************************************************************//** * @brief * The PercentageToScalar function convert percentage 0-100% duty * cycle to 0-255 scalar value. Index: firmware/App/Drivers/GLXferPump.h =================================================================== diff -u -rc8bc16e4ab55a0995f5282bc1b10bd9ee8656a87 -ra25d5c24569e3d77487a75498a4e10dd83ada9c4 --- firmware/App/Drivers/GLXferPump.h (.../GLXferPump.h) (revision c8bc16e4ab55a0995f5282bc1b10bd9ee8656a87) +++ firmware/App/Drivers/GLXferPump.h (.../GLXferPump.h) (revision a25d5c24569e3d77487a75498a4e10dd83ada9c4) @@ -40,6 +40,7 @@ void initGasLiqXferPumpDriver( void ); void setAirPumpMotorPower( F32 power ); F32 getAirPumpMotorPower( void ); +U16 getAirPumpMotorRPM( void ); BOOL testSetAirPump( MESSAGE_T *message ); Index: firmware/App/Services/FpgaTD.c =================================================================== diff -u -r395522dffef1348e176564925656012f529c1910 -ra25d5c24569e3d77487a75498a4e10dd83ada9c4 --- firmware/App/Services/FpgaTD.c (.../FpgaTD.c) (revision 395522dffef1348e176564925656012f529c1910) +++ firmware/App/Services/FpgaTD.c (.../FpgaTD.c) (revision a25d5c24569e3d77487a75498a4e10dd83ada9c4) @@ -911,6 +911,18 @@ /*********************************************************************//** * @brief + * The getH12AirPumpMotorRPM function reads the air pump RPM from FPGA. + * @details \b Inputs: fpgaSensorReadings + * @details \b Outputs: none + * @return air pump RPM value + *************************************************************************/ +U16 getH12AirPumpMotorRPM( void ) +{ + return fpgaSensorReadings.h12Speed; +} + +/*********************************************************************//** + * @brief * The setH12AirPumpMotorPowerLevel function sets the air pump motor power level * to 0 to turn pump off or 1..255 for varying power levels. * @details \b Inputs: fpgaActuatorSetPoints.h12Control Index: firmware/App/Services/FpgaTD.h =================================================================== diff -u -r395522dffef1348e176564925656012f529c1910 -ra25d5c24569e3d77487a75498a4e10dd83ada9c4 --- firmware/App/Services/FpgaTD.h (.../FpgaTD.h) (revision 395522dffef1348e176564925656012f529c1910) +++ firmware/App/Services/FpgaTD.h (.../FpgaTD.h) (revision a25d5c24569e3d77487a75498a4e10dd83ada9c4) @@ -125,6 +125,7 @@ void setH13ValveState( VALVE_3WAY_STATE_T state ); void setH20ValveState( VALVE_3WAY_STATE_T state ); +U16 getH12AirPumpMotorRPM( void ); void setH12AirPumpMotorPowerLevel( U08 power ); void setH12AirPumpMotorPWMCntTime( U16 tenNS );