From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
10-20-2016 09:38 PM
I have a simple application where I am using a pneumatic cylinder to apply compression force. The user inputs a load setpoint into the front panel, and my LabVIEW program reads the force coming from the load cell and adjusts current to an electric regulator to control the load at the set point.
I would like to have a simple LED boolean on the front panel to let the user know if the actual load is within +/- 2% of the setpoint that they entered. For instance, if they input 100 N, I want the LED Boolean to be green when the load is within 98 N and 102N and red when it is not.
I was thinking that I would need a case structure with a numeric range to control the boolean. The issue is that the load set point will change based on the user's input, so the range in the case structure will change. Is there a way to use the case structure where it can use the percentage of the load setpoint as the bounds for the range? Or is there another way to code this functionality?
Thank you,
Russell
Solved! Go to Solution.
10-20-2016 10:32 PM
You can't do it with a case structure.
You want to look at In Range and Coerce.
10-21-2016 03:39 AM
Try this:
10-21-2016 04:48 AM
Hi,
you can use the the range check function as suggested by Raven fans and sam_sharp suggested.
Have a look at the attched vi.
Best Regards
Deepu Jacob
10-21-2016 07:46 AM
I figured there was a simple solution, but did not know of this function before and it worked. Thank you everyone!