## 2 Physiological Controller Development
### Controller Design  
Figure 2 depicts a schematic diagram of the closed-loop control system. This diagram includes a block of the CVS-IRBP, the flow estimator model (FEM), the FLC system, and the desired reference flow (\(Q_{r}\)). In this work, a hybrid of a fuzzy proportional-integral (PI) control system was proposed. The gain parameters for the PI controller were used to enhance the rise time, overshoot, and settling time where a fuzzy system could adjust the pump flow scaling factor of the PI controller. This type of controller is known to be more stable with steady-state errors [22]. The FLC system consisted of four components; namely, the rule base, the fuzzy interface, fuzzification, and defuzzification. Within these components, the control index was quantified and acknowledged by the rule base. The control index was then evaluated by the fuzzy interface to enable the correct control input for the plant. Fuzzification was the method used to modify the inputs and defuzzification transformed the right input to the plant based on the fuzzy interface [23]. A fuzzy PI-type control system was employed to track the desired reference flow (\(Q_{r}(k)\)). The feedback error (\(err(k)\)) of the closed-loop control system could be written as follows:  
\[err(k)=Q_{r}(k)-\hat{Q}_{est}(k) \tag{6}\]  
From Equation (6), we could write:  
\[\delta err(k)=err(k)-err(k-1) \tag{7}\]  
where \(\delta err(k)\) is the changes in error. Equations (6) and (7) were subjected to the PI controller as follows:  
\[\delta u_{PWM}(k)=K_{p}\delta err(k)+K_{i}err(k) \tag{8}\]  
where \(\delta u_{PWM}(k)\) is the output of the FLC and \(K_{p}\) and \(K_{i}\) are the proportional and integral gains, respectively. The control inputs for the fuzzification stage were \(\delta err(k)\) and \(err(k)\). Figure 3 illustrates the usage of seven asymmetric triangle membership functions to emphasize the property of the error. The input and output labels were written as specified in Table 1. The fuzzy output set was achieved by applying the Mamdani fuzzy rules (Table 2). The de-fuzzification method was then used to transform the output to a single numerical value as \(\delta u_{PWM}(k)\). The fuzzy toolbox of MATLAB was used for the development of each step (The MathWorks Inc., Natick, MA, USA). All rules were utilized to produce a robust outcome as follows:  
\[\gamma_{\epsilon\epsilon p}(e,\;\delta e)=\min\bigl{\{}\gamma_{\epsilon}(e),\; \gamma_{p}(\delta e)\bigr{\}} \tag{9}\]  
\[\gamma_{\epsilon\epsilon p\to\alpha}(e,\;\delta e,\Delta u_{PWM})=\max \bigl{\{}\min\bigl{\{}\gamma_{\epsilon}(e),\;\gamma_{p}(\delta e),\;\gamma_{ \sigma}(\delta u_{PWM})\bigr{\}}\bigr{\}} \tag{10}\]  
where \(e\) and \(\rho\) are fuzzy sets for inputs \(e\) and \(\delta e\), respectively, and \(\sigma\) is a fuzzy set for the output \(\delta u_{PWM}\). The defuzzification procedure was carried out using this method and by employing the center of area method, which is described as follows:  
\[\delta u_{PWM}=\frac{\sum_{i=1}^{n}u_{\sigma}\Bigl{(}\delta u_{PWM})_{i} \Bigr{)}\delta u_{PWM}}{\sum_{i=1}^{n}u_{\sigma}\Bigl{(}\delta u_{PWM})_{i} \Bigr{)}} \tag{11}\]  
where \(n\) refers to the number of quantization levels that were included in the output. Figure 2: Schematic representation of the proposed system. CVS: cardiovascular system; IRBP: implantable rotary blood pump; FLC: fuzzy logic control; \(H_{cvs}\): differential pressure; FEM: flow estimator model; \(Q_{r}(k)\): desired reference flow; \(Q_{p}(k)\): actual pump flow; \(Q_{est}\): estimated average pump flow; \(err(k)\): error; \(\delta err(k)\): difference in error; PWM: pulse-width modulation; \(U_{PWM}\): PWM voltage signal; \(K_{p}\): proportional gain; \(K_{i}\): integral gain; \(K_{f}\): Kelman filter gain. The updated speed for the IRBP of the subsequent sample was given by:  
\[u_{PWM}(k+1)=u_{PWM}(k)+\delta u_{PWM}(k) \tag{12}\]  
where \(u_{PWM}\) is the PWM voltage signal, which was the input signal to the IRBP.