Index: NVDataMgmtDGRecords.h =================================================================== diff -u -r0ee608e8de70aef91f5bdf7ebfa1f1cccf2e43dd -rff5e595afd7ad79dd7693dfa598b24fdeacad95d --- NVDataMgmtDGRecords.h (.../NVDataMgmtDGRecords.h) (revision 0ee608e8de70aef91f5bdf7ebfa1f1cccf2e43dd) +++ NVDataMgmtDGRecords.h (.../NVDataMgmtDGRecords.h) (revision ff5e595afd7ad79dd7693dfa598b24fdeacad95d) @@ -1,13 +1,373 @@ -/* - * NVDataMgmtDGRecords.h - * - * Created on: Feb 12, 2021 - * Author: fw - */ #ifndef FWCOMMON_NVDATAMGMTDGRECORDS_H_ #define FWCOMMON_NVDATAMGMTDGRECORDS_H_ +#include "Common.h" +#include "ConcentratePumps.h" +/** + * @defgroup NVDataMgmtDGRecords NVDataMgmtDGRecords + * @brief Non-volatile DG data records including calibration records, system records, + * service records, and the scheduled runs record. + * + * @addtogroup NVDataMgmtDGRecords + * @{ + */ -#endif /* FWCOMMON_NVDATAMGMTDGRECORDS_H_ */ +// ********** public definitions ********** + +#define MAX_TOP_LEVEL_PN_CHARS 10U ///< Max number of characters for top level part number. +#define MAX_TOP_LEVEL_SN_CHARS 15U ///< Max number of characters for top level serial number. + +/// Manufacturing location enumeration. +typedef enum mfg_location +{ + MFG_LOC_FACTORY = 0, ///< Manufacturing location (HD/DG). + NUM_OF_MFG_LOC ///< Number of manufacturing location. +} MFG_LOCATION_T; + +/// Service location enumeration. +typedef enum service_location +{ + SERVICE_LOC_FACTORY = 0, ///< Service location factory (HD/DG). + SERVICE_LOC_FIELD, ///< Service location field (HD/DG). + NUM_OF_SERVICE_LOC ///< Number of service location. +} SERVICE_LOCATION_T; + +/// DG pressure sensors enumeration. +typedef enum dg_pressure_sensors +{ + CAL_DATA_RO_PUMP_INLET_PRES_SENSOR = 0, ///< DG calibration data RO pump inlet pressure sensor. + CAL_DATA_RO_PUMP_OUTLET_PRES_SENSOR, ///< DG calibration data RO pump outlet pressure sensor. + CAL_DATA_DRAIN_PUMP_INLET_PRES_SENSOR, ///< DG calibration data drain pump inlet pressure sensor. + CAL_DATA_DRAIN_PUMP_OUTLET_PRES_SENSOR, ///< DG calibration data drain pump outlet pressure sensor. + NUM_OF_CAL_DATA_PRES_SENSORS, ///< Number of calibration data pressure sensors. +} CAL_DATA_DG_PRES_SENSORS_T; + +/// DG flow sensors enumeration. +typedef enum dg_flow_sensors +{ + CAL_DATA_RO_PUMP_FLOW_SENSOR = 0, ///< RO pump flow sensor. + NUM_OF_CAL_DATA_FLOW_SENSORS, ///< Number of flow sensors. +} CAL_DATA_DG_FLOW_SENSORS_T; + +/// DG load cells enumeration. +typedef enum dg_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_DG_LOAD_CELLS_T; + +/// DG temperature sensors enumeration. +typedef enum dg_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_DG_ONBOARD_NTC_TEMP, ///< DG 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. + NUM_OF_CAL_DATA_TEMP_SENSORS, ///< Number of temperature sensors. +} CAL_DATA_DG_TEMP_SENSORS_T; + +/// DG conductivity sensors enumeration. +typedef enum dg_conductivity_sensors +{ + CAL_DATA_CPI_COND_SENSOR = 0, ///< CPi conductivity sensor. + CAL_DATA_CPO_COND_SENSOR, ///< CPo conductivity sensor. + CAL_DATA_CD1_COND_SENSOR, ///< CD1 conductivity sensor. + CAL_DATA_CD2_COND_SENSOR, ///< CD2 conductivity sensor. + NUM_OF_CAL_DATA_COND_SENSORS, ///< Number of conductivity sensors. +} CAL_DATA_DG_COND_SENSORS_T; + +/// DG pumps enumeration. +typedef enum dg_pumps +{ + CAL_DATA_CONC_PUMP_1 = 0, ///< Concentrate pump 1. + CAL_DATA_CONC_PUMP_2, ///< Concentrate pump 2. + CAL_DATA_DRAIN_PUMP, ///< Drain pump. + CAL_DATA_RO_PUMP, ///< RO pump. + NUM_OF_CAL_DATA_DG_PUMPS ///< Number of DG pump. +} CAL_DATA_DG_PUMPS_T; + +/// DG reservoirs enumeration. +typedef enum dg_reservoirs +{ + CAL_DATA_RSRVR_1 = 0, ///< Reservoir 1. + CAL_DATA_RSRVR_2, ///< Reservoir 2. + NUM_OF_CAL_DATA_RSRVRS ///< Number of reservoirs. +} CAL_DATA_DG_RESERVOIRS_T; + +/// DG acid concentrate enumeration. +typedef enum dg_acid_concentrate +{ + CAL_DATA_ACID_CONCENTRATE_1 = 0, ///< Acid concentrate 1. + CAL_DATA_ACID_CONCENTRATE_2, ///< Acid concentrate 2. + CAL_DATA_ACID_CONCENTRATE_3, ///< Acid concentrate 3. + CAL_DATA_ACID_CONCENTRATE_4, ///< Acid concentrate 4. + CAL_DATA_ACID_CONCENTRATE_5, ///< Acid concentrate 5. + NUM_OF_CAL_DATA_ACID_CONCENTRATES ///< Number of acid concentrates. +} CAL_DATA_DG_ACID_CONCENTRATES_T; + +/// DG bicarb concentrate enumeration. +typedef enum dg_bicarb_concentrate +{ + CAL_DATA_BICARB_CONCENTRATE_1 = 0, ///< Bicarb concentrate 1. + CAL_DATA_BICARB_CONCENTRATE_2, ///< Bicarb concentrate 2. + CAL_DATA_BICARB_CONCENTRATE_3, ///< Bicarb concentrate 3. + CAL_DATA_BICARB_CONCENTRATE_4, ///< Bicarb concentrate 4. + CAL_DATA_BICARB_CONCENTRATE_5, ///< Bicarb concentrate 5. + NUM_OF_CAL_DATA_BICARB_CONCENTRATES ///< Number of bicarb concentrates. +} CAL_DATA_DG_BICARB_CONCENTRATES_T; + +/// DG scheduled runs enumeration. +typedef enum dg_scheduled_runs +{ + FLUSH = 0, ///< Flush run. + HEAT_DISINFECT, ///< Heat disinfect run. + CHEMICAL_DISINFECT, ///< Chemical disinfect run. + NUM_OF_DG_SCHEDULED_RUNS ///< Number of DG scheduled runs. +} SCHEDULED_DG_RUNS_T; + +#pragma pack(push, 1) +/// Linear calibration structure +typedef struct +{ + F32 gain; ///< Gain. + F32 offset; ///< Offset. + U32 calibrationTime; ///< Calibration time. + U16 crc; ///< CRC for the linear calibration payload. +} LINEAR_CAL_PAYLOAD_T; + +/// DG concentrate pumps one-gain payload +typedef struct +{ + F32 stepSpeed2FlowRatio; ///< Step speed to flow ratio. + U32 calibrationTime; ///< Calibration time. + U16 crc; ///< CRC for the DG concentrate pumps calibration data. +} DG_CONC_PUMPS_CAL_DATA_T; + +/// DG concentrate pumps calibration record +typedef struct +{ + DG_CONC_PUMPS_CAL_DATA_T concentratePump[ NUM_OF_CONCENTRATE_PUMPS ]; ///< DG concentrate pumps calibration data. +} DG_CONC_PUMPS_CAL_RECORD_T; + +/// DG 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. +} DG_DRAIN_PUMP_CAL_RECORD_T; + +/// DG 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 DG RO pump calibration structure. +} DG_RO_PUMP_CAL_RECORD_T; + +/// Pressure sensors calibration structure +typedef struct +{ + LINEAR_CAL_PAYLOAD_T pressureSensors[ NUM_OF_CAL_DATA_PRES_SENSORS ]; ///< Pressure sensors to calibrate. + // NOTE: The reserved space is for 6 sensors. This portion of the struct should be eventually be + // reduced, so #define was not used for the size of the array + LINEAR_CAL_PAYLOAD_T reservedSpace[ 6 ]; ///< Reserved space for future pressure sensors. +} DG_PRES_SENSORS_CAL_RECORD_T; + +/// Flow sensors calibration structure +typedef struct +{ + LINEAR_CAL_PAYLOAD_T flowSensors[ NUM_OF_CAL_DATA_FLOW_SENSORS ]; ///< Flow sensors to calibrate. + // NOTE: The reserved space is for 6 sensors. This portion of the struct should be eventually be + // reduced, so #define was not used for the size of the array + LINEAR_CAL_PAYLOAD_T reservedSpace[ 3 ]; ///< Reserved space for future flow sensors. +} DG_FLOW_SENSORS_CAL_RECORD_T; + +/// Load cells calibration structure +typedef struct +{ + LINEAR_CAL_PAYLOAD_T loadCells[ NUM_OF_CAL_DATA_LOAD_CELLS ]; ///< Load cells to calibrate. +} DG_LOAD_CELLS_CAL_RECORD_T; + +/// Temperature sensors calibration structure +typedef struct +{ + LINEAR_CAL_PAYLOAD_T tempSensors[ NUM_OF_CAL_DATA_TEMP_SENSORS ]; ///< Temperature sensors to calibrate. + // NOTE: The reserved space is for 6 sensors. This portion of the struct should be eventually be + // reduced, so #define was not used for the size of the array + LINEAR_CAL_PAYLOAD_T reservedSpace[ 5 ]; ///< Reserved space for future temperature sensors. +} DG_TEMP_SENSORS_CAL_RECORD_T; + +/// Conductivity sensors calibration structure +typedef struct +{ + LINEAR_CAL_PAYLOAD_T condSensors[ NUM_OF_CAL_DATA_COND_SENSORS ]; ///< Conductivity sensors to calibrate. + // NOTE: The reserved space is for 6 sensors. This portion of the struct should be eventually be + // reduced, so #define was not used for the size of the array + LINEAR_CAL_PAYLOAD_T reservedSpace[ 2 ]; ///< Reserved space for future conductivity sensors. +} DG_COND_SENSORS_CAL_RECORD_T; + +/// Drain line volume calibration structure +typedef struct +{ + F32 volume; ///< DG Drain line volume. + U32 calibrationTime; ///< Calibration time. + U16 crc; ///< CRC. +} DG_DRAIN_LINE_VOLUME_T; + +/// DG pre RO purge volume calibration structure +typedef struct +{ + F32 pressure2FlowRatio; ///< Pressure to flow ratio. + F32 volume; ///< Volume. + U32 calibrationTime; ///< Calibration time. + U16 crc; ///< CRC. +} DG_PRE_RO_PURGE_VOLUME_T; + +/// DG reservoir volume calibration structure +typedef struct +{ + F32 rsrvrVolume; ///< Reservoir volume. + F32 normalFillVolume; ///< Normal fill volume. + F32 maxResidualFluid; ///< Max residual fluid. + F32 rsrvrUnfilledWeight; ///< Reservoir unfilled weight. + U32 calibrationTime; ///< Calibration time. + U16 crc; ///< CRC. +} DG_RESERVOIR_VOLUME_DATA_T; + +/// DG reservoir volume record +typedef struct +{ + DG_RESERVOIR_VOLUME_DATA_T reservoir[ NUM_OF_CAL_DATA_RSRVRS ]; ///< DG reservoir volume data. +} DG_RESERVOIR_VOLUME_RECORD_T; + +/// DG generic volumes (reserved space) +typedef struct +{ + F32 volume; ///< Volume. + U32 calibrationTime; ///< Calibration time. + U16 crc; ///< CRC. +} DG_GENERIC_VOLUME_T; + +/// DG acid concentrate +typedef struct +{ + F32 acidConcMixRatio; ///< Acid concentrate mix ratio. + F32 startVolume; ///< Start volume. + F32 reserverdSpace; ///< Reserved space. + U32 calibrationTime; ///< Calibration time. + U16 crc; ///< CRC. +} DG_ACID_CONCENTRATE_T; + +/// DG bicarb concentrate +typedef struct +{ + F32 bicarbConcMixRatio; ///< Bicarb concentrate mix ratio. + F32 startVolume; ///< Start volume. + F32 reservedSpace; ///< Reserved space. + U32 calibrationTime; ///< Calibration time. + U16 crc; ///< CRC. +} DG_BICARB_CONCENTRATE_T; + +/// DG acid concentrates +typedef struct +{ + DG_ACID_CONCENTRATE_T acidConcentrate[ NUM_OF_CAL_DATA_ACID_CONCENTRATES ]; ///< DG acid concentrates. +} DG_ACID_CONCENTRATES_T; + +/// DG bicarb concentrates +typedef struct +{ + DG_BICARB_CONCENTRATE_T bicarbConcentrate[ NUM_OF_CAL_DATA_BICARB_CONCENTRATES ]; ///< DG bicarb concentrates. +} DG_BICARB_CONCENTRATES_T; + +/// DG filter calibration record +typedef struct +{ + F32 reservedSpace1; ///< DG filter reserved space 1. + F32 reservedSpace2; ///< DG filter reserved space 2. + F32 reservedSpace3; ///< DG filter reserved space 3 + U32 calibrationTime; ///< Calibration time. + U16 crc; ///< CRC. +} DG_FILTER_CAL_RECORD_T; + +/// DG filters calibration data structure +typedef struct +{ + DG_FILTER_CAL_RECORD_T roFilter; ///< RO filter. + DG_FILTER_CAL_RECORD_T ultraFilter; ///< Ultra filter. + DG_FILTER_CAL_RECORD_T sedimentFilter; ///< Sediment filter. + DG_FILTER_CAL_RECORD_T carbonFilter; ///< Carbon filter. + DG_FILTER_CAL_RECORD_T carbonPolishFilter; ///< Carbon polish filter. +} DG_FILTERS_CAL_RECORD_T; + +/// DG fan calibration data structure +typedef struct +{ + F32 reservedSpace1; ///< Reserved space 1. + F32 reservedSpace2; ///< Reserved space 2. + U32 calibrationTime; ///< Calibration time. + U16 crc; ///< CRC. +} DG_FAN_CAL_RECORD_T; + +/// DG fans calibration data structure +typedef struct +{ + DG_FAN_CAL_RECORD_T fan1; ///< Fan 1. + DG_FAN_CAL_RECORD_T fan2; ///< Fan 2. +} DG_FANS_CAL_RECORD_T; + +/// DG systems record structure +typedef struct +{ + char topLevelPN[ MAX_TOP_LEVEL_PN_CHARS ]; ///< DG top level part number. + char topLevelSN[ MAX_TOP_LEVEL_SN_CHARS ]; ///< DG top level serial number. + MFG_LOCATION_T mfgLocation; ///< DG manufacturing location. + U32 mfgDate; ///< DG manufacturing date. + U16 crc; ///< CRC for the DG system record structure. +} DG_SYSTEM_RECORD_T; + +/// DG service record structure +typedef struct +{ + SERVICE_LOCATION_T serviceLoc; ///< DG service location. + U32 serviceDate; ///< DG service date. + U16 crc; ///< CRC for the DG service record structure. +} DG_SERVICE_RECORD_T; + +/// DG scheduled runs record structure +typedef struct +{ + U32 lastRunTime; ///< DG scheduled run last run time. + U16 crc; ///< CRC for the DG scheduled run record structure. +} DG_SCHEDULED_RUN_T; + +/// DG scheduled run record structure +typedef struct +{ + DG_SCHEDULED_RUN_T dgScheduledRun[ NUM_OF_DG_SCHEDULED_RUNS ]; ///< DG scheduled run. +} DG_SCHEDULED_RUN_RECORD_T; +#pragma pack(pop) + +/**@}*/ + +#endif