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.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Case Structure Range Question

Solved!
Go to solution

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

0 Kudos
Message 1 of 5
(3,222 Views)
Solution
Accepted by topic author russell.simms

You can't do it with a case structure.

 

You want to look at In Range and Coerce.

0 Kudos
Message 2 of 5
(3,207 Views)
Solution
Accepted by topic author russell.simms

Try this:

InRange.png


LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 3 of 5
(3,173 Views)
Solution
Accepted by topic author russell.simms

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.

Load Cell.vi Block Diagram1.png

 

Load Cell.vi Block Diagram 2.png

 

Best Regards

Deepu Jacob

-----------------------------------------------------------------------------------------------------------------------------
Waiting For the inner calling 🙂


0 Kudos
Message 4 of 5
(3,166 Views)

I figured there was a simple solution, but did not know of this function before and it worked. Thank you everyone!  

0 Kudos
Message 5 of 5
(3,142 Views)