Index: firmware/App/Controllers/BalancingChamber.c =================================================================== diff -u -r9e6e86f604c8cce7c1704ae55d1e026de3422782 -r4b09605126f35b80406e95d079f3822c51a3ba25 --- firmware/App/Controllers/BalancingChamber.c (.../BalancingChamber.c) (revision 9e6e86f604c8cce7c1704ae55d1e026de3422782) +++ firmware/App/Controllers/BalancingChamber.c (.../BalancingChamber.c) (revision 4b09605126f35b80406e95d079f3822c51a3ba25) @@ -37,8 +37,9 @@ */ // ********** private definitions ********** - +//Testing #define BAL_CHAMBER_DATA_PUBLISH_INTERVAL ( 250 / TASK_GENERAL_INTERVAL ) ///< Interval (ms/task time) at which the balancing chamber data published. +//#define BAL_CHAMBER_DATA_PUBLISH_INTERVAL ( 50 / TASK_GENERAL_INTERVAL ) ///< Interval (ms/task time) at which the balancing chamber data published. /// Payload record structure for balancing chamber switch only request typedef struct Index: firmware/App/Controllers/Heaters.c =================================================================== diff -u -r2e89a75592087ba15cae7070a92173e9f1efa8fe -r4b09605126f35b80406e95d079f3822c51a3ba25 --- firmware/App/Controllers/Heaters.c (.../Heaters.c) (revision 2e89a75592087ba15cae7070a92173e9f1efa8fe) +++ firmware/App/Controllers/Heaters.c (.../Heaters.c) (revision 4b09605126f35b80406e95d079f3822c51a3ba25) @@ -17,6 +17,7 @@ #include // Used for mathematical operations +#include "Conductivity.h" #include "FpgaDD.h" #include "Heaters.h" #include "Level.h" @@ -50,6 +51,7 @@ #define HEATERS_DUTY_CYCLE_CONVERSION_FACTOR 100.0F ///< Heaters duty cycle 0: OFF, 100: 100% duty cycle. #define HEATERS_ZERO_EFFICIENCY 0.0F ///< Zero heater efficiency #define HEATER_CNTL_TRANSFER_DELTA_TEMP_C 0.50F ///< AC heater delta temperature to transfer control from open to close loop +#define MAX_ADJ_DELTA_TEMP_C 2.0F ///< Maximum adjusted delta temperature to add/remove from calculated target temperature #define D5_HEAT_TX_INIT_FEED_FORWARD 0.0F ///< Initial Feed forward term for heater control //#define D5_HEAT_TX_P_COEFFICIENT 0.050F ///< P Term for AC primary heater control during treatment mode. @@ -79,6 +81,7 @@ #define D5_HEAT_CONTROL_INTERVAL_COUNT ( D5_HEAT_CONTROL_INTERVAL_MS / TASK_GENERAL_INTERVAL ) ///< Primary heater control interval count. #define D45_HEAT_CONTROL_INTERVAL_MS ( 1 * MS_PER_SECOND ) ///< Trimmer heater control interval in milli seconds #define D45_HEAT_CONTROL_INTERVAL_COUNT ( D45_HEAT_CONTROL_INTERVAL_MS / TASK_GENERAL_INTERVAL ) ///< Trimmer heater control interval count. +#define D5_TARGET_TEMP_ADJUST_INTERVAL_MS ( 10 * SEC_PER_MIN * MS_PER_SECOND / TASK_GENERAL_INTERVAL ) ///< Adjust primary target temperature #define PRIMARY_HEATER_MAX_PWR_WATTS 1400.0F ///< AC Primary Heater Max Power consumeption in Watts #define TX_PRIMARY_HEATER_MAX_PWR_WATTS 700.0F ///< Estimated power to be supplied to the primary heater during treatement mode #define HEAT_PRIMARY_HEATER_MAX_PWR_WATTS 980.0F ///< Estimated power to be supplied to the primary heater during heat disinfect mode @@ -121,6 +124,9 @@ static OVERRIDE_F32_T pwmPeriod[ NUM_OF_DD_HEATERS ]; ///< Total PWM period ( ON state + Off State of PWM) static U32 controlInterval[ NUM_OF_DD_HEATERS ]; ///< Heater control interval time. static U32 dataPublicationTimerCounter; ///< Data publication timer counter. +static U32 primaryTargetTempAdjCounter; ///< Primary target temperature adjustment counter. +static BOOL isTargetTempAdjusted; ///< Flag indicating that target temperature is adjusted +static U32 adjustedTargetTemp; ///< Adjusted primary target temperature static const F32 WATER_SPECIFIC_HEAT_DIVIDED_BY_MINUTES = 4184.0F / (F32)SEC_PER_MIN; ///< Water specific heat in J/KgC / 60. static OVERRIDE_U32_T heatersDataPublishInterval = { HEATERS_DATA_PUBLISH_INTERVAL, HEATERS_DATA_PUBLISH_INTERVAL, 0, 0 }; ///< Heaters data publish time interval. static F32 convertDC; ///< AC Heater converted duty cycle @@ -137,6 +143,7 @@ static HEATERS_STATE_T handleHeaterStateRampToTarget( DD_HEATERS_T heater ); static HEATERS_STATE_T handleHeaterStateControlToTarget( DD_HEATERS_T heater ); static HEATERS_STATE_T handleHeaterStateControlToDisinfectTarget( DD_HEATERS_T heater ); +static void updatePrimaryHeaterTargetTemp( DD_HEATERS_T heater ); static F32 calculateDutyCycle( F32 flowrate, F32 deltaTemp, F32 power, F32 efficiency, F32 min, F32 max ); static void setHeaterControl( DD_HEATERS_T heater ); @@ -187,6 +194,9 @@ heatersStatus[ D45_HEAT ].controlIntervalCounter = 0; startupHeaterControl = TRUE; lastDialTargetTemperatureSet = 0.0F; + primaryTargetTempAdjCounter = 0; + adjustedTargetTemp = 0.0F; + isTargetTempAdjusted = FALSE; for ( heater = DD_HEATERS_FIRST; heater < NUM_OF_DD_HEATERS; heater++ ) { @@ -341,12 +351,69 @@ { // Set flag to recalculate the feedforward signals startupHeaterControl = TRUE; + isTargetTempAdjusted = FALSE; } } } /*********************************************************************//** * @brief + * The signaltoResetAdjustedTargetTemp function resets the flag to + * update/adjust the target dialysate temperature + * @details \b Inputs: none + * @details \b Outputs: isTargetTempAdjusted + * @param heater: heater ID to update the heater control. + * @return none + *************************************************************************/ +void signaltoResetAdjustedTargetTemp( DD_HEATERS_T heater ) +{ + if ( D5_HEAT == heater ) + { + isTargetTempAdjusted = FALSE; + } +} + +/*********************************************************************//** + * @brief + * The updatePrimaryHeaterTargetTemp function adjusts the previosuly calcualted + * target dialysate temperature + * @details \b Inputs: Set Target Temperature, D28 Temp + * @details \b Outputs: Adjusted target temperature + * @param heater: heater ID to update the heater control. + * @return none + *************************************************************************/ +static void updatePrimaryHeaterTargetTemp( DD_HEATERS_T heater ) +{ + if ( D5_HEAT == heater ) + { + if ( ++primaryTargetTempAdjCounter >= D5_TARGET_TEMP_ADJUST_INTERVAL_MS ) + { + F32 targetTempfromTD = getTDTargetDialysateTemperature(); + F32 measuredTempAtDialyzer = getConductivityTemperatureValue( D27_COND ); + F32 calcTargetTemp = getHeaterTargetTemperature( heater ); + F32 deltaTempC = targetTempfromTD - measuredTempAtDialyzer; + F32 capDeltaTempC = MIN( fabs(deltaTempC), MAX_ADJ_DELTA_TEMP_C ); + + if ( deltaTempC > HEATERS_ZERO_DELTA_TEMP_C ) + { + adjustedTargetTemp = calcTargetTemp + capDeltaTempC; + } + else + { + adjustedTargetTemp = calcTargetTemp - capDeltaTempC; + } + + adjustedTargetTemp = MIN(adjustedTargetTemp, ( calcTargetTemp + MAX_ADJ_DELTA_TEMP_C ) ); + adjustedTargetTemp = MAX(adjustedTargetTemp, ( calcTargetTemp - MAX_ADJ_DELTA_TEMP_C ) ); + + isTargetTempAdjusted = TRUE; + primaryTargetTempAdjCounter = 0; + } + } +} + +/*********************************************************************//** + * @brief * The startHeater function starts the given heater by setting the flag. * @details \b Inputs: heatersStatus * @details \b Outputs: startHeaterSignal @@ -630,6 +697,8 @@ F32 measuredTemperature = 0.0F; F32 ctrl = 0.0F; + updatePrimaryHeaterTargetTemp( heater ); + if ( ++heatersStatus[ heater ].controlIntervalCounter >= controlInterval[ heater ] ) { if ( D5_HEAT == heater ) @@ -651,6 +720,10 @@ } else { + if ( TRUE == isTargetTempAdjusted ) + { + targetTemperature = adjustedTargetTemp; + } F32 deltaTempC = fabs( targetTemperature - measuredTemperature ); if ( deltaTempC >= D5_HEATER_DEADBAND_CONTROL ) @@ -856,9 +929,11 @@ HEATERS_DATA_T data; data.d5_HeaterDC = getHeaterControl( D5_HEAT ) * HEATERS_DUTY_CYCLE_CONVERSION_FACTOR; - data.d45_HeaterDC = getHeaterControl( D45_HEAT ) * HEATERS_DUTY_CYCLE_CONVERSION_FACTOR; + data.d45_HeaterDC = getTDTargetDialysateTemperature(); + //data.d45_HeaterDC = getHeaterControl( D45_HEAT ) * HEATERS_DUTY_CYCLE_CONVERSION_FACTOR; data.d5_HeaterTargetTemp = getHeaterTargetTemperature( D5_HEAT ); - data.d45_HeaterTargetTemp = getHeaterTargetTemperature( D45_HEAT ); + data.d45_HeaterTargetTemp = adjustedTargetTemp; + //data.d45_HeaterTargetTemp = getHeaterTargetTemperature( D45_HEAT ); data.d5_HeaterState = heatersStatus[ D5_HEAT ].state; data.d45_HeaterState = heatersStatus[ D45_HEAT ].state; #ifndef __HEATERS_DEBUG__ Index: firmware/App/Controllers/Heaters.h =================================================================== diff -u -rf14371c9c14b461a50d7b08336e2e5fbed16f360 -r4b09605126f35b80406e95d079f3822c51a3ba25 --- firmware/App/Controllers/Heaters.h (.../Heaters.h) (revision f14371c9c14b461a50d7b08336e2e5fbed16f360) +++ firmware/App/Controllers/Heaters.h (.../Heaters.h) (revision 4b09605126f35b80406e95d079f3822c51a3ba25) @@ -74,6 +74,7 @@ void startHeater( DD_HEATERS_T heater ); F32 getHeaterTargetTemperature( DD_HEATERS_T heater ); void signalHeaterControlOnQDUpdate( DD_HEATERS_T heater ); +void signaltoResetAdjustedTargetTemp( DD_HEATERS_T heater ); BOOL isHeaterOn( DD_HEATERS_T heater ); void stopHeater( DD_HEATERS_T heater ); void execHeatersControl( void ); Index: firmware/App/Controllers/Valves.c =================================================================== diff -u -r200dfbd12ee14a4dbe5ee1daaece7bfce9e8a104 -r4b09605126f35b80406e95d079f3822c51a3ba25 --- firmware/App/Controllers/Valves.c (.../Valves.c) (revision 200dfbd12ee14a4dbe5ee1daaece7bfce9e8a104) +++ firmware/App/Controllers/Valves.c (.../Valves.c) (revision 4b09605126f35b80406e95d079f3822c51a3ba25) @@ -36,8 +36,9 @@ #define ALL_VALVES_DEENERGIZED 0x0000 ///< 0 in U16 bit field for all valves. #define MAX_VALVE_STATE_MISMATCH_TIMER_COUNT (100 / TASK_PRIORITY_INTERVAL ) ///< Maximum time commanded valves state can fail to match read back valve states in a row. - +//Testing #define VALVES_STATE_PUB_INTERVAL ( MS_PER_SECOND / TASK_PRIORITY_INTERVAL ) ///< Interval ( ms / task time) at which valves states are published on CAN bus. +//#define VALVES_STATE_PUB_INTERVAL ( 50 / TASK_PRIORITY_INTERVAL ) ///< Interval ( ms / task time) at which valves states are published on CAN bus. #define DATA_PUBLISH_COUNTER_START_COUNT 50 ///< Data publish counter start count. /// Payload record structure for valve open/close request Index: firmware/App/Modes/ModeGenDialysate.c =================================================================== diff -u -r67731d57db9a620418b3b848d8f75ff204902c36 -r4b09605126f35b80406e95d079f3822c51a3ba25 --- firmware/App/Modes/ModeGenDialysate.c (.../ModeGenDialysate.c) (revision 67731d57db9a620418b3b848d8f75ff204902c36) +++ firmware/App/Modes/ModeGenDialysate.c (.../ModeGenDialysate.c) (revision 4b09605126f35b80406e95d079f3822c51a3ba25) @@ -52,6 +52,12 @@ #define DIALYSATE_TEMP_UPPER_SAFETY_LIMIT_C 42.0F ///< Dialysate upper bound safety temperature limit in C. #define DIALYSATE_TEMP_LOWER_SAFETY_LIMIT_C 33.0F ///< Dialysate lower bound safety temperature limit in C. #define DIALYSATE_TEMP_CLEAR_TIMEOUT_MS ( 10 * MS_PER_SECOND ) ///< Dialysate temperature clear persistence timeout. +#define QUAD_FIRST_COEFFICIENT 0.0006F ///< First coefficient used in adjusted dialysate temperature quadratic calculation for low Qds +#define QUAD_SECOND_COEFFICIENT -0.1743F ///< Second coefficient used in adjusted dialysate temperature quadratic calculation for low Qds +#define QUAD_THIRD_COEFFICIENT 17.3F ///< Third coefficient used in adjusted dialysate temperature quadratic calculation for low Qds +#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. //Testing #define DELAY_BC_SWITCHING_AT_START_UP ( 3 * MS_PER_SECOND ) ///< Provide a balancing chamber switching start up delay to stabilize pump speed etc., @@ -84,6 +90,7 @@ static DD_GEND_MODE_STATE_T handleGenDDialysateIsolatedUFState( void ); static F32 getGenDialysateTargetTemperature( void ); static void checkDialysateTemperature( void ); +static void calculateTargetDialysateTemp( void ); static void publishGenDialysateModeData( void ); /*********************************************************************//** @@ -191,7 +198,8 @@ //Previous state setValveState( DD_M4_VALV, VALVE_STATE_OPEN ); // Get the target temperature from TD - targetHydChamberFluidTemp.data = getTDTargetDialysateTemperature(); + //targetHydChamberFluidTemp.data = getTDTargetDialysateTemperature(); + calculateTargetDialysateTemp(); // Turn on the primary heater setHeaterTargetTemperature( D5_HEAT, getGenDialysateTargetTemperature() ); startHeater( D5_HEAT ); @@ -217,7 +225,8 @@ //Previous state setValveState( DD_M4_VALV, VALVE_STATE_OPEN ); // Get the target temperature from TD - targetHydChamberFluidTemp.data = getTDTargetDialysateTemperature(); + //targetHydChamberFluidTemp.data = getTDTargetDialysateTemperature(); + calculateTargetDialysateTemp(); setHeaterTargetTemperature( D5_HEAT, getGenDialysateTargetTemperature() ); startHeater( D5_HEAT ); setValveState( D14_VALV, VALVE_STATE_OPEN ); @@ -368,6 +377,37 @@ /*********************************************************************//** * @brief + * The calculateTargetDialysateTemp function calculate the delta temperature + * required for dialysate temperature to meet the set temperature at dialyzer. + * @details \b Inputs: Qd and target temperature. + * @details \b Outputs: Adjusted Target temperature + * @return none. + *************************************************************************/ +static void calculateTargetDialysateTemp( void ) +{ + // Get the dialysate flow rate from TD + F32 dialFlowrate = getTDDialysateFlowrate(); + F32 deltaTemp = 0.0F; + + if ( dialFlowrate >= LOW_DIAL_FLOW_RATE ) + { + // linear releationship seen against high dialysate flowrate Vs DeltaTemp + // deltaTemp = (-0.0029 * Qd) + 3.47 + deltaTemp = ( LINEAR_SLOPE_FACTOR * dialFlowrate ) + LINEAR_INTERCEPT_FACTOR; + } + else + { + // deltaTemp = (0.0006 * Qd * Qd)-(0.1743*Qd) + 17.3 + deltaTemp = ( QUAD_FIRST_COEFFICIENT * dialFlowrate * dialFlowrate ) + + ( QUAD_SECOND_COEFFICIENT * dialFlowrate ) + QUAD_THIRD_COEFFICIENT; + } + + // Adjust the D4 target temperature + targetHydChamberFluidTemp.data = getTDTargetDialysateTemperature() + deltaTemp; +} + +/*********************************************************************//** + * @brief * The handleGenDDialysateIsolatedUFState function performs the * Isolated ultrafiltration operations. * @details \b Inputs: none. @@ -535,7 +575,11 @@ updateBalChamberSwitchingPeriod(); // Get the target temperature from TD - targetHydChamberFluidTemp.data = getTDTargetDialysateTemperature(); + //targetHydChamberFluidTemp.data = getTDTargetDialysateTemperature(); + calculateTargetDialysateTemp(); + //Reset flag + signaltoResetAdjustedTargetTemp( D5_HEAT ); + // Update the target temperature for heater control setHeaterTargetTemperature( D5_HEAT, getGenDialysateTargetTemperature() ); Index: firmware/App/Monitors/Pressure.c =================================================================== diff -u -r67731d57db9a620418b3b848d8f75ff204902c36 -r4b09605126f35b80406e95d079f3822c51a3ba25 --- firmware/App/Monitors/Pressure.c (.../Pressure.c) (revision 67731d57db9a620418b3b848d8f75ff204902c36) +++ firmware/App/Monitors/Pressure.c (.../Pressure.c) (revision 4b09605126f35b80406e95d079f3822c51a3ba25) @@ -30,6 +30,7 @@ // ********** private definitions ********** //TODO : Increasing the publish interval #define PRESSURES_DATA_PUB_INTERVAL ( MS_PER_SECOND / TASK_PRIORITY_INTERVAL ) ///< Interval (ms/task time) at which the pressures data is published on the CAN bus. +//#define PRESSURES_DATA_PUB_INTERVAL ( 50 / TASK_PRIORITY_INTERVAL ) ///< Interval (ms/task time) at which the pressures data is published on the CAN bus. #define DATA_PUBLISH_COUNTER_START_COUNT ( 5 ) ///< Data publish counter start count. #define PRESSURE_SAMPLE_FILTER_MS ( 50 ) ///< Filter pressure data for given time #define PRESSURE_TEMP_SAMPLE_FILTER_MS ( 50 ) Index: firmware/App/Services/AlarmMgmtDD.c =================================================================== diff -u -r39475b40d39d5fc87c8d15bb0805b96a7594433b -r4b09605126f35b80406e95d079f3822c51a3ba25 --- firmware/App/Services/AlarmMgmtDD.c (.../AlarmMgmtDD.c) (revision 39475b40d39d5fc87c8d15bb0805b96a7594433b) +++ firmware/App/Services/AlarmMgmtDD.c (.../AlarmMgmtDD.c) (revision 4b09605126f35b80406e95d079f3822c51a3ba25) @@ -115,7 +115,7 @@ { // If alarm is a DD fault and the alarm manager can transition to fault immediately, go to fault mode //TODO : Testing - remove the comment later - requestNewOperationMode( DD_MODE_FAUL ); + //requestNewOperationMode( DD_MODE_FAUL ); } } } Index: firmware/App/Services/AlarmMgmtSWFaults.h =================================================================== diff -u -rafb05eebd86337012af4f6a9d21cb9a1e7f5f16a -r4b09605126f35b80406e95d079f3822c51a3ba25 --- firmware/App/Services/AlarmMgmtSWFaults.h (.../AlarmMgmtSWFaults.h) (revision afb05eebd86337012af4f6a9d21cb9a1e7f5f16a) +++ firmware/App/Services/AlarmMgmtSWFaults.h (.../AlarmMgmtSWFaults.h) (revision 4b09605126f35b80406e95d079f3822c51a3ba25) @@ -132,7 +132,7 @@ SW_FAULT_ID_INVALID_TD_OPERATING_MODE = 101, SW_FAULT_ID_GEND_MODE_INVALID_EXEC_STATE = 102, SW_FAULT_ID_GEND_MODE_INVALID_EXEC_STATE1 = 103, - SW_FAULT_ID_INVALID_RO_OPERATING_MODE = 104, + SW_FAULT_ID_INVALID_FP_OPERATING_MODE = 104, SW_FAULT_ID_PRE_GEND_MODE_INVALID_EXEC_STATE = 105, SW_FAULT_ID_POST_GEND_MODE_INVALID_EXEC_STATE = 106, SW_FAULT_ID_PRE_GEND_WET_SELF_TEST_INVALID_EXEC_STATE = 107, Index: firmware/App/Services/ROInterface.c =================================================================== diff -u -rff90c5d3a21b9b4eecc4f85a4cfeb15bff28d371 -r4b09605126f35b80406e95d079f3822c51a3ba25 --- firmware/App/Services/ROInterface.c (.../ROInterface.c) (revision ff90c5d3a21b9b4eecc4f85a4cfeb15bff28d371) +++ firmware/App/Services/ROInterface.c (.../ROInterface.c) (revision 4b09605126f35b80406e95d079f3822c51a3ba25) @@ -33,59 +33,59 @@ // ********** private definitions ********** -#define RO_DATA_FRESHNESS_TIMEOUT_MS ( 3 * MS_PER_SECOND ) ///< RO data freshness timeout (in ms). -#define MAX_RO_FLOW_RATE ( 700.0F ) ///< Max RO pump flow rate +#define FP_DATA_FRESHNESS_TIMEOUT_MS ( 3 * MS_PER_SECOND ) ///< FP data freshness timeout (in ms). +#define MAX_FP_FLOW_RATE ( 700.0F ) ///< Max FP pump flow rate // ********** private data ********** -static RO_OP_MODE_T roCurrentOpMode; ///< Current TD operation mode. -static U32 roSubMode; ///< Current state (sub-mode) of current TD operation mode. -static F32 roFlowRate; ///< RO flow rate +static FP_OP_MODE_T fpCurrentOpMode; ///< Current TD operation mode. +static U32 fpSubMode; ///< Current state (sub-mode) of current TD operation mode. +static F32 fpFlowRate; ///< FP flow rate -static BOOL roOpModeDataFreshFlag = FALSE; ///< Flag to signal/process fresh RO op mode data +static BOOL fpOpModeDataFreshFlag = FALSE; ///< Flag to signal/process fresh FP op mode data // ********** private function prototypes ********** -static void checkRODataFreshness( ALARM_ID_T alarmID, BOOL *roFreshDataFlag ); +static void checkFPDataFreshness( ALARM_ID_T alarmID, BOOL *fpFreshDataFlag ); /*********************************************************************//** * @brief - * The initROInterface function initializes the RO Interface unit. + * The initFPInterface function initializes the FP Interface unit. * @details \b Inputs: none - * @details \b Outputs: RO Interface unit initialized. + * @details \b Outputs: FP Interface unit initialized. * @return none *************************************************************************/ -void initROInterface( void ) +void initFPInterface( void ) { // Initialize unit variables - roCurrentOpMode = RO_MODE_INIT; - roSubMode = 0; - roFlowRate = MAX_RO_FLOW_RATE; + fpCurrentOpMode = FP_MODE_INIT; + fpSubMode = 0; + fpFlowRate = MAX_FP_FLOW_RATE; } /**********************************************************************//** * @brief - * The checkRODataFreshness function checks the freshness of data coming from - * the RO sub-system. - * @details \b Alarm: Given alarm is triggered if RO is communicating but has + * The checkFPDataFreshness function checks the freshness of data coming from + * the FP sub-system. + * @details \b Alarm: Given alarm is triggered if FP is communicating but has * not published new data for too long. - * @details \b Inputs: RO communicating flag + * @details \b Inputs: FP communicating flag * @details \b Outputs: none * @param alarm ID of alarm to check - * @param roFreshDataFlag Pointer to flag indicating whether new data has been + * @param fpFreshDataFlag Pointer to flag indicating whether new data has been * received since last time this function has seen it. * @return None *************************************************************************/ -static void checkRODataFreshness( ALARM_ID_T alarmID, BOOL *roFreshDataFlag ) +static void checkFPDataFreshness( ALARM_ID_T alarmID, BOOL *fpFreshDataFlag ) { - if ( TRUE == *roFreshDataFlag ) + if ( TRUE == *fpFreshDataFlag ) { - *roFreshDataFlag = FALSE; + *fpFreshDataFlag = FALSE; checkPersistentAlarm( alarmID, FALSE, 0.0, 0.0 ); } else - { // Alarm if not receiving RO fresh data message in timely manner - if ( TRUE == isROCommunicating() ) + { // Alarm if not receiving FP fresh data message in timely manner + if ( TRUE == isFPCommunicating() ) { checkPersistentAlarm( alarmID, TRUE, 0.0, 0.0 ); } @@ -98,44 +98,44 @@ /*********************************************************************//** * @brief - * The execROInterfaceMonitor function executes the RO Interface monitoring - * function. Ensures RO is sending fresh data in a timely manner. + * The execFPInterfaceMonitor function executes the FP Interface monitoring + * function. Ensures FP is sending fresh data in a timely manner. * @details \b Inputs: none * @details \b Outputs: none * @return none *************************************************************************/ -void execROInterfaceMonitor( void ) +void execFPInterfaceMonitor( void ) { } /*********************************************************************//** * @brief - * The cmdROStartStop function sends a start/stop command to RO for mode + * The cmdFPStartStop function sends a start/stop command to FP for mode * transition and generate water with commanded flow rate. * @details Inputs: none * @details Outputs: start/stop command along with flow rate if applicable. - * @param startStop To start/stop the RO delivery. + * @param startStop To start/stop the FP delivery. * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ -BOOL cmdROStartStop( BOOL startStop, RO_CMD_ID cmdMode) +BOOL cmdFPStartStop( BOOL startStop, RO_CMD_ID cmdMode) { - RO_WATER_REQ_PAYLOAD_T roStartRequest; + FP_WATER_REQ_PAYLOAD_T fpStartRequest; BOOL result; MESSAGE_T msg; U08 *payloadPtr = msg.payload; - // Populate RO start message - roStartRequest.cmdID = (U32)cmdMode; - roStartRequest.start = startStop; - roStartRequest.roRate = getROFlowRate(); + // Populate FP start message + fpStartRequest.cmdID = (U32)cmdMode; + fpStartRequest.start = startStop; + fpStartRequest.roRate = getFPFlowRate(); // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_DD_FP_START_STOP_CMD_REQUEST; - msg.hdr.payloadLen = sizeof( RO_WATER_REQ_PAYLOAD_T ); + msg.hdr.payloadLen = sizeof( FP_WATER_REQ_PAYLOAD_T ); - memcpy( payloadPtr, &roStartRequest, sizeof( RO_WATER_REQ_PAYLOAD_T ) ); + memcpy( payloadPtr, &fpStartRequest, sizeof( FP_WATER_REQ_PAYLOAD_T ) ); // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer result = serializeMessage( msg, COMM_BUFFER_OUT_CAN_DD_2_RO, ACK_REQUIRED ); @@ -145,78 +145,78 @@ /*********************************************************************//** * @brief - * The setROFlowRate function sets the RO pump flow rate to deliver purified + * The setFPFlowRate function sets the FP pump flow rate to deliver purified * water. * @details \b Inputs: none - * @details \b Outputs: roFlowRate + * @details \b Outputs: fpFlowRate * @return none. *************************************************************************/ -void setROFlowRate( F32 roFlow ) +void setFPFlowRate( F32 fpFlow ) { - roFlowRate = roFlow; + fpFlowRate = fpFlow; } /*********************************************************************//** * @brief - * The getROFlowRate function gets the RO flow rate. + * The getFPFlowRate function gets the FP flow rate. * @details \b Inputs: Ro flow rate * @details \b Outputs: none - * @return latest RO pump flow rate. + * @return latest FP pump flow rate. *************************************************************************/ -F32 getROFlowRate( void ) +F32 getFPFlowRate( void ) { - return roFlowRate; + return fpFlowRate; } /*********************************************************************//** * @brief - * The getROOpMode function gets the current latest reported RO operating mode. - * @details \b Inputs: roCurrentOpMode + * The getFPOpMode function gets the current latest reported FP operating mode. + * @details \b Inputs: fpCurrentOpMode * @details \b Outputs: none - * @return Latest reported RO operating mode. + * @return Latest reported FP operating mode. *************************************************************************/ -RO_OP_MODE_T getROOpMode( void ) +FP_OP_MODE_T getFPOpMode( void ) { - return roCurrentOpMode; + return fpCurrentOpMode; } /*********************************************************************//** * @brief - * The getROSubMode function gets the latest reported RO operating sub-mode. - * @details \b Inputs: roSubMode + * The getFPSubMode function gets the latest reported FP operating sub-mode. + * @details \b Inputs: fpSubMode * @details \b Outputs: none - * @return Latest reported RO operating sub-mode. + * @return Latest reported FP operating sub-mode. *************************************************************************/ -U32 getROSubMode( void ) +U32 getFPSubMode( void ) { - return roSubMode; + return fpSubMode; } /*********************************************************************//** * @brief - * The setROOpMode function sets the latest RO operating mode reported by - * the RO (called by RO published message handler). - * @details \b Alarm: ALARM_ID_DD_SOFTWARE_FAULT if reported RO mode is invalid. + * The setFPOpMode function sets the latest FP operating mode reported by + * the FP (called by FP published message handler). + * @details \b Alarm: ALARM_ID_DD_SOFTWARE_FAULT if reported FP mode is invalid. * @details \b Inputs: none - * @details \b Outputs: roCurrentOpMode, roSubMode, roOpModeDataFreshFlag - * @param opMode The operating mode reported by RO - * @param subMode The sub-mode of operating mode reported by RO + * @details \b Outputs: fpCurrentOpMode, fpSubMode, fpOpModeDataFreshFlag + * @param opMode The operating mode reported by FP + * @param subMode The sub-mode of operating mode reported by FP * @return none *************************************************************************/ -void setROOpMode( U32 opMode, U32 subMode ) +void setFPOpMode( U32 opMode, U32 subMode ) { - if ( opMode < NUM_OF_RO_MODES ) + if ( opMode < NUM_OF_FP_MODES ) { - // update RO op mode and sub-mode - roCurrentOpMode = (RO_OP_MODE_T)opMode; - roSubMode = subMode; + // update FP op mode and sub-mode + fpCurrentOpMode = (FP_OP_MODE_T)opMode; + fpSubMode = subMode; } else { - SET_ALARM_WITH_2_U32_DATA( ALARM_ID_DD_SOFTWARE_FAULT, SW_FAULT_ID_INVALID_RO_OPERATING_MODE, opMode ); + SET_ALARM_WITH_2_U32_DATA( ALARM_ID_DD_SOFTWARE_FAULT, SW_FAULT_ID_INVALID_FP_OPERATING_MODE, opMode ); } - roOpModeDataFreshFlag = TRUE; + fpOpModeDataFreshFlag = TRUE; } Index: firmware/App/Services/ROInterface.h =================================================================== diff -u -rd1527b612b7af4bd3103743b5a61ecad3a133ac0 -r4b09605126f35b80406e95d079f3822c51a3ba25 --- firmware/App/Services/ROInterface.h (.../ROInterface.h) (revision d1527b612b7af4bd3103743b5a61ecad3a133ac0) +++ firmware/App/Services/ROInterface.h (.../ROInterface.h) (revision 4b09605126f35b80406e95d079f3822c51a3ba25) @@ -21,7 +21,7 @@ #include "DDCommon.h" #include "MessagePayloads.h" #include "TDDefs.h" -#include "RODefs.h" +#include "FPDefs.h" /** * @defgroup ROInterface ROInterface @@ -38,16 +38,16 @@ // ********** public function prototypes ********** -void initROInterface( void ); -void execROInterfaceMonitor( void ); +void initFPInterface( void ); +void execFPInterfaceMonitor( void ); -BOOL cmdROStartStop( BOOL startStop, RO_CMD_ID cmdMode); -void setROFlowRate( F32 roFlow ); -F32 getROFlowRate( void ); +BOOL cmdFPStartStop( BOOL startStop, RO_CMD_ID cmdMode); +void setFPFlowRate( F32 fpFlow ); +F32 getFPFlowRate( void ); -void setROOpMode( U32 opMode, U32 subMode ); -RO_OP_MODE_T getROOpMode( void ); -U32 getROSubMode( void ); +void setFPOpMode( U32 opMode, U32 subMode ); +FP_OP_MODE_T getFPOpMode( void ); +U32 getFPSubMode( void ); /**@}*/ Index: firmware/App/Services/SystemCommDD.c =================================================================== diff -u -r9102c5da21a15bdaf4bb3bc38795ceb064e3c443 -r4b09605126f35b80406e95d079f3822c51a3ba25 --- firmware/App/Services/SystemCommDD.c (.../SystemCommDD.c) (revision 9102c5da21a15bdaf4bb3bc38795ceb064e3c443) +++ firmware/App/Services/SystemCommDD.c (.../SystemCommDD.c) (revision 4b09605126f35b80406e95d079f3822c51a3ba25) @@ -151,13 +151,13 @@ /*********************************************************************//** * @brief - * The isROCommunicating function determines whether the RO is communicating + * The isFPCommunicating function determines whether the RO is communicating * with the DD. * @details \b Inputs: roCommunicationStatus * @details \b Outputs: none * @return TRUE if RO has broadcast since last call, FALSE if not *************************************************************************/ -BOOL isROCommunicating( void ) +BOOL isFPCommunicating( void ) { return getU32OverrideValue( &roCommunicationStatus ); } Index: firmware/App/Services/SystemCommDD.h =================================================================== diff -u -r9102c5da21a15bdaf4bb3bc38795ceb064e3c443 -r4b09605126f35b80406e95d079f3822c51a3ba25 --- firmware/App/Services/SystemCommDD.h (.../SystemCommDD.h) (revision 9102c5da21a15bdaf4bb3bc38795ceb064e3c443) +++ firmware/App/Services/SystemCommDD.h (.../SystemCommDD.h) (revision 4b09605126f35b80406e95d079f3822c51a3ba25) @@ -46,7 +46,7 @@ COMM_BUFFER_T getInBufferID( U32 idx ); COMM_BUFFER_T getOutBufferID( U32 idx ); BOOL isTDCommunicating( void ); -BOOL isROCommunicating( void ); +BOOL isFPCommunicating( void ); void checkInFromTD( void ); void checkInFromRO( void ); BOOL isOnlyCANNode( void ); Index: firmware/source/sys_main.c =================================================================== diff -u -r333e2d0c0462dcb4343a279420949cce716ebab7 -r4b09605126f35b80406e95d079f3822c51a3ba25 --- firmware/source/sys_main.c (.../sys_main.c) (revision 333e2d0c0462dcb4343a279420949cce716ebab7) +++ firmware/source/sys_main.c (.../sys_main.c) (revision 4b09605126f35b80406e95d079f3822c51a3ba25) @@ -182,7 +182,7 @@ initOperationModes(); initTestConfigs(); initTDInterface(); - initROInterface(); + initFPInterface(); initUltrafiltration(); #ifdef __PUMPTEST__ initPistonPump();