LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I use the case selectors for this script?

I have an 1D array with products. I want to start 2 engines depending on 3 cases.  
-first case = start engine 1, if a product from „Produse” array is egal with a product from the first constant string array . (I want the engines to start only once depending on the case, not every time the condition is met.)
-second case = start engine 2, if a product from „Produse” array is egal with a product from the second constant string array. (I want the engines to start only once depending on the case, not every time the condition is met.)
-third case = start the both engines, if some products from „Produse” array  are egal with some products from the both.  (I want the engines to start only once depending on the case, not every time the condition is met.)
I attach my VI. Help me, please!

0 Kudos
Message 1 of 4
(124 Views)

So you really have four cases -- your Product is in neither "Basket 0" nor "Basket 1", your Product is in "Basket 0", your Product is in "Basket 1", or your Product is in both "Basket 0" and "Basket 1".

 

Suppose I add a third "Basket 2".  Now how many cases are there?  [8 -- can you enumerate them all?  Do you see a pattern emerging?  You should also consider the "One Basket" example, where there are 2 cases, and maybe even the "No Basket" example, where there are 0 cases.  I hope the pattern between "Number of Baskets" and "Number of Cases" pops out at you ...

 

Now to your task.  Have you learned about sub-VIs, a little VI that you can call with, say, two inputs, a Product (a string) and a Basket (an Array of String), and will output a Boolean "Product in Basket"?  You need two of these, and out of them (with the same Product wired to both, but with different "Basket" inputs) you'll get two Booleans.  Your "three cases" are TF, FT, and TT, while my four cases adds FF.  If you could change these "two-bit Booleans" into a number, you could write a single Case Statement that would give you three (or four) options.

 

Think about it.

 

Bob Schor

 

0 Kudos
Message 2 of 4
(92 Views)

Thank you so much for your response, but can you build the VI, please, because I did not understood all.

0 Kudos
Message 3 of 4
(84 Views)

Are you a student taking a course for which this is "homework"?  To get the best help, talk to:

  • your fellow students -- get them to "teach" you, as you are all in the "same boat".
  • your instructor -- get him (or her) to provide you with "hints" so that you can learn to do this yourself.

Bob Schor

0 Kudos
Message 4 of 4
(65 Views)