How to find out entered unit of variable?

How to find out entered unit of variable? - Сообщения

#1 Опубликовано: 03.04.2018 10:10:57
VeroAl

VeroAl

0 сообщений из 2 понравились пользователям.

Группа: User

Hello all,

I have just come across SMath a couple of weeks ago and I enjoy using it more and more. I've finally stumbled across a problem I could not solve so far and would like to know if you SMath cracks have an idea.

I would like to create a wrapper function for some CoolProp functions and use different parameters according to the unit of the input variable (if the relative or mass-specific air humidity was entered):
Units.PNG
I have tried the special function UnitsOf(), but it only returns the base unit like the special function UoM() of the variable (I guess because SMath saves the variable internally with the base unit). I am looking for a way to find out, which unit was entered by the user when defining the variable. Does anybody know which function I could use or does anybody have an idea how I could achieve the input unit detection?

Thank you in advance for your help!
#2 Опубликовано: 03.04.2018 11:06:15
Arie

Arie

93 сообщений из 285 понравились пользователям.

Группа: User

As far as I know this is not possible. I recall seeing some discussions in the past about carrying forward the units as defined by the user at entry, but that has not been implemented and I'm not sure if it's planned or not.
Feel free to join the SMath Studio Users Discord Channel: https://discord.gg/PayZpJW
#3 Опубликовано: 03.04.2018 11:38:47
Martin Kraska

Martin Kraska

1222 сообщений из 2150 понравились пользователям.

Группа: Moderator

You might use an undefined custom unit 'g/kg for mass specific humidity. This gets carried on because SMath has no idea what to do with it.

unittest.png
unittest.sm (5 КиБ) скачан 38 раз(а).
Martin Kraska Pre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
1 пользователям понравился этот пост
frapuano 03.04.2018 17:29:00
#4 Опубликовано: 03.04.2018 20:17:22
Jean Giraud

Jean Giraud

983 сообщений из 6866 понравились пользователям.

Группа: User

Wrote

I would like to create a wrapper function for some CoolProp functions and use different parameters according to the unit of the input variable (if the relative or mass-specific air humidity was entered):


==============================
That's what I know about CoolProp: The package was developed by Valery & al.
MEI [Moscow Engineering Institute]. The package was adapted for Mathcad 11.
It was available from Valery Web. MAS.
Essentially the package like IAPWS is based on standard properties [STP].
Thus you may have to convert the actual properties to STP.
On the other hand, if you are looking for air specific gravity at altitude
or at measured pressure, it comes from another standard. NASA has their own
but the one I'm familiar is ISA [International Standard Atmosphere].
Water is much easier than air !

Jean
#5 Опубликовано: 05.04.2018 06:50:14
VeroAl

VeroAl

0 сообщений из 2 понравились пользователям.

Группа: User

Thank you for the information and thanks for the workaround idea, Martin.

I decided to redefine the percent unit so that I can easier enter the g/kg ratio. The disavantages are that I have to use the unit % for relative humidity and that I cannot convert other ratios or efficiencies directly into percentages, but have to do it manually by multiplying it with 100 % (which is okay for me):

Units2.PNG


(I think CoolProp was mainly developed at the University of Liège in Belgium)
#6 Опубликовано: 05.04.2018 10:27:41
Martin Kraska

Martin Kraska

1222 сообщений из 2150 понравились пользователям.

Группа: Moderator

I would be very cautious with re-definition of built-in units. This increases the chance for your document to be misunderstood (including by yourself).
What was the disadvantage of defining a custom unit "g/kg"?
Martin Kraska Pre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
1 пользователям понравился этот пост
frapuano 05.04.2018 10:44:00
#7 Опубликовано: 05.04.2018 12:07:19
Jean Giraud

Jean Giraud

983 сообщений из 6866 понравились пользователям.

Группа: User

Wrote

(I think CoolProp was mainly developed at the University of Liège in Belgium)



Ian Bell, Bell Thermal Consultants
Jorrit Wronski, IPU Refrigeration and Energy Technology, Kgs. Lyngby, Denmark
Sylvain Quoilin, Vincent Lemort, Thermodynamics Laboratory, University of Liege, Liege, Belgium

#8 Опубликовано: 05.04.2018 12:10:24
Jean Giraud

Jean Giraud

983 сообщений из 6866 понравились пользователям.

Группа: User

Wrote

I would be very cautious with re-definition of built-in units.
This increases the chance for your document to be misunderstood (including by yourself).
What was the disadvantage of defining a custom unit "g/kg"?


Remember: Mike had long comments about CoolProp

#9 Опубликовано: 05.04.2018 12:24:32
Jean Giraud

Jean Giraud

983 сообщений из 6866 понравились пользователям.

Группа: User

Wrote

I decided to redefine the percent unit so that I can easier enter the g/kg ratio.
The disavantages are that I have to use the unit % for relative humidity and that I cannot convert
other ratios or efficiencies directly into percentages, but have to do it manually by multiplying
it with 100 % (which is okay for me):



Cross check your calculations

https://www.engineeringtoolbox.com/moist-air-properties-d_1256.html

That reminds me to convert my Mathcd Psychro => Smath


  • Новые сообщения Новые сообщения
  • Нет новых сообщений Нет новых сообщений