12-05-2014 11:12 AM
I have a fairly simple task to do but for some reason I can't get it to work. I'm sure it's a very simple fix but I've been stuck on it for a while now so I thought I'd come to you guys for help. Basically what I have is an "average" temperature and I have 4 temperatures being read. I want to have a string indicator show whether the incoming temperature is cold, hot, or the perfect temperature. Being the perfect temperature will result in a blank string. This is part of a much larger VI, so I just made a quick replica of it and isolated it so that it is easier to see by you guys. My initial thought was to nest two select functions for each temperature but I can't get the results that I'm looking for. Thanks in advance!
Solved! Go to Solution.
12-05-2014 11:18 AM
With the description based on the average temperature, simply wire the average temperature to a case structure (3 cases representing the temperature ranges for each).
12-05-2014 11:30 AM
@pjr1121 wrote:
With the description based on the average temperature, simply wire the average temperature to a case structure (3 cases representing the temperature ranges for each).
Wire the average temperature to a case structure how? What gets wired into the case selector terminal?
12-05-2014 11:37 AM
12-05-2014 11:39 AM
Something like this
...1 is cold, 2..7 is null
12-05-2014 11:51 AM
@JÞB wrote:
Something like this
...1 is cold, 2..7 is null
The way that the larger VI works is that there is a maximum temperature and a minimum temperature which are input. These two temperatures are averaged out and that's why I have a local variable for average instead of just wiring a constant. I was just using the random number generators to simulate the logic so I don't think that a case structure would work in this case, or at least not in the way you showed. I apologize for the mixup. I just thought that it would be doable with the select function just wired in a different way that I hadn't thought of so I didn't think to explain the rest of the VI.
12-05-2014 12:02 PM
@jmejiagusmer wrote:
The way that the larger VI works is that there is a maximum temperature and a minimum temperature which are input. These two temperatures are averaged out and that's why I have a local variable for average instead of just wiring a constant.
Are you saying the cut-off values for the Cold, Null, and Hot ranges are varaible based on user input?
12-05-2014 12:42 PM
What's wrong with using the Select function that you already have in your VI? You just have your "Cold" and Empty String swapped.
Alternatively, you could subtract the Average from the actual values and then wire the result into the case selector. Negative values will be too cold, positive too hot, and 0 just right.
12-05-2014 01:16 PM
@crossrulz wrote:
What's wrong with using the Select function that you already have in your VI? You just have your "Cold" and Empty String swapped.
Alternatively, you could subtract the Average from the actual values and then wire the result into the case selector. Negative values will be too cold, positive too hot, and 0 just right.
Nothing is wrong with the select functions. I just wasn't getting the logic correct and your suggestion seemed to have helped except that when the two numbers are very close, I'm getting some strange results and I'm not sure why? I have included the updated VI and screenshots of the last run so that you can see what I mean. In this particular case, I am getting a boolean true when my exit temp 1 is 0.161412 and my average is 0.173414. I have no idea why this would give me a true when it's clearly false?? Since I know that the boolean is returning true when it should be returning false, this doesn't even have anything to do with the select functions. This appears like it would be a problem with either the greater than function or the boolean array? I am very confused with this result.
12-05-2014 01:24 PM
Here is a block diagram of a sub-vi I wrote to do what I think you want to do.
Use the output as a case sellector for Cold, Hot, and Just Right.