Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations IDS on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

2 Formulas for Saturation - Vapor Pressures - Temperature

Status
Not open for further replies.

MaxRaceSoftware

Automotive
Nov 24, 2001
291
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 &quot;Input choices: dewpoint,vapor, or saturation pressure in inches Hg.&quot;;
LOCATE 5, 5
PRINT USING &quot;Pressure inches Hg.= ##.###### &quot;; 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 &quot;Temperature =####.#### deg.F (####.#) (2nd formula=####.####)&quot;; 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 &quot;Dry bulb = ###.## &quot;; 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 &quot;Saturation pressure =###.###### inches Hg.&quot;; satp
LOCATE 9, 5
PRINT USING &quot;Saturation pressure =###.###### psia&quot;; satp / 2.036020696#
LOCATE 10, 5
PRINT USING &quot;Saturation pressure =###.###### mm Hg.&quot;; satp * 25.4

GOTO start



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

Part and Inventory Search

Sponsor