Ventilation fan control via logic

Discussion in 'C-Touch/HomeGate/SchedulePlus/PICED Software' started by Damaxx, Oct 18, 2015.

  1. Damaxx

    Damaxx

    Joined:
    May 12, 2008
    Messages:
    229
    Likes Received:
    47
    After using a litre of chicken blood and a kilo of chalk, I failed to pray to the right voodoo gods to empower me with confidence in my coding capabilities. :rolleyes:
    I am trying to control of my two speed fan for a rack server that I hope someone wouldn't mind assisting.

    I have a temperature probe within the rack and a 2 speed exhaust fan to draw cold air through the rack. The two speed fan has two switched actives going to it that are electrically interlocked so they don't both come on at the same time but I have put a delay in for a little piece of mind also.

    Code:
    Module "Rack fan controller low speed"
    {Control of ventilation fan for server rack}
    once (GetIntSystemIO("Rack Temp") > 25) and
         (GetIntSystemIO("Rack Temp") < 30) then
    begin
      SetLightingState("Rack vent high", OFF);  
      Delay("0:00:03");
      SetLightingState("Rack vent low", ON);
    end;
    Code:
    Module "Rack fan controller high speed 
    {High speed controll of rack ventilation fan}
    once (GetIntSystemIO("Rack Temp") > 31) then
    begin
      SetLightingState("Rack vent low", OFF);
      Delay("0:00:03");
      SetLightingState("Rack vent high", ON);
    end;
    Couple of questions for the voodoo gurus;

    How would I code for a bit of hysteresis control? As you can imagine having it trigger on at 25 degrees then shut off at 24.9 by the time it gets up to speed 3 seconds later only to kick off again 3 seconds later would be less than desireable. Appreciate any suggestions or guidance you could give there.

    Do you see any other issues in my black magic?
     
    Damaxx, Oct 18, 2015
    #1
  2. Damaxx

    Ashley

    Joined:
    Dec 1, 2005
    Messages:
    1,548
    Likes Received:
    178
    Location:
    Adelaide, Australia
    One minor problem is once the fans come on they will never turn off :)

    You have 2 conditions. The first turns fan high off and fan low on, and the second fan low off and fan high on. There is no condition to turn both fans off.

    However, you do in fact have hysteresis between the low and high fans, because nothing happens between 30 and 31 degrees, so when the temp gets above 31 degrees it will go to high fan, but must get to under 30 degrees to go to low fan. So you have solved your own problem.

    All you need is another condition to turn the fans off when the temp goes below 24 degrees:
    Code:
    once (GetIntSystemIO("Rack Temp") < 24) then
    begin
      SetLightingState("Rack vent high", OFF);  
      Delay("0:00:03");
      SetLightingState("Rack vent low", OFF);
    end;
    I'm not sure if you realize that all these statements can be in a single module. The logic engine does not pause on a ONCE statement waiting for it to become true. It evaluates it each time and if the condition has gone from false to true will execute the statements. Otherwise it skips the conditional statement(s) and carries on with the following code.

    Also, if you start the logic engine and the temperature is already within one of the ranges the logic will not run because one condition will stay false and the second will stay true. Since there won't be a transition from false to true neither ONCE will ever be triggered until the temperature moves into a different range.
     
    Last edited by a moderator: Oct 18, 2015
    Ashley, Oct 18, 2015
    #2
  3. Damaxx

    Damaxx

    Joined:
    May 12, 2008
    Messages:
    229
    Likes Received:
    47
    Thanks Ashley for your guidance there. Yeah the whole not turning the system off thing might have become an issue. ;) Silly oversight on my behalf.

    Will play around to make the low run for a minimum 5 minutes or something and looks like I am good to go.

    Appreciate your well explained answers as always.
     
    Damaxx, Oct 18, 2015
    #3
  4. Damaxx

    Ashley

    Joined:
    Dec 1, 2005
    Messages:
    1,548
    Likes Received:
    178
    Location:
    Adelaide, Australia
    Given that once the low fan turns on the temperature has to drop over 1 degree you may not really need a minimum run timer unless the temperature can drop very quickly.

    If you really want a timer, the simplest way is just to replace the low fan off command with a pulse command.

    e.g

    replace:
    SetLightingState("Rack vent low", OFF);

    in the all off condition with

    PulseCbusLevel("local", "lighting", "Rack vent low", 100%, 0, "0:5:0:, 0);

    This will ensure the fan runs a further 5 minutes once the temperture drops below 24 degrees.
     
    Ashley, Oct 19, 2015
    #4
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.