Host Engineering Forum

General Category => General Discussion => Topic started by: maciek on November 12, 2019, 06:04:28 PM

Title: hours of the day
Post by: maciek on November 12, 2019, 06:04:28 PM
as always this is going to sound dumb but
i would like an output to be on from 8pm(20)to 6am and another one from 7am to 7pm(19)
Title: Re: hours of the day
Post by: franji1 on November 12, 2019, 07:27:05 PM
Is this two different outputs?  The second one is easy

STRGE $Now.Hour 7
ANDLT $Now.Hour 19
OUT C42

The first one is easier if you think about when you want it OFF, between 6 and 20, then invert using the NOT contact.

STRGE $Now.Hour 6
ANDLT $Now.Hour 20
ANDNOT  // inverts power flow; this is the triangle contact with a small circle on the end
OUT C43
Title: Re: hours of the day
Post by: franji1 on November 12, 2019, 07:29:30 PM
Or just

STRGE $Now.Hour 20
ORLT $Now.Hour 6
OUT C43

 ;D
Title: Re: hours of the day
Post by: maciek on November 13, 2019, 09:18:46 PM
thanks you are the man
Title: Re: hours of the day
Post by: Sayles on November 21, 2019, 09:31:27 AM
The first one is more difficult, but do you get any benefits for using that one?
Title: Re: hours of the day
Post by: Bolt on November 21, 2019, 05:33:22 PM
No "benefits" to the more difficult rung.  I suspect franj1 thought about a cleaner way to go about it a minute later.
Title: Re: hours of the day
Post by: PLCwannabe on December 16, 2019, 11:08:29 PM
How about if these outputs need to be on between 2 different times including minutes? E.g. 6:24  to 12:54 but not on Mondays and Fridays. It becomes a little more difficult and messy. That is why a scheduling structure would be great for Do-more. 
Title: Re: hours of the day
Post by: Bolt on December 17, 2019, 12:12:55 AM
I will sometimes create a variable HHMMSS, (Hour *3600) + (Minute *60) + Seconds, creating a time code. Then you can use comparison statements to a single number to enable desired actions.