Index: firmware/App/Services/NVRecordsDD.h =================================================================== diff -u -rf525d2be1e7038cacbe2bb34b8db3505cf26a350 -r66b03c4d4724df628b4fd175567880f23eb35259 --- firmware/App/Services/NVRecordsDD.h (.../NVRecordsDD.h) (revision f525d2be1e7038cacbe2bb34b8db3505cf26a350) +++ firmware/App/Services/NVRecordsDD.h (.../NVRecordsDD.h) (revision 66b03c4d4724df628b4fd175567880f23eb35259) @@ -16,9 +16,15 @@ #define _NV_RECORDS_DD_H_ #include "Common.h" +#include "ConcentratePumps.h" #include "DDDefs.h" +#include "DialysatePumps.h" +#include "FlowSensor.h" +#include "FluidPump.h" #include "NVDriver.h" #include "PressureSensor.h" +#include "RinsePump.h" +#include "TemperatureSensors.h" /** * @defgroup NVRecordsDD NVRecordsDD @@ -61,77 +67,21 @@ typedef enum DD_nv_commands { GET_CAL_PRESSURE_SENOSRS = 0, ///< Get pressure sensors calibration data. - GET_CAL_FLOW_SENSORS, ///< Get flow sensors calibration data. + GET_CAL_TEMP_SENSORS, ///< Get temperature sensors calibration data. + GET_CAL_CONCENTRATE_PUMPS_RECORD, ///< Get concentrate pumps calibration record. + GET_CAL_DIALYSATE_PUMPS_RECORD, GET_CAL_ACID_CONCENTREATES, ///< Get acid concentrates calibration data. GET_CAL_BICARB_CONCENTRATES, ///< Get bicarb concentrates calibration data. GET_CAL_ACCEL_SENSORS, ///< Get accelerometers calibration data. - GET_CAL_TEMP_SENSORS, ///< Get temperature sensors calibration data. - GET_CAL_HEATING_RECORD, ///< Get heating calibration record. - GET_CAL_DRAIN_LINE_VOLUME_RECORD, ///< Get drain line volume record. - GET_CAL_RO_PUMP_RECORD, ///< Get RO pump calibration record. - GET_CAL_CONCENTRATE_PUMPS_RECORD, ///< Get concentrate pumps calibration record. - GET_CAL_DRAIN_PUMP_RECORD, ///< Get drain pump calibration record. - GET_CAL_FANS_RECORD, ///< Get fans calibration record. - GET_CAL_PRE_RO_PURGE_VOLUME_RECORD, ///< Get pre RO purge volume record. - GET_CAL_FILTERS_RECORD, ///< Get filters record. GET_CAL_FILL_CONDUCTIVITIES_RECORD, ///< Get fill conductivities record. + GET_CAL_BLOOD_LEAK_SENSOR, GET_SYS_RECORD, ///< Get system record. GET_SRV_RECORD, ///< Get service record. GET_INSTITUTIONAL_RECORD, ///< Get institutional record. GET_USAGE_RECORD, ///< Get usage record. NUM_OF_NV_DD_DATA ///< Number of non-volatile data. } NV_DATA_T; -/// DD flow sensors enumeration. -typedef enum DD_flow_sensors -{ - CAL_DATA_RO_PUMP_FLOW_SENSOR = 0, ///< RO pump flow sensor. - CAL_DATA_DIALYSATE_FLOW_SENSOR, ///< RO pump dialysate flow sensor. - NUM_OF_CAL_DATA_FLOW_SENSORS, ///< Number of flow sensors. -} CAL_DATA_DD_FLOW_SENSORS_T; - -/// DD load cells enumeration. -typedef enum DD_load_cells -{ - CAL_DATA_LOAD_CELL_A1 = 0, ///< Load cell A1. - CAL_DATA_LOAD_CELL_A2, ///< Load cell A2. - CAL_DATA_LOAD_CELL_B1, ///< Load cell B1. - CAL_DATA_LOAD_CELL_B2, ///< Load cell B2. - NUM_OF_CAL_DATA_LOAD_CELLS, ///< Number of load cells. -} CAL_DATA_DD_LOAD_CELLS_T; - -/// DD temperature sensors enumeration. -typedef enum DD_temperature_sensors -{ - CAL_DATA_FPGA_BOARD_TEMP = 0, ///< FPGA board temperature sensor. - CAL_DATA_LOAD_CELL_A1_B1_TEMP, ///< Load cell A1/B1 temperature sensor. - CAL_DATA_LOAD_CELL_A2_B2_TEMP, ///< Load cell A2/B2 temperature sensor. - CAL_DATA_INTERNAL_THDO_RTD_TEMP, ///< Internal THDO RTC temperature sensor. - CAL_DATA_INTERNAL_TDI_RTD_TEMP, ///< Internal TDI RTD temperature sensor. - CAL_DATA_INTERNAL_COND_SENSOR_TEMP, ///< Internal conductivity sensor temperature sensor. - CAL_DATA_THERMISTOR_DD_ONBOARD_NTC_TEMP, ///< DD onboard NTC thermistor. - CAL_DATA_THERMISTOR_POWER_SUPPLY_1_TEMP, ///< Power supply 1 thermistor. - CAL_DATA_THERMISTOR_POWER_SUPPLY_2_TEMP, ///< Power supply 2 thermistor. - CAL_DATA_OUTLET_REDUNDANT_TEMP, ///< Outlet redundant temperature sensor. - CAL_DATA_INLET_DIALYSATE_TEMP, ///< Inlet dialysate temperature sensor. - CAL_DATA_INLET_PRIMARY_HEATER_TEMP, ///< Inlet primary heater temperature sensor. - CAL_DATA_OUTLET_PRIMARY_HEATER_TEMP, ///< Outlet primary heater temperature sensor. - CAL_DATA_COND_SENSOR_1_TEMP, ///< Conductivity sensor 1 temperature sensor. - CAL_DATA_COND_SENSOR_2_TEMP, ///< Conductivity sensor 2 temperature sensor. - CAL_DATA_HEAT_DISINFECT_TEMP, ///< Heat disinfect temperature sensor. - CAL_DATA_INTERNAL_THD_TEMP, ///< Heat disinfect internal ADC temperature sensor. - CAL_DATA_BARMOTERIC_TEMP, ///< Barometric temperature sensor. - NUM_OF_CAL_DATA_TEMP_SENSORS, ///< Number of temperature sensors. -} CAL_DATA_DD_TEMP_SENSORS_T; - -/// DD pumps enumeration. -typedef enum DD_pumps -{ - CAL_DATA_CONC_PUMP_CP1_ACID = 0, ///< Concentrate pump 1. - CAL_DATA_CONC_PUMP_CP2_BICARB, ///< Concentrate pump 2. - NUM_OF_CAL_DATA_DD_CONC_PUMPS ///< Number of DD concentrate pumps. -} CAL_DATA_DD_PUMPS_T; - /// DD acid concentrate enumeration. typedef enum DD_acid_concentrate { @@ -154,24 +104,11 @@ NUM_OF_CAL_DATA_BICARB_CONCENTRATES ///< Number of bicarb concentrates. } CAL_DATA_DD_BICARB_CONCENTRATES_T; -/// DD fans enumeration. -typedef enum DD_fans -{ - CAL_DATA_INLET_FAN_1 = 0, ///< Inlet fan 1. - CAL_DATA_INLET_FAN_2, ///< Inlet fan 2. - CAL_DATA_INLET_FAN_3, ///< Inlet fan 3. - CAL_DATA_OUTLET_FAN_1, ///< Outlet fan 1. - CAL_DATA_OUTLET_FAN_2, ///< Outlet fan 2. - CAL_DATA_OUTLET_FAN_3, ///< Outlet fan 3. - NUM_OF_CAL_DATA_FANS ///< Number of fans. -} CAL_DATA_DD_FANS_T; - /// DD scheduled runs enumeration. typedef enum DD_scheduled_runs { RUN_FLUSH = 0, ///< Flush run. RUN_HEAT_DISINFECT, ///< Heat disinfect run. - RUN_CHEMICAL_DISINFECT, ///< Chemical disinfect run. NUM_OF_DD_SCHEDULED_RUNS ///< Number of DD scheduled runs. } SCHEDULED_DD_RUNS_T; @@ -180,9 +117,6 @@ { USAGE_INFO_RO_GEN_WATER = 0, ///< Usage info RO generated water. USAGE_INFO_BASIC_FLUSH, ///< Usage info basic flush. - USAGE_INFO_CHEM_DIS_START, ///< Usage info chemcial disinfect start. - USAGE_INFO_CHEM_DIS, ///< Usage info chemical disinfect complete. - USAGE_INFO_CHEM_FLUSH, ///< Usage info chemical flush complete. USAGE_INFO_HEAT_DIS, ///< Usage info heat disinfect complete. USAGE_INFO_FILTER_FLUSH, ///< Usage info filter flush complete. USAGE_INFO_HEAT_DIS_ACTIVE_COOL, ///< Usage info heat disinfect active cool complete. @@ -211,90 +145,38 @@ U16 crc; ///< CRC for the polynomial calibration payload. } POLYNOMIAL_CAL_PAYLOAD_T; -/// DD calibration sensor temperature compensation calibration structure -typedef struct -{ - F32 gain; ///< Gain. - F32 coefficient; ///< Coefficient. - F32 offset; ///< Offset. - U32 calibrationTime; ///< Calibration time. - U16 crc; ///< CRC for the conductivity sensors temperature compensation cal payload. -} DD_COND_SENSOR_TEMP_COMP_CAL_PAYLOAD_T; - -/// DD concentrate pumps calibration record -typedef struct -{ - POLYNOMIAL_CAL_PAYLOAD_T concentratePumps[ NUM_OF_CAL_DATA_DD_CONC_PUMPS ]; ///< DD concentrate pumps calibration data. -} DD_CONC_PUMPS_CAL_RECORD_T; - -/// DD drain pump two-gain payload -typedef struct -{ - F32 voltage2SpeedRatio; ///< Voltage to speed ratio. - F32 stepSpeed2FlowRatio; ///< Step speed to flow ratio. - U32 calibrationTime; ///< Calibration time. - U16 crc; ///< CRC for the drain pump structure. -} DD_DRAIN_PUMP_CAL_RECORD_T; - -/// DD RO pump calibration structure. -typedef struct -{ - F32 gain1Ratio; ///< RO pump gain1 ratio. - F32 gain2Ratio; ///< RO pump gain2 ratio. - F32 gain3Ratio; ///< RO pump gain3 ratio. - U32 calibrationTime; ///< Calibration time. - U16 crc; ///< CRC for the DD RO pump calibration structure. -} DD_RO_PUMP_CAL_RECORD_T; - /// Pressure sensors calibration structure typedef struct { POLYNOMIAL_CAL_PAYLOAD_T pressureSensors[ NUM_OF_PRESSURE_SENSORS ]; ///< Pressure sensors to calibrate. } DD_PRES_SENSORS_CAL_RECORD_T; -/// Flow sensors calibration structure -typedef struct -{ - POLYNOMIAL_CAL_PAYLOAD_T flowSensors[ NUM_OF_CAL_DATA_FLOW_SENSORS ]; ///< Flow sensors to calibrate. -} DD_FLOW_SENSORS_CAL_RECORD_T; - /// Temperature sensors calibration structure typedef struct { - POLYNOMIAL_CAL_PAYLOAD_T tempSensors[ NUM_OF_CAL_DATA_TEMP_SENSORS ]; ///< Temperature sensors to calibrate. + POLYNOMIAL_CAL_PAYLOAD_T tempSensors[ NUM_OF_TEMPERATURE_SENSORS ]; ///< Temperature sensors to calibrate. } DD_TEMP_SENSORS_CAL_RECORD_T; -/// Drain line volume calibration structure +/// DD concentrate pumps calibration record typedef struct { - F32 volume; ///< DD Drain line volume. - U32 calibrationTime; ///< Calibration time. - U16 crc; ///< CRC. -} DD_DRAIN_LINE_VOLUME_T; + POLYNOMIAL_CAL_PAYLOAD_T concentratePumps[ NUM_OF_CONCENTRATE_PUMPS ]; ///< DD concentrate pumps calibration data. +} DD_CONC_PUMPS_CAL_RECORD_T; -/// DD pre RO purge volume calibration structure +/// DD dialysate pump calibration structure typedef struct { - F32 pressure2FlowRatio; ///< Pressure to flow ratio. - F32 volume; ///< Volume. - U32 calibrationTime; ///< Calibration time. - U16 crc; ///< CRC. -} DD_PRE_RO_PURGE_VOLUME_T; + float targetPumpSpeed[ NUM_OF_DIALYSATE_PUMPS ]; ///< Target Pump Speed + U32 calibrationTime; ///< Calibration time. + U16 crc; ///< CRC for the polynomial calibration payload. +} DD_DIALYSATE_PUMP_DATA_T; -/// DD generic volumes (reserved space) +/// DD dialysate pumps calibration record typedef struct { - F32 volume; ///< Volume. - U32 calibrationTime; ///< Calibration time. - U16 crc; ///< CRC. -} DD_GENERIC_VOLUME_DATA_T; + DD_DIALYSATE_PUMP_DATA_T dialysatePump[ NUM_OF_DIALYSATE_PUMPS ]; ///< DD dialysate pumps calibration data. +} DD_DIALYSATE_PUMPS_CAL_RECORD_T; -/// DD generic volume record -typedef struct -{ - DD_GENERIC_VOLUME_DATA_T genericVolume[ GENERIC_VOL_RESERVED_SPACE_COUNT ]; ///< DD generic volume record. -}DD_GENERIC_VOLUME_RECORD_T; - /// DD acid concentrate typedef struct { @@ -329,36 +211,6 @@ DD_BICARB_CONCENTRATE_T bicarbConcentrate[ NUM_OF_CAL_DATA_BICARB_CONCENTRATES ]; ///< DD bicarb concentrates. } DD_BICARB_CONCENTRATES_RECORD_T; -/// DD filter calibration record -typedef struct -{ - U32 calibrationTime; ///< Calibration time. - U16 crc; ///< CRC. -} DD_FILTER_CAL_RECORD_T; - -/// DD filters calibration data structure -typedef struct -{ - DD_FILTER_CAL_RECORD_T roFilter; ///< RO filter. - DD_FILTER_CAL_RECORD_T ultraFilter; ///< Ultra filter. - DD_FILTER_CAL_RECORD_T sedimentFilter; ///< Sediment filter. - DD_FILTER_CAL_RECORD_T carbonFilter; ///< Carbon filter. - DD_FILTER_CAL_RECORD_T carbonPolishFilter; ///< Carbon polish filter. -} DD_FILTERS_CAL_RECORD_T; - -/// DD fan calibration data structure -typedef struct -{ - U32 calibrationTime; ///< Calibration time. - U16 crc; ///< CRC. -} DD_FAN_CAL_RECORD_T; - -/// DD fans calibration data structure -typedef struct -{ - DD_FAN_CAL_RECORD_T fans[ NUM_OF_CAL_DATA_FANS ]; ///< Fans calibration record. -} DD_FANS_CAL_RECORD_T; - /// HD accelerometer sensor calibration record typedef struct { @@ -369,16 +221,6 @@ U16 crc; ///< CRC for the DD accelerometer sensor. } DD_ACCEL_SENSOR_CAL_RECORD_T; -/// DD heating calibration record -typedef struct -{ - F32 reservoirTempTauCPerMin; ///< Reservoir temperature Tau C/min. - F32 ultrafilterTempTauCPerMin; ///< Ultrafilter temperature Tau C/min. - U32 ultrafilterVolmL; ///< Ultrafilter volume in mL. - U32 calibrationTime; ///< Calibration time. - U16 crc; ///< CRC for the reservoirs and UF record. -} DD_HEATING_CAL_RECORD_T; - /// DD acid and bicarb fill conductivity values typedef struct { @@ -394,19 +236,31 @@ DD_ACID_BICARB_FILL_COND_VALUES_T fillCondValues[ NUM_OF_ACID_TYPE ][ NUM_OF_FILL_COND_TEST ]; ///< Acid and bicarb fill conductivity values. } DD_CONCENTRATES_COND_CAL_RECORD_T; +/// DD blood leak calibration structure +typedef struct +{ + U16 setPoint; ///< Blood leak sensor set point. + U32 calibrationTime; ///< Calibration time. + U16 crc; ///< CRC for the HD blood leak calibration payload. +} DD_BLOOD_LEAK_SENSOR_CAL_RECORD_T; + /// DD systems record structure typedef struct { - char topLevelPN[ MAX_TOP_LEVEL_PN_CHARS ]; ///< DD top level part number. - char topLevelSN[ MAX_TOP_LEVEL_SN_CHARS ]; ///< DD top level serial number. - U08 mfgLocation; ///< DD manufacturing location. - U32 mfgDate; ///< DD manufacturing date. - U16 crc; ///< CRC for the DD system record structure. + BOOL isROFeatured; ///< True : RO featured. False : RO de-featured. + BOOL isR0FeaturedBoostPump; ///< True : RO featured with boost pump. False : RO featured without the boost pump. + char topLevelPN[ MAX_TOP_LEVEL_PN_CHARS ]; ///< DD top level part number. + char topLevelSN[ MAX_TOP_LEVEL_SN_CHARS ]; ///< DD top level serial number. + U08 mfgLocation; ///< DD manufacturing location. + U32 mfgDate; ///< DD manufacturing date. + U16 crc; ///< CRC for the DD system record structure. } DD_SYSTEM_RECORD_T; /// DD service record structure typedef struct { + BOOL isHDFOnlineFluid; ///< True : HDF Online Fluid feature is available, False if not. + U32 waterRecovey; ///< Low : 0, Medium : 1, High : 2. U08 serviceLoc; ///< DD service location. U32 lastServiceEpochDate; ///< DD last service date in epoch. U32 serviceIntervalSeconds; ///< DD service interval in seconds. @@ -417,35 +271,28 @@ /// DD institutional record structure typedef struct { - U32 minBloodFlowMLPM; ///< Min blood flow in mL/min. - U32 maxBloodFlowMLPM; ///< Max blood flow in mL/min. - U32 minDialysateFlowMLPM; ///< Min dialysate flow in mL/min. - U32 maxDialysateFlowMLPM; ///< Max dialysate flow in mL/min. - U32 minTxDurationMIN; ///< Min treatment duration in minutes. - U32 maxTxDurationMIN; ///< Max treatment duration in minutes. - U32 minStopHeparinDispBeforeTxEndMIN; ///< Min stop heparin dispense before treatment end in minutes. - U32 maxStopHeparinDispBeforeTxEndMIN; ///< Max stop heparin dispense before treatment end in minutes. - U32 minSalineBolusVolumeML; ///< Min saline bolus volume in milliliters. - U32 maxSalineBolusVolumeML; ///< Max saline bolus volume in milliliters. - F32 minDialysateTempC; ///< Min dialysate temperature in C. - F32 maxDialysateTempC; ///< Max dialysate temperature in C. - S32 minArtPressLimitWindowMMHG; ///< Min arterial pressure limit window in mmHg. - S32 maxArtPressLimitWindowMMHG; ///< Max arterial pressure limit window in mmHg. - S32 minVenPressLimitWindowMMHG; ///< Min venous pressure limit window in mmHg. - S32 maxVenPressLimitWindowMMHG; ///< Max venous pressure limit window in mmHg. - S32 minVenAsymPressLimitMMHG; ///< Min venous asymmetric pressure limit in mmHg. - S32 maxVenAsymPressLimitMMHG; ///< Max venous asymmetric pressure limit in mmHg. - F32 minUFVolumeL; ///< Min ultrafiltration volume in mL. - F32 maxUFVolumeL; ///< Max ultrafiltration volume in mL. - F32 minHeparinDispRateMLPHR; ///< Min heparin dispense rate in mL/hr. - F32 maxHeparinDispRateMLPHR; ///< Max heparin dispense rate in mL/hr. - F32 minHeparinBolusVolumeML; ///< Min heparin bolus volume in mL. - F32 maxHeparinBolusVolumeML; ///< Max heparin bolus volume in mL. - U32 enableChemicalDisinfect; ///< Enable/disable chemical disinfect. - U32 minRORejectionRatioPCT; ///< Min RO rejection ratio in percent. - F32 minInletWaterCondAlarmLimitUSPCM; ///< Min inlet water conductivity alarm limit in uS/cm. - U32 calibrationTime; ///< Calibration time in epoch. - U16 crc; ///< CRC of the institutional record. + U32 minDialysateFlowMLPM; ///< Min dialysate flow in mL/min. + U32 maxDialysateFlowMLPM; ///< Max dialysate flow in mL/min. + F32 minDialysateTempC; ///< Min dialysate temperature in C. + F32 maxDialysateTempC; ///< Max dialysate temperature in C. + F32 acidConcentrate; ///< acid concentrate + F32 bicarbCartridgeSizeG; ///< bicarbonate cartridge size in grams. + F32 minSodiumMEQL; ///< Min sodium in mEq/L + F32 maxSodiumMEQL; ///< Max sodium in mEq/L + F32 minBicarbonateMEQL; ///< Min bicarbonate in mEq/L + F32 maxBicarbonateMEQL; ///< Max bicarbonate in mEq/L + U32 minRORejectionRatioPCT; ///< Min RO rejection ratio in percent. + U32 disinfectionFrequency; ///< Disinfection days between cycles. + F32 disinfectionCycleTime; ///< Disinfection Cycle Time + F32 minInletWaterCondAlarmLimitUSPCM; ///< Min inlet water conductivity alarm limit in uS/cm. + F32 maxInletWaterCondAlarmLimitUSPCM; ///< Max inlet water conductivity alarm limit in uS/cm. + F32 acidConcentrateJugSizeL; ///< acid concentrate jug size in Liters + F32 minAcidAlarmLimitPCT; ///< Min acid alarm limit in percent. + F32 minBicarbAlarmLimitPCT; ///< Min bicarbonate alarm limit in percent. + U32 postTreatDrainOption; ///< Dialysate Post Treatment Drain OptionĀ  + U32 postTreatDryBicarbOption; ///< Dry Bicarbonate Post Treatment OptionĀ  + U32 calibrationTime; ///< Calibration time in epoch. + U16 crc; ///< CRC of the institutional record. } DD_INSTITUTIONAL_RECORD_T; /// DD usage info structure. @@ -454,9 +301,6 @@ F32 roWaterGenTotalL; ///< Total RO water generated in liters. (Cannot be reset) F32 roWaterGenSinceLastServiceL; ///< RO water generated since last treatment in liters. U32 lastBasicFlushCompleteDateEpoch; ///< Last basic flush complete date in epoch. - U32 lastChemDisStartDateEpoch; ///< Last chemical disinfect start date in epoch. - U32 lastChemDisCompleteDateEpoch; ///< Last chemical disinfect complete date in epoch. - U32 lastChemDisFlushCompleteDateEpoch; ///< Last chemical disinfect flush complete date in epoch. U32 lastHeatDisCompleteDateEpoch; ///< Last heat disinfect complete date in epoch. U32 lastHeatActiveCoolCompleteDateEpoch; ///< Last heat disinfect active cool complete date in epoch. U32 lastFilterFlushCompleteDateEpoch; ///< Last filter flush complete date in epoch. @@ -476,10 +320,12 @@ BOOL setLastDisinfectDate( DD_USAGE_INFO_ITEMS_T disinfect, U32 epochTime ); BOOL setServiceTime( void ); BOOL getNVRecord2Driver( NV_DATA_T nvData, U08* bufferAddress, U32 bufferLength, U08 numOfSnsrs2Check, ALARM_ID_T nvAlarm ); -BOOL testSetNVRecordCRCOverride( U32 job, U16 crc ); + void updateNVSelfTestResult( SELF_TEST_STATUS_T result ); void updateNVSelfTestState( NVDATAMGMT_SELF_TEST_STATE_T state ); void updateSelfTestReadRecordsFlag ( BOOL value ); + +BOOL testSetNVRecordCRCOverride( U32 job, U16 crc ); /**@}*/ #endif /* _NV_RECORDS_DD_H_ */