## 2 Materials and Methods
### Application Architecture  
A GUI to operate the barometric chamber was developed to run in a web browser in order to enable the user to control the chamber via the touch screen display or remotely (Figure 5). The application developed to automate the control and monitoring routines of  
Figure 4: Diagram that represents the components of the electrical circuit responsible for the barometric chamber pressure control.  
the pressure chamber consist of two programs coded in Python, running simultaneously: (1) webApp.py and (2) controller.py. The program webApp.py launches Flask, which is a Python framework used for developing web applications. Basically, when webApp.py is launched, Flask activates a web server in the Raspberry PI, loads all static files and templates (HTML, CSS, JavaScript, and images), and handles HTML requests by routing mechanisms processed by Python methods. The template and static files necessary to render the web pages were developed using HTML, CSS, and JavaScript. The web pages allow the user to set parameters required to operate the chamber; configure, start, and stop experiments; monitor variables inside the chamber; and see charts and generate reports. Dynamic data shown on the web pages are retrieved from a MySQL database. JavaScript/AJAX methods generate HTML requests mapped by Python. Python methods execute the requested tasks in the database and send HTML responses back to the client. When an experiment is running, charts and fields in the GUI are updated every 5 s by sending requests to the database. When the user sets a variable in a web page, a field in the database is updated. Changes in the GUI cause updates in the database 'control' table, but there is no direct change in GPIOs due to requests made by the user over the web pages.  
The controller.py is the application in charge of synchronizing the database 'control' table and the GPIOs, as well as launching routines for controlling the barometric pressure and for monitoring variables inside the chamber. The database (DB) has only two tables: (1) 'control' and (2)'records'. The 'control' table has several fields but a single record. Only update operations are allowed in the 'control' table and such operations may occur due to requests from controller.py or webApp.py. The'records' table also has several fields and is used to save data gathered during experiments carried out in the barometric chamber. Data in this table are used to generate charts and reports of experiments. The controller.py also has the algorithm in charge of controlling the barometric pressure within the chamber. There is a routine used for ramp stages (i.e., stages 1 and 3) and another for steady stages (i.e., stages 2 and 4). Both routines implement a PI controller that reads the barometer and computes new output values every 0.2 s, as already mentioned in the control system.  
The application architecture was designed as described to allow the browser to be closed while running an experiment in the barometric chamber and to allow monitoring of the experiments remotely over the internet. Once an experiment has been launched by the user over the browser, all control tasks are handled on the server side by the application controller.py. When an experiment is running, the database is continuously updated, whether or not the browser is opened. In this way, when a user accesses the web pages, information about the ongoing or previous experiments is retrieved from the database.