View Issue Details

IDProjectCategoryView StatusLast Update
0003137FreeCADBugpublic2017-07-24 14:58
Reporterm42kus Assigned Towmayer  
PriorityhighSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version0.17 
Target Version0.17Fixed in Version0.17 
Summary0003137: Unit UserString wrong
Description
Quantity("0.237 W/m/K")
# 237 mm*kg/(s^3*K)
s = Quantity("0.237 W/m/K").UserString
# u'237.000 W/mm/K'
Quantity(s)
# 2.37e+08 mm*kg/(s^3*K)

I think the problem here is obvious: mm*kg/(s^3*K) is not the same as W/mm/K (= kg*m^2/(mm*s^3))
Additional InformationOS: Linux
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.11479 +72 (Git)
Build type: Debug
Branch: exec_framework
Hash: 10c18f28f8bfeba64abc83f4c3a45543ccb82643
Python version: 2.7.13
Qt version: 5.9.0
Coin version: 3.1.3
OCC version: 7.1.0
Tagsunits
FreeCAD Information

Activities

Kunda1

2017-07-24 10:25

administrator   ~0009804

Related forum thread: https://forum.freecadweb.org/viewtopic.php?f=18&t=22576&p=183698#p183698

wmayer

2017-07-24 11:36

administrator   ~0009805

Last edited: 2017-07-24 11:36

Am I right that the first and third expressions are correct? It's on the second one that is wrong which should be:
u'237.000e-6 W/mm/K'

m42kus

2017-07-24 11:53

developer   ~0009806

Yes, that is correct.

m42kus

2017-07-24 12:06

developer   ~0009807

Although I would prefere "237.0 mW/mm/K".

wmayer

2017-07-24 12:29

administrator   ~0009808

This commit introduces the bug:
https://github.com/FreeCAD/FreeCAD/commit/f9c5661096ade266dd2981afe05ae47043959d61

wmayer

2017-07-24 14:58

administrator   ~0009809

This fixes the issue: https://github.com/FreeCAD/FreeCAD/commit/7ab8a9996d47e8858e9be6ddaf07eaf5e5ab7378

And I have found a good way to perform consistency checks. If you have a certain quantity q then q.UserString must be equal to Quantity(q.UserString).UserString.

Now for all the more difficult expressions the tests can be added to testSelfConsistency. This way we can also verify that the parser can handle the output string.

Issue History

Date Modified Username Field Change
2017-07-24 06:57 m42kus New Issue
2017-07-24 06:59 m42kus Tag Attached: units
2017-07-24 10:25 Kunda1 Note Added: 0009804
2017-07-24 11:36 wmayer Note Added: 0009805
2017-07-24 11:36 wmayer Note Edited: 0009805
2017-07-24 11:53 m42kus Note Added: 0009806
2017-07-24 12:06 m42kus Note Added: 0009807
2017-07-24 12:29 wmayer Note Added: 0009808
2017-07-24 14:58 wmayer Assigned To => wmayer
2017-07-24 14:58 wmayer Status new => closed
2017-07-24 14:58 wmayer Resolution open => fixed
2017-07-24 14:58 wmayer Fixed in Version => 0.17
2017-07-24 14:58 wmayer Note Added: 0009809