Internet PLC Forum

General => Technical support => Topic started by: Smurf on June 06, 2005, 12:26:36 PM

Title: Day depended output
Post by: Smurf 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
Title: Re:Day depended output
Post by: Smurf on June 06, 2005, 12:48:28 PM
Is this http://www.madras.fife.sch.uk/maths/amazingnofacts/fact050.html the easiest way?
Title: Re:Day depended output
Post by: Smurf 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.
Title: Re:Day depended output
Post by: support 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.
Title: Re:Day depended output
Post by: Smurf on June 06, 2005, 11:48:33 PM
Looking in the manual is sometimes much easier. :-[