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.
08-24-2020 09:10 AM - edited 08-24-2020 09:15 AM
1. Is it possible to build enum type of control using boolean conditions and then connect it to a case structure?
2. I got it partially working using a formula node (only when the second condition is removed, i.e., x>=100 & x<=200), but when it is present I am getting an error.
Edit: y = -0-01*x+91; y = -0.01*x + 91;
08-24-2020 09:32 AM - edited 08-24-2020 09:35 AM
Case structures can take integers as their case selectors if you didn't already know. Take your setpoint, round it down and convert it to an integer, and build a case structure with that as the selector.
Saying "Thanks that fixed it" or "Thanks that answers my question" and not giving a Kudo or Marked Solution, is like telling your waiter they did a great job and not leaving a tip. Please, tip your waiters.
08-24-2020 09:40 AM - edited 08-24-2020 09:42 AM
Hi girish,
might be simpler to use Threshold1DArray:
You can use the "index" value to select one of several cases in a case structure. Or just use it with IndexArray to index the corresponding result from another array constant…
Btw. be aware of possible problems when comparing floating point numbers for equality!
08-24-2020 09:45 AM
Since the 2nd solution basically loops/checks through your comparisons until one is found, i'd make a while loop with a case structure that does the same. (Case 0 is the 1st X=100 case and so on)
(I Think you must use 'AND' in your formula node, '&' is a bitwise AND i Think, thus the integer requirement)
08-24-2020 03:01 PM
@girish_jadhav wrote:
Case structures can use I32 as inputs. You can use ranges for each case "..100" will give below 100. "100..200" will select 100 to 199. See the detailed help for a case structure for additional details on ranges.
Norm
08-25-2020 07:48 AM
@Viper wrote:
Case structures can use I32 as inputs. You can use ranges for each case "..100" will give below 100. "100..200" will select 100 to 199. See the detailed help for a case structure for additional details on ranges.
I did not know about this option! Thanks for the reply 🙂
08-25-2020 09:12 AM
You have 2 solutions for X=100, which one is correct?
08-25-2020 09:14 AM
Since you used a Double for X, i assumed you'd have values as 100.12. In that case, the case selectors option of 100..200 isn't really an option. 🙂 That only works for integers.
08-25-2020 09:23 AM
@Yamaeda wrote:
You have 2 solutions for X=100, which one is correct?
I confused how character ranges work with the integer cases. That's why I said read the detailed help.
Type of Values | Description of Type of Values |
---|---|
Numeric ranges | Specify a range as 10..20, meaning all numbers from 10 to 20 inclusively. |
Open-ended numeric ranges | Specify a range ..100, meaning all numbers less than or equal to 100, and 100.. represents all numbers greater than or equal to 100. |
Lists and ranges | Use commas to separate values, for example ..5, 6, 7..10, 12, 13, 14. When you enter values that contain overlapping ranges in the same case selector label, the Case structure redisplays the label in a more compact form. The previous example redisplays as ..10, 12..14. |
String ranges | A range of a..c includes all strings beginning with a or b, but not c. String ranges are case sensitive. For example, a range of A..c behaves differently than a..c because LabVIEW uses ASCII values to determine a string range. |
Enumerated values | The values display in quotation marks, for example "red", "green", and "blue". However, you do not need to type the quotation marks when you enter the values unless the string or enumerated value contains a comma or range symbol ("," or ".."). In a string value, use special backslash codes for non-alphanumeric characters, such as \r for a carriage return, \n for a line feed, and \t for a tab. |
08-25-2020 09:26 AM
@Yamaeda wrote:
Since you used a Double for X, i assumed you'd have values as 100.12. In that case, the case selectors option of 100..200 isn't really an option. 🙂 That only works for integers.
For your example I would multiply X by 100 then cast it to an I32. Then I would adjust my case selectors as well to account for the multiplication.
Norm