Index: firmware/.settings/org.eclipse.core.resources.prefs =================================================================== diff -u -r228773fa681489a62db5c47807a4794e5761d4f5 -r667b74fa0fcd8368f83fc8f8df5166eabea2bf4b --- firmware/.settings/org.eclipse.core.resources.prefs (.../org.eclipse.core.resources.prefs) (revision 228773fa681489a62db5c47807a4794e5761d4f5) +++ firmware/.settings/org.eclipse.core.resources.prefs (.../org.eclipse.core.resources.prefs) (revision 667b74fa0fcd8368f83fc8f8df5166eabea2bf4b) @@ -28,6 +28,8 @@ encoding//Release/App/Controllers/subdir_vars.mk=UTF-8 encoding//Release/App/Drivers/subdir_rules.mk=UTF-8 encoding//Release/App/Drivers/subdir_vars.mk=UTF-8 +encoding//Release/App/Modes/FPModes/subdir_rules.mk=UTF-8 +encoding//Release/App/Modes/FPModes/subdir_vars.mk=UTF-8 encoding//Release/App/Modes/subdir_rules.mk=UTF-8 encoding//Release/App/Modes/subdir_vars.mk=UTF-8 encoding//Release/App/Monitors/subdir_rules.mk=UTF-8 Index: firmware/App/Controllers/DialysatePumps.h =================================================================== diff -u -rf6022e86136c821709ce24b61e11e8e2bdf0b11e -r667b74fa0fcd8368f83fc8f8df5166eabea2bf4b --- firmware/App/Controllers/DialysatePumps.h (.../DialysatePumps.h) (revision f6022e86136c821709ce24b61e11e8e2bdf0b11e) +++ firmware/App/Controllers/DialysatePumps.h (.../DialysatePumps.h) (revision 667b74fa0fcd8368f83fc8f8df5166eabea2bf4b) @@ -24,15 +24,15 @@ * @defgroup DialysatePumps DialysatePumps * @brief Dialysate Pumps monitor/controller module. Controls and monitors the dialysate pumps. * Dialysate pump manufacturer: Diener Silencer Series Gear Pumps, PN: 01483-PM-3-RA. - * The pump shall produce flow rates of 350-2700 ml/min. + * The pump shall run at 200(10%) -2700(90%)RPM. * * @addtogroup DialysatePumps * @{ */ // ********** public definitions ********** -#define MIN_DIALYSATE_PUMP_RPM 350 ///< Minimum RPM target for dialysate pump (though zero is allowed if turning pump off). +#define MIN_DIALYSATE_PUMP_RPM 200 ///< Minimum RPM target for dialysate pump (though zero is allowed if turning pump off). #define MAX_DIALYSATE_PUMP_RPM 2650 ///< Maximum RPM target for dialysate pump. #define DEGAS_PUMP_TARGET_PRES_ADJ_THRESHOLD -1.0F ///< Dialysate Pump(D12) target pressure threshold adjustment factor. Index: firmware/App/Controllers/SpentChamberFill.h =================================================================== diff -u -re6415d33321e7990c3b5e82b0c8a87c64cc3a2c8 -r667b74fa0fcd8368f83fc8f8df5166eabea2bf4b --- firmware/App/Controllers/SpentChamberFill.h (.../SpentChamberFill.h) (revision e6415d33321e7990c3b5e82b0c8a87c64cc3a2c8) +++ firmware/App/Controllers/SpentChamberFill.h (.../SpentChamberFill.h) (revision 667b74fa0fcd8368f83fc8f8df5166eabea2bf4b) @@ -33,7 +33,7 @@ #define FRESH_DIAL_FILL_PRESSURE_MIN_PSIG 22.0F ///< Minimum fresh dialysate pressure (D18) limit for spent chamber fill operations. #define FRESH_DIAL_FILL_PRESSURE_MAX_PSIG 30.0F ///< Maximum fresh dialysate pressure (D18) limit for spent chamber fill operations. -#define SPENT_DIAL_FILL_PRESSURE_MIN_PSIG 24.0F ///< Minimum spent dialysate pressure (D51) limit for spent chamber fill operations. +#define SPENT_DIAL_FILL_PRESSURE_MIN_PSIG -10.0F ///< Minimum spent dialysate pressure (D51) limit for spent chamber fill operations. #define SPENT_DIAL_FILL_PRESSURE_MAX_PSIG 30.0F ///< Maximum spent dialysate pressure (D51) limit for spent chamber fill operations. /// spent chamber fill data structure Index: firmware/App/DDCommon.h =================================================================== diff -u -r3ca50e2b481ee3f2a350c071e6c98b3a68373e94 -r667b74fa0fcd8368f83fc8f8df5166eabea2bf4b --- firmware/App/DDCommon.h (.../DDCommon.h) (revision 3ca50e2b481ee3f2a350c071e6c98b3a68373e94) +++ firmware/App/DDCommon.h (.../DDCommon.h) (revision 667b74fa0fcd8368f83fc8f8df5166eabea2bf4b) @@ -51,6 +51,9 @@ //Uncomment below for bicarb chamber filling //#define __BICARB_CHAMBER_FILL__ 1 +//Uncomment below for Maxon controller speed change +//#define __MAXON_SPEED_UPDATE__ 1 + //Uncomment below to disable heaters debug message #define __HEATERS_DEBUG__ 1 Index: firmware/App/Modes/ModeGenDialysate.c =================================================================== diff -u -r1b110e3b2462fda74aa8f2811aad9ce61cb80309 -r667b74fa0fcd8368f83fc8f8df5166eabea2bf4b --- firmware/App/Modes/ModeGenDialysate.c (.../ModeGenDialysate.c) (revision 1b110e3b2462fda74aa8f2811aad9ce61cb80309) +++ firmware/App/Modes/ModeGenDialysate.c (.../ModeGenDialysate.c) (revision 667b74fa0fcd8368f83fc8f8df5166eabea2bf4b) @@ -60,7 +60,8 @@ #define LINEAR_SLOPE_FACTOR -0.0029F ///< Slope factor used in adjusted dialysate temperature linear calculation for high Qds #define LINEAR_INTERCEPT_FACTOR 3.47F ///< Intercept factor used in adjusted dialysate temperature linear calculation for high Qds #define LOW_DIAL_FLOW_RATE 150.0F ///< Dialysate flow rate lesser than 150 considered to be low Qds. -#define SPENT_CHAMBER_FILL_MAX_COUNT 15 ///< Total number of spent chamber fill allowed. +#define ZERO_DIAL_FLOW_RATE 0.0F ///< Zero dialysate flow rate +#define SPENT_CHAMBER_FILL_MAX_COUNT 10 ///< Total number of spent chamber fill allowed. #define BICARB_CHAMBER_FILL_TIMEOUT ( 1 * MS_PER_SECOND ) ///< Bicarb chamber fill timeout. //Testing #define DELAY_BC_SWITCHING_AT_START_UP ( 10 * MS_PER_SECOND ) ///< Provide a balancing chamber switching start up delay to stabilize pump speed etc., @@ -208,12 +209,13 @@ case DD_GEND_DIALYSATE_BYPASS_STATE: setValveState( D14_VALV, VALVE_STATE_OPEN ); - setValveState( D53_VALV, VALVE_STATE_OPEN ); // Drain valve + setValveState( D53_VALV, VALVE_STATE_OPEN ); // Drain valve setValveState( D35_VALV, VALVE_STATE_CLOSED ); // VDI setValveState( D40_VALV, VALVE_STATE_CLOSED ); // VDO setValveState( D47_VALV, VALVE_STATE_CLOSED ); // spent chamber purge valve setValveState( D64_VALV, VALVE_STATE_CLOSED ); setValveState( D34_VALV, VALVE_STATE_OPEN ); // Bypass valve + setValveState( D80_VALV, VALVE_STATE_OPEN ); // Bicarb valve // Turn on the primary heater calculateTargetDialysateTemp(); @@ -242,7 +244,7 @@ setValveState( D47_VALV, VALVE_STATE_CLOSED ); // spent chamber purge valve setValveState( D64_VALV, VALVE_STATE_CLOSED ); setValveState( D14_VALV, VALVE_STATE_OPEN ); - setValveState( D53_VALV, VALVE_STATE_OPEN ); // Drain valve + setValveState( D53_VALV, VALVE_STATE_OPEN ); // Drain valve // Turn on the primary heater calculateTargetDialysateTemp(); @@ -262,15 +264,17 @@ setValveState( D34_VALV, VALVE_STATE_CLOSED ); // Bypass valve setValveState( D35_VALV, VALVE_STATE_OPEN ); // VDI setValveState( D40_VALV, VALVE_STATE_OPEN ); // VDO + setValveState( D80_VALV, VALVE_STATE_OPEN ); // Bicarb valve break; case DD_GEND_SPENT_CHAMBER_FILL_STATE: //Set valves and actuators setValveState( D35_VALV, VALVE_STATE_CLOSED ); // VDI setValveState( D40_VALV, VALVE_STATE_CLOSED ); // VDO setValveState( D14_VALV, VALVE_STATE_OPEN ); - setValveState( D53_VALV, VALVE_STATE_OPEN ); // Drain valve + setValveState( D53_VALV, VALVE_STATE_OPEN ); // Drain valve setValveState( D34_VALV, VALVE_STATE_OPEN ); // Bypass valve + setValveState( D80_VALV, VALVE_STATE_OPEN ); // Bicarb valve setValveState( D47_VALV, VALVE_STATE_OPEN ); // Spent chamber purge valve requestConcentratePumpOff( D76_PUMP, FALSE ); @@ -304,9 +308,10 @@ setValveState( D40_VALV, VALVE_STATE_CLOSED ); // VDO setValveState( D14_VALV, VALVE_STATE_CLOSED ); - setValveState( D53_VALV, VALVE_STATE_OPEN ); // Drain valve + setValveState( D53_VALV, VALVE_STATE_OPEN ); // Drain valve setValveState( D34_VALV, VALVE_STATE_OPEN ); // Bypass valve setValveState( D64_VALV, VALVE_STATE_OPEN ); // Bicarb chamber purge valve + setValveState( D80_VALV, VALVE_STATE_OPEN ); // Bicarb valve bicarbFillStartTimeMS = getMSTimerCount(); // Turn on the primary heater @@ -324,22 +329,40 @@ break; case DD_GEND_DIALYSATE_DELIVERY_PAUSE: - // stop the motor during pause conditions - signalDialysatePumpHardStop( D12_PUMP ); + setDialysatePumpTargetRPM( D12_PUMP, FRESH_DIAL_PUMP_INITIAL_RPM, TRUE ); signalDialysatePumpHardStop( D48_PUMP ); requestConcentratePumpOff( D11_PUMP, FALSE ); requestConcentratePumpOff( D10_PUMP, FALSE ); requestConcentratePumpOff( D76_PUMP, FALSE ); //Rinse pump Off setRinsePumpState( RINSE_PUMP_STATE_OFF ); - stopHeater( D5_HEAT ); + // Turn on the primary heater + calculateTargetDialysateTemp(); + setHeaterTargetTemperature( D5_HEAT, getGenDialysateTargetTemperature() ); + //Disable the D28 based temp control as fluid dispense being stopped by balancing chamber. + setD28TempFeedbackControl( FALSE ); + startHeater( D5_HEAT ); stopHeater( D45_HEAT ); - //Enable bypass valve - setValveState( D35_VALV, VALVE_STATE_CLOSED ); // VDI - setValveState( D40_VALV, VALVE_STATE_CLOSED ); // VDO - setValveState( D34_VALV, VALVE_STATE_OPEN ); // Bypass valve + //close valves + setValveState( D35_VALV, VALVE_STATE_CLOSED ); + setValveState( D40_VALV, VALVE_STATE_CLOSED ); + setValveState( D31_VALV, VALVE_STATE_CLOSED ); + setValveState( D47_VALV, VALVE_STATE_CLOSED ); + setValveState( D64_VALV, VALVE_STATE_CLOSED ); + setValveState( D54_VALV, VALVE_STATE_CLOSED ); + setValveState( D14_VALV, VALVE_STATE_CLOSED ); + setValveState( D52_VALV, VALVE_STATE_CLOSED ); + setValveState( D65_VALV, VALVE_STATE_CLOSED ); + setValveState( D81_VALV, VALVE_STATE_CLOSED ); + setValveState( D8_VALV, VALVE_STATE_CLOSED ); + //Close all balancing chamber valves + valveControlForBCClosedState(); + + setValveState( D34_VALV, VALVE_STATE_OPEN ); + setValveState( D53_VALV, VALVE_STATE_OPEN ); + setValveState( D80_VALV, VALVE_STATE_OPEN ); break; case DD_GEND_ISOLATED_UF_STATE: @@ -443,8 +466,9 @@ BOOL hydChamberWaterInletControl( void ) { // Read floater switch - BOOL result = FALSE; - LEVEL_STATE_T floaterLevel = getLevelStatus( D6_LEVL ); + BOOL result = FALSE; + LEVEL_STATE_T floaterLevel = getLevelStatus( D6_LEVL ); + BOOL balancingChambFillInProgress = getBalancingChamberFillinProgressStatus(); // High level is met if ( LEVEL_STATE_HIGH == floaterLevel ) @@ -455,7 +479,7 @@ // Water level reached high. result = TRUE; } - else + else if ( LEVEL_STATE_LOW == floaterLevel || TRUE != balancingChambFillInProgress ) { // if level is not met,allow inlet water to hydraulics chamber setValveState( D3_VALV, VALVE_STATE_OPEN ); @@ -607,9 +631,10 @@ *************************************************************************/ static DD_GEND_MODE_STATE_T handleGenDDialysateDeliveryState( void ) { - DD_GEND_MODE_STATE_T state = DD_GEND_DIALYSATE_DELIVERY_STATE; - LEVEL_STATE_T spentChamberLevel = getLevelStatus( D46_LEVL ); - LEVEL_STATE_T bicarbChamberLevel = getLevelStatus( D63_LEVL ); + DD_GEND_MODE_STATE_T state = DD_GEND_DIALYSATE_DELIVERY_STATE; + LEVEL_STATE_T spentChamberLevel = getLevelStatus( D46_LEVL ); + LEVEL_STATE_T bicarbChamberLevel = getLevelStatus( D63_LEVL ); + BOOL balancingChambFillInProgress = getBalancingChamberFillinProgressStatus(); // if TD asks for bypass or dialysate is not good to deliver //transition to bypass dialystate state @@ -757,8 +782,13 @@ static DD_GEND_MODE_STATE_T handleGenDDialysateDeliveryPauseState( void ) { DD_GEND_MODE_STATE_T state = DD_GEND_DIALYSATE_DELIVERY_PAUSE; + F32 dialFlowrate = getTDDialysateFlowrate(); - //TODO : Handle pause state. + // Resume pause when Qd is not zero + if ( dialFlowrate > ZERO_DIAL_FLOW_RATE ) + { + state = DD_GEND_DIALYSATE_BYPASS_STATE; + } return state; } Index: firmware/App/Modes/ModeGenDialysate.h =================================================================== diff -u -ra711f7995e555b503ed8c295f98fbe7bb9e5abf5 -r667b74fa0fcd8368f83fc8f8df5166eabea2bf4b --- firmware/App/Modes/ModeGenDialysate.h (.../ModeGenDialysate.h) (revision a711f7995e555b503ed8c295f98fbe7bb9e5abf5) +++ firmware/App/Modes/ModeGenDialysate.h (.../ModeGenDialysate.h) (revision 667b74fa0fcd8368f83fc8f8df5166eabea2bf4b) @@ -33,7 +33,7 @@ #define FRESH_DIAL_PUMP_INITIAL_RPM 2500 ///< Nominal RPM target for fresh dialysate pump to maintain required pressure. #define SPENT_DIAL_PUMP_INITIAL_RPM 2300 ///< Nominal RPM target for spent dialysate pump to maintain required pressure. -#define SPENT_DIAL_PUMP_FILL_RPM 350 ///< Nominal RPM target for spent chamber fill operations. +#define SPENT_DIAL_PUMP_FILL_RPM 200 ///< Nominal RPM target for spent chamber fill operations. /// Generate dialysate mode data structure typedef struct Index: firmware/App/Services/FpgaDD.c =================================================================== diff -u -rc9a16bd5cab11fef6078dac1dd1cf62ab59801f3 -r667b74fa0fcd8368f83fc8f8df5166eabea2bf4b --- firmware/App/Services/FpgaDD.c (.../FpgaDD.c) (revision c9a16bd5cab11fef6078dac1dd1cf62ab59801f3) +++ firmware/App/Services/FpgaDD.c (.../FpgaDD.c) (revision 667b74fa0fcd8368f83fc8f8df5166eabea2bf4b) @@ -107,9 +107,13 @@ #define FPGA_CONDUCTIVITY_WR_ENABLE_BIT 0x04 ///< Conductivity Sensor write enable bit mask. #define FPGA_CONDUCTIVITY_RD_ENABLE_BIT 0x08 ///< Conductivity Sensor read enable bit mask. -#define FPGA_D42_BLOOD_LEAK_STATUS_MASK 0x04 ///< Bit mask for blood leak detector. -#define FPGA_D42_BLOOD_LEAK_ST_BIT_INDEX 2 ///< Bit index for the blood leak self test status bit. +#define FPGA_D42_BLOOD_LEAK_STATUS_MASK 0x04 ///< Bit mask for blood leak detector. +#define FPGA_D42_BLOOD_LEAK_ST_BIT_INDEX 2 ///< Bit index for the blood leak self test status bit. +#define MAX_PUMP_SPEED 3000.0F ///< Maxon controller pump maximum speed +#define PUMP_SPEED_OFFSET 168.7F ///< Speed Scale adjustment intercept factor +#define PUMP_SPEED_FULL_SCALE 3187.0F ///< Speed scale adjustment slope factor + #pragma pack(push,1) /// FPGA header struct. typedef struct @@ -540,7 +544,16 @@ *************************************************************************/ void setFPGAD48PumpSpeed( U16 speed ) { - fpgaActuatorSetPoints.fpgaD48PumpSpeed = speed; +#ifdef __MAXON_SPEED_UPDATE__ + { + U16 currentSpeed =(U16)( ( ( speed + PUMP_SPEED_OFFSET ) / PUMP_SPEED_FULL_SCALE ) * MAX_PUMP_SPEED ); + fpgaActuatorSetPoints.fpgaD48PumpSpeed = currentSpeed; + } +#else + { + fpgaActuatorSetPoints.fpgaD48PumpSpeed = speed; + } +#endif } /*********************************************************************//** @@ -554,7 +567,16 @@ *************************************************************************/ void setFPGAD12PumpSpeed( U16 speed ) { - fpgaActuatorSetPoints.fpgaD12PumpSpeed = speed; +#ifdef __MAXON_SPEED_UPDATE__ + { + U16 currentSpeed =(U16)( ( ( speed + PUMP_SPEED_OFFSET ) / PUMP_SPEED_FULL_SCALE ) * MAX_PUMP_SPEED ); + fpgaActuatorSetPoints.fpgaD12PumpSpeed = currentSpeed; + } +#else + { + fpgaActuatorSetPoints.fpgaD12PumpSpeed = speed; + } +#endif } /*********************************************************************//**