04-14-2024 04:48 AM
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!
04-14-2024 01:16 PM
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
04-14-2024 01:53 PM
Thank you so much for your response, but can you build the VI, please, because I did not understood all.
04-14-2024 08:30 PM
Are you a student taking a course for which this is "homework"? To get the best help, talk to:
Bob Schor