Interactive Thermodynamic Cycles using HTML and JavaScript

 

Alan J. Weston

Department of Technology

College of Engineering

Southern Illinois University at Carbondale

 

 

 

Summary

 

 

The goal of this project was to develop an Internet accessible site to enhance educational delivery in the area of thermodynamic cycles. 

 

The project resulted in the development of visual and interactive models of thermodynamic cycles for Engineering and Technology students.  The models exploit HTML interfaces with JavaScript computation engines.  The applications produced include the following: Air cycles (Otto and Diesel), Rankine cycles (superheat, reheat and regenerative), Brayton cycles  (closed, open and regenerative), and vapor compression refrigeration cycles (single-stage, cascaded, flash cooler, heat pump)

 

The Brayton cycles were modeled using air standard assumptions with a choice of cold air standard or average specific heat.  The Rankine cycles make use of steam as a working fluid with properties evaluated via equations.  The refrigeration and heat pump cycles also make use of equations for property evaluation.

 

Questionnaires for students, instructors or general users were developed via HTML for electronic feedback by users.  A formulation page explains the approaches taken in the cycle models.

 

Use of an Internet site for educational delivery allows centralization of data and eases software maintenance by requiring that only a single site/copy be administered.  Students access the software remotely, from any JavaScript-enabled Internet browser, without having to install software locally.

 

The project involved writing refrigerant property subroutines in JavaScript. The tools developed through this project could be used as building blocks for faculty interested in developing similar educational delivery systems. 

 

 

Project Description

 

 

1. Software Description

 

The software that was developed as a result of this Undergraduate Teaching Fellowship in Multimedia Instructional Technology consists of multiple graphical user interfaces, thermodynamic functions, and support files. Thirteen models were developed exploiting exchange of data between HTML and JavaScript constructs.

 

A. Refrigerant Equations

 

The underlying layer behind the graphical user interfaces consists of a set of thermodynamic functions and tools that were developed to ease implementation and to allow for future expandability.

 

Equations for the four basic properties of refrigerants (liquid density, vapor pressure, P-v-T relationships of the vapor, and heat capacity of the vapor) were taken from Refrigerant Equations published by R.C. Downing, Freon Products Division, The Dupont Company, Wilmington DE. Numerical methods were adapted as needed to exploit the published equations.

 

1. Liquid Density

 

  (equ.1)

 

2. Vapor Pressure

 

  (equ.2)

 

 

3. Equation of State

 

  (equ.3)

 

4. Heat Capacity of the Vapor

 

  (equ.4)

 

 

Derived equations compiled from the basic four and illustrated by R.C. Downing include:

 

5. Latent Heat of Vaporization

 

  (equ.5)

 

 

6. Enthalpy of Vapor

 

              (equ.6)

 

 

7. Entropy of Vapor

 

  (equ.7)

 

All of these equations rely on a single form with constants that vary according to refrigerant type. The constants are available for refrigerants such as: R-11, 12, 13, 14, 21, 22, 23, 113, 114, 500, 502, and C318. Although the software will allow for use of any refrigerant, R-12 was chosen for the sake of developing the initial model.

 

The aforementioned equations were used either explicitly or else via a numerical solution method. The following functions were developed:

  

tsat(P)              Calculates saturation temperature based on pressure. Employs secant method to solve for temperature in equation 2.

 

vpt(P, T)          Solves equation of state (equation 3) to find specific volume as a function of pressure and temperature. The solution method implements simple one point iteration.

 

hg(T, P, v)       Calculates enthalpy of the vapor, given temperature, pressure, specific volume. This is an explicit implementation of equation 6.

 

sg( T, v)           Calculates entropy of vapor, given temperature and specific volume.  This is an explicit implementation of equation 7.

 

sfg(T, vf, vg)   Calculates entropy of vaporization, given temperature, liquid specific volume and vapor specific volume.  The solution exploits the concept that the entropy change during a phase change may be calculated from the vapor pressure data and the P-v-T data at the phase boundaries using the Clapeyron equation:

           

                          (equ.8)

                       

The change in pressure with temperature at the boundary is obtained via vapress().

 

tps(P, s)           Calculates temperature as a function of pressure and entropy in the superheat region.  The solution implements the secant method.  The specific volume of the vapor is obtained via vpt(), and the entropy of the vapor is obtained from sg() (similarly to hps()).

 

hps(P, s)          Finds enthalpy in superheated vapor region as a function of pressure and entropy.  The secant method is employed to numerically solve for enthalpy. The specific volume of the vapor is obtained via vpt(), and the entropy of the vapor is obtained from sg().

 

liqden(T)         Calculates liquid density, given temperature. This is an explicit implementation of equation 1.

 

latent(T, P, vf, vg)       Calculates latent heat of vaporization, given temperature, pressure, liquid specific volume, and vapor specific volume. This is an explicit implementation of equation 5.

 

vappres(T)       Solves equation 2 for vapor pressure, given temperature.

 

 

C. Steam Equations

 

Equations for the steam properties calculated in the Rankine Cycles were taken from Steam and Gas Tables with Computer Equations, Thomas F. Irvine and Peter E. Liley, Academic Press, Inc., 1984.

 

The equations for saturation temperature and pressure are derived from the Clausius-Clapeyron equation. The equations for specific volume, enthalpy, entropy and enthalpy of vaporization result from the model developed by Torquato and Stell (J. Phys. Chem. 85, 3029, 1981).

 

1. Saturation Temperature

  (equ.9)

 

 

2. Saturation Pressure

  (equ.10)

 

 

3. Saturation Specific Volume, Enthalpy and Entropy

(equ.11)

 

 

 

 

 

 

 

 

 

 

 

 

 

4. Superheated Specific Volume

 

 (equ.12)

 

 

5. Superheated Enthalpy

  (equ.13)

 

 

6. Superheated Entropy

  (equ.14)

 

 

 

 

D. Air Standard

 

Air-standard assumptions are a simplified means of modeling processes, evaluating properties and calculating performance of gas-based cycles.

The approximations, commonly known as the air-standard assumptions, are the following:

 

1.      Air, behaving as an ideal gas, circulates continuously through the cycle.

2.      All the processes within the cycle are internally reversible.

3.      Combustion processes are viewed as heat addition steps.

4.      Exhaust processes are viewed as heat rejection steps.

 

When the working fluid in a cycle remains as a vapor or gas, changes of enthalpy or internal energy can be approximated through the use of constant pressure (Cp) or constant volume (Cv) specific heats. This approach works for cycles including the Otto, Diesel and Brayton cycles.

The air-standard assumption can be further restricted and simplified by what is known as the cold-air standard assumption. The cold-air standard assumption assumes that the air has constant specific heats evaluated at room temperature (25oC or 77oF).  All of the air cycle problems illustrated herein make use of SI units.

 

 

E. User Interface

 

The user Interface represents the ‘user apparent’ layer.  All input and output functions are accessed via the Web Pages defined via HTML.  The underlying thermodynamic functions layer is transparent to the user. The user interface design uses an intuitive common sense approach to provide as simple of an interface as possible. Therefore, pushbuttons, icons, input fields, and links are exploited extensively.

 

The pushbutton functions provide various derived displays. A mouse click on a P-h, P-v or T-s button produces a representative pressure vs. enthalpy, pressure vs. specific volume or temperature vs. entropy diagram, respectively.  The execute button takes the provided inputs and generates state properties as well as performance parameters.

 

 

III. Student Evaluations

 

 

A. Student Questionnaire

 

The following questions were provided as an online questionnaire for students to submit feedback electronically.

 

1.      Did the software increase your understanding of basic principles of thermodynamics?

2.      Did the software increase your understanding of basic principles of fluid mechanics?

3.      Did the software increase your understanding of basic principles of heat transfer?

4.      Did you find the documentation adequate?

5.      Were the graphical representations explicit enough to illustrate actual equipment?

6.      Were you able to test a majority of hypotheses?

7.      Did you find the environment to be too limited?

8.      Has the package affected your perception of computer-aided learning?

9.      Has the package affected your perception of the Internet as an educational delivery medium?

10.  Did the experience help you to better understand your learning process?

11.  Were you satisfied with the experience?

12.  Would you like to see similar tools available in other process-related courses?

13.  Does the package have potential as a substitute for actual laboratory practice and procedures?

14.  From your experience, did the software accurately depict the behavior and operation of similar equipment?

15.  Would you be interested in being involved in future enhancements to the software?

16.  Has the software increased your interest in the thermal sciences?

17.  Has the software increased your interest in computer programming?

 

 

B. Student Responses to Questions

 

The following bar chart illustrates the responses submitted by students to the aforementioned questions.


 


C. Student Comments

 

I am very impressed. These programs will prove to be very helpful especially for students learning the material for the first time. Too bad this was not available for use a few years ago when I was learning these cycles. These programs have definitely increased my appreciation of computer programming in general. For an answer to question 7 I think the environment is as elaborate as possible. They are relatively basic cycles but that is one of the advantages especially for students.

 

The program in general is really good. It's amazing the things that can be done on a computer. However, I did find one limit to the program, it was not available to all. Most students going through the school server don't have the proper levels of Netscape needed to view this. Other than that it is a very impressive page you have developed.

 

The diagrams are clear, concise, and easy to read. The program should be very helpful to future students.

 

We think that this is an excellent idea. It would be very helpful if the different categories would also contain sample calculations.

 

This is the first time I have dealt with interactive computer learning. I found it interesting and could see its use in preparing for examinations. For example similar test problems could be published on this page and the student would have an opportunity to study via the Internet.

 

Dr. Weston I do think that a button in the t-s and p-h fields to return to the diagram of the system would be a good addition. I had to use the back button to return, whereas I used a button in the same window to get to them. This package has not affected my perception of computer-aided learning for I have always thought it would be a good addition to a student's learning. I also think that the Internet is a good delivery medium, yet I worry about the security for the system. I don't think that there is a good substitute for actual laboratory practice maybe an enhancement. I have utilized, played, built, dismantled, and programmed computers from a very young age. I do like all of those but programming until the early hours of a new day. I hope that this information will be helpful. I had fun for I had to install a new hard drive to install ie4.0 from 3.02C so that I could have the space to do so. My first drive 1.6g was nearly packed, it only had 150mb of free space and that was used for cashing after I had zipped a lot of programs and files to get that much free space. Well I have to get back to my studies I have taken to long of a break and I am running out of time on the 30 min. SIU line.

 

This is an informative and thorough web page. I like the concept. This web page seems to be most beneficial if you are currently enrolled or have been previously enrolled in a course that covers this type of material.

 

I just wish that I knew about this site before the class started. This site would have been an asset for examples to the situations we had to look at in class.

 

I think that this web site is an excellent learning tool.  I don't think that it explains the basic principles because it doesn't show equations.  It would be a great advantage do doing homework.

 

 

IV. Conclusion

 

 

A majority of respondents found that the simulation software had merit in enhancing the delivery of refrigeration fundamentals.

The software was found to be illustrative, with limitations mainly due to the current level of development of the simulation package.

Perceptions regarding the use of computer-aided learning were positive.

Good suggestions were made with regards to possible enhancements and respondents indicated that they would like to see similar tools available in other courses or fields of study.

On the other hand a majority stated that such tools could not be a substitute for actual “hands on” experience.

Finally, all respondents indicated that they would be interested in participating in future development of this simulation package.

 

 

As depicted in the questionnaire results, a majority of respondents found that the simulation software had merit in enhancing the delivery of thermodynamic fundamentals. The software was found to be illustrative, with limitations mainly due to the current level of development of the simulation package. Perceptions regarding the use of computer aided learning via the Internet were positive. Good suggestions were made with regards to possible enhancements and respondents indicated that they would like to see similar tools available in other courses or fields of study. On the other hand a majority stated that such tools could not be a substitute for actual “hands on” experience. Finally, a majority of respondents indicated that they would be interested in participating in future development of this simulation package. But, at the same time most stated that their interest in computer programming was not increased.

 

The objectives of this study have been successfully achieved.  Future work will involve enhancements to extend the applicability of the package. The software will again be tested and evaluated in 1999 with students of ET313. 

This project has shown to be both stimulating for the developer as well as for student respondents to the questionnaire.  The positive feedback has been both rewarding and encouraging. 

 

The author thanks the Multimedia Instructional Technology Program for assistance in the development of this project.

 

This site is accessible at: http://www.engr.siu.edu/staff1/weston/thermo

 

 

References

 

 

1.   Refrigerant Equations, R.C. Downing, Freon Products Division, The Dupont Company

 

2.   Steam and Gas Tables with Computer Equations, T. F. Irvine and P. E. Liley, Academic Press, Inc., 1984.

 

3.   Torquato and Stell (J. Phys. Chem. 85, 3029, 1981).

 

4.   Jscript Documentation, Microsoft Scripting Technologies, http://msdn.microsoft.com/scripting/jscript/techinfo/jsdocs.htm