/************************************************************************** * * Copyright (c) 2019-2022 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 DialInFlow.h * * @author (last) Dara Navaei * @date (last) 11-Nov-2022 * * @author (original) Sean * @date (original) 16-Dec-2019 * ***************************************************************************/ #ifndef __DIALYSATE_IN_FLOW_H__ #define __DIALYSATE_IN_FLOW_H__ #include "HDCommon.h" /** * @defgroup DialysateInletFlow DialysateInletFlow * @brief Dialysate Inlet Pump & Dialysate Flow controller/monitor module. * Monitors the dialysate flow rate and controls the dialysate inlet pump. * * @addtogroup DialysateInletFlow * @{ */ // ********** public definitions ********** #define MAX_DIAL_IN_FLOW_RATE 600 ///< Maximum dialysate inlet flow rate (in mL/min). #define MIN_DIAL_IN_FLOW_RATE 100 ///< Minimum dialysate inlet flow rate (in mL/min). #define DIALYSATE_FLOW_RATE_FOR_RECIRC 100 ///< Dialysate recirculation flow rate (in mL/min). /// Payload record structure for a dialysate inlet pump data message. typedef struct { S32 setPoint; F32 measFlow; F32 measRotorSpd; F32 measPumpSpd; F32 measMCSpd; F32 measMCCurr; F32 pwmDC; U32 rotorCount; } DIALIN_PUMP_STATUS_PAYLOAD_T; // ********** public function prototypes ********** void initDialInFlow( void ); void execDialInFlowMonitor( void ); void execDialInFlowController( void ); BOOL setDialInPumpTargetFlowRate( U32 flowRate, MOTOR_DIR_T dir, PUMP_CONTROL_MODE_T mode ); BOOL setDialInPumpTargetRPM( U32 rpm, MOTOR_DIR_T dir ); void signalDialInPumpHardStop( void ); void signalDialInPumpRotorHallSensor( void ); BOOL homeDialInPump( void ); BOOL isDialInPumpRunning( void ); BOOL isDialInPumpRampComplete( void ); void resetDialInPumpRotorCount( void ); SELF_TEST_STATUS_T execDialInFlowTest( void ); S32 getTargetDialInFlowRate( void ); F32 getMeasuredDialInFlowRate( void ); F32 getMeasuredDialInPumpRotorSpeed( void ); F32 getMeasuredDialInPumpSpeed( void ); F32 getMeasuredDialInPumpMCSpeed( void ); F32 getMeasuredDialInPumpMCCurrent( void ); F32 getDialInPumpPWMDutyCyclePct( BOOL init ); U32 getDialInPumpRotorCount( void ); U32 getPumpRotorErrorPersistTime( F32 mtr_speed, F32 gear_ratio ); BOOL testSetDialInFlowDataPublishIntervalOverride( U32 value ); BOOL testResetDialInFlowDataPublishIntervalOverride( void ); BOOL testSetTargetDialInFlowRateOverride( S32 value, U32 ctrlMode ); BOOL testSetMeasuredDialInFlowRateOverride( F32 value ); BOOL testResetMeasuredDialInFlowRateOverride( void ); BOOL testSetMeasuredDialInPumpRotorSpeedOverride( F32 value ); BOOL testResetMeasuredDialInPumpRotorSpeedOverride( void ); BOOL testSetMeasuredDialInPumpSpeedOverride( F32 value ); BOOL testResetMeasuredDialInPumpSpeedOverride( void ); BOOL testSetMeasuredDialInPumpMCSpeedOverride( F32 value ); BOOL testResetMeasuredDialInPumpMCSpeedOverride( void ); BOOL testSetMeasuredDialInPumpMCCurrentOverride( F32 value ); BOOL testResetMeasuredDialInPumpMCCurrentOverride( void ); BOOL testSetDialInPumpTargetDutyCycle( F32 value ); BOOL testSetDialysateInPumpRotorCountOverride( U32 value ); BOOL testResetDialysateInPumpRotorCountOverride( void ); /**@}*/ #endif