Using Scheduler with General Logic

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • mcockerell
    Automated Home Sr Member
    • Jan 2009
    • 74

    Using Scheduler with General Logic

    Hi,

    I have been experimenting with a combination of scheduler events and general logic in the hope of having more flexibility than provided by lighting scenes - I want to control external and internal lighting based on time of day and day of week, with overrides for if I'm working from home, if we're out for the evening or away on holiday.

    The logic side is easy to configure, but I am having difficulty setting up the scheduler events - when I try to add an event action function it gives me two selections for the same general logic input (each with the same name), but neither seems to establish a connection to the general logic element itself.

    Am I missing something obvious, or is it just that this type of arrangement isn't possible?

    Thanks,
    Martin
  • Viv
    Automated Home Ninja
    • Dec 2004
    • 284

    #2
    Originally posted by m****erell View Post
    Hi,

    ... when I try to add an event action function it gives me two selections for the same general logic input (each with the same name),...

    Martin
    This is an error but does not affect the functionality. Its just offered twice.

    A few notes about Scheduler and Logic Gates etc.

    In Cortex, information is transfered around via its connections. The output of an object (A) is connected to the input of another object (B). When the output (A) changes, object (B) is informed. Object (B) then intergoates Object (A) and askes what the state of the output of Object (A) is on this connection. Depending on the type of object (B) it may react simply to being pinged on that input or may take the output state of (A) to make a decision on what to do.

    1. The Scheduler makes temporary connections to things when the event happens. So this is not ideal for gates that evaluate static conditions such as AND, OR, XOR etc, but will work until the gate is re-evaluated.

    2. The logic gates, SR Flip-Flop, Monostable, T Flip-Flop, have set, reset and clock inputs. They all evaluate the sender for 'True' in order to react (unlike some real hardware which is often negatively edge or logic low triggered).

    3. For the scheduler to trigger the S, R, or CLK inputs the Scheduler state should be set to '1'.

    If this information does not resolve your problem, can you provide more detail i.e. the type of scheduled event and what type of gate you are connecting to.

    Viv.
    Last edited by Viv; 27 October 2011, 11:19 PM.

    Comment

    • mcockerell
      Automated Home Sr Member
      • Jan 2009
      • 74

      #3
      Hi Viv,

      Thanks for the information, most helpful.

      I have now connected the scheduler event outputs to the S/R inputs of an SR FlipFlop logic element but am not seeing the latching taking place - I have set the action state to 1.

      I also played with the Time Window logic element instead; this seems to work as expected, but unfortunately doesn't give me the flexibility to select which days it applies to - I need only weekdays for part of the logic.

      I'm also seeing a problem if I connect a QBI button to the CLK input of a T FlipFlop logic element - again I'm not seeing the output toggle when the button is pressed. This QBI is also used for Cortex pause/run - does having Reflex & Cortex enabled affect button operation?

      Thanks,
      Martin

      Comment

      • Viv
        Automated Home Ninja
        • Dec 2004
        • 284

        #4
        Originally posted by m****erell View Post
        Hi Viv,
        I have now connected the scheduler event outputs to the S/R inputs of an SR FlipFlop logic element but am not seeing the latching taking place - I have set the action state to 1.
        Martin
        I have tried the SR Flip-Flop and triggering the S and R inputs from the Scehduler and it seems to work fine for me. In the scehduler I had the value set to '1' in both entries.
        I was able to set and reset the flip-flop.

        You can have the scheduler events window up and see the 'Done' property go to 'Y' when it fires the output. You can also have the Gate Item Edit menu up and should observer the inputs changing i.e. going to a '1' and the output changing accordingly. Both inputs set to '1' is indeterminant.

        Are you running the latest Cortex 25.2.10 ?

        Comment

        • mcockerell
          Automated Home Sr Member
          • Jan 2009
          • 74

          #5
          Hi Viv,

          Yes, I am running Cortex 25.2.10.

          I have been experimenting today and have managed to get scheduler events triggering General Logic; but I have found a problem - they only work if the 'Where' is set to 'All'. I don't want any annunciation so was setting 'Where' to 'Nowhere' for all events; this results in 'Nowhere Error GetPortValue virtual' in the log - any other value (except All) shows as 'Done' but doesn't seem to trigger (there is also no error in the log).

          Also, I still cannot get the QBI buttons to toggle the T-type - any ideas?

          Thanks,
          Martin

          Comment

          • Viv
            Automated Home Ninja
            • Dec 2004
            • 284

            #6
            Must admit we had not considered the 'Where' property influencing your results.
            I will try and explain although it may seem quite complicated…

            Consider a button in a room configured to trigger an external temperature sensor to speak its temperature. The temperature sensor offers two inputs, speak local and speak broadcast. The speak local is not local to the sensor but local to the sender, that is the button. So you press a button and hear the temperature spoken in the room where the button and the intercom are.

            The way this happens is the temperature sensor on receiving a ping on its speak local input passes a request to speak certain words to the sound object but as if it came from the button (the sender). The sound object seeing it came from a button looks to see if it is in a room. If it is it then looks to see if an intercom is in that room. Finding the intercom that’s where it directs the spoken words.

            Speaking broadcast sends a request as if it came from a null source. That is then interpreted as broadcast.

            The scheduler is however a special case. It mimics things as if they came from other objects. For example if you want the scheduler to cause the speaking of the outside temperature but in the room where the button is (the above example) then the scheduler pings the temperature sensor as if it came from the room where the button is. This is the ‘Where’ property in the scheduler.

            In your example setting the ‘Where’ property to a room will mean the scheduler will ping the general logic gate as if it came from that room which is not what you want, but is why it does not cause an error.

            The ‘Nowhere’ object is a special case which was added that if the sound object received a message from ‘Nowhere’ is did not speak at all. Your general logic gate is interrogating the ‘Nowhere’ object for a value which has not been implemented but clearly needs to be even if only to not report an error.

            So the simply answer is the scheduler needs to be set to ‘All’ for the moment and the gate should not cause anything to speak.

            I’ll get back regarding QBI buttons.

            Viv.

            Comment

            • Viv
              Automated Home Ninja
              • Dec 2004
              • 284

              #7
              QBI Buttons

              Hi Martin,

              I have tried QBI button 3 connected to T Flip-Flop. Provided T input is at a '1' (I connected to a room which was occupied) then pressing the button toggled the T Flip-Flop output correctly.

              I do not believe having reflex enabled as well should affect its Cortex operation provided that button does not have any reflex vectors.

              Would need more details of button connections and vector details to study further.

              Viv.

              Comment

              • mcockerell
                Automated Home Sr Member
                • Jan 2009
                • 74

                #8
                Hi Viv,

                I had another go at using the QBI buttons last night without success.

                I also tried using another switch to toggle the T-type, but this didn't seem to work either (it's normally used to toggle the porch lights on and off so I know it usually works).

                I'm slightly curious about your comment regarding an occupied room; my reading of the help for the T-type says that an unconnected T input defaults to 1 - is this not the case?

                I'll try a few more things when I have more time, hopefully this evening.

                Thanks,
                Martin

                Comment

                • Viv
                  Automated Home Ninja
                  • Dec 2004
                  • 284

                  #9
                  I add the connection to the T input as I was testing the clk with the T=0 e.g. does not toggle. However I tested disconnected and it does go to '1'.

                  Attached images.
                  I used Button behaviour menu to simulate button press but real button also works.

                  Viv
                  Attached Files

                  Comment

                  • mcockerell
                    Automated Home Sr Member
                    • Jan 2009
                    • 74

                    #10
                    OK, I've tried again with no success - I've even deleted all of the logic and rebuilt just a single gate in the Hall in case it was an issue of scope.

                    I'm attaching an image showing the configuration I was testing - the only thing that happened was that I got the message 'House set occupied' when I clicked on Button 3.

                    Grateful for any ideas.

                    Thanks,
                    Martin
                    Attached Files

                    Comment

                    • Viv
                      Automated Home Ninja
                      • Dec 2004
                      • 284

                      #11
                      Well it looks no different to what I tried which worked.

                      So if you can send a copy of your database to Idratek we will find the cause.

                      Viv.

                      Comment

                      • Viv
                        Automated Home Ninja
                        • Dec 2004
                        • 284

                        #12
                        Martin has supplied his database and from this was able to discover the problem.
                        It was caused by connecting the logic gate output to the LED of the button.
                        This is quite legitimate and should not have caused a problem. The result was that the gate got clocked twice because the gate got re-evaluated twice. This is the only gate which would have suffered from being re-evaluated twice.

                        Cortex update 25.2.11 should resolve the problem.

                        Viv

                        Comment

                        • mcockerell
                          Automated Home Sr Member
                          • Jan 2009
                          • 74

                          #13
                          Indeed it has, many thanks Viv - excellent support as ever.

                          Regards,
                          Martin

                          Comment

                          • mcockerell
                            Automated Home Sr Member
                            • Jan 2009
                            • 74

                            #14
                            With the onset of darker mornings and evenings I am revisiting the logic that I am using to control the outside lighting and would appreciate clarification on a couple of things:

                            1) The logic that I have implemented provides an on/off state for the outside lighting.
                            I haven't found a way to use this to directly control the lighting; instead I am using 1 second monostables to trigger the On and Off inputs
                            when the state changes. Is this the best way to do this?

                            2) As previously, I am using a T-type to store the toggle on/off of an override status derived from a QBI button.
                            I am also directly controlling the associated LED on the QBI to reflect the status.
                            Is this the best way to do this? If I edit the logic gate to review the current status it is reevaluated and resets.
                            Is there any way to implement the latching and LED follow state in the QBI itself? - this would be more reliable.

                            3) I am using Time Windows to set the operating windows (morning and evening) for the outside lights.
                            However, I am having to use Events to trigger a 'Weekday' status latch (an SR-type) - I am using single events at present.
                            Is there a better way of doing this?

                            4) As I require a default High (1) input for the T-type and Time Windows I have used a NOT gate with a disconnected input to generate a permanent 1.
                            It might be useful to define a World/Global 'True' output for this purpose.


                            I would appreciate any comments on the above.

                            Martin

                            Comment

                            • Karam
                              Automated Home Legend
                              • Mar 2005
                              • 863

                              #15
                              I just wonder if there is another way to achieve what you want. Is it that you don't have light level sensors and are using scheduling as a way around this, or is it that you are trying to achieve some specific behaviours not covered by existing logic notwithstanding light level sensing?

                              Comment

                              Working...
                              X