Results 1 to 8 of 8

Thread: Apex Code Question: Day of Week Control

  1. #1
    Regular Vistor
    Join Date
    Nov 2016
    Location
    Loveland, CO
    Posts
    18

    Apex Code Question: Day of Week Control

    I want to turn on and off a doser depending on the day of week and time. I want the doser on for 1hr on M and W

    So are these two lines of code sequential in operation or an either situation (IF DoW then If Time) or (If Time then If DoW). Just trying to understand what Apex does for order of operation....

    Fallback OFF
    Set OFF
    If DoW M-W Then On
    If Time 07:00 to 7:59 Then ON

    or

    Fallback OFF
    Set OFF
    If Time 07:00 to 7:59 Then ON
    If DoW M-W Then On

  2. #2
    Frequent Visitor Todd's Avatar
    Join Date
    Jan 2013
    Location
    Huntsville, AL
    Posts
    583
    Order is top to bottom. Any FALSE statement is ignored, last TRUE statement prevails. There are a couple exceptions such as DEFER and MIN TIME.

    Neither of your examples will work correctly since they 'overlap'. So have the Time command work opposite:

    Fallback OFF
    Set OFF
    If DOW -M-W--- Then ON
    If Time 8:00 to 6:59 Then OFF

    The Set OFF is probably redundant, but wont hurt. The Time command leaves a small 'window' for the DOW command to 'fall through' so to speak. It is OFF from 8:00 am until 7:00 am the next morning. Therefore, from 7-8 it will be FALSE and ignored.

  3. #3
    Frequent Contributor zombie's Avatar
    Join Date
    Dec 2013
    Location
    Denver, CO
    Posts
    13,176
    Or alternatively...

    Fallback OFF
    Set OFF
    If Time 07:00 to 07:59 Then ON
    If DOW S-T-TFS Then OFF


    The above statement and the one in the previous post both do the same thing. To create if this AND that logic you have to turn on for one of the conditions that you want and then turn off for the opposite of the other condition you want.

    You might be an engineer if...You have no life and can prove it mathematically.

  4. #4
    New User
    Join Date
    Oct 2013
    Location
    UK
    Posts
    9
    How do I set my ATO to come on between 07:15 and 22:00 om weekdays and only come on between 10:00 to 22:00 on the weekends?

  5. #5
    Frequent Contributor SuncrestReef's Avatar
    Join Date
    Feb 2018
    Location
    Beaverton, OR
    Posts
    3,105
    Quote Originally Posted by WYSIWYG View Post
    How do I set my ATO to come on between 07:15 and 22:00 om weekdays and only come on between 10:00 to 22:00 on the weekends?
    Create two virtual outputs to act as timers, one for weekdays and one for weekends:

    [ATO_Weekday] -- virtual output
    Set OFF
    If Time 07:15 to 22:00 Then ON
    If DOW S------S Then OFF

    [ATO_Weekend] -- virtual output
    Set OFF
    If Time 10:00 to 22:00 Then ON
    If DOW -MTWTF- Then OFF

    Then use these virtual outputs to control your ATO output:

    [ATO]
    Set OFF
    If Output ATO_Weekday = ON Then ON
    If Output ATO_Weekend = ON Then ON

    If you're not familiar with virtual outputs, see my tutorial here: https://www.reef2reef.com/ams/neptun...l-outputs.703/

  6. #6
    New User
    Join Date
    Oct 2013
    Location
    UK
    Posts
    9
    Excellent. Thank you very much.

  7. #7
    New User
    Join Date
    Oct 2013
    Location
    UK
    Posts
    9

    Apex Classic guide

    Hi there, I don't suppose you have a step by step guide for Apex Classic?

  8. #8
    New User
    Join Date
    Oct 2013
    Location
    UK
    Posts
    9
    [ATO]
    Set OFF
    If Output ATO_Weekday = ON Then ON
    If Output ATO_Weekend = ON Then ON

    So, the virtual outlets have been created and now the problem I have is when I replace If Time 19:00 to 07:15 Then OFF with your coding the ATO comes on. How do I get the ATO to only come on if the ATO_SW is CLOSED and at the times specified by whether it's the weekend or weekday?

    My original ATO coding:
    Fallback OFF
    Set OFF
    If ATO_SW CLOSED Then ON
    Defer 000:10 Then ON
    If ATO_SW OPEN Then OFF
    Defer 001:00 Then OFF
    If FeedA 000 Then OFF
    If Time 19:00 to 07:15 Then OFF
    If Water CLOSED Then OFF

Similar Threads

  1. DoS and Day of the Week
    By szavoda in forum DŌS & DDR – Dosing and Fluid Metering System
    Replies: 5
    Last Post: 12-18-2020, 17:27
  2. Question: Programming Day of week and time of day
    By cspearce2 in forum Misc Apex Usage & Programming
    Replies: 2
    Last Post: 04-06-2018, 10:51
  3. DoS and Day of the Week
    By szavoda in forum Apex Programming for Dosing, ATO, and AWC
    Replies: 0
    Last Post: 01-14-2016, 06:37
  4. day of the week
    By slosoaks in forum DŌS & DDR – Dosing and Fluid Metering System
    Replies: 1
    Last Post: 02-22-2015, 10:50
  5. Review My Program Day of week code
    By Kentucky13 in forum Misc Apex Usage & Programming
    Replies: 1
    Last Post: 12-14-2013, 14:12

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •