Post Reply 
Division by 0 (zero) in an App
03-30-2017, 12:45 AM
Post: #7
RE: Division by 0 (zero) in an App
Cyrille wrote;
"What does the HeatIndex function contain?"
Code:

//Variables... 
t;rh;
hi;hi2;tmp;

// Subroutine...
HeatIndexCalc();
EXPORT HeatIndex()
BEGIN
END;

VIEW "Start HeatIndex",START()

BEGIN
STARTVIEW(-1,1);
WHILE GETKEY<>4 DO
 REPEAT
  tmp:=INPUT(
  {{t,[0],{60,22,1}},
   {rh,[0],{60,22,2}},
   {hi,[0],{60,22,4}},
   {hi2,[0],{60,22,5}}},
   "Heat Index Input and Output",
   {"Temperature, Deg F  : ",
    "Relative Humidity, %  : ",
    "Heat Index, Deg F  :",
    "Heat Index, Deg F  :"},
   {" Air Temperature (80 to 104 °F)",
    " Relative Humidity (40 to 100 %)",
    " Heat Index from www.weatherimages.org",
    " Heat Index from www.4wx.com"},
   {t,rh,hi,hi2},{t,rh,hi,hi2});

  IF tmp==0 THEN
   STARTVIEW(-4,1);
   MSGBOX("End of Program");
   RETURN;
  END;
 UNTIL t>=80. AND t<=104. AND rh>=40. AND rh<=100.; 

 HeatIndexCalc();
END; // While

STARTVIEW(-4,1);
MSGBOX("End of Program");
END;

HeatIndexCalc()
BEGIN
// This is the 16 element equation used to convert
// dry bulb temperature (T) and relative humidity (RH)
// into the Heat Index. This equation works at
// dry bulb temperatures of 70°F and higher.
// Source: http://www.weatherimages.org/data/heatindex.html

//  Where:
//  hi = Heat Index
//  t = Temperature (° F)
//  rh = Relative Humidity (%)

tmp:=16.923;
tmp:=tmp+1.85212*10^(-1)*t;
tmp:=tmp+5.37941*rh;
tmp:=tmp-1.00254*10^(-1)*t*rh;
tmp:=tmp+9.41695*10^(-3)*t^2;
tmp:=tmp+7.28898*10^(-3)*rh^2;
tmp:=tmp+3.45372*10^(-4)*t^2*rh;
tmp:=tmp-8.14971*10^(-4)*t*rh^2;
tmp:=tmp+1.02102*10^(-5)*t^2*rh^2;
tmp:=tmp-3.8646*10^(-5)*t^3;
tmp:=tmp+2.91583*10^(-5)*rh^3;
tmp:=tmp+1.42721*10^(-6)*t^3*rh;
tmp:=tmp+1.97483*10^(-7)*t*rh^3;
tmp:=tmp-2.18429*10^(-8)*t^3*rh^2;
tmp:=tmp+8.43296*10^(-10)*t^2*rh^3;
hi:=tmp-4.81975*10^(-11)*t^3*rh^3;
hi:=ROUND(hi,0);

// Source: http://www.4wx.com/wxcalc/formulas/heatIndex.php
tmp:=-42.379;
tmp:=tmp+2.04901523*t;
tmp:=tmp+10.14333127*rh;
tmp:=tmp-.22475541*t*rh;
tmp:=tmp-6.83783*10^(-3)*t^2;
tmp:=tmp-5.481717*10^(-2)*rh^2;
tmp:=tmp+1.22874*10^(-3)*t^2*rh;
tmp:=tmp+8.5282*10^(-4)*t*rh^2;
hi2:=tmp-1.99*10^(-6)*t^2*rh^2;
hi2:=ROUND(hi2,0);
END;
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Division by 0 (zero) in an App - Han - 03-27-2017, 06:59 AM
RE: Division by 0 (zero) in an App - Han - 03-28-2017, 11:47 PM
RE: Division by 0 (zero) in an App - Bob Frazee - 03-30-2017 12:45 AM
RE: Division by 0 (zero) in an App - Han - 03-30-2017, 01:15 AM
RE: Division by 0 (zero) in an App - Han - 04-02-2017, 10:39 PM
RE: Division by 0 (zero) in an App - Han - 04-04-2017, 03:52 AM



User(s) browsing this thread: 1 Guest(s)