C-Bus Timers

Discussion in 'General Discussion' started by jamie79, Nov 23, 2021.

  1. jamie79

    jamie79

    Joined:
    Nov 23, 2021
    Messages:
    4
    Likes Received:
    0
    Hi All,

    Brand new to the C-Bus Forum here!

    I have a question relating to cbus timers.

    I have a range of cbus product installed including a B&W logic touchscreen. I am fairly familiar with toolkit & piced which are the programs that i used to setup the system.

    The touchscreen has 20 in-bult logic timers, my problem is that i have used them all. When i initially programmed the system back in 2009 I tried to get the unit logic to do what i wanted with the lighting and other equipment, but i really struggled to do it, so i ended up using the in-built timers through logic instead.

    My application i'm struggling with right now is as follows:
    I have a water level sensor that will trigger a bell press on a cbus coupler, If the water level sensor is on for say 5 min, then the pump will come on. However, if the water level sensor only stays on for 2 min, then the timer will re-trigger itself back to 0. The pump will not turn on until the water level sensor has been called for for a full 5 min.

    Then the same for off function. If the water level sensor is off for say 5 min, then the pump will go off. However, if the water level sensor only stays off for 2 min, then the timer will re-trigger itself back to 0, The pump will not turn off until the water level sensor has not called for water for a full 5 min.

    The idea of this is that I dont get nuissance switching as the water level rises and falls. e.g. wind ripples on the water surface triggering the sensor every few seconds.


    If i had a spare logic timer i could do it, but i dont. I have had a play with the 'delay function' in the piced logic programming wizard, but the delay seems to be more a case of delaying the output rather than the input. Are there any other timers/methods i can use?

    Kindest Regards
     
    jamie79, Nov 23, 2021
    #1
    1. Advertisements

  2. jamie79

    Ashley

    Joined:
    Dec 1, 2005
    Messages:
    1,297
    Likes Received:
    134
    Location:
    Adelaide, Australia
    Timers are almost never required in Cbus logic. I've written thousand of lines of Cbus code and can't remember ever using one :). There are usually better ways to accomplish things,

    In your example, simply use the ConditionStaysTrue function. It does all the work for you.
     
    Ashley, Nov 23, 2021
    #2
    1. Advertisements

  3. jamie79

    jamie79

    Joined:
    Nov 23, 2021
    Messages:
    4
    Likes Received:
    0
    Hi Ashley,

    Thanks so much for your reply, I have just realised I can free up all 20 timers I have used because I had a similiar application with my lighting PIR's re-triggering timers too.

    The below code worked first time:

    if ConditionStaysTrue(GetLightingState("Gazebo Water Level Call") = ON, 10) then
    begin
    SetLightingState("Gazebo Water Level Pump", ON);
    end;

    if ConditionStaysTrue(GetLightingState("Gazebo Water Level Call") = OFF, 10) then
    begin
    SetLightingState("Gazebo Water Level Pump", OFF);
    end;


    Quick question before I complete on this query - Obviously, there is some sort of timer associated with the above command, otherwise it wouldnt be able to measure time. So, what device is running the timer? in other words, whats the difference between a logic timer and the type used in the code above?

    Regards
     
    jamie79, Nov 24, 2021
    #3
  4. jamie79

    Ashley

    Joined:
    Dec 1, 2005
    Messages:
    1,297
    Likes Received:
    134
    Location:
    Adelaide, Australia
    Logic modules are run every 200mS. So a ConditionStaysTrue just sets a counter for the number of seconds x 5 (i.e. number of 200mS intervals). At each module run, if the condition is false, the counter is reset to the initial count. If the condition is true, the counter is decremented. If the counter gets to zero the statement is executed.

    You can use this 200mS module run interval to create your own timers.

    Also, don't forget about the PulseCBusLevel procedure. If you want a group to be in a certain state for a given amount of time, this is the easiest way to do it.

    Delays and timers in modules are rarely the best choice.
     
    Ashley, Nov 24, 2021
    #4
  5. jamie79

    jamie79

    Joined:
    Nov 23, 2021
    Messages:
    4
    Likes Received:
    0
    Hi Ashley,

    Thanks for the reply again.

    I have just checked out the help files within the PICED logic section on the 'PulseCBusLevel procedure', so I will have a play with this method of creating my own timers.

    It seems I could do with seeing a list of all the commands available to me in logic, but that seems tricky to find in the help files for some reason. I pressumed the options within the statement wizard would accomadate most commands, but that doesnt seem to be the case.

    Thanks
     
    jamie79, Nov 25, 2021
    #5
  6. jamie79

    Wonkey

    Joined:
    Aug 3, 2004
    Messages:
    248
    Likes Received:
    20
    Location:
    Adelaide
    Search for C-Bus Functions when in the Logic engine help
     
    Wonkey, Nov 25, 2021
    #6
  7. jamie79

    Ashley

    Joined:
    Dec 1, 2005
    Messages:
    1,297
    Likes Received:
    134
    Location:
    Adelaide, Australia
    All the commands are listed in the logic help file under HELP/LOGIC...
    Open Logic Engine Language/C-Bus Functions.

    You can also open the help file from explorer: C:\Clipsal\PICED\Logic.chm
     
    Ashley, Nov 25, 2021
    #7
  8. jamie79

    jamie79

    Joined:
    Nov 23, 2021
    Messages:
    4
    Likes Received:
    0
    Thanks guys, sorted now! :)

    I also had a good read over the Logic Instructions this morning.

    I cannot believe I have missed this... but if I right click in the statement box, all the functions are there too.

    Happy Days!
     
    jamie79, Nov 25, 2021
    #8
    1. Advertisements

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.