Index: firmware/App/Controllers/DialOutFlow.c =================================================================== diff -u -r57ee0134869672b53ab5b7146b8988ede8f828d6 -r7a14f1cc62ad1cb1d7d694f632ff3ddb90ca4717 --- firmware/App/Controllers/DialOutFlow.c (.../DialOutFlow.c) (revision 57ee0134869672b53ab5b7146b8988ede8f828d6) +++ firmware/App/Controllers/DialOutFlow.c (.../DialOutFlow.c) (revision 7a14f1cc62ad1cb1d7d694f632ff3ddb90ca4717) @@ -1,4 +1,4 @@ -/************************************************************************** +/**********************************************************************//** * * Copyright (c) 2020-2020 Diality Inc. - All Rights Reserved. * @@ -33,103 +33,103 @@ #include "Timers.h" #include "DialOutFlow.h" +/** + * @addtogroup DialysateOutlet + * @{ + */ + // ********** private definitions ********** -#define DIAL_OUT_DATA_PUB_INTERVAL ( MS_PER_SECOND / TASK_PRIORITY_INTERVAL ) // interval (ms/task time) at which the dialout vol data is published on the CAN bus +#define DIAL_OUT_DATA_PUB_INTERVAL ( MS_PER_SECOND / TASK_PRIORITY_INTERVAL ) ///< Interval (ms/task time) at which the dialysate outlet pump data is published on the CAN bus. -#define MAX_DIAL_OUT_FLOW_RATE 650 // mL/min -#define MIN_DIAL_OUT_FLOW_RATE 100 // mL/min +#define MAX_DIAL_OUT_FLOW_RATE 650 ///< Maximum dialysate outlet pump flow rate in mL/min. +#define MIN_DIAL_OUT_FLOW_RATE 100 ///< Minimum dialysate outlet pump flow rate in mL/min. -#define MAX_DIAL_OUT_PUMP_PWM_STEP_CHANGE 0.01 // max duty cycle change when ramping -#define MAX_DIAL_OUT_PUMP_PWM_DUTY_CYCLE 0.88 // controller will error if PWM duty cycle > 90%, so set max to 88% -#define MIN_DIAL_OUT_PUMP_PWM_DUTY_CYCLE 0.12 // controller will error if PWM duty cycle < 10%, so set min to 12% +#define MAX_DIAL_OUT_PUMP_PWM_STEP_CHANGE 0.01 ///< Maximum duty cycle change when ramping. +#define MAX_DIAL_OUT_PUMP_PWM_DUTY_CYCLE 0.88 ///< Controller will error if PWM duty cycle > 90%, so set max to 88%. +#define MIN_DIAL_OUT_PUMP_PWM_DUTY_CYCLE 0.12 ///< Controller will error if PWM duty cycle < 10%, so set min to 12%. -#define DOP_CONTROL_INTERVAL ( 1000 / TASK_GENERAL_INTERVAL ) // interval (ms/task time) at which the dialOut pump is controlled -#define DOP_P_COEFFICIENT 0.00005 // P term for dialOut pump control -#define DOP_I_COEFFICIENT 0.00015 // I term for dialOut pump control +#define DOP_CONTROL_INTERVAL ( 1000 / TASK_GENERAL_INTERVAL ) ///< Interval (ms/task time) at which the dialysate outlet pump is controlled. +#define DOP_P_COEFFICIENT 0.003 ///< P term for dialysate outlet pump control. +#define DOP_I_COEFFICIENT 0.001 ///< I term for dialysate outlet pump control. -#define DOP_MAX_CURR_WHEN_STOPPED_MA 150.0 // motor controller current should not exceed this when pump should be stopped -#define DOP_MIN_CURR_WHEN_RUNNING_MA 150.0 // motor controller current should always exceed this when pump should be running -#define DOP_MAX_CURR_WHEN_RUNNING_MA 1000.0 // motor controller current should not exceed this when pump should be running -#define DOP_MAX_CURR_ERROR_DURATION_MS 2000 // motor controller current errors persisting beyond this duration will trigger an alarm +#define DOP_MAX_CURR_WHEN_STOPPED_MA 150.0 ///< Motor controller current should not exceed this when pump should be stopped. +#define DOP_MIN_CURR_WHEN_RUNNING_MA 150.0 ///< Motor controller current should always exceed this when pump should be running. +#define DOP_MAX_CURR_WHEN_RUNNING_MA 1000.0 ///< Motor controller current should not exceed this when pump should be running. +#define DOP_MAX_CURR_ERROR_DURATION_MS 2000 ///< Motor controller current errors persisting beyond this duration will trigger an alarm. -#define DOP_SPEED_ADC_TO_RPM_FACTOR 1.375 // conversion factor from ADC counts to RPM for dialOut pump motor -#define DOP_CURRENT_ADC_TO_MA_FACTOR 2.65 // conversion factor from ADC counts to mA for dialOut pump motor -#define DOP_ADC_FULL_SCALE_V 3.0 // DOP analog signals are 0-3V (while int. ADC ref V is 3.3V) -#define DOP_ADC_MID_PT_BITS ( (F32)( INT_ADC_FULL_SCALE_BITS >> 1 ) * ( DOP_ADC_FULL_SCALE_V / INT_ADC_REF_V ) ) -#define SIGN_FROM_12_BIT_VALUE(v) ( (S16)(v) - (S16)DOP_ADC_MID_PT_BITS ) +#define DOP_SPEED_ADC_TO_RPM_FACTOR 1.375 ///< Conversion factor from ADC counts to RPM for dialysate outlet pump motor. +#define DOP_CURRENT_ADC_TO_MA_FACTOR 2.65 ///< Conversion factor from ADC counts to mA for dialysate outlet pump motor. +#define DOP_ADC_FULL_SCALE_V 3.0 ///< DPo analog signals are 0-3V (while int. ADC ref V is 3.3V). +#define DOP_ADC_MID_PT_BITS ( (F32)( INT_ADC_FULL_SCALE_BITS >> 1 ) * ( DOP_ADC_FULL_SCALE_V / INT_ADC_REF_V ) ) ///< Mid-point (zero) for ADC readings. +#define SIGN_FROM_12_BIT_VALUE(v) ( (S16)(v) - (S16)DOP_ADC_MID_PT_BITS ) ///< Macro converts a 12-bit ADC reading to a signed 16-bit value. /*** setDialOutFlowRxTotalVolumeAndRxTime ***/ -#define DOP_REV_PER_LITER 124.0 // rotor revolutions per liter -#define DOP_ML_PER_MIN_TO_PUMP_RPM_FACTOR ( DOP_REV_PER_LITER / ML_PER_LITER ) -#define DOP_GEAR_RATIO 32.0 // dialIn pump motor to dialIn pump gear ratio -#define DOP_MOTOR_RPM_TO_PWM_DC_FACTOR 0.00042 // ~24 BP motor RPM = 1% PWM duty cycle -#define DOP_PWM_ZERO_OFFSET 0.1 // 10% PWM duty cycle = zero speed -#define DOP_PWM_FROM_ML_PER_MIN(rate) ( (rate) * DOP_ML_PER_MIN_TO_PUMP_RPM_FACTOR * DOP_GEAR_RATIO * DOP_MOTOR_RPM_TO_PWM_DC_FACTOR + DOP_PWM_ZERO_OFFSET ) +#define DOP_REV_PER_LITER 124.0 ///< Rotor revolutions per liter. +#define DOP_ML_PER_MIN_TO_PUMP_RPM_FACTOR ( DOP_REV_PER_LITER / ML_PER_LITER ) ///< Conversion factor from mL/min to pump motor RPM. +#define DOP_GEAR_RATIO 32.0 ///< Pump motor to pump gear ratio. +#define DOP_MOTOR_RPM_TO_PWM_DC_FACTOR 0.00042 ///< ~24 DPo motor RPM = 1% PWM duty cycle. +#define DOP_PWM_ZERO_OFFSET 0.1 ///< 10% PWM duty cycle = zero speed. +#define DOP_PWM_FROM_ML_PER_MIN(rate) ( (rate) * DOP_ML_PER_MIN_TO_PUMP_RPM_FACTOR * DOP_GEAR_RATIO * DOP_MOTOR_RPM_TO_PWM_DC_FACTOR + DOP_PWM_ZERO_OFFSET ) ///< Macro converts a flow rate to an estimated PWM duty cycle %. -//#define MAX_RX_TOTAL_VOLUME_ML 8000 -//#define MIN_RX_TOTAL_VOLUME_ML 100 -//#define MAX_UF_RATE_ML_PER_HOUR 2500.0 - +/// Enumeration of dialysate outlet pump controller states. typedef enum DialOutPump_States { - DIAL_OUT_PUMP_OFF_STATE = 0, - DIAL_OUT_PUMP_RAMPING_UP_STATE, - DIAL_OUT_PUMP_RAMPING_DOWN_STATE, - DIAL_OUT_PUMP_CONTROL_TO_TARGET_STATE, - NUM_OF_DIAL_OUT_PUMP_STATES + DIAL_OUT_PUMP_OFF_STATE = 0, ///< Off state of the dialysate outlet pump state machine. + DIAL_OUT_PUMP_RAMPING_UP_STATE, ///< Ramping up state of the dialysate outlet pump state machine. + DIAL_OUT_PUMP_RAMPING_DOWN_STATE, ///< Ramping down state of the dialysate outlet pump state machine. + DIAL_OUT_PUMP_CONTROL_TO_TARGET_STATE, ///< Control state of the dialysate outlet pump state machine. + NUM_OF_DIAL_OUT_PUMP_STATES ///< # of dialysate outlet pump control states. } DIAL_OUT_PUMP_STATE_T; +/// Enumeration of dialysate outlet pump self test states. typedef enum DialOut_Pump_Self_Test_States { - DIAL_OUT_PUMP_SELF_TEST_STATE_START = 0, - DIAL_OUT_PUMP_TEST_STATE_IN_PROGRESS, - DIAL_OUT_PUMP_TEST_STATE_COMPLETE, - NUM_OF_DIAL_OUT_PUMP_SELF_TEST_STATES + DIAL_OUT_PUMP_SELF_TEST_STATE_START = 0, ///< Start state of the dialysate outlet pump self test state machine. + DIAL_OUT_PUMP_TEST_STATE_IN_PROGRESS, ///< In progress state of the dialysate outlet pump self test state machine. + DIAL_OUT_PUMP_TEST_STATE_COMPLETE, ///< Completed state of the dialysate outlet pump self test state machine. + NUM_OF_DIAL_OUT_PUMP_SELF_TEST_STATES ///< # of dialysate outlet pumpt self test states. } DIAL_OUT_PUMP_SELF_TEST_STATE_T; // pin assignments and macros for pump stop and direction outputs -#define STOP_DO_PUMP_MIBSPI1_PORT_MASK 0x00000400 // (MIBSPI1 SIMO[0] - re-purposed as output GPIO) -#define SET_DOP_STOP() {mibspiREG1->PC3 |= STOP_DO_PUMP_MIBSPI1_PORT_MASK;} -#define CLR_DOP_STOP() {mibspiREG1->PC3 &= ~STOP_DO_PUMP_MIBSPI1_PORT_MASK;} -//#define STOP_DO_PUMP_SPI4_PORT_MASK 0x00000200 // (SPI4CLK - re-purposed as output GPIO) -//#define SET_DOP_STOP() {spiREG4->PC3 |= STOP_DO_PUMP_SPI4_PORT_MASK;} -//#define CLR_DOP_STOP() {spiREG4->PC3 &= ~STOP_DO_PUMP_SPI4_PORT_MASK;} -#define STOP_DO_PUMP_GIO_PORT_PIN 6U -#define SET_DOP_DIR() gioSetBit( gioPORTA, STOP_DO_PUMP_GIO_PORT_PIN, PIN_SIGNAL_HIGH ) -#define CLR_DOP_DIR() gioSetBit( gioPORTA, STOP_DO_PUMP_GIO_PORT_PIN, PIN_SIGNAL_LOW ) +#define STOP_DO_PUMP_MIBSPI1_PORT_MASK 0x00000400 ///< MIBSPI1 SIMO[0] - re-purposed as GPIOoutput for pump controller run/stop pin. +#define SET_DOP_STOP() {mibspiREG1->PC3 |= STOP_DO_PUMP_MIBSPI1_PORT_MASK;} ///< Macro sets pump controller run/stop signal to stop. +#define CLR_DOP_STOP() {mibspiREG1->PC3 &= ~STOP_DO_PUMP_MIBSPI1_PORT_MASK;} ///< Macro sets pump controller run/stop signal to run. +#define STOP_DO_PUMP_GIO_PORT_PIN 6U ///< GIO port A pin used for pump controller direction pin. +#define SET_DOP_DIR() gioSetBit( gioPORTA, STOP_DO_PUMP_GIO_PORT_PIN, PIN_SIGNAL_HIGH ) ///< Macro sets pump controller direction to forward direction. +#define CLR_DOP_DIR() gioSetBit( gioPORTA, STOP_DO_PUMP_GIO_PORT_PIN, PIN_SIGNAL_LOW ) ///< Macro sets pump controller direction to reverse direction. // ********** private data ********** -static DIAL_OUT_PUMP_STATE_T dialOutPumpState = DIAL_OUT_PUMP_OFF_STATE; -static U32 dialOutFlowDataPublicationTimerCounter = 6; // set non-zero to phase dialout vol data publication to CAN bus -static BOOL isDialOutPumpOn = FALSE; -static U32 lastGivenRate = 0.0; -static F32 dialOutPumpPWMDutyCyclePct = 0.0; -static F32 dialOutPumpPWMDutyCyclePctSet = 0.0; -static MOTOR_DIR_T dialOutPumpDirection = MOTOR_DIR_FORWARD; -static MOTOR_DIR_T dialOutPumpDirectionSet = MOTOR_DIR_FORWARD; -static PUMP_CONTROL_MODE_T dialOutPumpControlMode = PUMP_CONTROL_MODE_CLOSED_LOOP; -static PUMP_CONTROL_MODE_T dialOutPumpControlModeSet = PUMP_CONTROL_MODE_CLOSED_LOOP; +static DIAL_OUT_PUMP_STATE_T dialOutPumpState = DIAL_OUT_PUMP_OFF_STATE; ///< Current state of the dialysate outlet pump controller state machine. +static U32 dialOutFlowDataPublicationTimerCounter = 6; ///< Timer counter controlling when to publish dialysate outlet data. Set non-zero to phase data publication to CAN bus. +static BOOL isDialOutPumpOn = FALSE; ///< Flag set to TRUE when dialysate outlet pump is running. +static U32 lastGivenRate = 0.0; ///< Remembers the last given set point rate for the dialysate outlet pump. +static F32 dialOutPumpPWMDutyCyclePct = 0.0; ///< Requested PWM duty cycle for dialysate outlet pump (based on given rate). +static F32 dialOutPumpPWMDutyCyclePctSet = 0.0; ///< Currently set PWM duty cycle for dialysate outlet pump. +static MOTOR_DIR_T dialOutPumpDirection = MOTOR_DIR_FORWARD; ///< Requested direction for dialysate outlet pump. +static MOTOR_DIR_T dialOutPumpDirectionSet = MOTOR_DIR_FORWARD; ///< Currently set direction for dialysate outlet pump. +static PUMP_CONTROL_MODE_T dialOutPumpControlMode = PUMP_CONTROL_MODE_CLOSED_LOOP; ///< Requested control mode for dialysate outlet pump (open or closed loop). +static PUMP_CONTROL_MODE_T dialOutPumpControlModeSet = PUMP_CONTROL_MODE_CLOSED_LOOP; ///< Currently set control mode for dialysate outlet pump. -DATA_DECL( U32, DialOutDataPub, DialOutDataPublishInterval, DIAL_OUT_DATA_PUB_INTERVAL, DIAL_OUT_DATA_PUB_INTERVAL ); // interval (in ms) at which to publish dialout vol data to CAN bus -DATA_ARRAY_DECL( F32, LoadCellWeightsInGrams, NUM_OF_LOAD_CELLS, loadCellWeightInGrams ); -DATA_DECL( F32, TotalTargetDialOutVolInMl, referenceUFVolumeInMl, 0.0, 0.0 ); // target dialout UF vol -DATA_DECL( F32, TotalMeasuredUFVolumeInMl, totalMeasuredUFVolumeInMl, 0.0, 0.0 ); // measured dialout UF vol -DATA_DECL( F32, MeasuredDialOutPumpMCSpeed, dialOutPumpMCSpeedRPM, 0.0, 0.0 ); // measured dialOut pump motor controller speed -DATA_DECL( F32, MeasuredDialOutPumpMCCurrent, dialOutPumpMCCurrentmA, 0.0, 0.0 );// measured dialOut pump motor controller current -DATA_DECL( F32, MeasuredDialOutPumpRotorSpeed, dialOutPumpRotorSpeedRPM, 0.0, 0.0 );// measured dialOut pump rotor speed -DATA_DECL( F32, MeasuredDialOutPumpSpeed, dialOutPumpSpeedRPM, 0.0, 0.0 ); // measured dialOut pump motor speed +DATA_DECL( U32, DialOutDataPub, DialOutDataPublishInterval, DIAL_OUT_DATA_PUB_INTERVAL, DIAL_OUT_DATA_PUB_INTERVAL ); ///< Interval (in ms) at which to publish dialysate outlet data to CAN bus. +DATA_ARRAY_DECL( F32, LoadCellWeightsInGrams, NUM_OF_LOAD_CELLS, loadCellWeightInGrams ); ///< Measured weight from load cells. +DATA_DECL( F32, TotalTargetDialOutVolInMl, referenceUFVolumeInMl, 0.0, 0.0 ); ///< Target ultrafiltration volume (in mL). +DATA_DECL( F32, TotalMeasuredUFVolumeInMl, totalMeasuredUFVolumeInMl, 0.0, 0.0 ); ///< Total measured ultrafiltration volume (in mL). +DATA_DECL( F32, MeasuredDialOutPumpMCSpeed, dialOutPumpMCSpeedRPM, 0.0, 0.0 ); ///< Measured dialysate outlet pump motor controller speed. +DATA_DECL( F32, MeasuredDialOutPumpMCCurrent, dialOutPumpMCCurrentmA, 0.0, 0.0 ); ///< Measured dialysate outlet pump motor controller current. +DATA_DECL( F32, MeasuredDialOutPumpRotorSpeed, dialOutPumpRotorSpeedRPM, 0.0, 0.0 ); ///< Measured dialysate outlet pump rotor speed. +DATA_DECL( F32, MeasuredDialOutPumpSpeed, dialOutPumpSpeedRPM, 0.0, 0.0 ); ///< Measured dialysate outlet pump motor speed. -static U32 dopControlTimerCounter = 0; -static U32 dopCurrErrorDurationCtr = 0; +static U32 dopControlTimerCounter = 0; ///< Timer counter to determine when to control dialysate outlet pump. +static U32 dopCurrErrorDurationCtr = 0; ///< Timer counter for motor current error persistence. -static DIAL_OUT_PUMP_SELF_TEST_STATE_T dialOutPumpSelfTestState = DIAL_OUT_PUMP_SELF_TEST_STATE_START; -static U32 dialOutPumpSelfTestTimerCount = 0; +static DIAL_OUT_PUMP_SELF_TEST_STATE_T dialOutPumpSelfTestState = DIAL_OUT_PUMP_SELF_TEST_STATE_START; ///< Current state of the dialysate outlet pump self test state machine. +static U32 dialOutPumpSelfTestTimerCount = 0; ///< Timer counter for time reference during self test. -// Broadcasting variables -DIAL_OUT_FLOW_DATA_T dialOutBroadCastVariables; +// Broadcasting record +DIAL_OUT_FLOW_DATA_T dialOutBroadCastVariables; ///< Record containing latest dialysate outlet data for broadcasting. // ********** private function prototypes ********** @@ -150,7 +150,7 @@ static DATA_GET_PROTOTYPE( U32, getPublishDialOutDataInterval ); -/************************************************************************* +/*********************************************************************//** * @brief * The initDialOutFlow function initializes the DialOutFlow module. * @details @@ -187,7 +187,7 @@ MIN_DIAL_OUT_PUMP_PWM_DUTY_CYCLE, MAX_DIAL_OUT_PUMP_PWM_DUTY_CYCLE ); } -/************************************************************************* +/*********************************************************************//** * @brief * The setDialOutPumpTargetRate function sets a new target flow rate, pump \n * direction, and control mode. @@ -247,14 +247,14 @@ } else // requested flow rate too high { - // TODO - SET_ALARM_WITH_2_U32_DATA( ALARM_ID_SOFTWARE_FAULT, SW_FAULT_ID_DIAL_OUT_FLOW_SET_TOO_HIGH, flowRate ) + SET_ALARM_WITH_2_U32_DATA( ALARM_ID_SOFTWARE_FAULT, SW_FAULT_ID_DIAL_OUT_FLOW_SET_TOO_HIGH, flowRate ) } } return result; } -/************************************************************************* +/*********************************************************************//** * @brief * The setDialOutUFVolumes function sets the ultrafiltration reference and \n * measured total volumes (in mL). @@ -271,7 +271,7 @@ totalMeasuredUFVolumeInMl.data = totVol; } -/************************************************************************* +/*********************************************************************//** * @brief * The signalDialOutPumpHardStop function stops the dialysate outlet pump \n * immediately. @@ -291,7 +291,7 @@ resetPIController( PI_CONTROLLER_ID_ULTRAFILTRATION, MIN_DIAL_OUT_PUMP_PWM_DUTY_CYCLE ); } -/************************************************************************* +/*********************************************************************//** * @brief * The setDialOutUFVolumes function sets the ultrafiltration reference and \n * measured total volumes (in mL). @@ -312,12 +312,14 @@ loadCellWeightInGrams[ LOAD_CELL_RESERVOIR_2_BACKUP ].data = res2Backup; } -/************************************************************************* +/*********************************************************************//** * @brief execDialOutFlowMonitor - * The execDialOutFlowMonitor function executes the dialout vol monitor. + * The execDialOutFlowMonitor function executes the dialysate outlet pump \n + * and load cell sensor monitor. Checks are performed. Data is published \n + * at appropriate interval. * @details - * Inputs : none - * Outputs : measuredDialOutFlowRate, dialOutPumpMCSpeedRPM, dialOutPumpMCCurrentmA + * Inputs : latest sensor data + * Outputs : dialOutPumpMCSpeedRPM, dialOutPumpMCCurrentmA * @param none * @return none *************************************************************************/ @@ -334,9 +336,10 @@ publishDialOutFlowData(); } -/************************************************************************* +/*********************************************************************//** * @brief execDialOutFlowController - * The execDialOutFlowController function executes the dialout vol controller. + * The execDialOutFlowController function executes the dialysate outlet pump \n + * ultrafiltration controller state machine. * @details * Inputs : dialOutPumpState * Outputs : dialOutPumpState @@ -369,7 +372,7 @@ } } -/************************************************************************* +/*********************************************************************//** * @brief handleDialOutPumpOffState * The handleDialOutPumpOffState function handles the dialOut pump off state \n * of the dialOut pump controller state machine. @@ -403,7 +406,7 @@ return result; } -/************************************************************************* +/*********************************************************************//** * @brief handleDialOutPumpRampingUpState * The handleDialOutPumpRampingUpState function handles the ramp up state \n * of the dialOut pump controller state machine. @@ -448,7 +451,7 @@ return result; } -/************************************************************************* +/*********************************************************************//** * @brief handleDialOutPumpRampingDownState * The handleDialOutPumpRampingDownState function handles the ramp down state \n * of the dialOut pump controller state machine. @@ -491,13 +494,13 @@ return result; } -/************************************************************************* +/*********************************************************************//** * @brief handleDialOutPumpControlToTargetState * The handleDialOutPumpControlToTargetState function handles the "control to \n * target" state of the dialOut pump controller state machine. * @details - * Inputs : none - * Outputs : dialOutPumpState + * Inputs : dopControlTimerCounter, dialOutPumpControlModeSet, volumes. + * Outputs : dopControlTimerCounter, pump controlled. * @param none * @return next state *************************************************************************/ @@ -524,20 +527,22 @@ return result; } -/************************************************************************* +/*********************************************************************//** * @brief - * The setDialOutPumpControlSignalPWM function set the PWM of the dialysate \n - * outlet pump. - * - * @param newPWM a fraction of between 0.0 and 1.0. + * The setDialOutPumpControlSignalPWM function set the PWM duty cycle of \n + * the dialysate outlet pump to a given %. + * @details + * Inputs : none + * Outputs : dialysis outlet pump PWM duty cycle is set. + * @param newPWM : A percentage duty cycle between 0.0 and 1.0. * @return none *************************************************************************/ static void setDialOutPumpControlSignalPWM( F32 newPWM ) { etpwmSetCmpA( etpwmREG3, (U32)( (S32)( ( newPWM * (F32)(etpwmREG3->TBPRD) ) + FLOAT_TO_INT_ROUNDUP_OFFSET ) ) ); } -/************************************************************************* +/*********************************************************************//** * @brief stopDialOutPump * The stopDialOutPump function sets the dialout flow stop signal and PWM * duty cycle to 0.0. @@ -555,12 +560,12 @@ isDialOutPumpOn = FALSE; } -/************************************************************************* +/*********************************************************************//** * @brief * The releaseDialOutPumpStop function clears the dialysate outlet pump stop signal. * @details * Inputs : none - * Outputs : dialysate outlet pump stop signal + * Outputs : dialysate outlet pump stop signal is cleared. * @param none * @return none *************************************************************************/ @@ -569,14 +574,14 @@ CLR_DOP_STOP(); } -/************************************************************************* +/*********************************************************************//** * @brief setDialOutPumpDirection * The setDialOutPumpDirection function sets the set dialIn pump direction to \n * the given direction. * @details - * Inputs : dialOutPumpState - * Outputs : dialOutPumpState - * @param dir : dialIn pump direction to set + * Inputs : none + * Outputs : dialOutPumpDirectionSet, pump direction signal set to match given direction. + * @param dir : dialysate outlet pump direction to set * @return none *************************************************************************/ static void setDialOutPumpDirection( MOTOR_DIR_T dir ) @@ -599,14 +604,13 @@ } } -/************************************************************************* +/*********************************************************************//** * @brief publishDialOutFlowData - * The publishDialOutFlowData function publishes dialout vol data at the set \n - * interval. + * The publishDialOutFlowData function publishes dialysate outlet data at \n + * the set interval. * @details - * Inputs : target flow rate, measured flow rate, measured MC speed, \n - * measured MC current - * Outputs : dialout vol data is published to CAN bus. + * Inputs : Dialysate outlet pump data + * Outputs : Dialysate outlet pump data is published to CAN bus. * @param none * @return none *************************************************************************/ @@ -632,7 +636,7 @@ * GET SUPPORT FUNCTIONS *************************************************************************/ -/************************************************************************* +/*********************************************************************//** * @brief * The getPublishDialOutFlowDataInterval function gets the dialysate out flow \n * data publication interval. @@ -644,7 +648,7 @@ *************************************************************************/ static DATA_GET( U32, getPublishDialOutDataInterval, DialOutDataPublishInterval ) -/************************************************************************* +/*********************************************************************//** * @brief * The getLoadCellWeightInGrams function gets the load cell weight. * @details @@ -655,7 +659,7 @@ *************************************************************************/ DATA_ARRAY_GET( F32, getLoadCellWeightInGrams, loadCellID, NUM_OF_LOAD_CELLS - 1, loadCellWeightInGrams, 0.0 ) -/************************************************************************* +/*********************************************************************//** * @brief * The getTotalTargetDialOutUFVolumeInMl function gets the target UF volume. * @details @@ -666,7 +670,7 @@ *************************************************************************/ DATA_GET( F32, getTotalTargetDialOutUFVolumeInMl, referenceUFVolumeInMl ) -/************************************************************************* +/*********************************************************************//** * @brief * The getTotalMeasuredUFVolumeInMl function gets the measured UF volume. * @details @@ -677,7 +681,7 @@ *************************************************************************/ DATA_GET( F32, getTotalMeasuredUFVolumeInMl, totalMeasuredUFVolumeInMl ) -/************************************************************************* +/*********************************************************************//** * @brief * The getMeasuredDialOutPumpRotorSpeed function gets the measured dialysate \n * outlet pump rotor speed. @@ -689,7 +693,7 @@ *************************************************************************/ DATA_GET( F32, getMeasuredDialOutPumpRotorSpeed, dialOutPumpRotorSpeedRPM ) -/************************************************************************* +/*********************************************************************//** * @brief * The getMeasuredDialOutPumpSpeed function gets the measured dialysate outlet \n * pump motor speed. @@ -701,7 +705,7 @@ *************************************************************************/ DATA_GET( F32, getMeasuredDialOutPumpSpeed, dialOutPumpSpeedRPM ) -/************************************************************************* +/*********************************************************************//** * @brief * The getMeasuredDialOutPumpMCSpeed function gets the measured dialOut pump \n * speed. @@ -713,7 +717,7 @@ *************************************************************************/ DATA_GET( F32, getMeasuredDialOutPumpMCSpeed, dialOutPumpMCSpeedRPM ) -/************************************************************************* +/*********************************************************************//** * @brief * The getMeasuredDialOutPumpMCCurrent function gets the measured dialOut pump \n * current. @@ -725,13 +729,15 @@ *************************************************************************/ DATA_GET( F32, getMeasuredDialOutPumpMCCurrent, dialOutPumpMCCurrentmA) +/**@}*/ + /************************************************************************* * TEST SUPPORT FUNCTIONS *************************************************************************/ -/************************************************************************* +/*********************************************************************//** * @brief * The testSetDialOutPumpAndLoadCellDataPublishIntervalOverride function overrides the \n * dialout vol data publish interval. @@ -757,7 +763,7 @@ return result; } -/************************************************************************* +/*********************************************************************//** * @brief * The testResetDialOutPumpAndLoadCellDataPublishIntervalOverride function resets the override \n * of the dialout vol data publish interval. @@ -780,7 +786,7 @@ return result; } -/************************************************************************* +/*********************************************************************//** * @brief * The testSetDialOutUFRefVolumeOverride function overrides the target \n * dialout vol rate. \n @@ -794,7 +800,7 @@ *************************************************************************/ DATA_OVERRIDE_FUNC( F32, testSetDialOutUFRefVolumeOverride, testResetDialOutUFRefVolumeOverride, referenceUFVolumeInMl ) -/************************************************************************* +/*********************************************************************//** * @brief * The testSetDialOutUFTotVolumeOverride function overrides the measured \n * dialout vol rate. \n @@ -808,7 +814,7 @@ *************************************************************************/ DATA_OVERRIDE_FUNC( F32, testSetDialOutUFTotVolumeOverride, testResetDialOutUFTotVolumeOverride, totalMeasuredUFVolumeInMl ) -/************************************************************************* +/*********************************************************************//** * @brief testSetMeasuredDialOutPumpRotorSpeedOverride and testResetMeasuredDialOutPumpRotorSpeedOverride * The testSetMeasuredDialOutPumpRotorSpeedOverride function overrides the measured \n * dialIn pump rotor speed. \n @@ -822,7 +828,7 @@ *************************************************************************/ DATA_OVERRIDE_FUNC( F32, testSetMeasuredDialOutPumpRotorSpeedOverride, testResetMeasuredDialOutPumpRotorSpeedOverride, dialOutPumpRotorSpeedRPM ) -/************************************************************************* +/*********************************************************************//** * @brief testSetMeasuredDialOutPumpSpeedOverride and testResetMeasuredDialOutPumpSpeedOverride * The testSetMeasuredDialOutPumpSpeedOverride function overrides the measured \n * dialIn pump motor speed. \n @@ -836,7 +842,7 @@ *************************************************************************/ DATA_OVERRIDE_FUNC( F32, testSetMeasuredDialOutPumpSpeedOverride, testResetMeasuredDialOutPumpSpeedOverride, dialOutPumpSpeedRPM ) -/************************************************************************* +/*********************************************************************//** * @brief testSetMeasuredDialOutPumpMCSpeedOverride and testResetMeasuredDialOutPumpMCSpeedOverride * The testSetMeasuredDialOutPumpMCSpeedOverride function overrides the measured \n * dialIn pump motor speed. \n @@ -850,7 +856,7 @@ *************************************************************************/ DATA_OVERRIDE_FUNC( F32, testSetMeasuredDialOutPumpMCSpeedOverride, testResetMeasuredDialOutPumpMCSpeedOverride, dialOutPumpMCSpeedRPM ) -/************************************************************************* +/*********************************************************************//** * @brief testSetMeasuredDialOutPumpMCCurrentOverride and testResetMeasuredDialOutPumpMCCurrentOverride * The testSetMeasuredDialOutPumpMCCurrentOverride function overrides the measured \n * dialIn pump motor current. \n @@ -864,7 +870,7 @@ *************************************************************************/ DATA_OVERRIDE_FUNC( F32, testSetMeasuredDialOutPumpMCCurrentOverride, testResetMeasuredDialOutPumpMCCurrentOverride, dialOutPumpMCCurrentmA ) -/************************************************************************* +/*********************************************************************//** * @brief * The testSetDialOutLoadCellWeightOverride function overrides the value of the \n * load cell sensor with a given weight (in grams). \n