/************************************************************************** * * Copyright (c) 2021-2025 Diality Inc. - All Rights Reserved. * * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * * @file NVDataMgmtHDRecords.h * * @author (last) Dara Navaei * @date (last) 19-Mar-2024 * * @author (original) Dara Navaei * @date (original) 13-Feb-2021 * ***************************************************************************/ #ifndef FWCOMMON_NVDATAMGMTHDRECORDS_H_ #define FWCOMMON_NVDATAMGMTHDRECORDS_H_ #include "Common.h" /** * @defgroup NVDataMgmt NVDataMgmt * @brief Non-volatile HD data records including calibration records, system records, * service records, and the scheduled runs record. * * @addtogroup NVDataMgmt * @{ */ // ********** public definitions ********** #define MAX_TOP_LEVEL_PN_CHARS 10U ///< Max number of characters for top level part number. #define MAX_TOP_LEVEL_SN_CHARS 20U ///< Max number of characters for top level serial number. #ifndef _RELEASE_ /// Software configuration enums typedef enum software_configurations { SW_CONFIG_DISABLE_ALARM_AUDIO = 0, ///< Software configuration disable alarm audio. SW_CONFIG_DISABLE_AIR_TRAP_LEVELING_ALARM, ///< Software configuration disable air trap leveling alarm. SW_CONFIG_DISABLE_ACK_ERRORS, ///< Software configuration disable acknowledge errors. SW_CONFIG_ENABLE_WORN_OUT_CARTRIDGE, // TODO remove ///< Software configuration enable worn out cartridge. SW_CONFIG_DISABLE_MOTOR_CURRNT_CHECKS, ///< Software configuration disable motor current checks. SW_CONFIG_DISABLE_PUMP_FLOW_CHECKS, ///< Software configuration disable pump flow checks. SW_CONFIG_DISABLE_PUMP_DIRECTION_CHECKS, ///< Software configuration disable pump direction checks. SW_CONFIG_DISABLE_PUMP_SPEED_CHECKS, ///< Software configuration disable pump speed checks. SW_CONFIG_DISABLE_SYRINGE_PUMP, ///< Software configuration disable syringe pump. SW_CONFIG_ENABLE_SYRINGE_PUMP_CMDS, ///< Software configuration enable syringe pump commands. SW_CONFIG_DISABLE_SYRINGE_PUMP_ALARMS, ///< Software configuration disable syringe pump alarms. SW_CONFIG_DISABLE_PRESSURE_CHECKS, ///< Software configuration disable pressure checks. SW_CONFIG_DISABLE_ARTERIAL_PRESSURE_CHECK, ///< Software configuration disable arterial pressure check. SW_CONFIG_DISABLE_VENOUS_PRESSURE_CHECK, ///< Software configuration disable venous pressure check. SW_CONFIG_DISABLE_DIALYSATE_TEMP_CHECK, ///< Software configuration disable dialysate temperature check. SW_CONFIG_DISABLE_CAL_CHECK, ///< Software configuration disable calibration check. SW_CONFIG_ENABLE_ALARM_VOLUME_DEFAULT_LOW, ///< Software configuration enable alarm default low volume. SW_CONFIG_DISABLE_ILLEGAL_AIR_TRAP_ALARM, ///< Software configuration disable illegal air trap alarm. SW_CONFIG_DISABLE_SELF_TESTS_AIR_BUBBLE_CHECK, ///< Software configuration disable air bubble check self tests. SW_CONFIG_DISABLE_OCCLUSION_SELF_TEST, ///< Software configuration disable occlusion self test. SW_CONFIG_DISABLE_BLOOD_LEAK_SELF_TEST, ///< Software configuration disable blood leak self test. SW_CONFIG_DISABLE_BLOOD_LEAK_ALARM, ///< Software configuration disable blood leak alarm. SW_CONFIG_DISABLE_UI_INTERACTION, ///< Software configuration disable UI interaction. SW_CONFIG_DISABLE_SAMPLE_WATER, ///< Software configuration disable sample water. SW_CONFIG_DISABLE_CONSUMABLES_TESTS, ///< Software configuration disable consumables tests. SW_CONFIG_DISABLE_DRY_SELF_TESTS, // TODO remove ///< Software configuration disable dry self tests. SW_CONFIG_DISABLE_PRIMING, // TODO remove ///< Software configuration disable priming. SW_CONFIG_DISABLE_WET_SELF_TEST, // TODO remove ///< Software configuration disable wet self test. SW_CONFIG_ENABLE_WET_SELF_TEST_WIDER_VOLUME_TOL, // TODO remove ///< Software configuration enable wet self test wider volume tolerance. SW_CONFIG_DISABLE_ULTRAFILTRATION_ALARMS, ///< Software configuration disable ultrafiltration alarms. SW_CONFIG_DISABLE_BUBBLE_ALARMS, ///< Software configuration disable bubble alarms. SW_CONFIG_DISABLE_ACCELEROMETERS, ///< Software configuration disable accelerometers. SW_CONFIG_DISABLE_RESERVOIRS_ALARMS, ///< Software configuration disable reservoirs alarms. SW_CONFIG_DISABLE_CARTRIDGE_REMOVAL_STEP, ///< Software configuration disable cartridge removal step. SW_CONFIG_DISABLE_PUMPS_FLOW_LIMITS, ///< Software configuration disable pumps flow limits. SW_CONFIG_DISABLE_UI_COMM_ALARMS, ///< Software configuration disable UI communications alarms. SW_CONFIG_DISABLE_VOLTAGES_ALARMS, ///< Software configuration disable voltages alarms. SW_CONFIG_ENABLE_1_MIN_TREATMENT, // TODO remove ///< Software configuration enable 1-minute treatment. SW_CONFIG_ENABLE_BLOOD_PUMP_OPEN_LOOP, ///< Software configuration enable blood pump open loop. SW_CONFIG_ENABLE_DIALYSATE_INLET_PUMP_OPEN_LOOP, ///< Software configuration enable dialysate inlet pump open loop. SW_CONFIG_DISABLE_SWITCHES_MONITOR, ///< Software configuration disable switches monitor. SW_CONFIG_ENABLE_VBA_SPECIAL_POSITION_C, ///< Software configuration enable VBA special position C. SW_CONFIG_DISABLE_SERVICE_AND_DISINFECT_CHECK, // TODO remove ///< Software configuration disable service and disinfect checks. SW_CONFIG_DISABLE_AIR_PUMP, // TODO remove ///< Software configuration disable air pump. NUM_OF_SW_CONFIGS ///< Number of software configurations. } SOFTWARE_CONFIG_T; #endif /// HD available NV data to get typedef enum hd_nv_commands { GET_CAL_BLOOD_LEAK_SENSOR = 0, ///< Get blood leak sensor calibration data. GET_CAL_TEMPERATURE_SESNORS, ///< Get temperature sensors calibration data. GET_CAL_ACCEL_SENSORS, ///< Get accelerometers calibration data. GET_CAL_HEPARIN_FORCE_SENSOR, ///< Get heparin force sensor calibration data. GET_CAL_PUMPS, ///< Get pumps calibration data. GET_CAL_PRESSURE_SENSORS, ///< Get pressure sensors calibration data. GET_CAL_OCCLUSION_SESNSORS, ///< Get occlusion sensors calibration data. GET_CAL_VALVES, ///< Get valves calibration data. GET_SYS_RECORD, ///< Get system record data. GET_SRV_RECORD, ///< Get service record data. GET_USAGE_RECORD, ///< Get usage record. GET_INSTITUTIONAL_RECORD, ///< Get institutional record. NUM_OF_NV_HD_DATA ///< Number of non-volatile data. } NV_DATA_T; /// HD pumps enumeration. typedef enum hd_pumps { CAL_DATA_BLOOD_PUMP = 0, ///< Blood pump. CAL_DATA_DIALYSATE_PUMP_IN, ///< Inlet dialysate pump. CAL_DATA_DIALYSATE_PUMP_OUT, ///< Outlet dialysate pump. NUM_OF_CAL_DATA_HD_PUMPS ///< Number of HD pumps. } CAL_DATA_HD_PUMPS_T; /// HD valves enumeration. typedef enum hd_valves { CAL_DATA_BLOOD_VENOUS_VALVE = 0, ///< Blood venous valve. CAL_DATA_BLOOD_ARTERIAL_VALVE, ///< Blood arterial valve. CAL_DATA_DIALYZER_INLET_VALVE, ///< Dialyzer inlet valve. CAL_DATA_DIALYZER_OUTLET_VALVE, ///< Dialyzer outlet valve. NUM_OF_CAL_DATA_HD_VALVES ///< Number of HD valves. } CAL_DATA_HD_VALVES_T; /// HD occlusion sensor enumeration. typedef enum hd_occlusion_sensors { CAL_DATA_BLOOD_PUMP_OCCLUSION_SENSOR = 0, ///< Blood pump occlusion sensor. NUM_OF_CAL_DATA_OCCLUSION_SENSORS, ///< Number of occlusion sensors. } CAL_DATA_HD_OCCLUSION_SENSORS_T; /// HD pressure sensors enumeration. typedef enum hd_pressure_sensors { CAL_DATA_ARTERIAL_PRESSURE_SENSOR = 0, ///< Arterial pressure sensor. CAL_DATA_VENOUS_PRESSURE_SENSOR, ///< Venous pressure sensor. NUM_OF_CAL_DATA_HD_PRESSURE_SESNSORS, ///< Number of HD pressure sensors. } CAL_DATA_HD_PRESSURE_SENSORS_T; /// HD temperature sensors enumeration. typedef enum hd_temperature_sensors { CAL_DATA_HD_THERMISTOR_ONBOARD_NTC = 0, ///< Onboard NTC thermistor. CAL_DATA_HD_THERMISTOR_POWER_SUPPLY_1, ///< Power supply 1 therimstor. CAL_DATA_HD_TEMPSENSOR_FPGA_BOARD, ///< FPGA board temperature sensor. CAL_DATA_HD_TEMPSENSOR_VENOUS_PRESSURE, ///< Venous pressure sensor temperature sensor. CAL_DATA_HD_TEMPSENSOR_ARTERIAL_PRESSURE, ///< Arterial pressure sensor temperature sensor. NUM_OF_CAL_DATA_HD_TEMP_SENSORS, ///< Number of HD temperature sensors. } CAL_DATA_HD_TEMEPERATURE_SENSORS_T; /// HD usage info items typedef enum hd_usage_items { USAGE_INFO_TX_HOURS_SINCE_LAST_SRVC = 0, ///< Usage info Tx hours since last service. USAGE_INFO_START_TX_TIME, ///< Usage info Tx start time. NUM_OF_USAGE_INFO_ITEMS ///< Number of usage info items. } HD_USAGE_INFO_ITEMS_T; #pragma pack(push, 1) /// Polynomial calibration structure typedef struct { F32 fourthOrderCoeff; ///< Fourth order coefficient. F32 thirdOrderCoeff; ///< Third order coefficient. F32 secondOrderCoeff; ///< Second order coefficient. F32 gain; ///< Gain. F32 offset; ///< Offset. U32 calibrationTime; ///< Calibration time. U16 crc; ///< CRC for the polynomial calibration payload. } POLYNOMIAL_CAL_PAYLOAD_T; /// HD pump calibration structure typedef struct { F32 pwm2Speed; ///< PWM to speed. F32 speed2Flow; ///< Speed to flow. F32 minCurrentLimit; ///< Minimum current limit. F32 maxCurrentLimit; ///< Maximum current limit. U32 calibrationTime; ///< Calibration time. U16 crc; ///< CRC for the HD pumps calibration payload. } HD_PUMP_CAL_PAYLOAD_T; /// HD valve calibration structure typedef struct { F32 counts2Position; ///< Counts to position scalar. U32 calibrationTime; ///< Calibration time. U16 crc; ///< CRC for the HD valves calibration payload. } HD_VALVE_CAL_PAYLOAD_T; /// HD blood pumps calibration record typedef struct { HD_PUMP_CAL_PAYLOAD_T hdPumps[ NUM_OF_CAL_DATA_HD_PUMPS ]; ///< HD pumps calibration data. } HD_PUMPS_CAL_RECORD_T; /// HD valves calibration record typedef struct { HD_VALVE_CAL_PAYLOAD_T hdvalves[ NUM_OF_CAL_DATA_HD_VALVES ]; ///< HD valves calibration data. } HD_VALVES_CAL_RECORD_T; /// HD occlusion sensors calibration record typedef struct { POLYNOMIAL_CAL_PAYLOAD_T hdOcclusionSensors[ NUM_OF_CAL_DATA_OCCLUSION_SENSORS ]; ///< HD occlusion sensors calibration data. } HD_OCCLUSION_SENSORS_CAL_RECORD_T; /// HD pressure sensors calibration record typedef struct { POLYNOMIAL_CAL_PAYLOAD_T hdPressureSensors[ NUM_OF_CAL_DATA_HD_PRESSURE_SESNSORS ]; ///< HD pressure sensors calibration data. } HD_PRESSURE_SENSORS_CAL_RECORD_T; /// HD temperature sensors calibration record typedef struct { POLYNOMIAL_CAL_PAYLOAD_T hdTemperatureSensors[ NUM_OF_CAL_DATA_HD_TEMP_SENSORS ]; ///< HD temperature sensors calibration data. } HD_TEMP_SENSORS_CAL_RECORD_T; /// HD heparin force sensor calibration record typedef struct { F32 hdHeparinForceSensorDACVoltage; ///< HD heparin force sensor calibration data. U32 calibrationTime; ///< Calibration time. U16 crc; ///< CRC for the HD heparin pump calibration payload. } HD_HEPARIN_FORCE_SENSOR_CAL_RECORD_T; /// HD accelerometer sensor calibration record typedef struct { F32 accelXOffset; ///< HD accelerometer X axis offset. F32 accelYOffset; ///< HD accelerometer Y axis offset. F32 accelZOffset; ///< HD accelerometer Z axis offset. U32 calibrationTime; ///< Calibration time. U16 crc; ///< CRC for the HD accelerometer sensor. } HD_ACCELEROMETER_SENSOR_CAL_RECORD_T; /// HD 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. } HD_BLOOD_LEAK_SENSOR_CAL_RECORD_T; /// HD systems record structure typedef struct { char topLevelPN[ MAX_TOP_LEVEL_PN_CHARS ]; ///< HD top level part number. char topLevelSN[ MAX_TOP_LEVEL_SN_CHARS ]; ///< HD top level serial number. U08 mfgLocation; ///< HD manufacturing location. U32 mfgDate; ///< HD manufacturing date. U16 crc; ///< CRC for the HD system record structure. } HD_SYSTEM_RECORD_T; /// HD service record structure typedef struct { U08 serviceLoc; ///< HD service location. U32 lastServiceEpochDate; ///< HD last service date in epoch. U32 serviceIntervalSeconds; ///< HD service interval in seconds. U32 lastResetTimeEpoch; ///< Last time the record was reset in epoch. U16 crc; ///< CRC for the HD service record structure. } HD_SERVICE_RECORD_T; /// HD 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. F32 roRejectionRatio; ///< RO rejection ratio. U32 calibrationTime; ///< Calibration time in epoch. U16 crc; ///< CRC of the institutional record. } HD_INSTITUTIONAL_RECORD_T; /// HD usage info structure. typedef struct { F32 txTimeTotalHrs; ///< Treatment time total in hours (never reset). F32 txTimeSinceLastSrvcHrs; ///< Treatment time since last service in hours. U32 txLastStartTimeEpoch; ///< Last treatment time in epoch. U32 lastResetTimeEpoch; ///< Last time the record was reset in epoch. U16 crc; ///< CRC for the HD usage info structure. } HD_USAGE_INFO_RECORD_T; #ifndef _RELEASE_ /// HD software configurations typedef struct { U08 swConfigs[ NUM_OF_SW_CONFIGS ]; ///< Software configurations. } HD_SW_CONFIG_RECORD_T; #endif #pragma pack(pop) /**@}*/ #endif