08-10-2021 10:28 AM
hi everyone i have some question. i want to makes a 3 condition about temperature.
for example when the temperature condition is "less than equal to 30" then the string status "cold", then if the temperature condition is "more than equal to 30" and "less than equal to 100" the string status "normal" and when the temperature condition is "more than equal to 100" then it appears state string "hot". here I use the comparison function "select" how to move to the next case when the current condition is false ? I feel this is the wrong function. I beg your help for the correct use of this case. thank you
Solved! Go to Solution.
08-10-2021 10:50 AM
You can probably implement this more easily with the Select node (as you've found), but without the Case Structure.
Is this the actual problem, or do you need the Case Structure for more code in the real case?
You're comparing a string to the "30", which probably won't do what you want.
If the pink wire from the left is a string giving the temperature (e.g. "28", "27.4", "95.1") then you can use one of the conversion functions to get a number instead, and then compare to a number. This will compare in the manner that you want.
For example:
By doing a series of different comparisons (here they are all > 30?) you can wire a series of Select nodes into each other and get the string you want out.
Another option is to use Threshold 1D Array, but I often find that function more complicated to understand and have to check the context help (Ctrl+H) every time...
08-10-2021 10:57 AM
the reason I made it into a case, this string will display the status of the detection and will also display an indicator lamp as well. I think it would be more concise if it was made into a case.
08-10-2021 11:07 AM
Comparisons with string will not do it numerically, but alphabetically, so 1000 < 2, for example (because "1000" would be before "2" in a dictionary). You need to do this using a numeric datatype.
Easiest would be to threshold into a sorted array of limits and then index into an array of strings.
08-10-2021 11:09 AM
08-10-2021 11:41 AM
@mamprat wrote:
the reason I made it into a case, this string will display the status of the detection and will also display an indicator lamp as well. I think it would be more concise if it was made into a case.
Still no need for a case. Here's what I had in mind earlier. (I use a colorbox as indicator lamp.)
08-10-2021 12:21 PM
if now i makes the system like that, its efective or not ?
08-10-2021 12:30 PM
Hi mamprat,
@mamprat wrote:
if now i makes the system like that, its efective or not ?
No, it's not effective. Infact it's mostly Rube-Goldberg…
Why don't you follow Christians (Altenbach) suggestion? His advice almost always is considered "effective"!
08-10-2021 12:53 PM - edited 08-10-2021 12:55 PM
sorry i missed your post, i applicated your the way you do it is very effective and I was helped by that thank you for the help
08-10-2021 03:15 PM
sir i try to makes your own. i have some question why the bundel name not display ?
why its happen ? thanks