This repository contains software for controlling the Integrated Multifunctional Environmental System (IMES) at Center for Nanophase Materials Sciences (CNMS) at Oak Ridge National Laboratory (ORNL).
The code and README file for this software is avilable at https://github.com/ericmuckley/IMES
A picture of the actual measurement chamber is shown below.
The software which controls the system is located in this repository. A screenshot of the software is shown below.
The system controls instruments through serial (RS-232, USB) communication and consists of a central vacuum chamber (and auxillary gas/liquid flow cells) with optical and electrical feedthroughs, gas flow control and pressure control hardware, and instruments for enabling acquisition of electrical, optical, gravimetric, and viscoelastic properties of a sample under test. A schematic of the system is shown below.
The software requires no formal installation, but installation of missing Python libraries will likely be required when running the software for the first time. To download the missing libraries, it is recommended to use the scientific Python distribution Anaconda (https://www.anaconda.com/). If Anaconda is not present on the local PC, download it from its website. Then download the imes_python folder in this repository to the local PC and unzip it.
To avoid installing individual libraries, the complete Python installation which includes all necessary packages is located in this folder as a .yml file. Alternatively, the same .yml file can be downloaded from Anaconda Cloud (https://anaconda.org/ericmuckley/imes_env_july2019)
First, download the IMES folder from this page. Then unzip the folder and put it on your local PC. Open the Anaconda prompt terminal window. Navigate to your IMES folder by typing cd C:\Users\a6q\Desktop\IMES
in the terminal window, but use the actual path to your own IMES folder. The terminal prompt should show you that you're now inside the IMES folder. Now you must install the IMES dependencies from the .yml file.
In the Anaconda terminal (which has been already been navigated to the IMES folder), type conda env create --name envname --file=imes_env_july2019.yml
This will create a new conda dependency environment using the imes_env_july2019.yml file, and name the new environment envname.
Now you can enter/activate the envirnment by typing conda activate envname
. Your terminal prompt should change to show that you're inside the new environment. Now you can type spyder
and Spyder should open inside your new environment. With Spyder open, you can open the IMES.py file and run it.
Conda-pack can be used to install an Anaconda environment on a machine with no network connectivity. Please follow the documentation at https://conda.github.io/conda-pack/#commandline-usage and use the .tar.gz file to unpack the environment. Note that the environment will only be compatible with 64-bit Windows machines running Python 3.
To run the IMES software, open a Python editor like Spyder, which comes pre-packaged with Anaconda. In the editor, open IMES.py in the imes_python folder. Run IMES.py in the editor. If there are errors because of missing libraries, you must first install those libraries. To manually install them, open the Anaconda prompt, which comes pre-packaged with Anaconda. In the Anaconda prompt, type conda install library_name
, where library_name is the name of the missing library. You can do an internet search for "conda install X", where X is the missing library name to figure out the best way to install the package through Anaconda.
When all libraries are installed correctly and IMES.py runs successfully, a file browser dialog will pop up ask ask you to designate a folder in which to save the experimental data files. You may select an existing folder or create a new one and select it. After selecting a folder for data files, the GUI window will appear.
To connect instuments, check the checkboxes on the left-hand side of the window. Before connecting an instument, change its address so it matches the actual physical address of the instument in the PC. It is easy to see which device addresses are connected using Windows Device Manager or National Instruments Measurement and Automation Explorer (NI-MAX).
While the IMES software is running, the output box in the lower left-hand corner of the window displays messages to the user. Instrument and measurement settings can be adjusted on the front panel of the GUI, and measurements and sequences of measurements can be initiated using the top toolbar.
The main IMES.py file calls a number of files:
- IMES_layout.ui: the GUI layout file, which dictates where GUI objects are placed and their names
- libusb-1.0.dll: a Windows USB library which may be required for communication with USB devices
- ornl_cnms_logo.png: raw image file of CNMS logo which is embedded on GUI
- ornl_cnms_logo.qrc: Qt resource file created from raw png image
- ornl_cnms_logo.py: Python file created from Qt resource file
IMES.py also imports python modules from the IMES_libs folder. These modules contain code for controlling instruments and measurement conditions inside the environmental chamber:
- cades.py: module for communicating with CADES server at ORNL
- eis.py: module for controlling Solartron 1260 impedance spectrometer
- jkem.py: module for controlling J-KEM temperature controller
- keith.py: module for controlling Keithley 2420 multimeter
- libusb-1.0.dll: USB windows library which is needed for running IMES.py
- ops.py: module for system operations like reading/writing data files, communication with Origin
- origin.py: module for communicating with Origin for plotting experimental results
- realtimeplot.py: module for creating real-time updating plots using the pyqtgraph library
- rh200.py: module for controlling the RH-200 relative humidity generator
- rhmeter.py: module for controlling relative humidity and temperature meter
- sark.py: module for controlling SARK-110 antenna analyzer for QCM measurements
- spec.py: module for controlling Ocean Optics optical spectrometer
- vac.py: module for controlling the vacuum pressure, valve, turbo pump, and mass flow controllers
Data is transferred between the main *IMES.py* script and the other modules using dictionaries which hold references to devices, front panel GUI objects, and measured parameters. There is a different dictionary associated with each module. For example, *vac_dict* holds information about the vacuum system and is used to communicate with the *vac.py* module, while *keith_dict* is used to transfer data to and from the *keith.py* module for controlling the Keithley multimeter.
To edit the GUI layout, use QtDesigner which comes pre-packaged with Anaconda. In the Anaconda prompt, type designer
. This wull open QtDesigner. Then open the IMES_layout.ui file. This is the editable layout file for designing the GUI. Front panel objects can be added, deleted and modified. New objects should be named according to their function, as referencing them in the code will require their name. For example, a new text box named text_box5 will be referenced in the main GUI class in IMES.py as self.ui.text_box5
.
IMES.py and other modules inside the IMES_libs folder are all editable. When changes are made to the GUI layout file, they should usually be accompanied by corresponding changes in the Python scripts.
Control for the humidity generator is accomplished by configuring the generator in National Instruments Measurement and Automation Explorer (NI MAX). Open NI MAX and import the rh_gen_tasks_new_6001.txt or rh_gen_tasks_old_6211.txt file, based on the model of the RH generator (new models use the NI 6001 board while old models use the NI 6211 board). Once imported, delete all the empty 6001 and 6211 devices and migrate their tasks to the new imported device. Now it should be possible to communicate with the RH generator using LabVIEW or Python with the nidaqmx library.
For additional help, you may contact Eric Muckley (ericmuckley at gmail dot com).