News:

  • September 23, 2026, 12:57:16 PM

Login with username, password and session length

Author Topic: BRX run schedule  (Read 13244 times)

EDurako

  • Sr. Member
  • ****
  • Posts: 52
BRX run schedule
« on: April 30, 2019, 02:11:44 PM »
I have searched to the best of my ability and not found the correct keywords to remedy my issue. I seem to be having a mental block.

I would like to have a pump (Y23) only energized if the current time is between 0545 and 1630 Monday through Thursday. I have tried several things and can't seem to find the secret recipe.

I tried a "greater than or equal to" between SDT0.Time and 01054500 and "less than or equal to" SDT0.Time and 01163000. Both of these numbers were changed by the program (see screen shot). I thought if that would work I could repeat it for the days of the week I want to run.

I then tried looking into the DTCMP command, I couldn't figure out how to get Monday morning in the "second time" slot.

I have a makeshift long logic (see screen shot) that is currently working, but I know that there is a more sophisticated way to execute this.

Please help


franji1

  • Bit Weenie
  • Host Moderator
  • Hero Member
  • *****
  • Posts: 3847
    • Host Engineering
Re: BRX run schedule
« Reply #1 on: April 30, 2019, 03:37:04 PM »
The .Time is a DWORD representation of the Day of Week, Hour, Minute, Second as BYTEs.  Don't use that.
Code: [Select]
-]SDT0.Hour == 5[-----]SDT0.Minute >= 45[---+----]SDT0..DayOfWeek >= 1[----]SDT0.DayOfWeek <= 4[------------------(OUT)
                                            |
-]SDT0.Hour >= 6[-----]SDT0.Hour <= 15[-----+
                                            |
-]SDT0.Hour == 16[----]SDT0.Minute <= 30[---+

EDurako

  • Sr. Member
  • ****
  • Posts: 52
Re: BRX run schedule
« Reply #2 on: April 30, 2019, 03:51:08 PM »
Thank you very much, I think I properly deciphered your reply (screen shot).

BY FAR way cleaner than the way I was looking at it.  :)

franji1

  • Bit Weenie
  • Host Moderator
  • Hero Member
  • *****
  • Posts: 3847
    • Host Engineering
Re: BRX run schedule
« Reply #3 on: April 30, 2019, 04:25:35 PM »
What I like to do is create symbolic constants for the days of the week.

On the Doc Editor, click Symb button to create a Symbolic Constant (one for each day of the week)
So,
Sun equals the decimal constant 0
Mon equals the decimal constant 1
Tue equals the decimal constant 2
?
Sat equals the decimal constant 6

THEN I your Ladder Logic, replace the .DayOfWeek comparison (right side) from the decimal constants to these symbolic constants (Mon and Thu):

]SDT0..DayOfWeek >= Mon[----]SDT0.DayOfWeek <= Thu[
and the code reads much better.  Attached is a screen shot.  Note how the "Extra Info" field reveals the constant value above the symbolic name (nickname), so you get both the symbolic name AND its value!




Controls Guy

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 3626
  • Darth Ladder
Re: BRX run schedule
« Reply #4 on: April 30, 2019, 05:23:42 PM »
I also like to create a four digit variable for hours/minutes, so then you can do the time gates in one shot, instead of separate hour and minutes comparisons.
I retract my earlier statement that half of all politicians are crooks.  Half of all politicians are NOT crooks.  There.

EDurako

  • Sr. Member
  • ****
  • Posts: 52
Re: BRX run schedule
« Reply #5 on: April 30, 2019, 06:00:10 PM »
I will try to execute the doc editor tomorrow when I get back into work. I?m so thankful for this forum. I wish I could figure out how to do an advanced search to narrow my results

Controls Guy

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 3626
  • Darth Ladder
Re: BRX run schedule
« Reply #6 on: April 30, 2019, 06:05:42 PM »
Geez, what the hell did he ever do to you?
I retract my earlier statement that half of all politicians are crooks.  Half of all politicians are NOT crooks.  There.

Mike Nash

  • Hero Member
  • *****
  • Posts: 655
Re: BRX run schedule
« Reply #7 on: April 30, 2019, 06:54:38 PM »
I wish I could figure out how to do an advanced search to narrow my results

Use Google. e.g.

"day of week" site:forum.hosteng.com