Post Reply 
How can I maintain a variables value when editing a Program or App
12-21-2014, 11:35 PM (This post was last modified: 12-21-2014 11:41 PM by Bob Frazee.)
Post: #7
RE: How can I maintain a variables value when editing a Program or App
Well, I am still unable to get the instructions to work. This is an APP. I need to preserve the numerical values of DegF and Mph during editing of the APP code and am attempting to store the variables in the APP's note file (called info, I believe). The code below works, so can someone modify the code with the above instructions that Didier and Cyrille has provided, so I don't lose the numerical values of DegF and Mph when I edit the APP. Also, I was unable to find the Instruction SIGMALIST in the online manual or calculator help. I am using Rev 6975 firmware update. Here's the code;
Code:

The name of the APP is "WindChillApp"

//Variables... 
DegF;Mph;
LOCAL wct,wcto,ft;
Local Counter,ChooseVar;

WindChillIntroDisplay();
InputPgm();
FrostBiteEqn();
WindChillEqn();
OutputPgm();

EXPORT WindChillApp()
BEGIN
END;

VIEW "Start WindChill",START()
BEGIN
LOCAL K;

REPEAT
STARTVIEW(-1,1);
WindChillIntroDisplay();
REPEAT
Counter:=Counter+1;
IF Counter>5 THEN
MSGBOX("Program is Paused
Any Key to Continue");
Counter:=0;
BREAK;
END;
WAIT(1);
K:=GETKEY;
UNTIL K>−1;

Counter:=0;

IF K==42 OR K==43 THEN
InputPgm();
END;

IF K==30 THEN
WindChillEqn();
FrostBiteEqn();
STARTVIEW(-1,1);
OutputPgm();
WAIT(0);
END;

UNTIL K==4;
STARTVIEW(-4,0);
END;

WindChillIntroDisplay()
BEGIN
TEXTOUT("1: DegF= "+DegF,-15,9);
TEXTOUT("2: Mph= "+Mph,-15,7);
TEXTOUT("Enter: Calculate WindChill",-15,1);
TEXTOUT("Esc=Quit",-15,-1);
END;

InputPgm()
BEGIN
REPEAT
INPUT({DegF,Mph},"Input Values",{"DegF= : ","Mph=  : "},{"Air Temperature (-45 to 40 °F)","Wind Speed (3 to 60 Mph)"},{DegF,Mph});
UNTIL DegF>=-45. AND DegF<=40. AND Mph>=3. AND Mph<=60.; 
END;

FrostBiteEqn()
BEGIN

//Calculate frostbite time
CASE
IF DegF≤-45 AND Mph≥12 THEN 5▶ft END;
If DegF≤-45 and Mph≥0 Then 10▶ft END;
If DegF≤-40 and Mph≥14 Then 5▶ft END;
If DegF≤-40 and Mph≥0 Then 10▶ft END;
If DegF≤-35 and Mph≥17 Then 5▶ft END;
If DegF≤-35 and Mph≥7 Then 10▶ft END;
If DegF≤-35 and Mph≥0 Then 30▶ft END;
If DegF≤-30 and Mph≥21 Then 5▶ft END; 
If DegF≤-30 and Mph≥7 Then 10▶ft END;
If DegF≤-30 and Mph≥0 Then 30▶ft END;
If DegF≤-25 and Mph≥26 Then 5▶ft END;
If DegF≤-25 and Mph≥9 Then 10▶ft END;
If DegF≤-25 and Mph≥0 Then 30▶ft END;
If DegF≤-20 and Mph≥37 Then 5▶ft END;
If DegF≤-20 and Mph≥12 Then 10▶ft END;
If DegF≤-20 and Mph≥0 Then 30▶ft END;
If DegF≤-17 and Mph≥35 Then 5▶ft END;
If DegF≤-15 and Mph≥42 Then 5▶ft END;
If DegF≤-15 and Mph≥16 Then 10▶ft END;
If DegF≤-15 and Mph≥45 Then 30▶ft END;
If DegF≤-12 and Mph≥45 Then 5▶ft END;
If DegF≤-10 and Mph≥57 Then 5▶ft END;
If DegF≤-10 and Mph≥22 Then 10▶ft END;
If DegF≤-10 and Mph≥0 Then 30▶ft END;
If DegF≤-5 and Mph≥33 Then 10▶ft END;
If DegF≤-5 and Mph≥7 Then 30▶ft END;
If DegF≤-2 and Mph≥35 Then 10▶ft END;
If DegF≤0 and Mph≥54 Then 10▶ft END;
If DegF≤0 and Mph≥12 Then 30▶ft END;
If DegF≤2 and Mph≥55 Then 10▶ft END; 
If DegF≤2 and Mph≥15 Then 30▶ft END;
If DegF≤5 and Mph≥28 Then 30▶ft END;
If DegF≤7 and Mph≥30 Then 30▶ft END;
If DegF≤10 and Mph≥52 Then 30▶ft END;
If DegF≤12 and Mph≥55 Then 30▶ft END; 
" NOT LIKELY"▶ft;
END;
END;

WindChillEqn()
BEGIN
//New WindChill Equation
35.74+.6215*DegF−35.75*Mph^.16+.4275*DegF*Mph^.16▶wct;
round(wct,0)▶wct;

//Old WindChill Equation(Prior to 2001)
.0817*(3.71*Mph^.5+5.81-.25*Mph)*(DegF-91.4)+91.4▶wcto;
round(wcto,0)▶wcto;
END;

OutputPgm()
BEGIN
TEXTOUT("DegF= "+DegF,-15,9);
TEXTOUT("Mph= "+Mph,-15,7);
TEXTOUT("New WindChill= "+wct,-15,5);
TEXTOUT("Old WindChill= "+wcto,-15,3);
TEXTOUT("Frostbite,≤min "+ft,-15,1);
TEXTOUT("Enter=Back",-15,-1);
END;
Thanks
RCF
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: How can I maintain a variables value when editing a Program or App - Bob Frazee - 12-21-2014 11:35 PM



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