A Photogrammetric Technique for Developing Boundary Equations for Flexible Sheath Waterless Trap Seals as Used in Building Drainage Systems

The water trap seal is still the main method of protecting building inhabitants from the ingress of foul contaminated air and noxious gases from the sewer. This seal can become compromised when water is lost in the trap by processes including evaporation and siphonage from excessive system suction pressures. A recent innovation is the waterless trap seal, which uses flexible sheaths, typically made from silicone rubber to form the seal. The sheath opens in response to a sub-atmospheric air pressure and will shut tightly under a supra-atmospheric pressure in order to form a seal. Full system numerical modelling of building drainage systems has offered insight into system responses to pressure transients and has opened up the evaluation of building wastewater systems to predictive modelling which has assisted in producing improvements to public health. A requirement of any predictive model is a mathematical representation of the physical characteristics of the system. This research develops a technique for developing boundary equations so that predictive modelling is possible. We combine photographic and pressure data analysed by Fourier analysis to develop the model. The technique is applicable to any device were the fluid structure interaction plays a significant role in its operation.


The Trap Seal
The water trap seal has been a feature of building drainage and sanitary systems since its first inclusion in 1775 when the approach was invented by Alexander Cummings [1]. The main function of the water trap seal is to stop the ingress of foul air into the interior of a building from the main sewer. The loss of water seal is a fundamental parameter set out in codes and standards globally-BSI, 2000 UK/EU, UPC, USA and ANZ3500, Australia/New Zealand [2][3][4] among others and it is the measure by which a system performance is defined. On a practical level, loss of water trap seal can be a nuisanceallowing malodourous air into living space, it can also be more harmful as the sewer system can also be a potential reservoir for harmful pathogens [5][6][7][8]. The consequences of water seal loss can have dire consequences for inhabitants, as brought to light by the SARS outbreak in Amoy Gardens in 2002/2003 with the infection of 320 people leading to 42 deaths in one housing complex alone [9][10][11]. While the current pandemic of SARS-CoV-2 and the disease it causes, COVID- 19 has not yet shown signs of such a similar transmission pathway, there is mounting evidence for viral shedding in faeces [12][13][14] and the pathway first identified in Amoy gardens has been validated by Gormley et al. as a legitimate risk [11].
While these fears about possible cross-contamination routes exist and efforts to limit the effects of pressure transients on system performance have been developed [15][16][17][18] there is an alternative which has been available for nearly 20 years; it is, however, not as prevalent in buildings as the simple water trap seal.

Modelling Waterless Traps
Waterless trap seals are flexible sheaths typically made from silicone rubber or some other similar flexible material. The sheath opens in response to a sub-atmospheric air pressure and will shut tightly under a supra-atmospheric pressure in order to form a seal. This allows fluid to flow through the sheath but blocks the return of any air back into the room.
In order to incorporate a waterless trap into a predictive model for system air pressures within a sanitary plumbing system requires an understanding of the physical properties of the device and a codification of these properties into boundary conditions suitable for a numerical solution.
An extensive literature review of the use and operation of waterless traps produced no evidence of prior work on modelling the operation of waterless trap sheath membranes, or similar flexible devices as used in building drainage systems; however, the literature did reveal modelling of systems analogous to the current device under investigation. Studies on modelling vocal cord movements, involving the complicated geometry of the vocal cord valve was informative as a proxy model for open/close operation. The model itself is generally condensed down into a small number of discrete masses using the "lumped element" method [19]. This method used by Flanagan and Landgraf [20] and Ishizaka and Flanagan [21,22], is found in numerous lip reed and vocal cord studies and describes the mechanical response of the reactive valve [19,23,24]. In addition, Lee and Xu [25] investigated flexible stenosed vessels for use in chemical engineering using simar type models. These analogous models have been used as the basis for investigating waterless traps.
Photogrammetric techniques are used to evaluate the structural integrity and characteristics of flexible structures; however, they are often used for evaluative purposes on large structures such as structural beams, underground piping systems and geographical mapping of large areas. [26][27][28] Other structural techniques were considered since there is a body of work looking at approaches other than optical ones [29]; however, these techniques applied to curing concrete offer little benefit in the practical application of a method to evaluate a fast moving membrane sheath such as the waterless trap under a negative pressure. The techniques applied to this research have been developed specifically for this purpose, based on previous work to develop boundary equations for building drainage applications although the techniques were not fully developed in that research [30].
The analysis of waterless traps using a vocal cord model as the mechanical analogue, coupled with photographic imagery linked to air pressure data, is the technique used in this research. The novelty of the technique is evidenced by the absence of other such work on waterless traps in general and none on the application of this technique to developing boundary conditions suitable for inclusion in a numerical model. This paper presents the results of the laboratory investigation into the characteristic movement of non-rigid self-sealing valves-waterless traps. Described, are analysis methods using shapes and patterns, to describe the flow changes by observing closely the opening and closing movements. The methods used incorporate photogrammetric data, obtained by analysing images of device operation under specific pressure conditions and codifying these in a model to provide a qualitative and quantitative representation of the deformable valve's oscillatory movement.

Materials and Methods
An experimental system was developed to apply system pressure to a waterless trap while using photographic imagery to capture the response of the device to the applied transient air pressures. Three different waterless trap seals were used during the course of this investigation and were named Sample 1, Sample 2 and Sample 3.
The photographic imagery is transformed into a 2-dimensional grid matrix defining each pixel in a binary fashion ensuring the opening and closing of the valve is related to the applied transients. This coding of images and pressure data has proved to be a powerful tool with which to define complex moving parts and the methodologic procedures, together with the derived frequency dependent boundary equations for the reference product waterless traps are described in the following subsections.
It should be noted that the term photogrammetric is used to define this novel analytical technique which couples photographic image data with system pressure data.

Reference Devices
Physical characteristic data of the three (3) samples are provided below in Table 1 with reference to the generic waterless trap seal image in Figure 1.   Table 1).

Laboratory Setup
The laboratory setup is shown in Figure 2 with a close-up image of a waterless trap sheath installed on the 50 mm diameter pipe shown in Figure 3.

Data Acquisition
Pressure readings from the transducer were recorded through the Keithley KPCI-3116 acquisition card. This acquisition card of 16 channels is triggered by a 5 V signal. An analogue trigger was linked to the high-speed camera, enabling the simultaneous recording of photographic data and pressure readings. The pressure readings and photographic images were set to record at a rate of 250 fps. Static pressure was measured at the pipe wall with a nominal internal diameter of 50 mm.

Photographic Imaging (Camera and Lighting)
The camera was a Photron Fastcam PCI Monochrome 500. The camera recorded at a rate of 250 fps and the total time set for each test was 60 s. Therefore, a total of 15,000 photographic images were recorded using the Photron FASTCAM Viewer software package version 2.1.1.6. Each greyscale image was saved individually and labelled as a number sequenced jpeg file.
The laboratory setup ensured that the high-speed camera recorded images concurrently, with the voltage readings from the transducer, so that images and pressure readings reflected the instantaneous effect of the device response and were therefore, comparable.

Analysis Methods-Image Analysis Procedure
A custom program was written for the analysis of the greyscale photographic data. This code written in C ++ , converts the image into a series of corresponding black or white pixels relating to the original image.
The binary image code comprises of five main elements: • an executable program (*.exe); • a text input file detailing the threshold parameter and instructions for conversion of images (*.txt); • photograph input folder (storing all original images to be converted to black and white images in jpeg format); • photograph output folder-gathering all converted black and white images (in jpeg format); • the results (percentage, height and width) from each image in the output folder recorded in sequential order in comma separated valves format (*.csv); • binary image processing.
This analysis relied on a customised version of the cell/pixel colour recognitions software compiled in Microsoft visual studio and written in C ++ . The system translates the greyscale images to monochromatic images with a single bit; 0 or 1 and has been used for data analysis in previous research relating to building drainage systems [30]. The methodology adopted in this research also drew on previous work on the analysis of vocal folds in medical research, as shown below in Figure 4. The software allowed for the measurement of height, width and the colour of the target object. As shown in Figure 4, the dark regions are coloured white and the light regions are coloured dark. This logic was reversed for this work, so that the opening area of the pipe which is noted as dark in colour due to no lighting within the pipe, remained as is and all other external features in the laboratory setup were converted to white.

Experimental Procedure
The procedure for collecting data was as follows: Pre experimental processing: 1. set up physical experiment; 2.
increase air pressure every 10 s; 6. end experiment.
process pressure data.

System Pressures
The range of pressures applied to the three waterless traps seal ranged between 0 and 250 mm wg (average). This measured variable became the method by which the behaviour of the products was compared. Three pressure ranges which existed in each experiment were identified: low, medium and high (see Figure 5, below). The pressure which resulted in the opening of the waterless trap seal, is considered here to be the "threshold" pressure.
The table below provides the threshold pressure for the three waterless trap seals tested. System pressures below this figure ensure sealing and prevention of cross contamination. Therefore, samples with a higher-pressure threshold may be deemed safer than their counterparts.
The Table above (Table 2), exhibits the results of the threshold assessment of the three waterless trap seals tested. Sample 1 responds by breaking the system seal with the lowest pressure reading of the three waterless trap seals tested. The waterless trap seal's mechanical/structural response to the pressure transients were recorded by dismissing the structural interaction along the length of the device and isolating a single opening area. The C ++ code converts the images to binary format and a count of the image dimensions is made. The program uses the Portable Binary Map (PBM) file format and displays images using the binary logic. Figure 6, below, shows one original greyscale image of Samples 1, 2 and 3 prior to the binary format conversion.

Segmentation
The process of segmentation through thresholding, allows the separating of light and dark regions in a frame by the masking of an object, is a binary picture. Once the image has been separated into two regions, the background and object, its topological and geometric properties useful to image analysis are attained.
It was necessary to separate the trap opening (object) and the valve, pipe, orifice and setup apparatus (collectively grouped as the background). The + + code first checks if the PBM files are valid, then scans each pixel within the photograph and separates pixels relating to the trap opening from the pixel relating to the rest of the elements in the frame (see Figure 7). The logic configured here is the opening of the water less trap seal is logic 0, while all other external elements are logic 1. The process of pixel threshold selection is vital to the accuracy of the geometric results.

Threshold and Averaging
Variations in daylighting, reflections due to the colour and material of the trap along with the oscillatory frequency (alternating with pressure) led to changes in illumination across the waterless trap seal throughout the test period. Local thresholding is advantageous as global thresholding does not compensate for changes in illumination within a single image, and thus, changes in the greyscale opening area pixel colour. Global thresholding runs the risk of introducing extraneous pixels data into the binary image. Due to the size of the image the effect of lighting in a single frame is believed to secondary to the effect of variations over time. Therefore, the photographic data was subdivided into regions based on the pressure profile and a global thresholding scheme adopted, Equation (1).
where T is the threshold, f t is the binary image function, f pixel intensity, b 1 binary logic 1, b 0 binary logic 0 and (x, y) is the spatial cordinate. The grey level 0 is the darkest and the grey level 1 is the lightest. Local thresholding enables the identification of the intensity of the opening area within each subdivided region. It was found possible for image intensity within the samples from a single test to vary according to the quality of lighting levels across the image (see Figure 8). Using a loop system, the executable file was run to determine if the isolated threshold colour provided results which were alike to the raw data. If unsatisfactory the colour intensity is reinvestigated until results gained for each data set are true to the unaltered images. See Figure 9 for the results of a single image where four (4) threshold colour intensities as used. The second variable, averaging, is altered upon the requirements of each data set according to the concentration of the threshold colour outside the target object.  It should be noted that Figure 9 is processed into a binary image with averaging value of 5 to ensure that the dark region to the left of the photograph (area outside the waterless seal) is not shown in the binary image. This dark region is not found in the other sample images and so, an averaging value of 1 is commonly adopted. The commonly noted thresholds for the three samples is T = 51 for Sample 1, T = 34 for Sample 2 and T = 68 for Sample 3.
Calibration of Pixels to metric measurements The images of the three samples were calibrated to physical measurements by first establishing a commonality between all readings. The orifice (the end of the pipe fitting) which enables connection between the waterless trap seal and the 50 mm pipe is used as the constant between the trap seal.
The area of a binary image is given by, Equation (2): where B|i, j| is the binary region. The first step was to determine the width and height of the visible area of the waterless trap seal when connected to the pipe. Then, the photograph is manipulated by converting the entire waterless trap to a colour 0 (black) region, first by eliminating any greyscale pixel and then filling in the missing sections manually. The new edited binary photograph is then run through and processed by the software in much the same way it would an original colour photograph. The image's height, width and percentage area of the orifice to the frame (120 × 256 pixels) is calculated using the software.
It was acknowledged that the area isolated in this process was not that of the waterless trap seal but of the orifice to which the sanitary components were connected to and, therefore, provided commonality to Samples 1, 2 and 3. The calibration results derived using Sample 3 photographs were then applied to all proceeding data.
To ensure accuracy in the measurement of the orifice area in pixels, multiple images were processed until certainty in the results was reached. From the measured diameter of 31.89 mm the following relationships were determined, Equations (3) and (4).

mm = 3.455 pixel (3)
where A is the opening area and a f is the % opening of the frame. This data presented in Table 3 confirm that opening characteristics of a waterless trap seal can be determined by recording and assessing photographic images. The photogrammetric method of extracting this data and calibrating all further assessments of the waterless trap seal is presented below in Figure 10.

Laboratory Results
The photogrammetric methods used to analyse the large data sets to provide quantitative data from photographs have been explained above. In this section, a description of the transient variation in the air pressure readings within the pipe, to the mechanical motion of the waterless trap seal; noted by the opening size-opening percentage (to frame size), height and width. This technique used the laboratory set-up shown in Figure 2 to vary the air pressure and record the corresponding photographic data for a given sample, with the objective of producing repeatable patterns of opening and closing of the device related to applied air pressure.

Measurements of Repeatable Patterns
The opening patterns of the waterless trap seals were originally considered to be random but upon closer inspection a repeatable pattern could be seen. These patterns differed with the pipe pressure and in accordance with the relative waterless trap seal under observation. As an example, Figure 11 shows a six-image cycle for Sample 2 through which the size and shape of the waterless trap seal opening remains fairly consistent. Figure 12 shows the same six-image cycle for Sample 3 for comparison.  Comparing the number and type of opening cycles between the waterless trap seals, it was found that when Sample 1 was installed, the number of images per cycles decreased steadily with an increase in pressure. Between the mean pressures of 17.18 mm wg and 39.5 mm wg a five-image cycle is noted, 46.29 mm wg and 73.26 mm wg a four-image cycle, 82.8 mm wg and 113.19 mm wg a three-image cycle and so on.
The number of images per cycle highlights the differing frequency of movement and allows comparison along similar pressure positions. Figure 13 excludes the data sets where no image data is recorded, but shows: • Sample 1 reduces most steadily in the length of a cycle as the pressure is increased on the valve; • Sample 2 remains constantly open at low pressures but quickly mimics the pattern found in Sample 1 at high pressure ranges (greater than 140 mm); • Sample 3 provided a less consistent pattern. Once above the RMS pressure value of 45.23 mm wg the cycle length became more difficult to predict. However, above 100 mm wg the cycle length constantly increases The discovery of cyclical patterns in the images across data ranges and prototypes, suggests that this repeatable pattern or oscillatory motion of the waterless trap seal can be predicted. All further analysis is aimed at mathematically reproducing the motion observed and shown here.

Determining the Opening Area by the Linear Measurements
Similar studies in other scientific fields such as acoustic modelling, aim to develop an artificial system which links pressure and opening size, to the pitch or note of a played instrument. The intended outcome of this examination is to determine the mathematical relationship between the opening area of the valve and the linear measurements, additionally, determine whether through this numerical approximation the valve opening is a function of its elasticity.
The max height and max width of the opening was not found to adequately describe the characteristics of the opening shape and so using principles from electrical engineering, the following relationship is yielded, Equation (5).
Here, the average opening area A av replaces the term P (average power) and A replaces p, the power in time.
Integrating over 2π rather than T, we obtain, Equation (6): which becomes, Equation (7), From the cos(a + b) = cos a cos b − sin a sin b relationship, the equation can be rewritten as Equation (8), Then, since we are taking over one time period Equation (9), In addition, the approximation of the opening area is given by, Equation (10) are the RMS values of the height and width and so A in Equation (10) can be simplified further if cos∅ (which represents the phase shift between the movement of the height and the movement of the width of the valve) equals 1 when the elasticity of the valve is inconsequential and ∅ is equal to 0. In effect the representation of the relationship between area, width and height of opening is analogous to the Ohm's law relationship between power, voltage and current in an electrical circuit so that, Equation (11) Note, however, that ∅ is likely to increase as elastic deformation of the waterless trap seal occurs. This deformation causes the membrane to stretch under the applied force making the movement of height and width arbitrary on occasion. This relationship is likened to Equation (11), used for the approximation of opening area in simplified models of lip motion where the lip aperture is regarded as rectangular Equation (12) (see Bromage, 2007 [23]).
where H is the mean height and W is the constant width written as, S(t) × h(t).
Stevenson [32] explains that, when Equation (12) is used in the lip motion analysis, the model assumes that the width remains constant throughout the playing of a brass instrument, but the height of the players' lips vary. The study measured the mean height and with this variable approximated the opening area of the lip. The early work by Saneyoshi et al. [33] was among the first to makes use of this linear relationship between the breadth and height of an opening. Other models have used a quadratic relationship to describe the lip motion of a bass player. To achieve an improvement on linear relationship, Equation (13) was assumed, Equation (13).
Predictions using Equation (13) were found to be the most realistic in lip motion analysis than the earlier linear relationships and was therefore used for the waterless trap.

Physical Movement Validation
The prediction of the waterless trap seal movement differs from the lip motion analysis as the width of the opening is not constant. Both the height and width of the trap seal vary with time and applied pressure. The RMS value of the maximum height and maximum width provide a mean linear measure of the opening. This measure when used in Equation (11), however, provides realistic predictions of the waterless trap seal opening area. Figure 14 provides a plot of the measured against the predicted opening area of Sample 2 in the medium pressure range data. Results from all other samples and ranges are presented in Table 4. These all show very good correlations.

Fourier Spectral Analysis
Spectral analysis was conducted using fast Fourier transform (FFT) to validate the frequency response of the opening and closing of the device to applied pressures. The FFT algorithm was used to determine the dominant frequencies (of opening and closing fluctuations) within time domain waveforms. These waveforms describe the transient pipe pressure and valve opening.
FFT transform enables a wave (a function of time, or space) to be broken up into the sum of their contributing exponentials (sines and/or cosines). So for instance as Filsell [30] describes, a sample wave of 1KHz may contain two dominant frequencies of 4 and 16 Hz. The resultant or original wave is the summation of these contributing sinusoids. This relationship is expressed in Equation (14).
The FFT transform however, does not provide timing information. Probability of the wave frequency is the only measure gained and is suggested by the acoustic strength of the noted frequency. Autosignal, the software package used for this application, regards the Fourier basis functions as phase bearing sinusoids and so the complete signal is a mere summation of the constituent frequencies. Therefore, it is possible to reconstruct the signal for any time period using Equation (15).
where A is the amplitude, v is the frequency and θ is the phase.

Fourier Frequency Spectrum-Pressure and Device Opening/Closing
The resultant frequency of the air pressure transient measured in the pipe is a reaction to the frequency of the applied wave originating from the pressure transient generator and the reflections induced by the closures to the waterless trap seal within an oscillatory cycle. This oscillatory motion does not occur at all frequencies, however. Dependent on the trap characteristics and an applied low amplitude pressure transient, the waterless trap seal is likely to remain in an open position for the entirety of the wave.
The predictive method for the oscillatory motion of Samples 1 and 3 is described in detail by the equations below. Using a sinusoidal relationship requiring both an amplitude and frequency, the prediction method for Sample 1 utilised the following amplitude relationship, Equation (16): and dominant frequency relationship: When combined, Equations (16) and (17) give: The prediction method for Sample 3 differs, as the amplitude relationship was found to be the only requirement for this trap seal.
The movement of the waterless trap seal could be predicted through the novel use of photogrammetric methods. Figure 15 shows that the boundary conditions developed, represent the opening of the waterless trap seal in response to the internal pipe pressure. This approach has never before been used to develop boundary conditions and has been found to provide equations which satisfactorily predict the opening area of the pipe with an installed waterless trap seal. A limitation, however, of this method is in the qualitative analysis of the mechanical response of the valve. Photogrammetric methods using only a single high-speed camera, provide only a 2-dimension perspective of the fluid structural interactions of the trap. Predicted data is derived from Equation (19). Figure 15 (a) threshold, (b) low, (c) medium and (d) high.

Conclusions
New devices are being produced all the time, even in conservative industries such as plumbing. Dynamic systems involving flexible structures increasingly feature as systems become more "active" than "passive". Achieving the ability to represent and characterise physical attributes for flexible structures is challenging.
This research has introduced a new methodology for developing a suite of equations to describe waterless trap responses to air pressure fluctuations by using a combination of photographic and pressure data. These data were processed to produce fundamental equations for opening and closing in response to applied air pressure. The equations developed were validated using Fourier spectral processing.
The application of models from other disciplines such as medicine (vocal cord models) and the physics of musical instruments (brass and woodwind models) supported and validated the methodology and complex relationships developed for the waterless traps.
Accurate modelling of building drainage system operation and air transient behaviours has consequences for disease spread. The models developed through this new methodology contribute to the early-stage certification of building design operational safety and add to the body of work relating to public health engineering design and validation.
Key findings from this research can be summarized as follows: • an alternative to traditional water seals and can be beneficial since they cannot dry out and are not subject to siphonage problems; • photogrammetric methods have been used to describe and model large engineering systems, but not for small flexible devices, such as the waterless trap; • alternative analogue models have been found in the field of medicine where modelling vocal cords follow a similar pattern; • digital coding of opening and closing provide an opportunity to describe the physical phenomenon and when linked to applied pressure data gives a holistic view of the device operation; • the use of FFT is an appropriate means to validate the model.