Welcome Guest! To enable all features please Login. New Registrations are disabled.

Notification

Icon
Error

Login


Options
Go to last post Go to first unread
Offline callmeishmael  
#1 Posted : 06 May 2010 22:28:22(UTC)
callmeishmael


Rank: Member

Groups: Registered
Joined: 29/04/2010(UTC)
Posts: 15
Man
Location: Italy

Was thanked: 4 time(s) in 2 post(s)
Only today I noticed that SMath handles also non linear unit conversion like temperatures.
Well done :-), it took more than 10 years to have the same in Mathcad...
Just I would like to discuss with the gurus and the Developer on some tricky situation that may lead to confusion for unskilled users.
(by the way, I cannot insert units in live mode, is a keyboard problem? the ' key does not work)

If we define
t1=20°C
and

t2=30°C

How much is t1+t2?

t1+t2=596.3K
or 323.15°C and not 50°C
What SMath does is to convert internally t1 and t2 in Kelvin adding 273.15, and then revert it back to °C subtracting again 273.15

I do not consider it a bug, but a consequence of the fact that non linear unit scaling is evil, but this may lead to unexpected results for novice users.
What Mathcad does in this case is to add a further unit "Delta °C", "Delta °F".

DeltaC=1 K
DeltaF=5/9 K

So one has to define t1 as 20°C, t2 as 20°DeltaC, so the sum returns t2+t1=323.15K=50°C as one would expect.

I'm not sure this would be the smartest approach, however, and it can be easily achieved by adding the custom units in SMath.

What do you think about?

Wanna join the discussion?! Login to your SMath Studio Forum forum account. New Registrations are disabled.

Offline maweilian  
#2 Posted : 06 May 2010 23:34:09(UTC)
maweilian


Rank: Advanced Member

Groups: Registered
Joined: 09/01/2010(UTC)
Posts: 102
Man
United States
Location: Oregon, USA

Was thanked: 5 time(s) in 5 post(s)
Just for your reference, this topic was also touched on in this thread:

Variable assignment bug

However, I think this topic may be worthy of more discussion.

Edited by user 06 May 2010 23:37:00(UTC)  | Reason: Not specified

Will Massie
Mechanical Engineer
Oregon, USA
Offline omorr  
#3 Posted : 06 May 2010 23:35:32(UTC)
omorr


Rank: Administration

Groups: Registered, Advanced Member
Joined: 23/06/2009(UTC)
Posts: 1,740
Man
Serbia

Was thanked: 318 time(s) in 268 post(s)
Hello callmeishmael,

Look at these posts please http://en.smath.info/forum/default.aspx?g=posts&t=400. This is about the temperature units and temperature differences you are talking about. The temperature differences can be added as new defined units. However, I agree with you and think it might be well enough to add the temperature differences ("Delta °C", "Delta °F" ) into the tempreture units list of SMath.

Regards,
Radovan

EDIT: Will pointed out on the same thread. Just to note, one must take extra care when using the negative relative temperatures (°C,°F).

Edited by user 06 May 2010 23:45:26(UTC)  | Reason: Not specified

When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
Offline Dave  
#4 Posted : 24 September 2010 15:39:15(UTC)
Dave

Rank: Newbie

Groups: Registered
Joined: 24/09/2010(UTC)
Posts: 3

I don't know if what I have to say will add any value to the discussion about relative units, but here goes.

I work a LOT with relative and absolute units, due to hydraulic and pneumatic calculations.
psiA = Absolute pressure (referenced to vacuum = 0 psi)
psid = differential pressure (referenced to another pressure)
psig = gage pressure (referenced to ambient pressure (nominally 14.7 psiA)

The relative Temperatures scales are the same.
These are all a big pain to keep straight, or sometimes even to determine what units a given formula is written to use.
So of course when I started using sMath, and found out that it even does UnitsClap , I had to try making a few of my own. Of course, I started with the ones that are the most problematic, not knowing any betterConfusion
I didn't succeed, but I noticed that some are referring to relative units as non-linear units, and that struck me as incorrect. The temperature scales are all linear, but their scale origins do not coincide.

That made me notice that all the built-in unit conversions are ratiometric (i.e. multiplication/division) only, and offset scales require addition/subtraction to convert. This is where the problem is, I think.

I tried to define psig = psi + 14.7, and got all sorts of odd results.
I'm sorry I have no concrete suggestions for how to handle this, but I though addressing the terminolgy might spur some useful ideas for implementation. I know it makes the conversion math horrible, and that's all I can add.
Offline omorr  
#5 Posted : 24 September 2010 17:00:01(UTC)
omorr


Rank: Administration

Groups: Registered, Advanced Member
Joined: 23/06/2009(UTC)
Posts: 1,740
Man
Serbia

Was thanked: 318 time(s) in 268 post(s)
Hello Dave,

I think you can not make new units that way. SMath uses absolute pressure units (psi=psia=psiA). The psig can not be defined, it could be just introduced as a unit in SMath. If you want to calculate both with absolute and gauge pressure, the workaround is to just make some functions:

psig(Pabs)←Pabs-14.7*psi
Giveing Pabs in absolute pressure and obtaining results in gauge pressure

psia(Pgauge)←Pgauge+14.7*psi
Giveing Pgauge in gauge pressure and obtaining results in absolute pressure

Arguments to the functions must have pressure units or "Units do not match" error will be issued.

You can even put the apostrophe in front of function names and arguments like this
(type it as you see it below)
Code:
'psig('Pabs):'Pabs-14.7*'psi
'psia('Pgauge):'Pgauge+14.7*'psi

and the look will be italized and blue - like the default units color and look.
Open in SMath Cloud
Regards,
Radovan

Edited by user 24 September 2010 17:25:44(UTC)  | Reason: Not specified

When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
Offline Dave  
#6 Posted : 24 September 2010 19:34:00(UTC)
Dave

Rank: Newbie

Groups: Registered
Joined: 24/09/2010(UTC)
Posts: 3

Thanks, Radovan

That was very helpful. I am starting to get the picture. Good
I didn't understand about the ' key for entering Units, so I had a big mess, with "function not defined" messages all over the place. Sad
I created three additional units 'psiA:='psi, 'psig:='psi, and 'psid:='psi, and now my calculations are displayed unambiguously.

It seems like the automatic unit conversion is the problem with the temperature conversions people are complaining about.
Internal calculations are handled in the default units (K). The problem seems to me that sMath understands every conversion to be an absolute conversion. The results of some temperature calculations are relative. A Kelvin degree is literally the same as a Celsius degree, by definition.
If you measure 350K on one side of a barrier, and 1500K on the other side of the barrier, the differential temperature is 1150K, but if you override the units to °C, the result will be 876.85°C, which is definitely not a correct result, and if the input to your equation is supposed to be the temperature difference, you will have a disastrous miscalculation. The correct differential temperature in °C is also 1150°C. The principle is the same if the units are overridden to °F, and the result will be 1610.33°F, which will also be wrong. The differential temperature in °F is 2070°F.
The problem is mixing of the concept of conversion and scaling. I don't see how sMath could be programmed to correctly recognize which conversion is appropriate under all circumstances. Your suggested workaround of creating the conversion functions is a good one, and I will be applying that, and creating additional variables as necessary...
Dave

P.S. I would post a screenshot or sMath code, but I haven't figured out how to do that yet...
Offline maweilian  
#7 Posted : 24 September 2010 20:20:25(UTC)
maweilian


Rank: Advanced Member

Groups: Registered
Joined: 09/01/2010(UTC)
Posts: 102
Man
United States
Location: Oregon, USA

Was thanked: 5 time(s) in 5 post(s)
Here is a worksheet I did recently that shows how to work with differences in relative temperatures. I think it is a good example of how to deal with the issue being discussed here. I know that this solution was presented by Radovan in previous threads (Variable assignment bug), but I think that seeing a practical example is very helpful.

Engine Heat Rejection Calcs.pdf
Engine Heat Rejection Calcs.zip

Edited by user 24 September 2010 22:56:00(UTC)  | Reason: Not specified

Will Massie
Mechanical Engineer
Oregon, USA
thanks 1 user thanked maweilian for this useful post.
on 24/09/2010(UTC)
Offline Dave  
#8 Posted : 26 September 2010 07:11:06(UTC)
Dave

Rank: Newbie

Groups: Registered
Joined: 24/09/2010(UTC)
Posts: 3

That's exactly it. Setting up a unit that accommodates the scaling factor, but without including the offset, and using (or not using, as appropriate) a function to deal with the correct choice of offset.
Great advice from both of you. I did read the other thread about the variable assignment bug, but I must admit I still don't know exactly what you guys are talking about... Blush I have only been using the program for about three days, and I am still easily confused...
I love the way sMath Studio lets you set up a calculation sheet with equations that actually look (mostly) like the formula in the book! Interspersing explanatory notes (and pictures!) right in with the formulas and definitions is such a super cool feature that words fail me.
One of the biggest headaches with doing calcs in Excel or any programming language is checking that you are actually doing the calculation that the formula describes. And incorporating useful notes in Excel sheets is a pain.
cos(x^2)is much easier to interpret than COS((A$4$)^2) especially for something like the formula for calculating orifice flow.
http://en.wikipedia.org/wiki/Or..._flow_through_an_orifice
There's a reason those pipe flow calculation programs cost money Dry
They know you'd pay someone else to set it up...
Of course there's always guys like us...Umnik

Kudos to Andrey for developing such a cool program, and thanks to you guys for helping a n00b out. Good

Dave

P.S. I tried to use the Thanks button, but it doesn't work for me... :'( Consider yourselves thanked.Clapping
Offline omorr  
#9 Posted : 26 September 2010 09:15:47(UTC)
omorr


Rank: Administration

Groups: Registered, Advanced Member
Joined: 23/06/2009(UTC)
Posts: 1,740
Man
Serbia

Was thanked: 318 time(s) in 268 post(s)
You are welcome Dave Good ,
Dave wrote:
I did read the other thread about the variable assignment bug, but I must admit I still don't know exactly what you guys are talking about... Blush I have only been using the program for about three days, and I am still easily confused...

Do not hesitate to ask about everything that confuses you. We might know the answer or might stay confused all together Good . Anyway, I would suggest you to read some Tutorials, Examples and other stuff on the Wiki. Regarding to your interests (hydraulics), I would suggest you to pay attention on the Tutorials and Examples made by Prof. Gilberto Urroz.

Regards,
Radovan

Edited by user 26 September 2010 09:33:52(UTC)  | Reason: Not specified

When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.