Vous êtes sur la page 1sur 6

EES Tutorial Adapted from EES Tutorial by Pascual, C.

, Cal Poly, San Luis Obispo, CA, 2004

Engineering Equation Solver (EES) is a powerful mathematical program similar to Matlab. What makes EES unique is that it also contains the thermophysical properties of many common substances used in thermal science application. EES has these properties both in SI and English units. Using EES eliminates the need to look up properties in tables and performing tedious interpolation or multiple interpolations. Since EES is also similar to Matlab, this program can solve very complex system problems which would require iteration if done by hand. EES will simplify the design process for your project. As with any program, EES does have shortcomings. You can down load EES from the MechSE software website for free: https://wwws.mechse.uiuc.edu/software/. Follow the directions for correctly installing the software on your computer. Start the EES program. Click on File>New. Now you should have a blank Equations Window. This is the area where equations will be typed. In general, you would type the equations similar to writing the equations on paper. Let us illustrate by solving this simple system problem from Thermodynamics. Example 1: An ideal Rankine cycle (Figure 1) uses steam as a working fluid, which circulates at a rate of 80 kg/s. The boiler pressure is 6 MPa, and the condenser pressure is 10 kPa. The steam enters the turbine at 600C and leaves the condenser as a saturated liquid. Assume that there is no pressure drop in the boiler or condenser. Also assume that both the pump and turbine are isentropic.

In EES, first select the desired Unit System located under the Options Tab. Make sure the unit system selected for this problem is SI. Just like with any programming it is important to place appropriate comments throughout the code to aid in debugging. In EES separate comments from the code with quotation marks. Begin the analysis at the Turbine. Type in the following code:
"Turbine: Assume isentropic" m = 80 [kg/s]

P_boiler = 6000 [kPa] T_3 = 600 [C] h_3 = enthalpy(steam, P=P_boiler, T=T_3) s_3 = entropy(steam, P=P_boiler, T=T_3) P_condenser = 10 [kPa] h_4 = enthalpy(steam, P=P_condenser, s=s_3) W_turbine = m*(h_3-h_4) "[kW]"

EES has the ability to check units for you but conversion factors must be used and all variables must be assigned a unit. Above, by placing the units for the variables in brackets ([kPa]), you are assigning units to this variable. In the solution window, this unit will appear next to the variable. This type of assignment only works when a variable is assigned a numeric value like P_boiler. You will notice that next to W_turbine, the units are typed as "[kW]". In this situation, the units have not been assigned to the variable because EES does not know which variable in that equation has units of kW. Therefore, to properly assign units to W_turbine, highlight the variable W turbine and right click the mouse. Choose Variable Info. Enter units as kW. The underscore symbol (like h_4) is used to denote a subscript. Therefore, in the Formatted Equation window the variable h_4 will appear as h_4. Go to the Windows tab and select Formatted Equations. Another window will open showing the equations in a neat printable form. You do not have to remember the format for the property equations. Instead go to the Options tab and select Function Info. From here select Fluid Properties. The box on the left shows the property, while the box on the right shows the fluid. Instead of typing the equation, choose enthalpy and steam and then paste (Do not do this now since you already typed in the equation above). Remember from the State Postulate, that you need two independent properties to define the state. The function information shows pressure and temperature, but you can choose any two independent properties. In setting the enthalpy at state 4, notice that pressure and entropy were chosen. Now type the following code for the remainder of the system components.
"Condenser: Assume no pressure drop" h_1 = enthalpy(steam, P = P_condenser, x = 0) "Aside: Recall x is the quality" s_1 = entropy(steam, P =P_condenser, x = 0) Q_condenser = m*(h_1 - h_4) "[kW]" "Pump: Assume isentropic" h_2 = enthalpy(steam, P= P_boiler, s = s_1) W_pump = m*(h_1 - h_2) "[kW]" "Boiler: Assume no pressure drop" Q_boiler = m*(h_3-h_2) "[kW]" "efficiency" eta = (W_turbine+W_pump)/Q_boiler "[-]"

EES does not recognize the difference between lower and upper case letters; therefore, variables q and Q are interpreted as the same variable. Greek letters are entered by typing their full name like eta for 11. In the Formatted Equations, Greek letters appear as their symbol. Finally, has no units and that is indicated by [-] next to the variable. Don't forget to add units to Q_condenser, W_pump, Q_boiler, and eta.

Now that the code has been entered, the system of equations can be solved. Before solving the equation, check for any syntax errors by clicking on Check/Format under the Calculate tab (or by pushing the red check button). If no errors are found, this check will inform you of the number of equations and the number of unknowns. If the number of equations and number of unknowns are not equal, no solution can be found. If the format is correct, then click on Solve also under the Calculate tab (or by clicking the calculator button). The solution window will appear showing the values for all the variables. EES will also perform a units check. Click Check Units under the Calculate tab. You will notice that the properties have units automatically added. The answers for the first exercise are: Wturbine = 110990 kW, Qcondenser = 166318 kW, Wpump = -483.5 kW, Qboil = 276825 kW, and 0.3992. Clicking Print under the File tab will print the program and solution. The formatted equations choice will print out the equations in a format similar to written equations. Another powerful feature of EES is the Parametric Table. This feature allows you to vary parameters and see the result on the system. This feature will be very useful in your design project when choosing the best overall design. This feature will be illustrated with the following example.

Example 2: The condenser pressure from Example 1 is now allowed to vary from 2 kPa to 10 kPa. How does varying condenser pressure affect the power from the turbine and the efficiency of the cycle? Click on New Parametric Table under the Tables tab. For this example, choose 9 runs, and title the table as Condenser Pressure. The left box shows all the variables in the program. Choose P_condenser first. Click Add. Now P_condenser is removed from the left box and placed in the right box. Next add W_turbine and eta to the box on the right and click OK. A spreadsheet looking table now appears with Pcondenser, Wturbine, and appearing at the top. On the column for Pcondenser, click on the black arrow at the top. Set the first value to 10 and the last value to 2 (therefore, the pressure will vary from 10 kPa to 2 kPa in 1 kPa increments) and click OK. EES will now fill in the column of Pcondenser with the test values. EES will now solve the program for each value of Pcondenser and insert the corresponding values of Wturbine and in the appropriate column. To solve the table either click the green arrow in the upper left or click Solve Table under the Calculate Tab. To avoid an error in solving the table, the equation, which sets the value for Pcondenser, must be deleted in the Equations window. Therefore there is one variable more than the number of equations.

As the condenser pressure drops, the power from the turbine and the cycle efficiency increase. You can plot this trend by clicking New Plot Window (X-Y Plot) under the Plots tab. Choose P_condenser for the x-axis and W_turbine for the y-axis. Before clicking OK, check the automatic update box, so the graph will be updated every time the table is updated. The plot can be resized by dragging the lower right hand corner. Now add the efficiency data by clicking Overlay Plot under the Plots tab. Select eta for the y-axis and select Y2 for the right Y-scale. Don't forget to click automatic update before hitting OK. Your graph should look similar to Figure 2. If it doesn't look similar to Figure 2 then adjust the y-axis scales. There are many features which are similar to Excel, which allow you to change the format of the plot and add text. Now let us do another example, which is more difficult.

Figure 2. Effect of Varying Condenser Pressure

Figure 3. Rankine Cycle with Regeneration

Example 3: The ideal Rankine cycle described in Example 1 is modified to include the regeneration process. A portion of the steam is extracted from the high-pressure turbine at 0.5 MPa and is used to heat the feedwater in an open feedwater heater (Figure 3). The rest of the steam enters the condenser at 10 kPa. All other conditions are the same as Example I. You may assume that both pumps and the turbine are isentropic. The open feedwater heater is at saturation conditions with a pressure of 0.5 MPa. Here is the program to solve this example. Start with a new equation window.
"Turbine: Assume isentropic" m = 80 [kg/s] P_boiler = 6000 [kPa] T_5=600 [C] h_5 = enthalpy(steam, T = T_5,P = P_boiler) s_5 =entropy(steam, T= T_5, P= P_boiler) P_condenser = 10 [kPa] h_7 = enthalpy(steam, P = P_condenser, s = s_5) T_7 = temperature(steam, P = P_condenser, s = s_5) h_6 = enthalpy(steam, P = 500, s = s_5) m_7 = m - m_6 "Mass Balance" W_turbine = m*h_5 - m_6*h_6 - m_7*h_7 "[kW]" "Condenser: Assume no pressure drop" h_1 = enthalpy(steam, P = P_condenser, x = 0) s_1 = entropy(steam, P = P_condenser, x = 0) Q_condenser = m_7*(h_1 -h_7) "[kW]" "Low-Pressure Pump: Assume isentropic" h_2 = enthalpy(steam, P = 500, s = s_1) W_lowpump = m_7*(h_1 -h_2) "[kW]" "Feedwater Heater: Assume saturated system" h_3 = enthalpy(steam, P = 500, x = 0) "Saturated liquid at exit of feedwater heater" s_3 = entropy(steam, P = 500, x = 0) m_6 = (m*h_3 -m_7*h_2)/h_6 "[kg/s]" "High-Pressure Pump: Assume isentropic" h_4 = enthalpy(steam, P = P_boiler, s = s_3) W_highpump = m*(h_3 - h_4) "[kW]" "Boiler: Assume no pressure drop" Q_boiler = m*(h_5 -h_4) "[kW]" "Efficiency" eta = (W_turbine + W_lowpump + W_highpump)/Q_boiler "[-]"

Don't forget to add units to the following variables: m_6, m_7, W_turbine, Q_condenser, W_lowpump, W_highpump, Q_boiler, and eta. After typing in the program, check the format and solve the equations. As you will see, the solution is solved iteratively since the mass flowrate to the feedwater heater was not known. However, EES was able to solve the problem. This is not always the case. Sometimes EES needs help. The next example will illustrate this point. The solution for Example 3 is: Wturbine = 102581 kW, Qcondenser = -138875 kW, Wlowpump = -33 kW, Whighpump = -480 kW, Qboiler = 240943 kW, = 0.4236.

Example 4: A 25-mm diameter cable has an electrical resistance of 10-4 /m and is transmitting a current of 1000 A. If the cable is submerged in a tank of water at 1C and is flowing at 5 m/s in cross flow over the cable, what is its surface temperature in C? From Newtons Law of Cooling, the heat transfer from the cable per unit length is: q' . The properties of the q' Dh (Ts T ) . Solving for the surface temperature: Ts T Dh fluid need to be evaluated at the film temperature: T film 0.5(Ts T ) . As you will learn in heat transfer, these types of problems require iteration on the fluid properties since the film temperature is unknown. EES now makes this part easier (almost). The Hilpert correlation is used to calculate the heat transfer coefficient from a heated cylinder. Here is the program to solve this example. Start with a new equation window.
"Heat Transfer Rate" q = 1000^2*10^(-4) "Heat Transfer Coefficient" T_0 = 10 [C] T_film = 0.5*(T_0+T_surf) "[C]" Nu = VISCOSITY(water, T=T_film, P=101.32)/DENSITY(Water, T=T_film, P=101.32) V = 5 [m/s] D = 0.025 [m] Re_D =V*D/nu "[-]" Pr = PRANDTL(Water, T=T_film, P=101.32) NuD = 0.193*Re_D^0.618*Pr^(1/3) "[-] Hilpert Correlation" k = CONDUCTIVITY(Water, T=T_film, P=101.32) h = NuD*k/D "[W/m^2-C]" "Surface Temperature" T_surf = T_0 + q/(pi*h*D)

After checking the format of the equations, adding units to variables and correcting any syntax errors, click calculate. More than likely, EES will give you some type of error, which does not result in a solution. This error is not a result of a programming mistake, but instead it is a mistake in your initial guesses. Click on Variable Info under the Options tab. This screen will show you all the variables, their initial guess, their lower limit, their upper limit, and their units. The default values are negative infinity for the lower limit, positive infinity for the upper limit, and an initial guess of 1. For this example, these particular limits and guess are not working so you need to change them. In order to come up with intelligent guesses, you need to know how the system is behaving. In this example not knowing the film temperature is causing the properties to be poorly guessed. Therefore replace the equation for the film temperature with T_film=10C and solve the problem. Now you have a solution, which is not correct but it is better than no solution. Use this solution to update the guesses in the Variable Info window and resolve the problem by putting the original equation for T_film back into the program. The answers are Tsurf = 10.1 C and Tfilm = IO.06C.

Vous aimerez peut-être aussi