LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to improve while loop


wiebe@CARYA wrote:

Looking at that data, I'd say there is a linear relationship between input and output. So once you know +10 at the input equals +7 at the output (you can get this from two measurements), calculating the correct can be done in one step, using linear interpolation. This would be very similar to the binary search. Just instead of dividing the steps, you can make a much better estimate.

 

If you've done this once, you know the relation. So the next time, you can set the value in just one step if you're lucky.


Assuming the relation IS linear (dangerous) One could use any two points to determine a line (y=Mx+B)

 

Of course that doesn't take any potential sources of error into account. (Hey, it looks like the OP is setting a current so self heating is another component)  A linear search usually helps with some of that by not introducing large changes.  A Binary search introduces changes from coarser to finer.  A conditionally halted binary search should only be used if you know that the settling time is sufficient for all change magnitudes (I'm pleased that the OP selected the full Binary search option after re-reviewing the thread)

 

So, in table form

Type, Speed, Accuracy, (Error sources)

Linear, Slowest, Best, (Hysteresis)

Anti Hysterisis Linear(Go up, then go down. split the delta & not discussed in this thread) Turtleish, Unbeatable, ( Step size)

2-Pt Mx+B, Fastest, Good, (Settling time, Quantization errors, non-linearity)

Full Binary, Consistant Good, Very Good (Settling time)

Interruptible Binary, Very Fast to Good (depends), Fair, (Settling time, Tolerance limits)

 

Its on the Developer to do the "due diligence" and select an appropriate method.  Yup, sometimes we do need to worry about having 3-n-1 oil around for our slipstick


"Should be" isn't "Is" -Jay
Message 11 of 18
(774 Views)

Jeff, I agree. Not saying don't iterate, just that he can use the relation to speed up the search. If the relation is reliable\reproducible might as well use it. Guess it takes some fiddling only OP can do.

Message 12 of 18
(768 Views)

Wiebe, That isExactly the point I was trying to make in the last post. thanks for restating it succinctly. 


"Should be" isn't "Is" -Jay
Message 13 of 18
(764 Views)

the data is 100% linear.

my senior engineer did mentioned to use the slope methods but haven't program labview in over 2 years.

I have never seen it done before. can someone show me where to find examples so I can look at?

"One could use any two points to determine a line (y=Mx+B)"

Best regards,
Krispiekream
0 Kudos
Message 14 of 18
(727 Views)

@krispiekream wrote:

the data is 100% linear.

my senior engineer did mentioned to use the slope methods but haven't program labview in over 2 years.

I have never seen it done before. can someone show me where to find examples so I can look at?

"One could use any two points to determine a line (y=Mx+B)"


Your original data looks a little choppy ("White" Line). Rather than using any two points, I would use the Linear Fit.vi. Outputs from that VI also include the slope (M) and y-intercept (B).

 

graph.JPG

 

EDIT: x-axis is your "Input" Column, and y-axis is your "Measured" Column

 

Lin_Fit.png

Message 15 of 18
(717 Views)

 

how would I use the linear fit to the current while loop I have?

Untitled.png

Best regards,
Krispiekream
0 Kudos
Message 16 of 18
(701 Views)

@krispiekream wrote:

 

how would I use the linear fit to the current while loop I have?

 


 

Start with y = Mx + B. The linear fit.VI gave you M & B. You know what Y is (Target voltage). SOLVE for X!! That's the amplitude setting of the Frequency Generator.


As Wiebe and Jeff previously stated, and I agree, it's not advisable to immediately jump to full power unless you know what you are doing. A linear ramp or binary search is more advisable. Spending 40 seconds to slowly increase to full power is a lot less painful than trying to explain to your boss why you blew up his multi-million dollar equipment and delayed the delivery date by 6 months.

0 Kudos
Message 17 of 18
(674 Views)

@jamiva wrote:

@krispiekream wrote:

 

how would I use the linear fit to the current while loop I have?

 


 

Start with y = Mx + B. The linear fit.VI gave you M & B. You know what Y is (Target voltage). SOLVE for X!! That's the amplitude setting of the Frequency Generator.


As Wiebe and Jeff previously stated, and I agree, it's not advisable to immediately jump to full power unless you know what you are doing. A linear ramp or binary search is more advisable. Spending 40 seconds to slowly increase to full power is a lot less painful than trying to explain to your boss why you blew up his multi-million dollar equipment and delayed the delivery date by 6 months.


OH Come On Jam!  if he forgot LabVIEW in 2 yrs how do you expect him to remember 7th grade algebra?

x=(y-B)/M


"Should be" isn't "Is" -Jay
0 Kudos
Message 18 of 18
(669 Views)