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?
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.
Log in to post a comment.