Difference between Real and Virtual Calculator
10-04-2017, 07:40 AM
Post: #1
 simone_71 Junior Member Posts: 8 Joined: Jun 2016
Difference between Real and Virtual Calculator
Hi to all. I'm current using a real Calculator with 12066 (2017 07 10) software version and Virtual calculator on my laptop with 11226 (2016 12 08) software version. As I know those version are the mos updated. Yesterday i wrote this simple code:
Code:
 //The formula to compute PT100/1000 is: // //R(t)=R(0)(1+At+Bt^2+c(t-100)t^2) // //​​where t is the temperature, R(0) is //the 0degree-resistance (100 or 1000) //The remaining parameters A, B and C //depend on the temperature standard in //use and might be measured by the sensor //manufacturer for additional accuracy. //For the ITU-90 standard they equal: // //A = 3.9083E10^-3 //B = -5.7750E10^-7 //C = -4.1830E10=12 for t<0 //    0.0 for t>=0 // //Simone Selleri 2017 EXPORT RTD(r,t,d) BEGIN 3.9083ᴇ-3▶A; 5.7750ᴇ-7▶B; -4.1830ᴇ-12▶C; r▶R; t▶T; d▶D; "R=D*(1+A*T+B*T^2+C*(T-100)*T^3)"▶E1; CASE IF R==0 AND T<0 THEN SOLVE(E1,R);END;   IF R==0 AND T>=0 THEN 0.0▶C;SOLVE(E1,R);END; IF T==0 AND R<>0 THEN SOLVE(E1,T);END; END; END;
This code is working fine on my real calculator, but is not possible to run on virtual one due a syntax error

Can someone explain me why it happens?
I always use the virtual calculator as "beta tester" for my programs, because is easier and quicker to write, save and test, but now i'm getting different behavior, I'm confused.
10-04-2017, 11:04 AM
Post: #2
 DrD Senior Member Posts: 1,066 Joined: Feb 2014
RE: Difference between Real and Virtual Calculator
The program provided doesn't work on either the physical calculator or the virtual calculator. There are several changes that could make this program run without error, which you might find useful.

Before suggesting anything, though, it would be helpful to provide an example of r,t,d input values, and a known result, (to confirm the program's output).

-Dale-
10-04-2017, 11:30 AM
Post: #3
 simone_71 Junior Member Posts: 8 Joined: Jun 2016
RE: Difference between Real and Virtual Calculator
The program is working on my real calculator with no problem.
the purpose of this program is to check and calibrate thermocouples.
the thermocouple is a sensor that is giving a resistance (in Ohm) changing with the temperature. PT100 is a thermocouple that give 100 Ohm at 0°C
PT1000 is a thermocouple that give 1000 Ohm at 0°C

R=D*(1+A*T+B*T^2+C*(T-100)*T^3)

where T is the temperature, D is the 0°C-resistance (100 or 1000) and the remaining parameters A, B and C are:
A = 3.9083E10^-3
B = -5.7750E10^-7
C = -4.1830E10=12 for t<0 or 0.0 for t>=0

Syntax:
RTD(r,t,d)
r= Reststance
t= Temperature
d=Thermocouple Type. the most common values are 100 or 1000

Example:
RTD(0,26.5,100) will give 110.397549938, that is the Resistance value for 26.5°C for a PT100 sensor

RTD(124.5,0,100) will give 62.1074171403, that is the Temperature value for 124.5 Ohm for a PT100 sensor
10-04-2017, 12:13 PM
Post: #4
 Didier Lachieze Senior Member Posts: 1,116 Joined: Dec 2013
RE: Difference between Real and Virtual Calculator
As far as I can see, your program relies on the active app being "Solve". Try pressing Apps, selecting "Solve", then "Home" and enter RTD(0,26.5,100).
10-04-2017, 12:23 PM
Post: #5
 simone_71 Junior Member Posts: 8 Joined: Jun 2016
RE: Difference between Real and Virtual Calculator
Maybe i'm not well explained.
My program works well on my physical calculator, I have no problem with that.
The problem is on Virtual Calculator on PC.
I got a syntax error on line 33,
I'm asking about the difference between physical and real calculators, both of them updated with the latest software version.
Thank you
10-04-2017, 12:36 PM
Post: #6
 DrD Senior Member Posts: 1,066 Joined: Feb 2014
RE: Difference between Real and Virtual Calculator
I set the active app to Solve, as Didier suggests, and the program does work, then, on the virtual calculator, with RTD(0,26.5,100) as the command entry line. 110.40 is the displayed result, and the Solve Symbolic View, E1, shows up as R=D*(1+A*T+B*T^2+C*(T-100)*T^3).

That was probably your design intention, so, I can confirm it works on this virtual calc, at least when Solve is the active app. STARTAPP() and STARTVIEW() might also be useful for you.
10-04-2017, 02:30 PM (This post was last modified: 10-04-2017 02:31 PM by Tim Wessman.)
Post: #7
 Tim Wessman Senior Member Posts: 2,083 Joined: Dec 2013
RE: Difference between Real and Virtual Calculator
As stated, the issue here is you are mixing application variables/functions with a global program that may or may not be active.

Is there a specific reason you are trying to store things into content of the Solve application? If so, the best way to handle things is make a copy of your solve app, and then put your program in the application program source file.

If you don't need the solve app, I'd recommend using the FNROOT command which is the correct global root finder.

If you want to keep it as a global program, and also want to blow out any content in the Solve app's E1, just qualify your call to the app function SOLVE.

Solve.SOLVE(E1...

TW

Although I work for the HP calculator group, the views and opinions I post here are my own.
10-05-2017, 07:34 AM
Post: #8
 simone_71 Junior Member Posts: 8 Joined: Jun 2016
RE: Difference between Real and Virtual Calculator
Quote:If you don't need the solve app, I'd recommend using the FNROOT command which is the correct global root finder.
I checked in the manual, but the explanation of this command is very poor. My equation have many variables and needs to be solved for two of them, according to the requirements. can you, if you can, make an example?
Because i don't really need to solve the equation in the solve app, i just need to solve it ;-)
moreover i repeat my question: why the same code is working in my real calculator and is not working in the virtual?
Maybe some wrong setting? If yes, where I can check?
10-06-2017, 05:49 AM
Post: #9
 cyrille de brébisson Senior Member Posts: 829 Joined: Dec 2013
RE: Difference between Real and Virtual Calculator
Hello,

You should be able to use
Solve.SOLVE(equation, var); directly... As in
Solve.SOLVE(sin(A)=B,A,1); // the 1 here is a guess
This would remove a lot of dependencies and most likely make things work better for you.

Cyrille

Although I work for the HP calculator group, the views and opinions I post here are my own. I do not speak for HP.
10-06-2017, 04:01 PM
Post: #10
 Tim Wessman Senior Member Posts: 2,083 Joined: Dec 2013
RE: Difference between Real and Virtual Calculator
(10-05-2017 07:34 AM)simone_71 Wrote:  moreover i repeat my question: why the same code is working in my real calculator and is not working in the virtual?

Hello,

Several people answered this already. You do NOT have the Solve app running/selected when you are editing your source file. Thus when it checks the code, it can't find SOLVE which is a solve app function and not a global system function

Solve.SOLVE fully qualifies the command and tells the system where to look. You currently have a dependency on the Solve app being active to use your program.

Solve.SOLVE replacing "SOLVE" would fix it.

SOLVE is basically identical to FNROOT. You aren't simultaneously solving with SOLVE - it can't do that. FNROOT is a drop in replacement in your source and will have no dependency on the solve app. If you got rid of storing into E1, you'd no longer be using anything in the solve app.

FNROOT(X^2-2,X,-2) -> ~-1.41
FNROOT(X^2-2,X,2) -> ~1.41

TW

Although I work for the HP calculator group, the views and opinions I post here are my own.
 « Next Oldest | Next Newest »

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