## 2 Materials and Methods
### Cardiac Function
\[\text{V}_{\text{la}}=\frac{2}{3}\pi\text{K}_{\text{la}}\text{r}_{\text{la}}^{2 }\text{la}_{\text{la}}, \tag{10}\]  
\[\frac{\text{d}\text{n}_{\text{la}}}{\text{dt}}=\frac{3\Big{(}\text{Q}_{\text{ pv}}-\text{Q}_{\text{mv}}\Big{)}}{4\pi\text{K}_{\text{la}}\text{la}_{\text{la}}} \bigg{(}\frac{3\text{V}_{\text{la}}}{2\pi\text{K}_{\text{la}}\text{la}_{\text{ la}}}\bigg{)}^{-1/2}, \tag{11}\]  
\[\text{E}_{\text{la}}(\text{t})=\text{E}_{\text{min,la}}+0.5(\text{E}_{\text{ max,la}}-\text{E}_{\text{min,la}})\text{f}_{\text{act,la}}(\text{t}-\text{D}), \tag{12}\]  
\[\text{f}_{\text{act,la}}(\text{t})=\left\{ \begin{array}{ll}0&0\leq\text{t}< \text{T}_{\text{a}},\\ 1-\cos\Big{(}2\pi\frac{\text{t}-\text{T}_{\text{a}}}{\text{t}-\text{T}_{\text{ a}}}\Big{)}&\text{T}_{\text{a}}\leq\text{t}<\text{RR},\end{array} \right. \tag{13}\]  
Here, E\({}_{\text{min,la}}\) and E\({}_{\text{max,la}}\) are the minimal and maximal atrial elastances over a cardiac cycle, respectively, and T\({}_{\text{a}}\) is the atrial activation time instant. The right ventricular pressure and volume signals were modelled in a similar way to the left ventricular pressure and volume signals using different parameter values. The right atrial pressure and volume signals were modelled in a similar way to the left atrial pressure and volume signals using different parameter values. Detailed information about the model used to describe atrial ventricular functions can be found in [28]. The atrial contraction contributes to ventricular filling around 10%-15% over each cardiac cycle for a healthy condition [31]. However, the absence of P-wave indicates an impaired function of atrial contraction due to continuous atrial activity resulting from both ectopic and re-entrant sources [32]. The impaired atrial contraction was described in the cardiovascular system models simulating AF using only the minimal atrial elastance (E\({}_{\text{min,la}}\)) as given below [33]. \[\text{E}_{\text{la}}(\text{t})=\text{E}_{\text{min,la}}, \tag{14}\]  
The systolic elastance in the cardiovascular system models, simulating heart failure with normal SR and AF with unimodal and bimodal RR interval distributions, was adjusted to provide the similar mean blood flow from the left ventricle over a 10 min period. Typical value of systolic elastance in healthy subjects is around 2.5 mmHg/mL; however, it reduces significantly during heart failure [34]. Therefore, systolic elastance in the cardiovascular system model, simulating the heart failure with normal SR, was set to 0.865 mmHg/mL to simulate reduced ejection fraction. A positive correlation exists between the systolic function of left ventricle and the ratio of the preceding RR intervals in heart failure patients with AF [9]. The left ventricular end-systolic elastances in the cardiovascular system models, simulating AF with unimodal (E\({}_{\text{es,lv,u}}\)) and bimodal (E\({}_{\text{es,lv,b}}\)) RR interval distributions, were adjusted by adopting patient-specific correlations from heart failure patients, as given in [9], to provide the similar mean blood flows in these models as in the cardiovascular system model simulating heart failure with normal SR. The left ventricular end-systolic elastances in the cardiovascular system models simulating AF were described as below. \[\text{E}_{\text{es,lv,u}}=0.27\frac{\text{RR}_{1}}{\text{RR}_{2}}+0.52, \tag{15}\]  
\[\text{E}_{\text{es,lv,b}}=0.34\frac{\text{RR}_{1}}{\text{RR}_{2}}+0.80, \tag{16}\]