CODESYS - the IEC 61131-3 automation software

Welcome to the official CODESYS Forum by 3S-Smart Software Solutions GmbH | A member of the CODESYS Group
Deutsche Version English version russian version 
It is currently Mon Feb 24, 2020 9:59 pm

All times are UTC+01:00

Post new topic  Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Fri Nov 29, 2019 3:53 pm 

Joined: Fri Sep 20, 2019 10:41 am
Posts: 2
Hi everyone,

I'm quite new to CodeSys. I'm dealing with an OPC DA project. The scenario is as follows:

I have a PID block. I want to store in an array the timestamp of each output value, whenever it changes. In this case the OP.

How can I achieve that?

Thank you.

PostPosted: Sat Nov 30, 2019 6:38 pm 

Joined: Tue Mar 26, 2019 4:28 pm
Posts: 97
DTUtil library has a get time function.
You might need to setup the timezone if you don't want to use UTC. (Although, you should always use UTC for control!)

Then you just need some data compare logic. Perhaps you will have some minimum change value?
So, here is a typical data change detector..
IF (PID_0.OP > (lastOP + deadband)) OR 
       (PID_0.OP < (lastOP - deadband)) THEN
     //store the array...
     lastOP := PID_0.OP;

Let us know how you go with your code.

Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 2 posts ] 

All times are UTC+01:00

Who is online

Users browsing this forum: Andreas Kehrer, xs27 and 8 guests

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:  
Powered by phpBB® Forum Software © phpBB Limited