# Hardware-in-Loop Modules for Testing Automated Ventilator Controllers
## 2 Materials and Methods
### MechVent Development  
To control EtCO\({}_{2}\), mechanical ventilators modulate various settings including the PEEP, peak inspiratory pressure (PIP), and minute ventilation (MV)--which is itself the arithmetical product of V\({}_{\rm T}\) and RR. Additional physiological characteristics that directly impact the dynamics of mechanical ventilation include airway resistance (R\({}_{\rm aw}\)) and lung compliance (CL). The MechVent module was primarily designed to generate EtCO\({}_{2}\) readings within a physiological range that responds to changes in the select ventilator settings mentioned above while also enabling the adjustment of simulated patient variables (namely R\({}_{\rm aw}\) and CL). Development and testing were conducted using the MOVES(r) SLC(tm) ventilator platform (Thornhill Medical, Toronto, ON, Canada). This system was selected due to its ruggedized design for prehospital medicine and ongoing collaboration with the manufacturer, which allowed for the reading of input data and the sending of ventilator commands in real time. This capability was essential for tuning and characterizing the MechVent system, as well as testing a proof-of-concept automated ventilator controller. The design and development of the MechVent system, as shown in Figure 1, began with the selection of cylindrical bellows (McMaster-Carr, Elmhurst, IL, USA) with cuff ends that could be sealed on one end using a cuff insert and secured to the manifold that connected to the ventilator on the other. The size of the bellows was chosen to operate within a relevant V\({}_{\text{T}}\) range of 200-1200 mL without overly stressing the bellows' material. Key interface components--including the central three-way hub, hose fittings, a custom choke, and parts for the R\({}_{\text{aw}}\) and CL adjustments--were modeled using computer-aided design (CAD) software and were either 3D printed or assembled from laser-cut acrylic parts. A 5 in (127 mm) diameter acrylic cylinder was used to house the bellows, and a laser-cut lid was fixed to the cuff insert on the upper end of the bellows. The combination of the cylinder housing and lid served to ensure the even and unidirectional expansion of the bellows during respiration and provided a support platform for the CL adjustment compartment. Lung compliance was manually set by placing standardized weights in the CL compartment. As CL changes are more associated with chronic conditions and are not expected to rapidly change during trauma [34], setting this simulated patient characteristic once at the beginning of a test was considered acceptable; this was in comparison to an automated real-time adjustment. The lower end of the bellows was attached to the central three-way hub, which was seated within the base of the housing. The central hub contained three ports: the main port that attached to the bellows, a supply port that was connected to the CO\({}_{2}\) supply, and the final port that connected to the ventilator. As an analogue for CO\({}_{2}\) generation, a compressed gas cylinder (Airgas, Radnor, PA, USA) supplying medical-grade CO\({}_{2}\) was used, and components were connected using 4 in  
Figure 1: **Diagram of the MechVent hardware-in-loop test module for the evaluation of CO\({}_{2}\) removal. ** CO\({}_{2}\) gas flows from the supply tank to the expansion tank and bellows. Lung compliance and airway resistance can be adjusted in the hardware-in-loop system. The ventilator measures EtCO\({}_{2}\) and enables the tidal volume and respiratory rate settings to be set via computer control. (-6.4 mm) plastic tubing. A two-stage regulator was used to reduce the pressure to around 10 psi (-517 mmHg) and was connected to a 15 gal (-57-L) expansion tank (McMaster-Carr, Elmhurst, IL, USA) to stabilize the supply pressure. The initial MechVent design employed continuous flow and a custom-designed choke, which was connected to an adapter fitting that then connected to the supply port of the central hub.