LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Suggestion for Multipoint Limiter Function

I'm relatively new to LabVIEW and have been tasked with creating what I call a multipoint limiter.  This function creates a curve where the value of Y is limited based on the value of X.  I'm performing real-time motion control.  In my applications, X is always speed and Y is position.   The faster you go, the tighter the limits get.

 

In C++ I use 7 element arrays for X and Y.   Read the values X and Y, determine the proper X array index, using that index select the proper Y limit value, and limit the value of Y if necessary.  Some logic is included to indicate if my Y limits are unipolar or bipolar.

 

Reading some other posts, I see the In Range and Coerce function discussed.  I also read the In Range and Coerce lower and upper limit values can be arrays.

 

Does this sound like the correct direction to head in, or is there something better?

0 Kudos
Message 1 of 14
(1,039 Views)

it Looks like you're going on the right direction 

LVNinja_0-1687465385157.png

 

0 Kudos
Message 2 of 14
(1,022 Views)

Thanks for the reply.

 

As I read the Help file for the In Range and Coerce function, it implies that x, lower limit, and upper limit should be the same type.  Like you showed all three as arrays in your diagram.

 

Does the input to x have to be an array?

 

 

 

 

0 Kudos
Message 3 of 14
(1,016 Views)

@stgislander wrote:

Thanks for the reply.

 

As I read the Help file for the In Range and Coerce function, it implies that x, lower limit, and upper limit should be the same type.  Like you showed all three as arrays in your diagram.

 

Does the input to x have to be an array?

 

 

 

 


That's the only thing that makes sense.

0 Kudos
Message 4 of 14
(996 Views)

No, it can be a number. 

 

I'm not sure if you can mix arrays and numbers, if that's what you;r planning to do. 

 

RKO
0 Kudos
Message 5 of 14
(990 Views)

@paul_a_cardinale wrote:

@stgislander wrote:

Thanks for the reply.

 

As I read the Help file for the In Range and Coerce function, it implies that x, lower limit, and upper limit should be the same type.  Like you showed all three as arrays in your diagram.

 

Does the input to x have to be an array?

 

 

 

 


That's the only thing that makes sense.


Oops.  I misread what @stgislander wrote.  I thought he was asking about the 'output'.

0 Kudos
Message 6 of 14
(984 Views)

Thanks.

 

If I reading the Help files correctly, I think I can use the Index Array function to get the particular limit value I need from the first array.  I can wire that to the upper limit input on the In Range and Coerce function.  (The lower limit will be either 0 or the negative of the upper limit.)  That way all inputs are numbers.

 

If that is right, then my next step is to determine the correct index value based on a comparison of the X value and a second array.

0 Kudos
Message 7 of 14
(960 Views)

Hi stgislander,

 


@stgislander wrote:

Thanks.

 

If I reading the Help files correctly, I think I can use the Index Array function to get the particular limit value I need from the first array.  I can wire that to the upper limit input on the In Range and Coerce function.  (The lower limit will be either 0 or the negative of the upper limit.)  That way all inputs are numbers.

 

If that is right, then my next step is to determine the correct index value based on a comparison of the X value and a second array.


You better look at the help for the Interpolate1DArray/Threshold1DArray functions…

(They also work with array of points!)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 8 of 14
(958 Views)

If I understand this right, you are only looking at one Y value at any given time, but you know the X at that point. Why not just use a simple formula to calculate upper and lower limits for that x?

 

I am sure you can come up with a simple formula for UpperLimit(x) and LowerLimit(x) to be wired to the InRangeCoerce function. Wrap it all into a subVI.

0 Kudos
Message 9 of 14
(948 Views)

Well every application is different.  We don't know what the relationship between speed and position is until after trials testing.  In C++, we approximate the curve from a look-up "table" method using arrays.  Trials reveals what the limit points need to be at various speed points.  This method is easy to understand, easily adjustable, very fast, and accurate enough.

0 Kudos
Message 10 of 14
(944 Views)