Wiser Logic - setting to run - or other isssue?

Discussion in 'C-Bus Wiser 1 Controller' started by Phantom99, Mar 18, 2012.

  1. Phantom99

    Phantom99

    Joined:
    Feb 16, 2012
    Messages:
    19
    Likes Received:
    0
    Location:
    Sydney
    I know this is a very fundamental question, but I am not sure if I have to "turn on" the logic engine within the Wiser unit.

    I have compiled, saved and transferred the project, but it doesn't seem to be running.
    If I RUN it from within Piced it still doesn't change the lighting state.

    I assume the User System I/O variable names are arbitrary. As I change the label and transfer again to the Wiser, it changes the input field label on the Wiser UI web page.

    It is simple logic that looks for the date and time to be greater than or equal to a user input date/time field on the Wiser UI and then sets light to ON.
    Note: (I have made outputload the study light to get it working, then I will make it the pool pump, hence the mixed labelling.)

    [ON Module]
    once (GetIntSystemIO("Pool Pump Date ON") <= Date) then
    once (Time >= GetIntSystemIO("Pool Pump Time ON")) then

    begin

    SetLightingState("Study West Window", ON);

    end;

    [OFF Module]

    once (GetIntSystemIO("Pool Pump Date OFF") <= Date) then
    once (Time >= GetIntSystemIO("Pool Pump Time OFF")) then

    begin

    SetLightingState("Study West Window", OFF);

    end;
     
    Phantom99, Mar 18, 2012
    #1
  2. Phantom99

    Phil Summers

    Joined:
    Jun 26, 2009
    Messages:
    41
    Likes Received:
    0
    Location:
    UK
    I am not familiar with Wiser (only the Touch Screens) but PICED and the logic are the same for both.

    I suspect that it's your use of the "Once" statement that's causing the problem. It waits for a transition in the condition you are testing for. Thus unless you wait for midnight you won't see any action.

    From the Help file-

    "Each time the once statement is evaluated, the Logic Engine looks at the state of the condition. If the condition is TRUE and it was FALSE the last time it was executed then it will execute the statement."

    Changing the "once" to "if" would do the trick but it would cause a message on the bus every scan (which is a bad idea). The best way around this would be to set things up the way they're supposed to be using an "if" statement in the initialisation section of your code, leaving the "On" and "Off" logic modules to monitor the date and time for subsequent changes using a combination of "once" and "if" statements.

    Have a look at the "when to use if and once" and "the once statement" in the PICED logic help.

    Or you could just use a schedule which will take care of all of this for you.

    Hope this makes sense and helps you sort things out.

    Phil
     
    Last edited by a moderator: Mar 19, 2012
    Phil Summers, Mar 18, 2012
    #2
  3. Phantom99

    Phantom99

    Joined:
    Feb 16, 2012
    Messages:
    19
    Likes Received:
    0
    Location:
    Sydney
    Some progress on User input to logic

    Thanks Phil, that was quite helpful. Even though I am referring to the Manuals, I don't necessarily see what I am supposed to, so I appreciate the voice of experience.
    I tried removing the date reference and it works fine. (Thanks)


    once (GetIntSystemIO("Study Light Time OFF") <= Time) then
    begin
    SetLightingState("Study West Window", OFF)
    end;

    I was still a bit puzzled by the date input.
    Firstly, I couldn't see how your suggestion to put into Init area would work unless it was the only code I had, and wouldn't I have to reset the logic engine each time the user changed the date? (Not sure how I would do this unless the logic engine restarts each day maybe?)

    Anyhow, I thought I would try something else and put the "Once time" condition prior to the date check and use an IF for the date. That way I figured it would only run the IF statement after the "Once Time" condition is met.
    Seemed logical (in my minds logic engine anyway).
    But alas it didn't work.
    So then I thought I would try an if then else to see if it was getting through the module and nothing works (again).
    I'm wondering if I am referencing the date comparison incorrectly.
    The system IO is "date" type.

    This is what I tried (and nothing turned off):

    once (GetIntSystemIO("Study Light Time OFF") <= Time) then
    begin

    if Date = GetIntSystemIO("Study light Date OFF")

    then

    SetLightingState("Kitchen Over Sink", OFF)


    else
    SetLightingState("Study West Window", OFF)
    end;


    Hoping this makes enough sense for some assistance (and I'll keep checking the manuals in the meantime).
    :)
     
    Phantom99, Mar 19, 2012
    #3
  4. Phantom99

    Darren Senior Member

    Joined:
    Jul 29, 2004
    Messages:
    2,361
    Likes Received:
    0
    Location:
    Adelaide, South Australia
    Try this:

    Code:
    once (Date >= GetIntSystemIO("Pool Pump Date ON")) and 
         (Time >= GetIntSystemIO("Pool Pump Time ON")) then
    begin
       SetLightingState("Study West Window", ON);
    end;
    
    once (Date >= GetIntSystemIO("Pool Pump Date OFF")) and 
         (Time >= GetIntSystemIO("Pool Pump Time OFF")) then
    begin
       SetLightingState("Study West Window", OFF);
    end; 
    
     
    Darren, Mar 21, 2012
    #4
  5. Phantom99

    Phantom99

    Joined:
    Feb 16, 2012
    Messages:
    19
    Likes Received:
    0
    Location:
    Sydney
    Thanks Darren.
    Works perfectly.
    Elegantly simple code. (Works best every time right!)
     
    Phantom99, Mar 22, 2012
    #5
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.