Author Topic: Day depended output  (Read 4957 times)

Smurf

  • Guest
Day depended output
« on: June 06, 2005, 12:26:36 PM »
Thanks for the previous very fast reply.
Another question: how can we activate an output day dependent, let's say activate each Monday at 07 AM output 1 and each Sunday on 8AM activate output 2.

Other question when excuting a PIDDEF: is it correct that we only needs to execute this function once at startup of the program or repeat after some time?

Kind regards

Tim

Smurf

  • Guest
Re:Day depended output
« Reply #1 on: June 06, 2005, 12:48:28 PM »

Smurf

  • Guest
Re:Day depended output
« Reply #2 on: June 06, 2005, 02:19:30 PM »
Found something, please correct if wrong
A = (23*DATE[2]/9) + DATE[3] + 4 + DATE[1] + (DATE[1]/4) - (DATE[1]/100) +(DATE[1]/400)- 2
B = A MOD 7
0 = Sunday and 1 = Monday

This seems not working
A = (((23*DATE[2]/9) + DATE[3] + 4 + DATE[1] + (DATE[1]/4) - (DATE[1]/100) + (DATE[1]/400) ? 2) MOD 7))

Then I need to put the dates in some sort of lookup table I think and match the right number wit the right day.

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3170
    • View Profile
    • Internet Programmable PLCs
Re:Day depended output
« Reply #3 on: June 06, 2005, 08:59:48 PM »
The variable DATE[4] gives the day of the week.  1 for Monday and 7 for Sunday - if this is what you are looking for. You just have to test the variable DATE[4] first, if it matches the day of interest, then further test the time and set the output accordingly.

PIDDEF only needs to be executed once unless you want to change the parameters after sometime. The Integral and derivative historical data will be cleared when PIDDEF is run.
« Last Edit: June 07, 2005, 09:35:04 AM by support »
Email: support@triplc.com
Tel: 1-877-TRI-PLCS

Smurf

  • Guest
Re:Day depended output
« Reply #4 on: June 06, 2005, 11:48:33 PM »
Looking in the manual is sometimes much easier. :-[