What is the best way to define exponential values in a protocol?
For example a value that can range between 1E-3 and 1E-10
Goals:
- readable in a data page
- able to trend
- able to add alarm thresholds
Would the scientificNotation option on the Measurement -> Type tag do what you are looking for?
How do you get it to work correct for small numbers?
When using universal notation, 2 decimals:
-If I perform a set from a QAction with 2235, then the UI shows 2,24E+003
-If I perform a set from a QAction with double 0.02235, then the UI shows 2,00E-002
When going one digit smaller to 0.002235, then the UI shows 0,00E+000 so I need to increase the digits to 3, and then it shows 2,000+E-003
It seems that the decimals is used duplicate: it’s used for the “raw” value to take that number of decimals, but it’s also used to display the “E” value with such amount of decimals and how smaller the number is how more “0” are appended. E.g. 0.000002235 if I specify 6 decimals then it’s capping the raw value to 0.000002 (6 decimals) and then shows it as 2.000000E-006 . How did you get to let it display e.g. 2 decimals but still display a value of E-006? How does the parameter definition look like?
I have only used it before to represent large numbers, so I had not noticed the issue Laurens is mentioning, I tried playing around with the Interprete and Display decimals tag but the behavior seems to always be the same.
Could this be something to improve on as a new feature, where, for instance, the decimals on the Display tag are used to indicate how many decimals are shown in the scientific notation and the decimals on the Interprete are used to limit the actual precision of the raw value?
I have created task 132515 for this so we will be able to display E-006 without having to specify decimals > 6, with this task it shouldn’t cap the original raw value before converting to the scientific equivalent.
At this moment you're going to have to parse the incoming value and choose a fixed unit (e.g. E-6), this way you'll be able to trend and put alarm thresholds.
It will not be ideally readable as you could have E-3 up to E-10 values that will be a very large or small number being displayed in the E-6 unit.
In the future we're having the dynamic unit which will allow the user to select an appropriate unit, I don't know if we will be able to dynamically change it from inside the driver. That will have to be checked once that feature is available.
Thank you for the answer.
Ideally the Exx is added automatically when a number is very small / large and is displayed next to the unit.
Example: the speed of light displayed value = 2.998 E08 m/s. internal value = 299792458 m/s
This is correct. Just some more info about the dynamic units:
Support for dynamic units will be added in 10.0.9 (RN26330) in Visio. However, exponential notation is currently not a part of that feature. So you will be able to display a value in the best fitting unit (for example Hz for small numbers, Ghz for big numbers), but it’s currently not possible yet to automatically convert 1000 E-6 to 1 E-3.
It would certainly be interesting to have that functionality (with and without units). Feel free to create a task to request this feature.
Thanks, this is indeed what I need.
Only the trend graph is now no longer readable:
– only zooms until 0.1 steps
– selected value shows the full (very small / large value)
Could the graph apply a similar dynamic display?
Is this feasible for a new cube feature?