×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

2 Formulas for Saturation - Vapor Pressures - Temperature

2 Formulas for Saturation - Vapor Pressures - Temperature

2 Formulas for Saturation - Vapor Pressures - Temperature

(OP)
Calculates Temperature
there are (2) Loops , either computes the same answer
i prefer the 9 Loop version
 
'======== Copyright (c) 1995 Larry Meaux , All Rights Reserved ==============
'|                                                                          |
'|   Program Name: REVERSE.BAS   , QBasic/QuickBasic version                |
'|           Date: Sept 29,1995                                             |
'|           Time: 1:00 pm                                                  |
'|        Purpose: Compute temperature from dewpoint vapor pressure or      |
'|                 from saturation pressure (all in inches Hg.)             |
'============================================================================
WIDTH 80                 '<--set screen to 80 columns , default
SCREEN 0                 '<--set to text screen , default
KEY OFF                  '<--turn-off 25th line GW-Basic's menu text
VIEW PRINT               '<--enable printing on 25th line
LOCATE , , , 7, 7        '<--set cursor to default shape
COLOR 15, 1              '<--bright white on blue
CLS                      '<--clear entire screen
start:
LOCATE 3, 5
PRINT "Input choices: dewpoint,vapor, or saturation pressure in inches Hg.";
LOCATE 5, 5
PRINT USING "Pressure inches Hg.= ##.######                    "; psat;
LOCATE 5, 38
INPUT psat$: IF LEN(psat$) > 0 THEN psat = VAL(psat$)
IF psat = 0 THEN psat = .5216  '<--default value if no input, (60 deg.F)
 
x = LOG(29.9213 / psat)   '<--29.9213 inches Hg. at sea-level at 59 F
b = psat
a = 672         '<- 672 Rankine, (672 = 460 + 212) , 212 F = boiling pt. H2O
c = 35.9381#    '<- Constant , 35.913 works with 671.67 and 459.67 (original)
d = -1.152437#  '<- Constant , best constant value for d,(-1.152437 orig.)
logicloop:
FOR cnt = 1 TO 25   '<---- 25 is best value for number of loops
t1 = x - (a - b) * c * (b ^ d)
b = b + t1 / (a * c * d * b ^ (d - 1) - c * (d + 1) * b ^ d)
NEXT cnt
dry1 = psat
FOR cnt = 1 TO 9
dry1 = ((x + (c * (dry1 ^ (-.152437)))) / (a * c)) ^ -.867726392#
NEXT
dryb = (dry1 - 460)
 
LOCATE 10, 5
psatf = b - 460  '<-Fahrenheit conversion from Rankine degrees (459.67 orig.)
PRINT USING "Temperature =####.#### deg.F (####.#)   (2nd formula=####.####)"; psatf; psatf; dryb
GOTO start
=================================================================================



Calculates Pressure


'======== Copyright (c) 1995 Larry Meaux , All Rights Reserved ==============
'|                                                                          |
'|   Program Name: MEAUX.BAS   , QBasic/QuickBasic version                  |
'|           Date: Sept 29,1995                                             |
'|           Time: 1:00 pm                                                  |
'|        Purpose: Compute vapor pressure or                                |
'|                 saturation pressure (all in inches Hg.)                  |
'============================================================================

WIDTH 80                 '<--set screen to 80 columns , default
SCREEN 0                 '<--set to text screen , default
KEY OFF                  '<--turn-off 25th line GW-Basic's menu text
VIEW PRINT               '<--enable printing on 25th line
LOCATE , , , 7, 7        '<--set cursor to default shape
COLOR 15, 1              '<--bright white on blue
CLS                      '<--clear entire screen


start:
LOCATE 5, 5
PRINT USING "Dry bulb = ###.##                       "; dryf;
LOCATE 5, 30
INPUT dryf$: IF LEN(dryf$) > 0 THEN dryf = VAL(dryf$)

dryr = 459.67 + dryf
satp = 29.9213 / (EXP((671.67 - dryr) * 35.913 * (dryr ^ -1.152437)))

LOCATE 8, 5
PRINT USING "Saturation pressure =###.###### inches Hg."; satp
LOCATE 9, 5
PRINT USING "Saturation pressure =###.###### psia"; satp / 2.036020696#
LOCATE 10, 5
PRINT USING "Saturation pressure =###.###### mm Hg."; satp * 25.4

GOTO start

Larry Meaux (maxracesoftware@yahoo.com)
Meaux Racing Heads - MaxRace Software
ET_Analyst for DragRacers
Support Israel - Genesis 12:3

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources