Host Engineering Forum

General Category => Do-more CPUs and Do-more Designer Software => Topic started by: EDurako on April 30, 2019, 02:11:44 PM

Title: BRX run schedule
Post by: EDurako 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

Title: Re: BRX run schedule
Post by: franji1 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[---+
Title: Re: BRX run schedule
Post by: EDurako 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.  :)
Title: Re: BRX run schedule
Post by: franji1 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!



Title: Re: BRX run schedule
Post by: Controls Guy 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.
Title: Re: BRX run schedule
Post by: EDurako 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
Title: Re: BRX run schedule
Post by: Controls Guy on April 30, 2019, 06:05:42 PM
Geez, what the hell did he ever do to you?
Title: Re: BRX run schedule
Post by: Mike Nash 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