LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Format and precision and rounding?

I have a vi I have attached and it is giving me fits. I am trying to create a number generator which will automatically figure out the number of turns I need to turn. I have plugged in default numbers for testing purposes. My results appear to be true, but it is not stopping the loop and confirming my result. Does labview not take into account the format and precision in its calculations. I have set the two points I am comparing to 2 decimal places, but it still does not stop the loop. It appears to be correct when probed, but then it just keeps on trucking. I guess I need to round to 1 decimal place. Any help with this is greatly appreciated.
0 Kudos
Message 1 of 4
(2,772 Views)
Yes, the numbers are not equal at higher resolution, set the control/indicators to show e.g. 20 digits of precision.

You need to e.g. check if the absolute difference is less than a suitable threshold.
0 Kudos
Message 2 of 4
(2,772 Views)
Actually, In this particular problem, you could just use "less or equal", then increase x until the loop stops.

A better way would be to use an automatic iterative procedure to find the value x where the difference between "Total Fiber Length" and "x+y" is zero. That shouldn't be to difficult.
0 Kudos
Message 3 of 4
(2,772 Views)
Thanks for the assist on this. It didn't click to use greater than or equal. Stared at it too long I guess. In your second comment, I understand what you are saying. The difficulty comes in the other layer configurations. For example, the x+y isn't going to happen exactly like it does in this one. In this example x is multiplied by 2. In the three layer x is going to be added to the first layer, and the last layer. It makes it a bit mor difficult. It is taking the total fiber length and taking it backwards basically which doesn't sound difficult, but it makes it interesting. I will try to post an example if I can. Thanks again for the help.
0 Kudos
Message 4 of 4
(2,772 Views)