It is currently Thu Aug 21, 2014 6:05 am




Post new topic Reply to topic  [ 6 posts ] 
 Time Problem 
Author Message
Cadet
Cadet

Joined: Tue Jan 25, 2011 4:25 am
Posts: 3
Post Time Problem
In a group I added a Action Item "timer" which condition set as hour=23, min=59 and sec>=0 and sec<=30
and Group's Update Rate=30 second. The timer is the trigger item for the group i.e it has to log data every day at 23:59:(0-30) but I am facing some variation of time on data logging at SQL server.
Sometime it log data at 23:58,00:06.............
please refer to attached file for variation.



Regards,
Subodh


Attachments:
File comment: the time is not fit according to the given condition
log data.xls [25.5 KiB]
Downloaded 194 times
Tue Jan 25, 2011 5:19 am
Profile
Moderator
Moderator

Joined: Sun Apr 02, 2006 2:46 pm
Posts: 1982
Location: Sacramento, CA
Post Re: Time Problem
What is the exact expression on the timer condition?

_________________
Travis Cox
Inductive Automation
Technical Support Rep.


Tue Jan 25, 2011 9:38 am
Profile WWW
Moderator
Moderator

Joined: Sun Apr 02, 2006 3:43 pm
Posts: 2491
Post Re: Time Problem
Also, is the database on a different server? How are you getting the time for the trigger? It could be a difference between the clocks of the FactorySQL machine, and the database server. The query that FactorySQL sends to the server will have "t_stamp=CURRENT_TIMESTAMP", so the time recorded will be the database time. If you're getting the trigger time with an expression and "now()" (or one of the other similar functions), you're using the time on the local machine.

If this sounds like your setup, I would recommend logging the local machine time as the timestamp. You can do this easily:
1) On the group, turn off "store timestamp"
2) Create an Action Item, set it to "DateTime" datatype, writeback to "t_stamp", and set its expression to "now()".

Regards,

_________________
Colby Clegg
Inductive Automation
Software Development


Tue Jan 25, 2011 1:38 pm
Profile
Cadet
Cadet

Joined: Tue Jan 25, 2011 4:25 am
Posts: 3
Post Re: Time Problem
the exact condition for Action item "Timer" is as follow:-

If((ExtractHour(Now())=12 && ExtractMinute(Now())=59 && ExtractSecond(Now())>=0 && ExtractSecond(Now()) <=30),1,0)

and "t_stamp" data is directly dump to the server from factory SQL.


Regards,
Subodh


Wed Jan 26, 2011 9:29 pm
Profile
Moderator
Moderator

Joined: Sun Apr 02, 2006 3:43 pm
Posts: 2491
Post Re: Time Problem
Hello,

You forgot to mention if the database is on a different machine. I suspect it's as I described earlier- I recommend turning off "store timestamp" and making your own timestamp item based on "now()" and seeing if that changes things.

Regards,

_________________
Colby Clegg
Inductive Automation
Software Development


Thu Jan 27, 2011 6:44 am
Profile
Cadet
Cadet

Joined: Tue Jan 25, 2011 4:25 am
Posts: 3
Post Re: Time Problem
After creating my own action item for date time (t_stamp) on group the problem of time mismatch has solved ....
Thanks for ur help..........





Regards,
Subodh Pradhan


Tue Feb 01, 2011 8:47 pm
Profile
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: