CENG 402: Transport Phenomena II

Final Project -- Unit Converter

by Valentin Prieto and Daniel Trahan

 

Objective:  To create a graphical user interface (GUI) in MATLAB that perform unit conversions and can be used in most engineering courses. Goals for the program included:

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

How It Works:

The use of this program is relatively straight forward.  In essence, one begins by entering the value to be converted.  Then the old units must be input.  This is done by selecting the units in the listbox and toggling back and forth between the numerator and the denominator.  The listbox has two levels to it.  The first level lists the dimensions into which the units are grouped (e.g. length, time, etc.).  By clicking on one of the dimensions, the user is moved into the second level where the units corresponding to that dimension are listed.  If the user clicks on one of these units, the old units display is updated with the unit just selected.  If the numerator button is selected when this occurs, the unit appears in the numerator; if the denominator button is selected, the unit appears in the denominator.  The user then enters the units to which he or she wishes to convert by the same method.  The user then presses OK, and the converted value is displayed.  If the user wishes to perform a new conversion, he or she can press the CLR button to return the GUI back to its initial state.

In order to move back to the first level of one of the listboxes, the user should click the '...' selection.  Also, if the user enters a unit by mistake, he or she can remove it by toggling from the numerator to the denominator, or vice versa, and clicking on the same unit again.  If the user clicks on one unit more than once, then that unit will be raised to the corresponding power.  Lastly, the user should not be overly concerned about the "correctness" of his or her entries since the program is quite robust.

The program can be easily modified to include new units and corresponding dimensions by updating the file "unitData.dat" according to the user's needs. The format required to update this file is specified in the file itself.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Challenges:

The main challenge we faced was learning the MATLAB functions and commands to interact with the GUI.  Although the project may seem simple, it is only deceptively so.  We required around 500 lines of code to complete the task.  Another challenge we faced was creating a robust program that could not be "broken" by the user.  This required us to think of every possible input or action that a user might enter or perform (e.g. entering characters or multiple numbers in the input box or not have matching dimensions between the old and new units).  Therefore, our program accounts for mistakes like this without causing a crash and outputs error messages when such instances occur. Here is the link to our code.

 

Future Work:

Although we feel our program is quite thorough and user-friendly, there are a couple features that could be implemented that would make it even more useful.  First, rather than having the old and new unit displays be static text boxes, they could be changed to editable text boxes where the user, if he or she knows the unit abbreviations, could enter the units and have the program input the units in that manner.  This would be much quicker and more convenient, especially for those users that are familiar with the program and its abbreviations.  Second, it might be useful to link this program to start301 so that if the GUI is open and one of the start301 programs is run, the value returned and its corresponding units are automatically entered into the GUI section for the old units.  This would allow for fast and easy unit conversion since the user would then only have to enter in the new units to which he or she wished to convert.  The improvements, however, will be left as future projects for CENG 402 students.