cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X

Error in script: "These values cannot be compared"

fbartyzel
1-Newbie

Error in script: "These values cannot be compared"

Hello everyone!

I'm a new user of Mathcad and I encountered some difficulties. I need to write a mathcad script which would allow me to calculate output parameters of air in Earth-To-Air Heat Exchanger (temperature, relative humidity and humidity ratio).

I think that the code is OK but Mathcad is showing me an error as I said in title. Could anybody help me with this?

Best regards,

Filip

10 REPLIES 10
LucMeekes
23-Emerald III
(To:fbartyzel)

No clue yet. Unfortunately I cannot inspect in detail as I'm limited to Express Prime (= no programming).

Try to inspect the value of Delta-t just before the if-statement:

insert a "return Delta-t" just above the offending if.

It will break your loop, but the function will output the value of Delta-t at that moment.

Then check if it is logical that Delta-t cannot be compared to 0...

Success!
Luc

It returns deltaT=-1,398*10^3... This value is wrong but it still should compare it with 0.

LucMeekes
23-Emerald III
(To:fbartyzel)

I've checked the 'label's of the two variables Delta-t (before the If statement) and the one in the if-statement.

The first is labelled as a 'variable', the second is both 'automatic' AND 'variable' (My cursor is in between the Delta and the t.)

If you change that one to 'variable' it might work.

Success!
Luc

Unfortunately it does not change a thing 😕 It still gives me the same error.

Can you post a screnshot or pdf print of your file.

Many of us are limited (?) to Version 3.0 and so can't read your file.

And, no! - You can't save in 3.0 format - is a PTC software.

Can it be an .xps file?

> Can it be an .xps file?

Yes, thats OK.

But unfortunately I was not able to spot anything suspicious. Some things are done rather cumbersome and elaborate and could be achieved with less effort (and less lines of code) but basically your program should run OK. At the end you do some bad think with t_d (you turn it into a vector) but is has no effect as you don't use it afterward and you redefine it every time the loop starts again. So this should do no harm.

What I would do if I had access to the sheet is to check labeling (as Luc has done) and to check if you had used the correct type of index for all variables (literal vs. matrix index).

Have you checked what Luc has suggested?

How about copying the Delta t from the line above the comparison and copy it over the Delta t below?

Or replace the Delta  t in the if statement by t_s - t_d.

Have you already tried this?

I've done everything as you said above but still no clue. I've found some small mistakes in equation but it still does break the if operator... I've labelled all variables as variables and constants as constants but still... In attachment is the most recent version, and code without programming to check if calculations are correct.

The weird thing is that when I change the grater than zero mark to less than 0 the scripts is working but as you can expect the results are wrong...

I try in same case at first to create a calculation operator by operator and at second to create a program

See please here Study 4. My first Power Engineering Mathcad-calculation

figs 4.5 and 4.6 

Hello!

I made corrections as some of you mentioned above. The if function is working now correctly. But I have encountered another error. RH (relative humidity) is not calculated correctly (it's a value between 0-1, since it goes above 1 I think that there is an error somewhere, but I cannot find it...). Anybody see an error in my script? I would appreciate any help. Thank you in advance!

Top Tags