LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I reach the Limits on a DBL Slider

Update: I contacted NI by phone and they told me that the bug has been reported to the developers in the USA. All I can do is hope that the bug will be fixed soon.
0 Kudos
Message 11 of 39
(1,487 Views)
Update: I installed LabVIEW 9.0. The strange behavior is still there. Still no solution to my problem. At the moment we are forced to sell our product with buggy software...
0 Kudos
Message 12 of 39
(1,417 Views)

Hi AStankov,

 

what about this little work-around:

SlideLimit.png

You check the limits in an event case and set only the increment of the slider...

The problem mainly results from límited resolution of DBL floats and your use of a "0.1" increment, which cannot be represented as DBL correctly.

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 13 of 39
(1,411 Views)

Hi GerdW,

 

Thank you for the tip! Unfortunately I use Value Change event cases which handle multiple slides at the moment. Also my limits need to be read from a device configuration. Additionally I use a queued state machine. So I will have to check if this can be implemented. And after all I bought LabVIEW to make my life easier and not to fix its problems with workarounds...If I remember I had tried a similar workaround in the past but could not solve the problem.

 

Best regards,

Anguel

0 Kudos
Message 14 of 39
(1,403 Views)

AStankov wrote:

Hi GerdW,

 

Thank you for the tip! Unfortunately I use Value Change event cases which handle multiple slides at the moment. Also my limits need to be read from a device configuration. Additionally I use a queued state machine. So I will have to check if this can be implemented. And after all I bought LabVIEW to make my life easier and not to fix its problems with workarounds...If I remember I had tried a similar workaround in the past but could not solve the problem.

 

Best regards,

Anguel


Ouch!  From what I have read so far, this isn't necessarily a LabVIEW issue as much as it's an issue with how computers represent floating point numbers?

 

Bill

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 15 of 39
(1,384 Views)

Hi Anguel,

 

I have to echo Bllko's sentiment when he questioned if you read;

 

"

The problem mainly results from límited resolution of DBL floats and your use of a "0.1" increment, which cannot be represented as DBL correctly.

"

 

Please see these links on "epsilon" for more reading on this subject.

 

Only an old analog computer could do an exact match and trust me they where much hardrer to program (required a soldering iron or a wire-wrapping tool).

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 16 of 39
(1,378 Views)

Anguel,

 

If you really need a slider which can only go in 0.1 increments (as perceived by the user), make the control an integer control and divide by ten.

 

If the integer control has a range of -450 to +450 this will give you what you seem to be seeking.  Adding DBL indicator(s) will allow the display of the decimal point.  Notice that I hid the DBL slide indicator behind the I32 slide control.  The Control's scale is blank.  The Indicator's scale is visible.  The Numeric indicator is positioned over the Digital display of the I32 control so that the decimal point shows.  Sample VI is in LV2009.

 

Lynn

 

 

Message 17 of 39
(1,371 Views)

Thanks to all for the comments and workarounds. As I already said I would have to rewrite my complete code if I wanted to try to implement them. Adding the workarounds would also render my code even slower than it is at the moment. I don't think that this was my intention when I paid for LabVIEW.

 

As far as I see it is simple to solve the problem. The problem is that LabVIEW adds the increment every time the number in the digital display is being increased by the user. The error caused by DBL representation sums up and when I want to increase from 44.9 to 45 LabVIEW calculates the 45 as 45.00000000000000XXX which is greater than 45 and does not allow this number. If there were an option in LabVIEW to make the 45.00000000000000XXX coerce to the upper limit which is 45 everything would be fine...

 

Best regards,

Anguel

 

 

0 Kudos
Message 18 of 39
(1,359 Views)

AStankov wrote:

Thanks to all for the comments and workarounds. As I already said I would have to rewrite my complete code if I wanted to try to implement them. Adding the workarounds would also render my code even slower than it is at the moment. I don't think that this was my intention when I paid for LabVIEW.

 

As far as I see it is simple to solve the problem. The problem is that LabVIEW adds the increment every time the number in the digital display is being increased by the user. The error caused by DBL representation sums up and when I want to increase from 44.9 to 45 LabVIEW calculates the 45 as 45.00000000000000XXX which is greater than 45 and does not allow this number. If there were an option in LabVIEW to make the 45.00000000000000XXX coerce to the upper limit which is 45 everything would be fine...

 

Best regards,

Anguel

 

 


Wow, now you're blaming LabVIEW about a coding decision that YOU made...  I get the feeling you're just a LabVIEW hater.  😉

 

Anyway, what's wrong with rounding the number to the nearest tenth?

 

Edit:

Also, I don't see how implementing johnsold's solution would require a complete rewrite... or are you that umm... well I won't go there, I promised not to start any flame wars today.  😄

 

Bill

Message Edited by billko on 09-09-2009 12:12 PM
Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 19 of 39
(1,329 Views)

Have you tried making the upper limit e.g. 45.0001. You can coerce it in the code if needed.

 

0 Kudos
Message 20 of 39
(1,309 Views)