LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Case Structure with Three Cases and a Tolerance

Solved!
Go to solution

Hi all

 

I have a varying voltage which I will feed into a case structure. Is it possible to implement the case structure as follows.

 

If input to case is between 1.238 and 1.242, output = STRAIGHT

If input to case is less than 1.238, output = LEFT

If input to case is greater than 1.242, output = RIGHT

 

Thanks

Greg

 

 

 

0 Kudos
Message 1 of 11
(4,732 Views)

Yes it is possible.  There are numerous on-line instructional material for LabVIEW -- after the first one, you should be able to solve this problem yourself.  If you do it yourself, it will "stick" with you.  Put some effort into this yourself, then come back when you have a real question.

 

BS

0 Kudos
Message 2 of 11
(4,718 Views)

You can't use floating point numbers in a case structure directly however there is no reason you can't use the comparion primitives to achieve this task.

 

This is a very fundamental question - I recommend looking through the online tutorials as well to increase your overall LabVIEW knowledge.

0 Kudos
Message 3 of 11
(4,715 Views)
You can also scale the floating point numbers to integers and wire integers directly to the case selector. You can use ranges with a single case statement - ..1237, 1238..1242, 1243..
Message 4 of 11
(4,697 Views)

Thanks all

 

gonna tackle it now....will be back with any issues (real issues Smiley Wink)

 

Regards

Greg

0 Kudos
Message 5 of 11
(4,652 Views)

Hi

 

I have tried to remove the floating point. I am using a daq assistant to acquire the signal and I cant see how I can change it before it leaves the daq assistant.

 

I have scaled the number up after leaving the daq assistant to an integar and selected ranges to suit, but the program wont accept this. (the ranges appear in red)

It will however accept the same ranges if I wire a numeric control to the case selector.

 

I have viewed the scaled up number on a numeric indicator and it is an integar that suits the ranges in the case structure.

 

I have atached an image of my code also.

 

Thanks

Greg

 

 

0 Kudos
Message 6 of 11
(4,647 Views)
Solution
Accepted by topic author GregFlynn

As was mentioned earlier, you can't use a double precision variable as a case selector. You'll need to convert it to integer (numeric>conversion) first

Message 7 of 11
(4,643 Views)

Many thanks for all the pointers....The help was really appreciated

 

Regards

Greg

0 Kudos
Message 8 of 11
(4,629 Views)
If you use the assistant, eliminate the evil dynamic data as soon as it leaves the assistant. The dynamic data hides the real underlying data.
Message 9 of 11
(4,621 Views)

Greg,

     Because you marked this post as "Solved", I'm assuming you have code that does what you need.  I hope that it looks something like this (perhaps with Case Statements instead of Select functions).  You stated the problem in terms of Greater Than or Less Than conditions, so it might help "transparancy" if these relationships appear in the code directly, as is shown here.  Note also that the Output will be one of three values of the Straight/Left/Right enum that I defined by putting an Enum control on the Front Panel, right-clicking it, choosing Edit, and simply creating these three values.

Simple 3-way selection.png

Bob Schor

0 Kudos
Message 10 of 11
(4,587 Views)