03-14-2018 01:31 PM
I wish to control a heater and a fan, either on or off for both.. If the temperture is too cold turn on heat. If too hot turn on Fan. if not too cold or hot do nothing in otherwords I have two relays controlled via digital bits P1-0 and P1-1. Actually there is a third option to shutdown if temp exceeds a Maximum, but that happens outside of this control code
Bit 0 High turns on a heater, bit 0 low turns the heater off.
Bit 1 High turns on a fan. bit 1 low turns fan off
Now I've tried somthing like this:
But it isn't quite what I need. The code pix shows that I want to regulate the heater between 55 and 60. The Fan between 65 and 61
I vaguley recall a truth chart or something from the LabView 1 or 2 Lessons but I cannot find it
Can someone please point me in the right direction?
Gene
03-14-2018 01:40 PM - edited 03-14-2018 01:45 PM
Create a sorted array of limits and threshold into it with your value. The rounded down (or up) index will give you the state. Tweak as needed.
Start here (the second array could be an array of enums with reasonable items (low, in range, above range, way above range, etc. to be wired to a case selector)
03-14-2018 01:53 PM - edited 03-14-2018 01:53 PM
Just to show what Christian already stated
03-14-2018 02:12 PM
Thanks to both of you. I am looking at your suggestion and I will add FAST responce!
Gene
03-14-2018 02:15 PM
Thanks for the fast responce!!
I am looking at your answer to understand
03-15-2018 12:42 PM - edited 03-15-2018 12:44 PM
I think I understand how the array thing works. (It is not intuitive for me), see the attached code (I'm using LV14). This may be one of those times I can code C easier?
This will send a relay command during each iteration unless someone can help me limit the digital command until a threshold is passed.
Thanks for the help I will continue to develop this code. I will share it when I finish
Gene
this test code will be part of a larger VI
03-15-2018 12:49 PM
@justgene wrote:
I think I understand how the array thing works. (It is not intuitive for me), see the attached code (I'm using LV14). This may be one of those times I can code C easier?
This will send a relay command during each iteration unless someone can help me limit the digital command until a threshold is passed.
Thanks for the help I will continue to develop this code. I will share it when I finish
Gene
this test code will be part of a larger VI
Every iteration? I see no loop. Don't use the continuous run button.
03-15-2018 01:09 PM
Billko said" Every iteration? I see no loop. Don't use the continuous run button."
too late I did... I had to ctl-alt -delete but the finished code will reside inside the attached code. This will be a project (I hope) to monitor and control a test station for a 30 cell electrochemical stack I've written a C code version using an Arduino Uno But it has no nice HMI, and does not save data files
Gene
03-15-2018 02:28 PM
Why can't you use an array of cells to display? Thy all have the same range.
Why can't you use a shift register loop to set all these dynamic data attributes.
Your VI is still full of race conditions (local variable abuse) that will give you unexpected result. For example there is no guarantee that the local variables for "cycle count" and "highest cell #" get read only after the terminal is updated. Most likely they will read stale data from the previous iteration.
Your "number of records" belongs into a feedback node and only a "wire" or a "+1" primitive belong inside the cases.
03-15-2018 02:47 PM - edited 03-15-2018 02:51 PM
@altenbach wrote:
Why can't you use a shift register loop to set all these dynamic data attributes.
For example compare the following functionally identical code fragments:
(disclaimer: I never use dynamic data, so there might be even easier solutions. This is just a literal translation of whatever you are doing. If some cells really should be uppercase and some lowercase, a little bit more code is needed.).