Proektsoftbg / Calcpad

Free and open source software for mathematical and engineering calculations.
https://calcpad.eu
MIT License
349 stars 42 forks source link

Incorrect Celsius behaviour #317

Open escull opened 3 months ago

escull commented 3 months ago

Hello!

I think there is a problem with temperature calculations, Calcpad 6.2.3.

°C seems to be behaving like Δ°C not like scaled K.

`t_1 = 25°C t_2 = 100°C t_3 = t_2/t_1

t_1 = 25°C|K t_2 = 100°C|K t_3 = t_2/t_1 `

image

Thanks Ed

Proektsoftbg commented 3 months ago

Hi! I am not sure that I understand what is the problem. Both calculations look correct for me. Can you please specify what do you expect to get.

prfpeste commented 3 months ago

Well this is about physics. You never divide or multiply Temperatures with the Unit °C, you have first to convert into Kelvin, then execute the division and then convert back into °C, otherwise you get physical crap.

Proektsoftbg commented 3 months ago

@prfpeste Thank you! But if the problem in in physics, then it requires "physical" solution. Just do your calcs in Kelvins explicitly. Otherwise, it will be very confusing for simple engineers like me, who are not professional physicists, to see: 100°C/25°C = 1.25.

prfpeste commented 3 months ago

Well, I think this is a bit more complex than you assume. Basically, for a simple engineer to calculate 100°C/25°C=4 is dangerous, as this will result in wrong designs. °C (as well as °F) are units which require for each calculation always a transformation in the basic SI units. Engineers in Europe tend to use °C, because they have a good feeling about what it means. I give you a brief example. In thermodynamics, you calculate the states e.g. of an adiabatic state change by:

T2/T1 = (p2/p1)^((k-1)/k)

where T is the temperature, p the pressure and k the isentropic coefficient.

If you enter the Temperatures in °C, this results in a complete different pressure ratio, than if you do it the proper way, to calculate in Kelvin. However, as (especially the simple) engineers tend to enter numbers in the units they are used and as they assume, that the tools work proper in the background, they will likely fail with their calculations. Assume you layout a pressure vessel with this calculation and receive a wrong number, and in real live for the according temperature change it would explode etc..

The best you could do is, for every calculation perform in the background a transformation into basic SI units, then perform the calculations, and thereafter provide the output in the basic units, and the user shall by hand decide, if he likes a different unit for the output.

Proektsoftbg commented 3 months ago

Thank you! I think I can see now. I will check this out.

escull commented 3 months ago

Apologies for my absence, I have been on honeymoon for a while.

@prfpeste excellent explanation!

I am an electronics guy and tend to work in K. Sometimes I work in C for reports because it is easier for a wider non technical team to understand (or get a "feel").

As a point of interest here is the output from a commercially available tool.

image
Proektsoftbg commented 3 months ago

Thank you! I got it. I will adjuct the math in Calcpad accordingly. It is never too late to learn something new. :)