HP50G PROGRAMS
2008-09-10 by Charles Chindenga
Guys i have, 3 programs below that i have written, they seem to be working well. Can anyone improve on them and let me know. i'm still learning to program on HP50G. i was used to programming HP42S. I upgraded from HP42S to HP50G.
RATIONAL METHOD (HP 50G)
«
"Catchment Constant"
{ {"C:" "Rational Formula Coefficient" 0.} } { } { 0.8 } { 1 } INFORM
IF
THEN
OBJ-> DROP `C' STO
ELSE
"Operation Cancelled" MSGBOX
END
WHILE `C<=0' `C>1' OR
REPEAT "Please Check" "¿" + " 0 < C <= 1" + MSGBOX
"Catchment Constant"
{ {"C:" "Rational Formula Coefficient" 0.} } { } { 0.8 } { 1 } INFORM
IF
THEN
OBJ-> DROP `C' STO
ELSE
"Operation Cancelled" MSGBOX
END
END
"Catchment Characteristics"
{ { "r:" "Permeability Coefficient" 0.}
{ "L:" "Longest Catchment Path in km" 0.}
{ "S:" "Average Catchment Slope" 0.} }
{ } {0.02 0.1 0.0001} {0.3 0.05 0.01} INFORM
IF
THEN OBJ-> DROP -> r L S
« `0.604 ´ (r ´ L / ÖS) ^ 0.467' EVAL `M1' STO
`(0.87 ´ SQ(L) / (1000 ´ S)) ^ 0.385' EVAL `M2' STO »
ELSE
"Operation Cancelled" MSGBOX
END
"Nature of Flow"
{ {"Overland" M1}
{"Defined Watercourse" M2} } 1 CHOOSE
DROP EVAL
3 FIX DUP `t' STO
"Time to Concentration:" "¿' " + SWAP + "_hrs' " + MSGBOX
"Catchment Area & Charts"
{ { "A:" "Catchment Area in square km" 0.}
{ "P:" "Point Rainfall from Charts (mm)" 0.} }
{ } {0.02 20} {0.65 17.8} INFORM
IF
THEN
OBJ-> DROP -> A P
`C ´ P / t ´ A ´ 1000 / 3.6' EVAL 1 FIX
"Run-off generated:" "¿' " + SWAP + "_l/s' " + MSGBOX
ELSE
"Operation Cancelled" MSGBOX
END
STD
« { t M1 M2 C } PURGE » EVAL
»
MANNINGS METHOD (HP 50G)
«
"Manning's Formula"
{ { "n:" "Manning's Coefficient" 0.}
{ "A:" "Flow Cross-sectional Area" 0.}
{ "P:" "Wetted Perimeter" 0.}
{ "S:" "Channel or Pipe Slope" 0.} }
{ } {0.012 0.2025 1.35 0.0125} {0.012 0.18 1.25 0.01} INFORM
IF
THEN
OBJ-> DROP -> n A P S
«
`A / P' -> NUM DUP `1_m' ´
"Hydraulic Radius:" "¿ " + SWAP + MSGBOX
-> R
`1 / n ´R ^ ( 2 / 3 ) ´ ÖS' EVAL 3 FIX `1_m / s' ´ DUP
"Velocity:" "¿ " + SWAP + MSGBOX
A ´ `1_m ^ 2' ´
`Flow Rate:" "¿ " + SWAP + MSGBOX STD
»
ELSE
"Operation Cancelled" MSGBOX
END
»
COLEBROKE-WHITE METHOD (HP 50G)
«
"Colebrook-White Formula"
{ { "k:" "Roughness Coefficient" 0.}
{ "D:" "Pipe Diameter in metres" 0.}
{ "μ:" "Kinematic Viscosity" 0.}
{ "S:" "Pipe Slope" 0.} }
{ } {0.0006 0.15 0.0000014 0.0125} {0.0015 0.15 0.00000131 0.1} INFORM
IF
THEN
OBJ-> DROP -> k D μ S
«
k `1_m' ´ D `1_m' ´ μ `1_m ^ 2 / s' ´ -> k D μ
`-2 ´ Ö ( ( 2 ´ 9.80665_m / s ^ 2) ´ D ´ S ) ´ LOG( k / ( 3.71 ´ D ) + 2.51 ´ μ / ( D ´ Ö (( 2 ´ 9.80665_m / s ^ 2) ´ D ´ s ) ) )'
EVAL
3 FIX DUP
"Velocity:" "¿ " + SWAP + MSGBOX
`p ´ SQ ( D ´ 1_m ) / 4
EVAL ´
`Flow Rate:" "¿ " + SWAP + MSGBOX STD
»
ELSE
"Operation Cancelled" MSGBOX
END
»
