Index: firmware/App/Controllers/BalancingChamber.c =================================================================== diff -u -r8471d9c87bc554586ecc1e7e12d6ee35b7876230 -r34e1ca4e998f57d2e962709cd272a296dc4d8c50 --- firmware/App/Controllers/BalancingChamber.c (.../BalancingChamber.c) (revision 8471d9c87bc554586ecc1e7e12d6ee35b7876230) +++ firmware/App/Controllers/BalancingChamber.c (.../BalancingChamber.c) (revision 34e1ca4e998f57d2e962709cd272a296dc4d8c50) @@ -207,7 +207,7 @@ { // Increment counter indicating fill is in progress. currentBalChamberSwitchingCounter += 1; - currentBalChamberFillCounter+=1; + currentBalChamberFillCounter += 1; // execute current balancing chamber exec state switch ( balChamberExecState ) @@ -802,7 +802,7 @@ * @details \b Inputs: Pressure * @details \b Outputs: valve states * @details \b Alarm: ALARM_ID_DD_BC_STATE1_FILL_START_PRESSURE_OUT_OF_RANGE - * when pressure is not in range during balacing chamber fill start. + * when pressure is not in range during balancing chamber fill start. * @return next balancing chamber state. *************************************************************************/ static BAL_CHAMBER_EXEC_STATE_T handleBalChamberState1FillStart( void ) @@ -860,7 +860,7 @@ /*********************************************************************//** * @brief * The handleBalChamberConcentrateControl function handles the Acid and Bicarb - * concentrate doisng and checks the conductivity of the dialysate for the treatment. + * concentrate dosing and checks the conductivity of the dialysate for the treatment. * @details \b Inputs: balChamberSWState , Concentrate volume * @details \b Outputs: isPressureDroppedDuringFill, state * @return next balancing chamber state. @@ -951,7 +951,7 @@ // close the state 1 opened valves valveControlForBCState1FillEnd(); isBalChamberFillInProgress = FALSE; - setDialysatePumpTargetRPM( D48_PUMP, getD48PumpSpeed(), TRUE ); + setDialysatePumpTargetRPM( D48_PUMP, getD48PumpSpeedForBCFill(), TRUE ); // Transition to next state state = BAL_CHAMBER_STATE1_FILL_END; @@ -963,21 +963,21 @@ /*********************************************************************//** * @brief * The handleBalChamberState1FillEnd function check for the balancing chamber - * switching period and tranistion to next state switching. + * switching period and transition to next state switching. * @details \b Inputs: currentBalChamberSwitchingCounter, balChamberSwitchingPeriod * @details \b Outputs: balChamberFillPressureDropCounter,balChamberFillCompleteStablePressureCounter * @details \b Alarm: ALARM_ID_DD_BC_STATE1_FILL_PRESSURE_DROP_OUT_OF_RANGE - * when pressure drop is not in range during balacing chamber fill in progress. + * when pressure drop is not in range during balancing chamber fill in progress. * @details \b Alarm: ALARM_ID_DD_BC_STATE1_FILL_END_PRESSURE_OUT_OF_RANGE - * when pressure is not in range during balacing chamber fill complete. + * when pressure is not in range during balancing chamber fill complete. * @return next balancing chamber state. *************************************************************************/ static BAL_CHAMBER_EXEC_STATE_T handleBalChamberState1FillEnd( void ) { BAL_CHAMBER_EXEC_STATE_T state = BAL_CHAMBER_STATE1_FILL_END; // On completion of cycle time, transition to next state - if ( currentBalChamberSwitchingCounter >= balChamberSwitchingPeriod ) + //if ( currentBalChamberSwitchingCounter >= balChamberSwitchingPeriod ) { balChamberFillPressureDropCounter = 0; balChamberFillCompleteStablePressureCounter = 0; @@ -1024,7 +1024,7 @@ * @details \b Inputs: fresh and spent dialysate pressure * @details \b Outputs: valve states * @details \b Alarm: ALARM_ID_DD_BC_STATE2_FILL_START_PRESSURE_OUT_OF_RANGE - * when pressure is not in range during balacing chamber state 2 fill start. + * when pressure is not in range during balancing chamber state 2 fill start. * @return next balancing chamber state. *************************************************************************/ static BAL_CHAMBER_EXEC_STATE_T handleBalChamberState2FillStart( void ) @@ -1120,7 +1120,7 @@ // close the valves valveControlForBCState2FillEnd(); isBalChamberFillInProgress = FALSE; - setDialysatePumpTargetRPM( D48_PUMP, getD48PumpSpeed(), TRUE ); + setDialysatePumpTargetRPM( D48_PUMP, getD48PumpSpeedForBCFill(), TRUE ); //Transition to next state state = BAL_CHAMBER_STATE2_FILL_END; @@ -1146,7 +1146,7 @@ BAL_CHAMBER_EXEC_STATE_T state = BAL_CHAMBER_STATE2_FILL_END; // On completion of cycle time, transition to next state - if ( currentBalChamberSwitchingCounter >= balChamberSwitchingPeriod ) + //if ( currentBalChamberSwitchingCounter >= balChamberSwitchingPeriod ) { balChamberFillPressureDropCounter = 0; balChamberFillCompleteStablePressureCounter = 0; @@ -1209,20 +1209,20 @@ F32 diffInSpentPressure = 0.0F; U32 absDiffSpentFillCount = 0; U32 adjustedSpeed = 0; - U32 spentDialPumpSpeed = getD48PumpSpeed(); + U32 spentDialPumpSpeed = getD48PumpSpeedForBCFill(); // Collect the next sample of spent pressure lastPrevSpentDialPressure = prevSpentDialPressure; prevSpentDialPressure = spentDialPressure; // find the pressure difference for pressure spike detection diffInSpentPressure = fabs(spentDialPressure - lastPrevSpentDialPressure); - if ( diffInSpentPressure >= SPENT_FILL_COMPLETE_DIFF_PRES ) + if ( ( diffInSpentPressure >= SPENT_FILL_COMPLETE_DIFF_PRES ) && ( isSpentFillComplete != TRUE ) ) { // Check spent fill time against the balancing chamber closing period diffSpentFillCompleteCount = balChamberValveClosePeriod - currentBalChamberFillCounter; absDiffSpentFillCount = abs(diffSpentFillCompleteCount); - adjustedSpeed = ( ( absDiffSpentFillCount / balChamberValveClosePeriod ) * getD48PumpSpeed() ) * D48_SPEED_ADJUST_FACTOR; + adjustedSpeed = ( ( absDiffSpentFillCount / balChamberValveClosePeriod ) * getD48PumpSpeedForBCFill() ) * D48_SPEED_ADJUST_FACTOR; //Not adjust the D48 pump speed if the fill counter is just 50ms difference from the closing period. if ( absDiffSpentFillCount > SPENT_DIFF_COUNT_DEADBAND ) @@ -1239,7 +1239,7 @@ } // Update the D48 pump speed - setD48PumpSpeed( spentDialPumpSpeed ); + setD48PumpSpeedForBCFill( spentDialPumpSpeed ); } //Update spent fill is complete @@ -1377,7 +1377,7 @@ data.isBalChamberFillInProgress = isBalChamberFillInProgress; data.currentBalChamberSwitchingCounter = currentBalChamberSwitchingCounter; #else - data.balChamberSwPeriod = getD48PumpSpeed(); + data.balChamberSwPeriod = getD48PumpSpeedForBCFill(); data.isBalChamberFillInProgress = isSpentFillComplete; data.currentBalChamberSwitchingCounter = currentBalChamberFillCounter; #endif Index: firmware/App/Modes/ModeGenDialysate.c =================================================================== diff -u -r8471d9c87bc554586ecc1e7e12d6ee35b7876230 -r34e1ca4e998f57d2e962709cd272a296dc4d8c50 --- firmware/App/Modes/ModeGenDialysate.c (.../ModeGenDialysate.c) (revision 8471d9c87bc554586ecc1e7e12d6ee35b7876230) +++ firmware/App/Modes/ModeGenDialysate.c (.../ModeGenDialysate.c) (revision 34e1ca4e998f57d2e962709cd272a296dc4d8c50) @@ -103,6 +103,7 @@ static DD_GEND_MODE_STATE_T handleGenDIsolatedUFState( void ); static F32 getGenDialysateTargetTemperature( void ); static void calculateTargetDialysateTemp( void ); +static void calculateD48PumpSpeedForBCFill( void ); static void updateDialysateToDialyzerFlowRate( void ); static void checkDialysateTemperature( void ); static void monitorChamberLevelStatus( void ); @@ -166,7 +167,7 @@ { initGenDialysateMode(); setCurrentSubState( NO_SUB_STATE ); - calculateD48PumpSpeed(); + calculateD48PumpSpeedForBCFill(); transitionToUltrafiltration(); return genDialysateState; @@ -501,25 +502,25 @@ /*********************************************************************//** * @brief - * The getD48PumpSpeed function returns the calculated D48 pump speed + * The getD48PumpSpeedForBCFill function returns the calculated D48 pump speed * @details \b Inputs: none * @details \b Outputs: none * @return D48 pump speed. *************************************************************************/ -U32 getD48PumpSpeed( void ) +U32 getD48PumpSpeedForBCFill( void ) { return d48PumpSpeed; } /*********************************************************************//** * @brief - * The setD48PumpSpeed function sets the updated D48 pump speed. + * The setD48PumpSpeedForBCFill function sets the updated D48 pump speed. * @details \b Inputs: none * @details \b Outputs: d48PumpSpeed * @param pumpSpeed Dialysate pump speed * @return none. *************************************************************************/ -void setD48PumpSpeed( U32 pumpSpeed ) +void setD48PumpSpeedForBCFill( U32 pumpSpeed ) { d48PumpSpeed = pumpSpeed; } @@ -581,13 +582,13 @@ /*********************************************************************//** * @brief - * The calculateD48PumpSpeed function calculates the pump speed based on the + * The calculateD48PumpSpeedForBCFill function calculates the pump speed based on the * dialysate flow rate for continuous delivery of dialysate. * @details \b Inputs: Qd. * @details \b Outputs: D48 pump speed * @return none. *************************************************************************/ -static void calculateD48PumpSpeed( void ) +static void calculateD48PumpSpeedForBCFill( void ) { // Get the dialysate flow rate from TD F32 dialFlowrate = getTDDialysateFlowrate(); @@ -902,7 +903,7 @@ signalUFRateUpdate(); //Update D48 pump speed - calculateD48PumpSpeed(); + calculateD48PumpSpeedForBCFill(); //reset the flag isTreatmentParamUpdated = FALSE; Index: firmware/App/Modes/ModeGenDialysate.h =================================================================== diff -u -r8471d9c87bc554586ecc1e7e12d6ee35b7876230 -r34e1ca4e998f57d2e962709cd272a296dc4d8c50 --- firmware/App/Modes/ModeGenDialysate.h (.../ModeGenDialysate.h) (revision 8471d9c87bc554586ecc1e7e12d6ee35b7876230) +++ firmware/App/Modes/ModeGenDialysate.h (.../ModeGenDialysate.h) (revision 34e1ca4e998f57d2e962709cd272a296dc4d8c50) @@ -63,8 +63,8 @@ void setTreatmentParamUpdate( void ); // To indicate one or more treatment parameters updated void updateTreatmentSettings( void ); // Process the recent treatment parameters changes BOOL requestDDGenDialyasteStop( void ); // Stop generate dialysate -U32 getD48PumpSpeed( void ); // Get D48 pump speed -void setD48PumpSpeed( U32 pumpSpeed ); // Set D48 pump speed +U32 getD48PumpSpeedForBCFill( void ); // Get D48 pump speed +void setD48PumpSpeedFill( U32 pumpSpeed ); // Set D48 pump speed BOOL testDDGenDialysateDataPublishIntervalOverride( MESSAGE_T *message ); // GenD Mode data publish interval override BOOL testDialDeliveryInProgressOverride( MESSAGE_T *message ); // To override the dialysate delivery in progress flag