12-02-2020 01:04 PM
Hello!
I am using a case structure with true/false and I want to add a new case, but there is the next error: Some of the selector values specified for cases in the Case structure could not be converted to the same type as the selector.
I have to compare 3 numbers and in the end to display a message using String, and if the number, which i have entered is between the others 2 numbers( limits), i have to use a boolean.
12-02-2020 01:19 PM
I'm afraid your description of your problem is too confusing to know what you are trying to do. Now if you had attached an actual VI, we might be able to understand.
You talk about a case structure with true/false. That means you can only have two cases and never 3 or more. Booleans are either True or False.
Perhaps you are looking for a case structure embedded inside a case structure?
12-02-2020 01:27 PM
I would use my psychic powers to look at your code, but I don't have any psychic powers. Just kidding. Even if I had psychic powers, I wouldn't bother using them to try to search for your code.
12-02-2020 02:03 PM - edited 12-02-2020 02:37 PM
here it is what i tried
12-02-2020 02:26 PM - edited 12-02-2020 02:35 PM
Use In Range and Coerce to determine wither it is in range. If in range, (True case), then do your in range message. In the False case, do a comparison with upper limit and determine if it is high. Otherwise it is low.
12-02-2020 05:28 PM - edited 12-02-2020 05:38 PM
True/False can only have two cases.
So what exactly did you wire to the case selector now? (There are many possibilities: Boolean, integer, String, enum, etc.)
It seems you only have two possibilities (A) Values in range, (B) Value is NOT in range. So all you need is two cases with the selector wired to the output of the "in range and coerce function" Since you seem to only have two possible strings, a simple "select" could be used instead of a case structure..
Note that you need to decide to include or exclude the boundaries. I am using integers, because DBL comparisons can be tricky.
12-03-2020 03:38 AM
Hello, my sister have a homework, as limit testing. Can you help me or us:)) thank you in advance.
1. The user should be able to enter the date via a slider, ranging from -10 to 10
2. to be 2 numerical controls
3. There should be an LED that lights up if the input value is out of range
4. a.there is a string indicator, which shows a. (Always): "the current value is ...
b. (if the value is above \ below the range): "and this is above \ below the range of Y", where X is the current input value, and Y. represents the difference between the input value and the given range.
She must use case structure and comparison palette.
12-03-2020 03:48 AM
The easier tool for limit testing would probably be In Range and Coerce, but since this is homework with a specific method in mind, it sounds like you have pretty good instructions.
Where are you having trouble?
12-03-2020 03:49 AM
12-03-2020 11:36 AM
@J.Julia wrote:
Hello, my sister have a homework, as limit testing. Can you help me or us:)) thank you in advance.
1. The user should be able to enter the date via a slider, ranging from -10 to 10
2. to be 2 numerical controls
3. There should be an LED that lights up if the input value is out of range
4. a.there is a string indicator, which shows a. (Always): "the current value is ...
b. (if the value is above \ below the range): "and this is above \ below the range of Y", where X is the current input value, and Y. represents the difference between the input value and the given range.
She must use case structure and comparison palette.
OK, your sister should start with going over the class notes. Most likely all that's needed has been covered. If there are remaining doubts, there are quite a few learning resources listed on the top of the forum.
Now start looking at the requirements and place everything required on the front panel:
Now switch to the diagram. At this point you should see the terminals of all the front panel elements you just placed. Some are controls (i.e. data sources) and some are indicators (i.e. data sinks). A running program should read the controls at regular intervals, do the comparison, and output the result to the indicators. This means that you should surround everything with a while loop. Wire the stop button terminal to the stop terminal.
Since it does not really make sense to spin the loop millions of times per second, place a small wait (e.g. 50ms) to make it a million times slower and better allow your computer to also focus on other things.
Now how do you check if a value is in range? Yes, there is a function in the comparison palette that has already been mentioned. It has three inputs, exactly what you need! So wire the controls to its inputs. It has two outputs and you only need the boolean output at the bottom right. Wire the LED to it. Run the program to see hat happens. You are almost there (!) except for some flaws: the string always shows blank and the LED is lit when in range instead of when out of range. Bummer! If only there was a function to flip the value in a boolean wire.
Now about the string. Look into the formatting operations already mentioned. Still, first you need to clarify point #4. Not sure what the "difference between input value and range" really means. Do you mean how far outside the range it is, i.e. the distance to the closes boundary? See how far you (and she) gets.