# Hardware-in-Loop Modules for Testing Automated Ventilator Controllers
## 3 Results
### MechVent Testing  
To evaluate the closed-loop controller functionality of the MechVent module, we conducted tests at different starting EtCO\({}_{2}\) settings by using the decision table logic shown in Figure 2 for the controller. A duty cycle of 3.3% for the solenoid valve supplying CO\({}_{2}\) was found to result in generally stable EtCO\({}_{2}\) readings of \(\sim\)20 mmHg and a setting of 6% produced baseline readings of \(\sim\)40 mmHg. A duty cycle of 7.3% produced high EtCO\({}_{2}\) readings, stabilizing at \(\sim\)60 mmHg. The controller was initialized at the middle of the ARDSNet table with a V\({}_{\rm T}\) of 550 mL (8 mL/kg for 70 kg patient) and RR of 12 BPM, but was free to make adjustments immediately at the beginning of the test and then once every 60 s afterwards. Data were averaged across the three test runs, as shown in Figure 6. Further, plots of EtCO\({}_{2}\) and MV against time across all trials for the low and high starting EtCO\({}_{2}\) scenarios are shown in Figure 7A. Adjustments to RR and V\({}_{\rm T}\) were shown to reliably control the system's EtCO\({}_{2}\), raising it from \(\sim\)20 to \(\geq\)35 mmHg within 5 min, and lowering it from \(\sim\)55 to \(\leq\)45 mmHg in \(\sim\)4 min. It should be noted that there are two potential values for V\({}_{\rm T}\) that are relevant and could be used to calculate MV. One is the ventilator's setting for V\({}_{\rm T}\) (V\({}_{\rm Set}\)), while the other is the real-time, physical measurement of V\({}_{\rm T}\) during operation (V\({}_{\rm Measured}\)). Large discrepancies between these values can indicate an issue with the system, helping to identify an early leak in the system, which was repaired, and V\({}_{\rm TSet}\) vs. V\({}_{\rm Measured}\) plots were regularly generated as a quality measure for all tests (Figure 7B). All MV values were calculated using V\({}_{\rm Measured}\). The scatter plots of tests starting at an EtCO\({}_{2}\) level of 20 mmHg are shown in Figure 8A, which highlights the inverse relationship  
Figure 5: **Characterization results for MechVent module.****(A)** Evaluation of MechVent’s ability to successfully replicate an inverse relationship between the respiratory rate (RR) and EtCO\({}_{2}\). (**B**) Average expiratory (VTE) and inspiratory (VTI) tidal volumes at three R\({}_{\rm aw}\) settings. (**C**) Average VTE and CL setting.  
between MV and EtCO\({}_{2}\) when changing V\({}_{\text{T}}\) and RR. Runs starting from this low position showed little to no correlation between EtCO\({}_{2}\) and RR, as the controller was primarily updating V\({}_{\text{T}}\) values to the system (Figure 8B). The high EtCO\({}_{2}\) tests revealed the same inverse relationship with MV, as shown with the low EtCO\({}_{2}\) tests, showcasing the ability of the system to modulate EtCO\({}_{2}\) down to a healthy range (Figure 8C). The main factor in the modulation of MV for the high tests was RR, which is shown by Figure 8D.  
Figure 6: **Summary of closed-loop testing result with MechVent module.** (**A**) Minute ventilation (MV) and EtCO\({}_{2}\) for a high starting EtCO\({}_{2}\) at 60 mmHg. (**B**) Minute ventilation and EtCO\({}_{2}\) for a low starting EtCO\({}_{2}\) at 20 mmHg.  
Figure 7: **Individual trial runs for each MechVent closed loop controller runs.** (**A**) Minute ventilation (MV) and EtCO\({}_{2}\) for each replicate, as partitioned by a red and green dotted line. Green shaded region indicates the target EtCO\({}_{2}\) range. (**B**) Tidal volume (V\({}_{\text{T}}\)) set and measured for each individual run.