Ceng 402 Final Project

Ben Harper

 

Goal:

To alter the ceng402 and ceng301 data programs to output the units with the answers they provide.

 

Accomplishments:

I have produced a combined GUI for most of the pertinent and useful data programs from the applicable classes. The GUI uses start301 to gather compound data and temperature units. The program then also allows input of the temperature, pressure, state, and compound index, which are the most frequently used input parameters.  Once these parameters have been inputted (by virtue of the “input parameters” button), the 13 programs can be run. Some of the programs require additional information (usually the mol fractions for each of the compounds), and the user will be prompted for them.

            Once the input process is complete, the program will return an answer in the matlab workspace, identifying the value, the temperature, temperature unit, the result itself, and the units of the result. If there is a vector of temperatures, or multiple compounds, they will each be identified in a separate line. This result can then be easily copied into maple.

 

Challenges:

            The most difficult part to this project was using the generally poor matlab GUI help files. This was largely overcome due to trial and error. If I had more time, it would be nice to implement error messages, so that the program wouldn’t need to be restarted when one of the parameters has been exceeded. The usual problem is trying to plug a vector of temperatures into a program not capable of it, or the like. So it goes.

            The initial reason I chose to do a fancy, complicated GUI system was to avoid irrevocably screwing with the individual programs. It would have required major modifications to the output method to every program. This in turn would have made it much more difficult to have one program calling on another. While this could have been further solved by a complicated system of global variables, the chances were simply too high of messing up a program I had not considered, or the projects of my compatriots.

As it stands, the modifications to the programs takes a few minutes, and is extremely simple (adding a second output variable “units” to the function call, then defining the units as a string somewhere in the m-file). The files still output the first variable (the actual answer value) like normal.

Beyond that, the only major difficulties encountered involved sorting out cell outputs and other matlab nomenclature.

 

Use:

            The program begins by running start301. The user should input the compounds as normal here, including selecting mass and energy balances. When the data402 console opens, there will be boxes for temperature, pressure, state, and compound index. The program will show the temperature units selected in start 301. Simply including a space in between values can enter a vector of temperatures. The pressure can be inputted in any of the units shown, and the program will take care of the conversions. The state should be l (liquid), v (vapor), or s (solid). The index should indicate which of the compounds the user would like to run the data files for. If this box is left blank, all the compounds will be used, or a particular vector can be selected by placing a space between each compound.

            Clicking on a program name will then run that program. A description of each program is on the right of the button.  If a necessary parameter is missing, or a vector in place of a single value, the program will crash and needs to be restarted. If the program requires additional information, it will prompt the user. I know, seems like it’d prompt the user too if there was bad data, but I’ve been busy. And this thing took me forever anyhow. So its good enough.

            The results of the program will be displayed in the main matlab workspace, along with the units, compound number, temperature, degrees of temperature, and the identity of the value. If multiple compounds are in play, or there are multiple temperatures, there will be a separate entry for each case.