News:

  • April 30, 2026, 08:16:21 PM

Login with username, password and session length

Author Topic: hours of the day  (Read 9874 times)

maciek

  • Sr. Member
  • ****
  • Posts: 95
hours of the day
« 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)

franji1

  • Bit Weenie
  • Host Moderator
  • Hero Member
  • *****
  • Posts: 3806
    • Host Engineering
Re: hours of the day
« Reply #1 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

franji1

  • Bit Weenie
  • Host Moderator
  • Hero Member
  • *****
  • Posts: 3806
    • Host Engineering
Re: hours of the day
« Reply #2 on: November 12, 2019, 07:29:30 PM »
Or just

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

 ;D

maciek

  • Sr. Member
  • ****
  • Posts: 95
Re: hours of the day
« Reply #3 on: November 13, 2019, 09:18:46 PM »
thanks you are the man

Sayles

  • Newbie
  • *
  • Posts: 1
Re: hours of the day
« Reply #4 on: November 21, 2019, 09:31:27 AM »
The first one is more difficult, but do you get any benefits for using that one?

Bolt

  • Hero Member
  • *****
  • Posts: 595
Re: hours of the day
« Reply #5 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.

PLCwannabe

  • Hero Member
  • *****
  • Posts: 208
Re: hours of the day
« Reply #6 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. 

Bolt

  • Hero Member
  • *****
  • Posts: 595
Re: hours of the day
« Reply #7 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.