Development and Characterisation of a Gas System and its Associated Slow-Control System for an ATLAS Small-Strip Thin Gap Chamber Testing Facility

A quality assurance and performance qualification laboratory was built at McGill University for the Canadian-made small-strip Thin Gap Chamber (sTGC) muon detectors produced for the 2019-2020 ATLAS experiment muon spectrometer upgrade. The facility uses cosmic rays as a muon source to ionise the quenching gas mixture of pentane and carbon dioxide flowing through the sTGC detector. A gas system was developed and characterised for this purpose, with a simple and efficient gas condenser design utilizing a Peltier thermoelectric cooler (TEC). The gas system was tested to provide the desired 45 vol% pentane concentration. For continuous operations, a state-machine system was implemented with alerting and remote monitoring features to run all cosmic-ray data-acquisition associated slow-control systems, such as high/low voltage, gas system and environmental monitoring, in a safe and continuous mode, even in the absence of an operator.

The testing facility has a multi-channel HV system for the simultaneous operation of sTGCs, a multi-channel low voltage (LV) system for the sTGC readout electronics, a custom trigger and data acquisition system, and a gas system that can separately provide CO 2 gas or a gaseous pentane and CO 2 mixture. Pure CO 2 gas is needed to purge detectors of their oxygen, which should not be mixed with pentane for safety reasons, and other possible contaminants. It is also used to remove the pentane from the detector once operations are terminated, to avoid potential damage to the sTGCs that can occur if trace amounts liquefy inside the gas volume. All these systems are monitored and controlled by a slow-control system that additionally monitors the environmental conditions of the testing facility. A state machine [5] in the slow-control system has been developed to ensure a safe operation of the testing facility.
The complete testing and performance characterisation of an sTGC quadruplet module spans a period of a few to several days, during which the gas system is required to operate continuously in a safe and stable manner. More than one sTGC quadruplet module is expected to be tested simultaneously, requiring the availability of several different gas lines with the ability to deliver and control either CO 2 or a CO 2 :pentane gas mixture at different points in time. The design of the system must allow the flexibility to modify the flow and type of gas provided on individual gas lines, as well as the addition or removal of a gas connection, without having to stop the system. The gas system is also required to operate more or less continuously for a period of approximately 18 months without any major downtime.
The paper is arranged as follows. Section 2 describes in detail the design, implementation and performance of the gas system while Section 3 describes the design, implementation and performance of the slow-control system of the Canadian sTGC testing facility. A summary is provided in Section 4.

Gas System
The design of the gas system for the Canadian sTGC testing facility is based on similar existing systems located in Israel (Tel Aviv University, Weizmann Institute) [6], Switzerland (CERN) [7] and Canada (TRIUMF) [8]. Unique constraints imposed by the McGill laboratory space, such as physical size, building safety protocols, and laboratory amenities, require that specific procedures and functionality be incorporated into the system.
The gas system must provide a continuous flow with a stable concentration (within ±3vol%) of either pure gaseous CO 2 or gaseous CO 2 :pentane mixture (55%:45% by volume, respectively) at input CO 2 flow rates ranging from 50 to 100 mL/min per line in up to 10 lines simultaneously. The system was designed to have five lines providing independent flow rates of pure CO 2 gas, and five dual-purpose lines that can be operated independently with either pure CO 2 gas or the CO 2 :pentane mixture required for sTGC operation. To avoid out-of-plane deformations and damage to the sTGCs, the delivered pressure on each line should not exceed 0.5 kPa above the ambient pressure. The pentane exiting the chamber must be disposed of in a manner that is safe for the laboratory and the surrounding environment. The system must be simple to operate and be equipped with automated monitoring and controls to permit running during extended periods when an operator may not always be present. The system must also be intrinsically fail-safe, which we define as a capacity to react to particular potential failure conditions by defaulting to a safe state that requires manual intervention before normal operations can resume.
Operational safety is central to the design of the gas system. Because there is no fume hood in the laboratory, no handling of liquid or gaseous pentane is permitted to take place there, due to its volatility and flammability. The laboratory is equipped with a negative-pressure exhaust that is used to dispose of unreclaimed gas downstream of the detectors. Within the gas system, all wetted parts must be constructed from materials resistant to pentane, which is known to attack rubber and various plastics and coatings [9]. Otherwise, chemical residues could end up contaminating the CO 2 :pentane gas mixture and, in turn, the sTGCs.

Design and Implementation
The main component of the gas system is the mixing apparatus. It takes pure CO 2 gas and liquid pentane as inputs and provides the desired mixture as a gaseous output. Different methods can be considered to control the output gas composition of a mixer, mainly by setting either the mixing volumes or the mixture temperature. From maintenance and simplicity considerations, temperature control is chosen for this gas system, following the gas system designs of the aforementioned facilities. Using the temperature dependence of the vapour pressure of liquid pentane, Amagat's and Dalton's laws for ideal gases [10] (see Equation 2.1), which state that in a gaseous mixture the volume (V) fraction of constituent gases is proportional to their respective pressure (p) fractions, the volume fraction can in turn be controlled for constituent gas x: Assuming atmospheric pressure (101.325 kPa), Equation 2.1 and the vapour pressure of pentane as a function of temperature obtained from CHERIC [11], Figure 1 displays the temperature dependence of the pentane volume fraction.
The mixing apparatus presented here first creates a saturated CO 2 :pentane mixture, which corresponds to a higher concentration than desired, at room temperature (∼20 • C). It then cools the resulting gas mixture to achieve 45 vol% of pentane. The apparatus consists of two principal components: the liquid pentane mixing vessel and the Peltier thermoelectric cooler (TEC) condenser system, as seen in Figure 2. The Peltier condenser consists of a cooling plate and a condensing pipe assembly described later. The condensing pipe assembly is connected to the mixing vessel by a tubing manifold. The Peltier condenser is positioned above the pentane reservoir to ensure that the condensed liquid returns to the vessel by gravity. This novel design facilitates the refilling and replacement of the pentane reservoir during continuous operation of the gas system by cooling the resulting gas mixture instead of the vessel where the initial mixing occurs [8]. The refilling of the liquid pentane in the reservoir is done using a glass separatory funnel1 such that no intake of air occurs during the process.
The pentane reservoir consists of a 7.5 L stainless steel pressure vessel2 fitted with a dip-tube connection reaching to the bottom of the vessel and a quick-disconnect fitting on the top of the vessel. CO 2 flows through a set of bubbling stones fixed to the end of the dip-tube immersed in 1Scientific Equipment of Houston, "separatory funnel with glass stopcock, 500 mL". 2McMaster-Carr "portable Stainless Steel ASME-code pressurized liquid dispensing tank", 9-inch diameter.    (a) Cooling efficiency as a function of the volume flow rate and pipe length assuming a 50%:50% mixture of pentane and CO 2 . (b) Cooling efficiency assuming a 30 cm pipe length (as is used in the apparatus) for the limiting cases of pure pentane and pure CO 2 , as well as a 50%:50% mixture. the liquid pentane, while the saturated mixture (roughly 57 vol% pentane 43 vol% CO 2 at 20 • C) flows out through the connection at the top of the vessel. The gas mixture residing in the mixing vessel reaches saturation due to the large surface area of the liquid, the use of bubbling stones to increase the interaction area of the liquid pentane with the CO 2 , the large pentane vapour volume in equilibrium with the liquid in the reservoir, and the low flow rate which translates into a residence time of about 1 hour for CO 2 in the vessel for typical conditions with multiple gas lines in use.

Pentane Volume Fraction [%]
The Peltier cooling plate, which has a maximum cooling capacity of 200 W at 0 • C, was purchased commercially3. The cooling surface has dimensions 15 cm x 21.5 cm. A simple condensing assembly was designed to maximise the cooling efficiency by splitting the total flow to increase the contact area with the Peltier plate and increase the time that the gas spends within the cooling volume. A rudimentary thermodynamic analysis of the cooling of a laminar gaseous flow in an isothermal pipe indicates that the most sensitive parameters affecting its performance are the set temperature, the volume flow rate, and the pipe length [12]. The calculation is done assuming fully developed laminar flow in the system, an inner pipe diameter of 1.1 cm, and literature values for the dynamic viscosity, heat capacity, thermal conductivity and density of the input CO 2 :pentane mixture. The cooling efficiency is defined as where T O and T I are the temperatures of the outgoing and incoming gas, while T W is the temperature of the isothermal pipe. Figure 3(a) displays the resulting cooling efficiency as a function of the flow rate and pipe length assuming a 50%:50% CO 2 :pentane mixture. Figure 3(b) shows the cooling efficiency assuming a pipe length of 30 cm, as is used in the apparatus, for the limiting cases of pure CO 2 and pure pentane, as well as for a 50%:50% mixture that is similar in composition to the actual gas mixture used in the Peltier condenser.
The maximum flow rate of gas mixture anticipated for this apparatus is approximately 525 mL/min, assuming all five CO 2 :pentane mixture distribution lines are in simultaneous use. By dividing the flow in the condensing assembly into six pipes, the flow in each pipe becomes 87 mL/min. At this flow rate, as shown in Figure 3(b), employing a pipe length of 30 cm ensures that the mixture should approach the set point of the condenser temperature even when assuming the limiting case of pure pentane vapour. Thus, considering the simplistic nature of this analysis and implicit assumptions, the choice of using a 30 cm assembly provides a safety factor towards achieving the desired gas temperature and, in turn, the desired pentane removal by condensation. The adopted assembly design consists of six 1.3 cm outer diameter copper pipes (1.1 cm inner diameter), each 30 cm in length, arranged with a pitch of 3.2 cm to accommodate their fittings. The pipes are then inset and soldered onto a 25.5 cm x 23 cm x 0.64 cm copper plate. The insets in the copper plate are machined to a 1.3 cm diameter to match the outer diameter of the pipes. This assembly is then placed in thermal contact with the cooling plate of the Peltier condenser and bolted in place. An aluminium plate is added and bolted in front of the pipes to provide cover and mechanical support. Figure 4 shows a basic schematic for this setup. The main advantages of this design are that it is simple, requires minimal machining, is easy to assemble making use of standard and readily available parts, and makes optimal use of the total Peltier cooling plate area.
The gas system design is displayed in Figure 5. The gas flow starts with a CO 2 cylinder that is set to an output pressure of 70 kPa4, suitable for operation of the two mass flow controllers (MFC) directly downstream. A pressure release valve is placed between the CO 2 tank and the MFCs and is set at 103 kPa to protect the gas system and the sTGCs from any accidental sudden increase in pressure. One MFC5 regulates the flow rate of the pure CO 2 input line, while the other6 regulates the flow rate of CO 2 to the CO 2 :pentane mixer. The pure CO 2 and the CO 2 :pentane mixture lines then feed into separate manifolds, which, in turn, feed individual lines controlled by manual three-way ball valves. It is important to note that using a three-way valve ensures that there is no possibility for mixing of the CO 2 and CO 2 :pentane mixture flows; each line must be set to CO 2 , to CO 2 :pentane mixture, or be closed. Half of the individual gas lines are dedicated to flow only CO 2 .
Individual lines consist of a manual needle valve rotameter7, which is used to visualise and adjust the flow of the individual line, followed by two bubblers8, one in parallel with the sTGC to protect it from mechanical stresses in the event of an overpressure in the line, and one in series downstream of the sTGC that serves as a visual indicator that flow is present. A mineral oil bubbler is a device used in a gas circuit to maintain an inert gas environment while exercising pressure control. The overpressure bubbler is filled with a liquid column of vacuum pump oil equivalent to 0.5 kPa in order to minimise the differential between the sTGC and ambient pressure. The overpressure bubbler is also equipped with a reservoir on top that allows for all its oil content to be stored in the event of a back-pressure flow, such that no oil could make it into the gas system tubing and cause a blockage. The visual indicator bubbler is installed right after the sTGC, in series with the individual gas line hence creating a pressure drop in the system. It is therefore important 4All pressures in the gas system are measured with respect to the atmospheric pressure. 5MKS "mass flow controller CO 2 M100B" (M100B02513CS1BV) with power supply 246B. 6Omega "economical gas mass controllers with integral display" FMA5514A. 7Aalborg model P "single flow tube meters" PMR1-015710. 8Laboy "bubbler, mineral oil".  Gas System Diagram. The gas flows from left to right. Two independent Mass Flow Controllers (MFC) control the gas flow input for the two sets of lines (pure CO 2 and CO 2 :pentane mixture). The layout for each individual gas line is shown in the box, with the sTGC detector connected to the gas line. In the special case of the dedicated CO 2 lines, the 3-way valve is a simpler 2-way valve and the exhaust manifold, situated downstream from the flow-indicator bubblers, is not needed as there is no recovery system. to minimise this pressure drop by keeping the column height of oil in the bubbler as close to zero as possible, while filling the bubbler enough to show bubbling and to display that there is flow in the line. The flow indicator bubbler is also filled with glass beads immersed in the oil to minimise the oil volume exposed to pentane. Because of its molecular polarity, pentane accumulates in the oil and over time raises the overall liquid volume in the bubbler, thereby increasing the pressure drop of the bubbler. Therefore, minimising the volume exposed to pentane by the addition of glass beads in the flow indicator bubbler minimises the increase in pressure drop of the bubbler over time. This pressure drop should always remain lower than the overpressure bubbler drop to avoid back flow. A differential pressure sensor9 is connected in parallel with the CO 2 :pentane mixture lines for monitoring purposes. This sensor is capable of tracking changes in the individual line pressure with respect to the atmosphere as well as transient effects due to, for example, cycling of the building's ventilation system. Following the visual indicator bubbler, the flow of the line is then either directed to the recovery system or directly to the exhaust using a three-way valve10, as shown in Figure 6. This valve is configured such that its orientation matches that of the input valve as CO 2 :pentane mixture is typically sent to the recovery system while CO 2 is sent directly to the exhaust. The components of the gas system are installed on a 19-inch rack, referred to here as the gas rack.
The recovery system consists of a flammable proof refrigerator11 set to its coldest setting (0 • C), housing a condenser tube connected to a recovery vessel12. The recovery vessel collects re-liquefied pentane prior to the exhaust. As displayed in Figure 6, as the CO 2 :pentane mixture flows through the tube it cools and condenses pentane into the vessel. Approximately 50 vol% of the pentane is recovered at nominal temperature and pressure, as expected from the pentane fraction curve shown in Figure 1. A large acrylic box, with a volume of approximately 0.34 m 3 , is used to dilute the remaining CO 2 :pentane mixture with air to well below the threshold for flammability prior to the mixture being sent to the exhaust and vented from the building. The dilution box also decouples the sTGC gas system from the negative pressure of the exhaust system. Diluting the mixture also reduces the risk of liquid pentane condensing at or near the outside vent when outdoor temperatures get substantially lower than the mixing temperature.
The gas system lines and connections are built using nylon tubing13, nylon push-to-connect14 couplings and acetal quick-disconnect15 couplings with automatic shutoff valves. These components, while exhibiting the necessary material compatibility, are also easily assembled and interchanged, making the system simple and convenient to manipulate and modify. Rotameters on all ten lines have a maximum measurable CO 2 flow of 90 mL/min (they can flow up to 100 mL/min, beyond the displayed readings), with the exception of a larger rotameter installed on one of the CO 2 dedicated lines, which has a maximum measurable CO 2 flow of 730 mL/min. The larger rotameter allows flexibility in the number of quadruplet modules that can be flushed with CO 2 at any given time. The mass flow controllers are capable of flowing 0-1000 mL/min of CO 2 , ensuring that in the event of a full system flush, 100 mL/min can be flushed through each line simultaneously. The MFC for the pure CO 2 lines is also equipped with a manual override switch such that an operator can always bypass the slow-control system (see Section 3) and flush the system manually with CO 2 . Solenoid valves16 are installed in specific locations (see Figure 5) and are directly actuated by the control system. The valves are closed in the absence of current, stopping gas flow in the event of a loss of power. Temperatures of the solenoid valves are used as indications of their recent prevailing energized or de-energized states. Explosive gas sensors provide analog readings and have relays hard-wired to the solenoid valves and the HV/LV crate, which is used to trip off the system and isolate the pentane vessels in the event of a flammable gas leak.

Characterisation of the Gas System
The mixing procedure provides an adjustment from the concentration of pentane in CO 2 at ambient temperature saturation (57 vol% pentane at 20 • C) to the desired concentration of 45 vol% using a Peltier condenser. In order to determine the condenser temperature set point needed to achieve this value, two different methods are used to characterise the mixture. The characterisation methods are 11Fisher Scientific "explosion proof undercounter refrigerator" 3556FS. 12Same type as mixing vessel, same diameter, but smaller capacity. 13McMaster-Carr "extra-flexible nylon tubing .180" ID, 1/4" OD, .035" wall thickness, semi-clear white (also opaque black)", 50 ft. length (5112K63); "extra-flexible nylon tubing .275" ID, 3/8" OD, .050" wall thickness, semi-clear white", 100 ft. length (5112K65).
14McMaster-Carr "push-to-connect tube fittings". 15McMaster-Carr "air and water quick-disconnect tube couplings". 16ASCO 8215G010 24VDC. also useful to understand the evolution of the concentration at various points within the distribution system. One method makes use of the knowledge of the mass of pentane and volume of CO 2 consumed in the run to estimate the mixture volume fraction. The amount of pentane consumed during the run is determined by weighing the pentane reservoir before and after the run. The volume of CO 2 is estimated by integrating the flow rate of the MFC over the period of interest. The uncertainty on the resulting volume fraction is calculated by propagating the error of the mass scale (∼ 10%) and the MFC measurements (∼ 0.02%).
For a selection of runs where the above method is used, small gas samples were also collected to be later analysed using gas chromatography (GC) [13] with a Thermal Conductivity Detector (GC-TCD). Helium is used as the carrier gas in the GC column to obtain the best sensitivity to pentane. The GC-TCD allows the determination of the quantity of each gas type contained in a given sample. A gas mixture with a known concentration17 of 10 vol% of pentane in CO 2 (with a relative tolerance of ±5%) is used to provide a calibration for the GC-TCD. Two calibration curves are obtained from the same calibration sample and are used to determine the uncertainty on the measurement. Gas samples are collected from the gas system at the point where the sTGC would normally be connected. Additional samples are collected at the output of the pentane recovery system to verify its performance as a function of the refrigerator set point. Each sample is then analysed with the GC-TCD. Uncertainties due to the GC-TCD are evaluated by using different calibration results. The concentration uncertainty is computed as the difference between the extremum values and the central value at the middle of the interval. Additional systematic uncertainties associated with laboratory manipulations are not evaluated. The results are shown in Figure 7 where the sample concentrations are plotted as a function of the Peltier condenser set point temperature, and multiple measurements for each Peltier set point have been combined. The expected pentane vapour pressure curve, adjusted for the gas temperature measured inside the Peltier condenser, is shown overlaid on the data, showing that the measured concentrations as a function of temperature exhibit the expected trend.
The recovered fraction, defined as the fraction of pentane in the gas mixture collected by the recovery system over the duration of a run, is measured by taking the ratio of the mass change in the pentane mixing vessel and its contents to that in the pentane recovery vessel and its contents. The uncertainty in this measurement is calculated by propagating the uncertainty on the mass scale (∼10%). It is found that the recovered fraction is greater for higher input pentane volume fractions (i.e. warmer Peltier settings) and colder refrigerator settings, as expected. For typical running conditions, i.e. ∼14.5 • C Peltier condenser and 0 • C recovery refrigerator settings, the recovered fraction is measured to be approximately 50%, as expected by design of the recovery system. Figure 8(a) displays the measured recovered fraction as a function of the Peltier set temperature, for a constant refrigerator temperature of 0 • C. The exhaust pentane concentration is measured by using the mass changes in the contents of the pentane reservoir and the recovery vessel, and the volume of CO 2 consumed in the run. It is given by ( where V m , V r and V CO 2 are the pentane evaporation gas volume out of the mixing vessel, the pentane condensation gas volume in the recovery vessel and the integrated gas flow though the MFC, respectively, treating the pressure 17Praxair, Custom specialty gas mixture, CGA-510 connector, CD PT10C-FX. and temperature as constant during the whole run. Given a constant refrigerator temperature, the behaviour of the recovered pentane fraction is driven by the Peltier set point and should follow the pentane volume fraction curve, which is shown in Figure 8(a) as a dashed line. Figure 8(b) shows the average exhaust concentration of pentane downstream from the refrigerator for each run, as a function of the Peltier temperature. No significant dependence is observed, implying the exhaust pentane concentration is determined entirely by the refrigerator temperature rather than the Peltier set temperature, as expected. Multiple measurements for each Peltier set point are combined in both plots of Figure 8. The exhaust mixture (with a pentane concentration of about 20%) is later diluted in air to a concentration that is well below the lower explosive limit (LEL) for pentane, as verified by an explosive gas sensor placed just prior to the exhaust for the purpose of this measurement.

Slow-Control System
The operation of the sTGC detectors in the testing facility must ensure both the integrity and safety of the sTGCs and that all measures are taken to minimise possible sources of human error. Such a facility can exhibit different types of hazards: risk of injury to personnel, damage to the laboratory, damage to the sTGC detectors due to problems with the gas system, and damage to the sTGC detectors due to environmental conditions. A slow-control system and its associated state machine [5] have been developed at McGill to safely operate the facility by providing automated safety actions, system control and conditions monitoring. The system is tailored to the requirements of a testing facility in a university laboratory and is therefore distinct from the global slow-control paradigm used for the ATLAS experiment at CERN.
The slow-control system incorporates environmental sensors to monitor the ambient laboratory conditions as well as sensors that monitor the individual gas system components' conditions and performance. The output values of these sensors can trigger safety actions, such as bypassing the pentane mixer and recovery refrigerator, or turning off the high/low voltage supply, through either hard-wired relay circuits or software controls. The data from each sensor are logged, organised and presented to the operator through graphical interfaces. Since the testing facility operates with or without the presence of an operator, the state machine includes an alert system to inform personnel, via email and SMS messages, when a warning or error condition is raised, as well as a remote monitoring system publishing the current state of the system in real-time on a web page.
The state machine is the primary user interface, with built-in protocols for the gas system and high/low voltage system operation. It imposes conditions for the flushing with CO 2 prior to CO 2 :pentane mixture flow and ensures that HV is only applied once a stable gas composition has been reached inside the detector volume. The slow-control system includes hard-wired safety actions that take place when an error condition is raised by the sensors, independently of the state of the slow-control system software or the state machine. It is also designed to halt operation and revert to a safe state in the event of a power loss or loss of connectivity.

Design and Implementation
The sTGC state machine is a software interface programmed using LabVIEW. It controls, monitors and operates the gas flow, the high voltage supplied to the sTGCs and the low voltage supplied to the readout electronics. The state machine sequentially guides the operator through the procedure needed to operate these systems and to perform a successful run, while concurrently displaying the current state of the system and imposing fail-safe operation in the event of a failure.
The sensor monitoring and control signal output is implemented using a National Instruments CompactDAQ system, which is composed of a crate (readable via a single USB cable) and six modules, listed in Table 1. Four of the modules read sensor inputs and two provide signal outputs. The specific sensors monitored by the CompactDAQ system, excluding temperature and ambient condition sensors, are listed in Table 2. Output voltage signals provide the set points for the two MFCs, controlling the gas flow in the system. The relay output controls a separate emergency relay. The emergency relay is triggered either by the software when the slow-control system detects problematic operating conditions or directly via the hardware, bypassing the slow control system, if either the explosive gas sensors or the exhaust flow sensor detect dangerous operating conditions. The emergency relay itself cuts power to the solenoid valves, thus isolating and bypassing the pentane mixer and pentane recovery system. It also triggers the interlock on the high-voltage source, the CAEN power supply crate that hosts positive and negative polarity HV and LV cards. The interlock signal is sent via the front panel Lemo connector on the CAEN power supply, which ramps down the HV at the fastest possible rate (measured to be 200 V/s). Control and monitoring elements external to the CompactDAQ system, which include the Peltier temperature controller, the Uninterruptible Power Supply (UPS), and the CAEN HV power supply, are managed using proprietary software that interfaces directly with the LabVIEW environment. The Peltier controller and the UPS are connected via USB while the CAEN crate is connected with ethernet. The UPS is used to power the essential sensor, relay and solenoid-valve elements of the slow-control system in the event of a power cut, long enough (about two hours) that the entire system can be flushed through the CO 2 Bypass state; see §3.2 for a description of this state. An emergency stop button can be used to activate the interlocks on the UPS units, cutting the power to the computers as well as the gas rack, which, in turn, causes the emergency relay to trip. This removes spark-inducing sources and electrical hazards present in the laboratory and in addition to sealing off the pentane vessels, for example, in case of a fire in the laboratory. The general layout of the slow-control connections is shown in Figure 9. The Peltier system controller and the HV/LV crate are read into LabVIEW directly via USB and ethernet, respectively, using software provided by the manufacturer.
The system software is separated into three main LabVIEW Virtual Instruments (VIs): a data acquisition (DAQ) panel, a HV/LV system control panel, and an overall state-machine panel. The DAQ panel is configured to read and calibrate the raw data coming from the sensors at a rate of 1 Hz, making this information available to all other VIs. The system allows live monitoring by concurrently displaying and logging the sensor data on the Slow Control computer, which is periodically backed up to a separate server. The HV/LV panel allows the operator to control and monitor the HV/LV system. The current state of the system is globally made available for the use of other VIs. The state-machine panel controls the gas system and guides the operator through the global system operation. The operational flow of the system is displayed in Figure 10(a), and each state is described in Table 3. Each of the ten individual gas lines has its own dedicated state machine, with some states affecting all gas lines. The global state of the system is always the state of the line that is highest in the operations hierarchy, which increases from the Dormant state up through to the Run state. The state of any individual gas line must be consistent with that of the global state machine; e.g., changing the global state machine to the CO 2 Bypass state triggers a

State Description Dormant
Inactive state, no gas flow and high voltage off. CO 2 Flush CO 2 gas flow at high rate in gas line. High voltage off. Gas Operation Gas changed to CO 2 :pentane mixture in the case of a pentane line. Gas flow at normal rate. High voltage off. HV Operation Gas type same as Gas Operation. Gas flow at normal rate, high voltage on.

Run
Data acquisition state. Gas type same as Gas Operation. Gas flow at normal rate, high voltage on, data acquisition active.

CO 2 Bypass
Error state. Pentane systems isolated, high voltage off, CO 2 flow at high rate for active lines (not in Dormant state).

Pause
Operator intervention state. Stops gas flow on all active lines temporarily while keeping high voltage on if present.
change of state of all the active gas lines.

Operations
Cosmic-ray data-taking requires that the system reaches the Run state, after navigating from the Dormant state through the other intermediate states. The CO 2 Flush state ensures flushing at a high flow rate until a pre-determined amount of pure CO 2 has been flowed (depending on the sTGC size and gas line length) through the detector. This step is necessary to prepare a contaminant-free and

Info Level Errors
• Doesn't affect normal operation • Info message every 10 minutes sent to operators.

Warning Level Errors
• Individual line state change buttons disabled. • Times out after 5 minutes, becoming critical. • Info messages every minute. oxygen-free environment inside the detector. In the Gas Operation state, the flushed sTGC is flowed with the CO 2 :pentane mixture, at a lower flow rate than in the previous state. The operator needs to wait until equilibrium is reached inside the detector, quantified in the software as approximately 10 detector-volume changes. The HV Operation state permits HV to be applied to the trigger system PMTs and the sTGC modules, necessary for data acquisition, ensuring that only channels (or sTGCs) associated with a gas line in the state machine, and therefore containing a stable gas mixture, may be powered.

Critical Level Errors
When actions are required from the operator, the system prompts the operator and waits for confirmation that the action has been taken. For example, when moving a given gas line from the CO 2 Flush to the Gas Operation state, the operator is asked to turn the input and exhaust manifold valves for the given line from the CO 2 to the pentane position, hence stopping the CO 2 flow and allowing the mixture to circulate. The various sensors are continuously monitored and alerts are displayed in a dedicated message log window. The errors are classified into three levels as shown in Figure 10(b). Info level errors, which correspond to system information messages, don't affect normal operation. Warning level errors prompt the operator to take some action before the state can be changed. If not addressed by the operator within five minutes, Warning level errors are promoted to Critical level. Critical level errors cause the system to automatically transition into a predefined safe state, CO 2 Bypass, which stops all data taking and pentane flow while forcing CO 2 flow through all lines by setting the appropriate solenoid valves to their open or closed position. A

Error
Level Cause High pentane concentration Critical A combustible gas sensor detecting a high pentane concentration around the gas system or in the exhaust chamber. Solenoid valve overheat Critical Temperature sensor on one of the solenoid valves detecting an overheat. No exhaust flow Critical Flow sensor measuring a critically low flow in the exhaust. Non-optimal exhaust flow Warning Flow sensor measuring a non-optimal flow in the exhaust. Gas flow input mismatch Warning Operator input to mass flow controller different than the measured gas flow. High pressure in gas line Warning Differential pressure on gas line measuring pressure high enough to potentially damage an sTGC chamber. Room temperature low Warning Room temperature measured to be low enough to potentially cause pentane condensation in gas system. Very high room humidity Warning Humidity sensor measuring extreme humidity levels. Peltier TEC set temperature mismatch

Info
The temperature of the Peltier TEC controller set by the operator doesn't match its control temperature. Refrigerator not cold Info Refrigerator temperature sensor measuring temperatures far above normal operating temperature.
list of state-machine errors is shown in Table 4. If a brief intervention is needed, an operator can manually initiate a pause using the control panel. The Pause state halts all gas flow temporarily on all lines, giving the operator a prompt to resume within 10 minutes. Failure to resume operation after the prescribed time has elapsed results in all active lines going to the CO 2 Bypass state. The Pause state is used to do small interventions on the gas system, such as swapping pentane reservoirs or connecting a new sTGC to the gas system, without perturbing the gas flow on the already connected lines. If a Critical level or Warning level error has been active for more than one minute (10 minutes for Info level) and no action was taken by the operator, the state machine starts sending alert messages (via email and SMS) to operators periodically until an action is taken by the operator to resolve the error. Time intervals between messages sent of any level are doubled at every iteration until the problem is resolved, in order to control the inflow of messages to the operators.

Performance
The slow-control system has been used extensively over more than a year for cosmic-ray data taking with an sTGC prototype and has maintained stable conditions for operations. The performance of the system is assessed and described in the following section for expected operations scenarios.
The normal start and stop sequences of a gas run using a single line (line 6) are illustrated in Figure 11. From the Dormant state, the lines in operation are initially in a CO 2 Flush state with a flow rate of approximately 100 mL/min; the dashed line indicates the time at which the CO 2 gas in line 6 is replaced with the CO 2 :pentane mixture at an input CO 2 flow rate of 45 mL/min, as shown in Figure 11 Figure 11. Temperatures and flow rates (a), and differential pressures (b) during a standard start sequence of the gas system. Temperatures and flow rates (c), and differential pressures (d) during a standard stop sequence of the gas system.
slightly higher (about 15 • C due to the temperature gradient inside the gas pipe). The differential pressure of line 6 shows a sudden shift when switching from CO 2 to CO 2 :pentane-mixture, as displayed in Figure 11(b). Line 8 is shown to illustrate the pressure trend for an unused line as a comparison. Figure 11(c) and 11(d) show reactions to a standard stop sequence. The dashed line indicates the end of the gas run. Line 6 is returned to CO 2 Flush state and the Peltier condenser system is stopped.
Based on our operational experience, a 2500 L CO 2 tank is expected to last for approximately 2 months when operating a single gas line. During this time, the tank pressure remains constant as the pressurised CO 2 is in liquid form. As the tank is emptied, the liquid CO 2 is depleted and the volume of the tank is filled with only gaseous CO 2 . The pressure of the gaseous CO 2 then decreases linearly, which is a signal that the tank is almost empty, as shown in Figure 12. Section A shows a CO 2 Flush at 100 mL/min on the gas line connected to the sTGC detector. Section B shows the same gas line going to the Gas Operation state (CO 2 :pentane mixture) at an input flow rate of 45 mL/min, then at 15 mL/min in section C. In section D, the line enters the CO 2 Flush state once more at 100 mL/min. Finally, in section E, CO 2 Flush is initiated on five gas lines simultaneously at 100 mL/min each until the tank is completely empty. Monitoring of the CO 2 tank pressure therefore provides advance notice that a tank switch is needed, helping to ensure uninterrupted gas-system operation. The slow-control system sends an alert message when the pressure of the CO 2 tank goes below 3500 kPa so that the operator can anticipate when to stop the gas run and switch tanks before resuming operations.
Operational safety is critical in the presence of pentane in the laboratory; therefore, a prompt response of the explosive gas sensors is needed. The response was tested in a controlled test where the dilution box exhaust was blocked while CO 2 :pentane mixture was flowing. Figure 13 shows the response of the explosive gas sensors, one positioned for the purpose of this test inside the exhaust box, the other located at the bottom of the gas rack. As CO 2 flows through the mixing apparatus (initially at a rate of 100 mL/min, and then at 200 mL/min and 50 mL/min for short periods of time), the negative exhaust pressure is blocked in four instances such that the CO 2 :pentane mixture accumulates inside the exhaust box and is detected by the explosive gas sensors. The negative exhaust pressure is reinstated just before the lower explosive limit concentration (%LEL) readout reaches 50% to avoid any risks of explosion, which takes about two minutes (at 100 mL/min). In all four instances, the explosive gas sensors are quick to respond to the presence of pentane while the negative-pressure exhaust is efficient at evacuating the accumulated pentane.
As listed in Table 4, there are three emergency cases in which the slow-control system would put the gas system into a CO 2 Bypass state (excluding the timeout of a warning level error): a high pentane concentration detected by the explosive gas sensors, a solenoid valve overheat, or a lack of exhaust flow. In the event of an exhaust failure during a run (whether due to a blockage, or a fan malfunction), the slow-control system would react immediately and bypass the pentane mixer and recovery refrigerator, and turn off the high and low voltage supply. An exhaust failure was simulated for a single flowing line by manually blocking the exhaust. In Figure 14 Figure 13. Tests of the explosive gas sensors with various MFC flow rates. The negative exhaust pressure is blocked 4 times, which creates peaks in the explosive gas sensor readout located in the exhaust box (red points), and gets released shortly after. The explosive gas sensor located in the gas rack (green points) does not react. Trials are carried out at different flow rates (blue points). As expected, the time for the concentration to build up is linearly correlated to the gas flow rate. simulated blockage is indicated by the arrow, the temperature of a solenoid valve can be used to tell whether it is open (high temperature) or closed (low temperature). In Figure 14(b), the high voltage is turned off as soon as the exhaust blockage is detected by the flow sensor. The mixing apparatus is bypassed and the MFC, which normally feeds the CO 2 :pentane mixture lines, starts flowing pure CO 2 at a rate of 100 mL/min (the typical flow rate for the CO 2 MFC) in each gas line as needed to flush the system. These actions would vent a small amount of pentane into the room, but would protect the sTGC modules without creating a hazardous situation in the laboratory.
In the event of a high pentane concentration detected by the explosive gas sensors, the same action is taken as described above for the case of interrupted exhaust flow. The quantity of pentane in the system at any given time, excluding the reservoir and recovery vessels, would be insufficient to create a dangerous situation if it were all gradually vented into the laboratory. In case of a leak, flushing with CO 2 protects the sTGC modules and helps to prevent the dangerous accumulation of pentane. The implementation of safety actions is fully automatic to ensure continuous operation of the facility.

Conclusions
The Canadian sTGC testing facility is being commissioned to use a cosmic-ray hodoscope to characterise new muon detectors for the ATLAS Run 3 data-taking period planned to begin in 2021. A gas system was designed to supply the Canadian sTGCs with the proper gas mixture needed for flushing and safe operations while in the testing facility. The mixing apparatus creates a saturated CO 2 :pentane mixture at room temperature that is subsequently cooled in a Peltier TEC condenser system yielding the desired mixture volume fraction of 45 vol% of pentane. This innovative mixture apparatus design is simple, cost effective, and easy to build, providing reliable operation that permits swapping liquid pentane reservoirs without interrupting an ongoing run. The mixture fraction and performance of the system were characterised using two distinct methods: a mass measurement and a gas chromatography analysis. This simple design could be used for upcoming gas detector testing facilities, such as the one needed for the reception testing of the Canadian sTGCs at CERN. Slow-control system software was written using LabVIEW to ensure continuous, controlled and reliable operation of the gas and HV/LV systems during cosmic-ray muon data taking. The system software employs a state-machine framework that continuously monitors, characterises, and guides the operation of the system and the lab. The system takes as inputs various sensor readings, both from the apparatus itself, such as flow rates and pressures, and from the ambient conditions in the lab, such as explosive gas readings, and manipulates various aspects of the system, such as high voltages and flow rates. The system software is designed to shut down safely with built-in hardware redundancy for failures involving pentane gas risks. The slow-control system provides remote monitoring through a web interface and alerts operators of warnings and errors via email and SMS. The Canadian sTGC testing facility is expected to commence operations in 2017.