Index: firmware/App/Controllers/BalancingChamber.c =================================================================== diff -u -rf1dc3383b840c39f202b15679e0bbe2b2f7a2f83 -r42541cc4700d748d524400f61d99e288a0e11f3e --- firmware/App/Controllers/BalancingChamber.c (.../BalancingChamber.c) (revision f1dc3383b840c39f202b15679e0bbe2b2f7a2f83) +++ firmware/App/Controllers/BalancingChamber.c (.../BalancingChamber.c) (revision 42541cc4700d748d524400f61d99e288a0e11f3e) @@ -58,6 +58,7 @@ #define D48_SPEED_RANGE_LIMIT 0.25F ///< D48 speed adjustment range check limit ( D48 speed can vary +/-25% of initial calculated speed) #define BICARB_CHAMBER_PERIODIC_FILL_TIME ( 1 * SEC_PER_MIN * \ ( MS_PER_SECOND / TASK_GENERAL_INTERVAL ) ) ///< Periodic bicarb chamber fill request 60 sec x 20 = 1200 +#define NUMBER_OF_CYCLES_BASED_ON_FLOWRATE 4 ///< NUmber of Balancing Chamber cycles required to update the new Qd rate. #define BAL_CHAMBER_FILL_TIMEOUT_FACTOR 3.0F ///< Balancing Chamber fill timeout factor (300% of observed fill count) #define COMP_SLOPE -0.000376F ///< Balancing chamber temperature compensation slope factor #define COMP_INTERCEPT 1.007269F ///< Balancing chamber temperature compensation intercept factor @@ -212,8 +213,9 @@ * The getBicarbConcentratePumpSpeedMlMin function computes D10 pump speed * from the instantaneous bicarb mix volume: * speed = 240 - sqrt(230400 - 96000*v) / 2 - * Result is clamped to [0, CONCENTRATE_PUMP_MAX_SPEED]. + * Result is clamped to [CONCENTRATE_PUMP_MIN_SPEED, CONCENTRATE_PUMP_MAX_SPEED]. * @details \b Inputs: bicarbVolumeMl + * @details \b Outputs: none * @param bicarbVolumeMl Instantaneous bicarb mix volume (mL) * @return Bicarb concentrate pump speed (mL/min) *************************************************************************/ @@ -235,7 +237,7 @@ } else if ( result < 0.0F ) { - result = 0.0F; + result = CONCENTRATE_PUMP_MIN_SPEED; } return result; @@ -409,9 +411,7 @@ *************************************************************************/ static void scheduleFirstCycleRelaxAfterQdApply( void ) { - //TODO : revert after testing - //bcSwitchingBasedOnClosedPeriodCounter = 2; - bcSwitchingBasedOnClosedPeriodCounter = 4; + bcSwitchingBasedOnClosedPeriodCounter = NUMBER_OF_CYCLES_BASED_ON_FLOWRATE; } /*********************************************************************//** @@ -924,11 +924,12 @@ { SET_ALARM_WITH_2_U32_DATA( ALARM_ID_DD_BC_FILL_TIMEOUT_FAULT, currentBalChamberFillCounter, balChamberFillTimeoutCount ); + SEND_EVENT_WITH_2_U32_DATA( DD_EVENT_BC_FILL_TIMEOUT, isPressureStabilizedDuringFill, isSpentFillComplete ); + // Move to the idle state state = BAL_CHAMBER_STATE_IDLE; } -#if 1 // Check fresh dialysate pressure back in range to indicate fresh fill complete. if ( ( freshDialPressure >= FRESH_DIAL_PRESSURE_MIN_PSIG ) && ( freshDialPressure <= FRESH_DIAL_PRESSURE_MAX_PSIG ) ) { @@ -938,22 +939,6 @@ isPressureStabilizedDuringFill = TRUE; } } -#else - // If the dry bicarbonate is enabled then we ignore looking at d18 pressure to be in range. - if ( ( FALSE == getTestConfigStatus( TEST_CONFIG_DD_DISABLE_DRY_BICARB ) ) && ( TRUE == getBicarbChamberFillRequested() ) ) - { - isPressureStabilizedDuringFill = TRUE; - } - // Check fresh dialysate pressure back in range to indicate fresh fill complete. - else if ( ( freshDialPressure >= FRESH_DIAL_PRESSURE_MIN_PSIG ) && ( freshDialPressure <= FRESH_DIAL_PRESSURE_MAX_PSIG ) ) - { - if ( ++balChamberFillCompleteStablePressureCounter >= BAL_CHAMBER_FILL_COMPLETE_MS ) - { - // stabilized pressure indicating fresh side fill is complete - isPressureStabilizedDuringFill = TRUE; - } - } -#endif // Close fresh side valves only upon fresh fill completion by detecting pressure rise. closeFreshSideValvesWhenFillComplete(); @@ -1191,7 +1176,17 @@ freshDialPressure = getFilteredPressure( D18_PRES ); spentDialPressure = getFilteredPressure( D51_PRES ); -#if 1 + // After the first BC cycle, fault if fill never completes at the Qd-based timeout. + if ( ( currentBalChamberFillCounter > balChamberFillTimeoutCount ) && ( TRUE != getTestConfigStatus( TEST_CONFIG_DD_DISABLE_BC_PRESSURE_ALARMS ) ) ) + { + SET_ALARM_WITH_2_U32_DATA( ALARM_ID_DD_BC_FILL_TIMEOUT_FAULT, currentBalChamberFillCounter, balChamberFillTimeoutCount ); + + SEND_EVENT_WITH_2_U32_DATA( DD_EVENT_BC_FILL_TIMEOUT, isPressureStabilizedDuringFill, isSpentFillComplete ); + + // Move to the idle state + state = BAL_CHAMBER_STATE_IDLE; + } + // Check fresh dialysate pressure back in range to indicate fresh fill complete. if ( ( freshDialPressure >= FRESH_DIAL_PRESSURE_MIN_PSIG ) && ( freshDialPressure <= FRESH_DIAL_PRESSURE_MAX_PSIG ) ) { @@ -1201,32 +1196,7 @@ isPressureStabilizedDuringFill = TRUE; } } -#else - // If the dry bicarbonate is enabled then we ignore looking at d18 pressure to be in range. - if ( ( FALSE == getTestConfigStatus( TEST_CONFIG_DD_DISABLE_DRY_BICARB ) ) && ( TRUE == getBicarbChamberFillRequested() ) ) - { - isPressureStabilizedDuringFill = TRUE; - } - // Check fresh dialysate pressure back in range to indicate fresh fill complete. - else if ( ( freshDialPressure >= FRESH_DIAL_PRESSURE_MIN_PSIG ) && ( freshDialPressure <= FRESH_DIAL_PRESSURE_MAX_PSIG ) ) - { - if ( ++balChamberFillCompleteStablePressureCounter >= BAL_CHAMBER_FILL_COMPLETE_MS ) - { - // stabilized pressure indicating fresh side fill is complete - isPressureStabilizedDuringFill = TRUE; - } - } -#endif - // After the first BC cycle, fault if fill never completes at the Qd-based timeout. - if ( ( currentBalChamberFillCounter > balChamberFillTimeoutCount ) && ( TRUE != getTestConfigStatus( TEST_CONFIG_DD_DISABLE_BC_PRESSURE_ALARMS ) ) ) - { - SET_ALARM_WITH_2_U32_DATA( ALARM_ID_DD_BC_FILL_TIMEOUT_FAULT, currentBalChamberFillCounter, balChamberFillTimeoutCount ); - - // Move to the idle state - state = BAL_CHAMBER_STATE_IDLE; - } - // Close fresh side valves only upon fresh fill completion by detecting pressure rise. closeFreshSideValvesWhenFillComplete(); Index: firmware/App/Controllers/BalancingChamber.h =================================================================== diff -u -rf1dc3383b840c39f202b15679e0bbe2b2f7a2f83 -r42541cc4700d748d524400f61d99e288a0e11f3e --- firmware/App/Controllers/BalancingChamber.h (.../BalancingChamber.h) (revision f1dc3383b840c39f202b15679e0bbe2b2f7a2f83) +++ firmware/App/Controllers/BalancingChamber.h (.../BalancingChamber.h) (revision 42541cc4700d748d524400f61d99e288a0e11f3e) @@ -75,8 +75,8 @@ F32 getBalancingChamberError( void ); // Get balancing chamber error to adjust UF rate. F32 getBicarbDoseVol( void ); // Get liquid bicarb dose volume F32 getAcidDoseVol( void ); // Get acid dose volume -BOOL isBalChamberSwitchImminent( void ); -BOOL getBalChamberFreshSideValvesClosedStatus( void ); +BOOL isBalChamberSwitchImminent( void ); // Get the balancing chamber is within the valve-close window (50 ms) before switching. +BOOL getBalChamberFreshSideValvesClosedStatus( void ); // Get the balancing chamber fresh side valve close status BOOL testDDBalChamberDataPublishIntervalOverride( MESSAGE_T *message ); // To override the balancing chamber data publish interval BOOL testBalChamberSwFreqOverride( MESSAGE_T *message ); // To override the balancing chamber switching frequency Index: firmware/App/Controllers/ConcentratePumps.h =================================================================== diff -u -rf1dc3383b840c39f202b15679e0bbe2b2f7a2f83 -r42541cc4700d748d524400f61d99e288a0e11f3e --- firmware/App/Controllers/ConcentratePumps.h (.../ConcentratePumps.h) (revision f1dc3383b840c39f202b15679e0bbe2b2f7a2f83) +++ firmware/App/Controllers/ConcentratePumps.h (.../ConcentratePumps.h) (revision 42541cc4700d748d524400f61d99e288a0e11f3e) @@ -32,7 +32,8 @@ // ********** public definitions ********** // For 150 RPM, Diener pump delivers 60ml/min #define CONCENTRATE_PUMP_MAX_SPEED 200.0F ///< Maximum Diener pump speed for concentrate pump in mL/min -#define DOSING_ACID_CONCENTRATE_PUMP_SPEED 100.0F ///< Diener pump speed for acid pump +#define CONCENTRATE_PUMP_MIN_SPEED 20.0F ///< Minimum Diener pump speed for concentrate pump in mL/min +#define DOSING_ACID_CONCENTRATE_PUMP_SPEED 60.0F ///< Diener pump speed for acid pump #define DOSING_CONCENTRATE_PUMP_SPEED 100.F ///< Dosing pump speed for spent chamber fill for acid and bicarb pumps #define DRAIN_BICART_PUMP_SPEED 200.0F ///< Diener pump speed for cartridge drains at maximum speed in mL/min Index: firmware/App/Controllers/DryBiCart.c =================================================================== diff -u -rf1dc3383b840c39f202b15679e0bbe2b2f7a2f83 -r42541cc4700d748d524400f61d99e288a0e11f3e --- firmware/App/Controllers/DryBiCart.c (.../DryBiCart.c) (revision f1dc3383b840c39f202b15679e0bbe2b2f7a2f83) +++ firmware/App/Controllers/DryBiCart.c (.../DryBiCart.c) (revision 42541cc4700d748d524400f61d99e288a0e11f3e) @@ -169,7 +169,7 @@ static BICARB_CHAMBER_FILL_EXEC_STATE_T handleBicarbChamberPressureCheckState( void ); static BICARB_CHAMBER_FILL_EXEC_STATE_T handleBicarbChamberSupplyVentStartState(void); static BICARB_CHAMBER_FILL_EXEC_STATE_T handleBicarbChamberSupplyVentEndState(void); -static BOOL isDryBicartBalChamberFillWindowOpen( void ); +static BOOL isDryBicartChamberFillWindowOpen( void ); static void closeD65IfBalChamberSwitchImminent( void ); // Drain static DRY_BICART_DRAIN_EXEC_STATE_T handleDryBicartDrainStartState( void ); @@ -560,14 +560,14 @@ /*********************************************************************//** * @brief - * The isDryBicartBalChamberFillWindowOpen function checks whether D65 may be + * The isDryBicartChamberFillWindowOpen function checks whether D65 may be * opened for dry bicarb refill: fresh-side BC valves closed and BC switch not - * within the 100 ms valve-close window. + * within the 50 ms valve-close window. * @details \b Inputs: getBalChamberFreshSideValvesClosedStatus, isBalChamberSwitchImminent * @details \b Outputs: none - * @return TRUE when the BC fresh-side fill window is open for D65. + * @return TRUE when the BC fill is completed and allow D65 to fill Chamber F *************************************************************************/ -static BOOL isDryBicartBalChamberFillWindowOpen( void ) +static BOOL isDryBicartChamberFillWindowOpen( void ) { BOOL result = FALSE; @@ -887,16 +887,16 @@ F32 d66Pressure = getFilteredPressure( D66_PRES ); F32 fillCompletePressure = GET_FILL_COMPLETE_PRESSURE_PSI; - // Close dry bicart inlet water if D66 pressure is 17 PSI + // Close dry bicart inlet water if D66 pressure is equal to fill complete pressure if ( d66Pressure >= fillCompletePressure ) { - // start the persistence timer once d66 reaches 17 PSI + // start the persistence timer once d66 reaches fill complete pressure if ( 0 == dryBiCartPersistenceStartTime ) { dryBiCartPersistenceStartTime = getMSTimerCount(); } - // 200 ms persistence on D66 pressure since pressure overshoot just after D65 opening + // defined persistence on D66 pressure since pressure overshoot just after D65 opening if ( TRUE == didTimeout( dryBiCartPersistenceStartTime, DRY_BICART_PERSISTENCE_DURATION_MS ) ) { setValveState( D65_VALV, VALVE_STATE_CLOSED ); @@ -963,15 +963,15 @@ //Vent chamber F to atmosphere setValveState( D64_VALV, VALVE_STATE_OPEN ); - // D66 pressure drops to below 1.5 PSI + // D66 pressure drops to below fill vent complete pressure if ( ( d66Pressure <= DRY_BICART_FILL_VENT_COMPLETE_PRESSURE_PSI ) ) { - // start the persistence timer once d66 reaches 1.5 PSI + // start the persistence timer once d66 reaches fill vent complete pressure if ( 0 == dryBiCartPersistenceStartTime ) { dryBiCartPersistenceStartTime = getMSTimerCount(); } - // 200 ms persistence on D66 pressure since pressure drop below 1.5 PSI after opening D64 + // defined persistence on D66 pressure since pressure drop below fill vent complete pressure after opening D64 if ( TRUE == didTimeout( dryBiCartPersistenceStartTime, DRY_BICART_PERSISTENCE_DURATION_MS ) ) { setValveState( D85_VALV, VALVE_STATE_CLOSED ); @@ -1095,8 +1095,9 @@ * @brief * The handleBicarbChamberStartState function wait for bicarb chamber fill request * @details \b Inputs: bicarbChamberFillRequested - * @details \b Outputs: none - * @return the next drybicart fluid drain state. + * @details \b Outputs: dryBiCartVentCycleWaitTimeStartedFlag, dryBiCartPressureDecayStartTimeFlag, + * dryBiCartVentCycleStartTime. + * @return the next drybicart fluid supply state. *************************************************************************/ static BICARB_CHAMBER_FILL_EXEC_STATE_T handleBicarbChamberStartState( void ) { @@ -1106,7 +1107,6 @@ if ( TRUE == getU32OverrideValue( &bicarbChamberFillRequested ) ) { - //state = BICARB_CARTRIDGE_FILL_WATER_START_STATE; state = BICARB_CHAMBER_SUPPLY_STATE; if ( FALSE == dryBiCartVentCycleWaitTimeStartedFlag ) @@ -1129,12 +1129,11 @@ { BICARB_CHAMBER_FILL_EXEC_STATE_T state = BICARB_CARTRIDGE_FILL_WATER_START_STATE; - if ( TRUE == isDryBicartBalChamberFillWindowOpen() ) + if ( TRUE == isDryBicartChamberFillWindowOpen() ) { // Close vent valves and descaling valve setValveState( D80_VALV, VALVE_STATE_CLOSED ); setValveState( D81_VALV, VALVE_STATE_CLOSED ); - //setValveState( D83_VALV, VALVE_STATE_CLOSED ); setValveState( D85_VALV, VALVE_STATE_CLOSED ); // open inlet water to bicart only when fresh-side BC valves are closed @@ -1152,8 +1151,8 @@ /*********************************************************************//** * @brief - * The handleBicarbChamberCartridgeFillWaterStartState function stop water in the dry bicart - * @details \b Inputs: D66 pressure, dryBiCartPersistenceStartTime + * The handleBicarbChamberCartridgeFillWaterStartState function stop water in the fill water end state + * @details \b Inputs: dryBiCartPersistenceStartTime * @details \b Outputs: valve states * @return the next bicarb chamber check level state. *************************************************************************/ @@ -1164,16 +1163,16 @@ F32 fillCompletePressure = GET_FILL_COMPLETE_PRESSURE_PSI; LVL_STATE_T bicarbChamberLevel = getBicarbChamberLevelStatus(); - if ( FALSE == isDryBicartBalChamberFillWindowOpen() ) + if ( FALSE == isDryBicartChamberFillWindowOpen() ) { setValveState( D65_VALV, VALVE_STATE_CLOSED ); } - else if ( TRUE == isDryBicartBalChamberFillWindowOpen() ) + else if ( TRUE == isDryBicartChamberFillWindowOpen() ) { setValveState( D65_VALV, VALVE_STATE_OPEN ); } - // check D66 pressure greater than or equal to 17 PSI + // check D66 pressure greater than or equal to Fill complete pressure if ( d66Pressure >= fillCompletePressure ) { // start the persistence timer once d66 reaches 17 PSI @@ -1182,8 +1181,7 @@ dryBiCartPersistenceStartTime = getMSTimerCount(); } - //TODO: revert after testing - // 2s persistence on D66 pressure since pressure overshoot just after D65 opening only for chamber fill + // Defined persistence on D66 pressure since pressure overshoot just after D65 opening only for chamber fill if ( TRUE == didTimeout( dryBiCartPersistenceStartTime, DRY_BICART_PERSISTENCE_DURATION_MS ) ) { // Close water inlet valve as D66 pressure reaches 11 PSI after persistence @@ -1222,7 +1220,6 @@ BICARB_CHAMBER_FILL_EXEC_STATE_T state = BICARB_CHAMBER_PRESSURE_CHECK_STATE; // TODO: set supply in progress to inform BC control to disable alarm - //setValveState( D64_VALV, VALVE_STATE_CLOSED ); setValveState( D64_VALV, VALVE_STATE_OPEN ); // Open the Bicarb chamber inlet valve @@ -1240,10 +1237,9 @@ * @brief * The handleBicarbChamberPressureCheckStartState function actuates the vent valve * present in the Bicart assembly. - * @details \b Inputs: D66 Pressure, D63 level, dryBiCarbSupplyStartTime, - * dryBiCarbSypplyVentStartTime, dryBiCartPersistenceStartTime, bicarbChamberLevel, - * dryBiCartPressureDecayStartTimeFlag, drybicartPersistenceOnLowercartPressureStartTime - * @details \b Outputs: dryBiCarbSypplyVentStartTime + * @details \b Inputs: dryBiCarbSupplyStartTime, dryBiCarbSypplyVentStartTime, dryBiCartPersistenceStartTime, + * bicarbChamberLevel, dryBiCartPressureDecayStartTimeFlag, drybicartPersistenceOnLowercartPressureStartTime + * @details \b Outputs: dryBiCarbSypplyVentStartTime, valve states * @return the next bicarb chamber Supply Vent Start state. *************************************************************************/ static BICARB_CHAMBER_FILL_EXEC_STATE_T handleBicarbChamberPressureCheckState( void ) @@ -1267,7 +1263,7 @@ dryBiCarbSupplyStartTime = getMSTimerCount(); dryBiCartPressureDecayStartTimeFlag = TRUE; } - // do not close the D80 valve, wait till d66 decays to 3 PSI + // do not close the D80 valve, wait till d66 decays to supply decay complete pressure if ( TRUE == didTimeout( dryBiCarbSupplyStartTime, DRY_BICART_SUPPLY_COMPLETE_TIME_MS ) ) { if ( d66Pressure <= DRY_BICART_SUPPLY_DECAY_COMPLETE_PRESSURE_PSI ) @@ -1301,9 +1297,9 @@ drybicartPersistenceOnLowercartPressureStartTime = getMSTimerCount(); } - // 200 ms persistence on D66 pressure + // defined persistence on D66 pressure if ( ( TRUE == didTimeout( drybicartPersistenceOnLowercartPressureStartTime, DRY_BICART_PERSISTENCE_DURATION_MS ) ) && - ( TRUE == isDryBicartBalChamberFillWindowOpen() ) ) + ( TRUE == isDryBicartChamberFillWindowOpen() ) ) { setValveState( D65_VALV, VALVE_STATE_OPEN ); setValveState( D80_VALV, VALVE_STATE_CLOSED ); @@ -1319,7 +1315,7 @@ dryBiCartPersistenceStartTime = getMSTimerCount(); } - // 200 ms persistence on D66 pressure since pressure overshoot just after D65 opening + // defined persistence on D66 pressure since pressure overshoot just after D65 opening if ( TRUE == didTimeout( dryBiCartPersistenceStartTime, DRY_BICART_PERSISTENCE_DURATION_MS ) ) { setValveState( D65_VALV, VALVE_STATE_CLOSED ); @@ -1341,7 +1337,7 @@ * The handleBicarbChamberSupplyVentStartState function actuates the vent valve * present in the Bicart assembly. * @details \b Inputs: dryBiCarbSypplyVentStartTime, dryBiCartPersistenceStartTime - * @details \b Outputs: dryBiCarbSypplyVentStartTime + * @details \b Outputs: dryBiCarbSypplyVentStartTime, valve states * @return the next bicarb chamber Supply Vent End state. *************************************************************************/ static BICARB_CHAMBER_FILL_EXEC_STATE_T handleBicarbChamberSupplyVentStartState(void) @@ -1354,15 +1350,15 @@ //Vent chamber F to atmosphere setValveState( D64_VALV, VALVE_STATE_OPEN ); - // D66 pressure drops to below 1.5 PSI or time out + // D66 pressure drops to below fill vent complete pressure or time out if ( ( d66Pressure <= DRY_BICART_FILL_VENT_COMPLETE_PRESSURE_PSI ) ) { - // start the persistence timer once d66 reaches if it drops below 1.5 + // start the persistence timer once d66 reaches if it drops below fill vent complete pressure if ( 0 == dryBiCartPersistenceStartTime ) { dryBiCartPersistenceStartTime = getMSTimerCount(); } - // 200 ms persistence on D66 pressure since pressure overshoot just after D65 opening + // defined persistence on D66 pressure since pressure overshoot just after D65 opening if ( TRUE == didTimeout( dryBiCartPersistenceStartTime, DRY_BICART_PERSISTENCE_DURATION_MS ) ) { setValveState( D85_VALV, VALVE_STATE_CLOSED ); Index: firmware/App/Controllers/MixingControl.c =================================================================== diff -u -rf1dc3383b840c39f202b15679e0bbe2b2f7a2f83 -r42541cc4700d748d524400f61d99e288a0e11f3e --- firmware/App/Controllers/MixingControl.c (.../MixingControl.c) (revision f1dc3383b840c39f202b15679e0bbe2b2f7a2f83) +++ firmware/App/Controllers/MixingControl.c (.../MixingControl.c) (revision 42541cc4700d748d524400f61d99e288a0e11f3e) @@ -201,7 +201,7 @@ static void setBicarbMixVol( F32 targetValue ); static void setAcidMixVol( F32 targetValue ); -static void updatedConcentrateControlInterval( void ); +static void updatedCMixingControlInterval( void ); static F32 getBicarbDeltaConductivity( void ); static F32 getBicarbTargetConductivity( void ); @@ -258,8 +258,8 @@ mixingControlBicarbVolume.ovInitData = 0.0F; mixingControlBicarbVolume.override = OVERRIDE_RESET; - lastAcidMixVolume = DEFAULT_ACID_VOLUME_ML; - lastBicarbMixVolume = DEFAULT_BICARB_VOLUME_ML; + lastAcidMixVolume = 0; + lastBicarbMixVolume = 0; mixingControlAcidVolumeKpGain.data = ACID_VOL_CONTROL_P_COEFFICIENT; mixingControlAcidVolumeKpGain.ovData = ACID_VOL_CONTROL_P_COEFFICIENT; @@ -365,7 +365,7 @@ { if ( getCurrentBalancingChamberExecState() > BAL_CHAMBER_STATE_IDLE ) { - updatedConcentrateControlInterval(); + updatedCMixingControlInterval(); // closed loop bicarb and acid mixing controller handleDialysateCompositionMixing(); @@ -433,14 +433,14 @@ /*********************************************************************//** * @brief - * The updatedConcentrateControlInterval function sets both acid and bicarb + * The updatedCMixingControlInterval function sets both acid and bicarb * Mix volume provided by the controller * @details \b Inputs: none * @details \b Outputs: mixingControlBicarbMixVolume * @param targetValue bicarb Mix volume * @return TRUE if successful, FALSE if not. *************************************************************************/ -static void updatedConcentrateControlInterval( void ) +static void updatedCMixingControlInterval( void ) { F32 tdDialysateFlowRate = 0.0F; F32 balChamberSwitchingFreq = 0.0F; @@ -638,6 +638,7 @@ *************************************************************************/ static F32 getBicarbConductivityPost( void ) { + //TODO: Update to return bicarb post conductivity once defined. return BICARB_CONDUCTIVITY_PRE; } @@ -702,7 +703,7 @@ //TODO: right now using the fixed conductivity , later use the calculated version API F32 measuredAcidBicarbMixConductivity = getFilteredConductivity( D27_COND ); F32 DialysateConductivity = getDialysateTargetConductivity(); - F32 DialysateDeltaConductivity = getDialysateTargetConductivity(); + F32 DialysateDeltaConductivity = getDialysateDeltaConductivity(); if ( TRUE != getTestConfigStatus( TEST_CONFIG_DD_ENABLE_DOSING_OPEN_LOOP_CONTROL ) ) { Index: firmware/App/Monitors/Conductivity.c =================================================================== diff -u -rdfbd800e10847db992bd6a9981c26d1f8d763c6f -r42541cc4700d748d524400f61d99e288a0e11f3e --- firmware/App/Monitors/Conductivity.c (.../Conductivity.c) (revision dfbd800e10847db992bd6a9981c26d1f8d763c6f) +++ firmware/App/Monitors/Conductivity.c (.../Conductivity.c) (revision 42541cc4700d748d524400f61d99e288a0e11f3e) @@ -40,7 +40,7 @@ #define FP_CONDUCTIVITY_DATA_PUBLISH_COUNTER_START_COUNT 41 ///< FP Conductivity data publish counter start count. #define RO_DATA_PUBLISH_COUNTER_START_COUNT 42 ///< FP RO Data publish counter start count. #define RESISTANCE_DATA_PUBLISH_COUNTER_START_COUNT 43 ///< DD Resistance data publish counter start count. -#define CONDUCTIVITY_MAX_FILTER_SIZE_MULTIPLIER ( 252 ) ///< Maximum conductivity filter sample count. +#define CONDUCTIVITY_MAX_FILTER_SIZE_MULTIPLIER ( 252 ) ///< Maximum conductivity filter sample count (At 50qd, we switch once for every 36sec, so 36 * FILTER_SIZE_MULTIPLIER = 252). #define CONDUCTIVITY_TEMP_SAMPLE_FILTER_MS ( 30 ) ///< Filter conductivity temperature data for given time. Currently set to have 5 samples over 3.5s ( 700ms sample rate ) #define FILTER_SIZE_MULTIPLIER ( 7 ) ///< Conductivity filter size multiplier. #define SIZE_OF_COND_TEMP_ROLLING_AVG ( CONDUCTIVITY_TEMP_SAMPLE_FILTER_MS / TASK_PRIORITY_INTERVAL ) ///< Filtered conductivity temprature moving average sample count. @@ -51,7 +51,7 @@ /// Filter conductivity readings record. typedef struct { - F32 conductivityReadings[ CONDUCTIVITY_MAX_FILTER_SIZE_MULTIPLIER ]; ///< Holds conductivity sample rolling average. + F32 conductivityReadings[ CONDUCTIVITY_MAX_FILTER_SIZE_MULTIPLIER ]; ///< Holds conductivity sample rolling average. U32 conductivityReadingsIdx; ///< Index for next sample in rolling average array. F32 conductivityReadingsTotal; ///< Rolling total - used to calc average. U32 conductivityReadingsCount; ///< Number of samples in rolling average buffer