Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [milo-dev] DataChangeFilter for MonitoredItem to receive a callback even if the value does not change

Many thanks for checking this Kevin!

We will have to add something like a timestamp to the contents of the string to make sure it triggers a change when written.

On Wed, May 20, 2020 at 4:39 PM Kevin Herron <kevinherron@xxxxxxxxx> wrote:
Okay, unfortunately this is expected behavior.

Here is his reply:

Timestamps are not stored in the PLC context, all values are stamped by the OPC UA Server when requested.
This means that a write to such a variable will not influence the timestamp. If you read the value, you will get a timestamp of the read operation and not the last time the variable was written to. 
 
This also means that reading and writing the same value to a PLC variable you are subscribed to will not trigger a Datachangenotification.
 
Same occurs if you write the variable at the end of the control cycle of the PLC Program.
Even when written every millisecond in the control cycle, a data (and timestamp) change will only occur when the value changes.
 
This applies also to triggeringlinks.

On Wed, May 20, 2020 at 5:14 AM Kevin Herron <kevinherron@xxxxxxxxx> wrote:
Guy,

I think it's expected that a read operation always reports a new timestamp. I'm not sure there's anything that can be done here if it's not already being reported with DataChangeTrigger.StatusValueTimestamp.

I know an engineer who works on the OPC UA server in the S7-1500, I'll reach out to him and ask if this is expected behavior.

On Tue, May 19, 2020 at 9:01 PM Guy Mahieu <guy.mahieu@xxxxxxxxx> wrote:
Hi Kevin,

Thanks for the swift response!

This value is written from within the logic of a PLC program, not via OPC-UA. 
Good point about the writing of the same string potentially being considered a no-op, that would explain it. 
Is there an easy way to check if the timestamp is even changed? A read operation always seems to give me the timestamps of the read action.

Cheers,
Guy

On Tue, May 19, 2020 at 9:05 PM Kevin Herron <kevinherron@xxxxxxxxx> wrote:
Guy,

Glad to hear you've had success using Milo.

It seems you're using the correct approach to me, so my first thought is that means the server in the S7-1500 treats that write with the same String value as something like a no-op and doesn't even update the timestamp. 

Are you writing this value from an OPC UA client or as part of the logic of the PLC program? Writes from an OPC UA client often do not include any timestamps or StatusCode, so I could see an argument for this logic being correct, since in that case neither the status, value, or timestamp would have changed.

On Tue, May 19, 2020 at 11:55 AM Guy Mahieu <guy.mahieu@xxxxxxxxx> wrote:
Hello all,

I have been using milo for a few years in a handful of projects and I must say I am amazed at how well it works and how stable it runs. Great work! 

Currently we are in a situation where we have a monitored item on a node to which a string is written by the PLC, and we want to receive a callback for this write, even when the same value is written to the DB by the PLC than the one that was already there.

For a Mitsubishi Melsec IQ-R PLC we have been able to get this working using a DataChangeFilter like this:

DataChangeFilter filter = new DataChangeFilter(DataChangeTrigger.StatusValueTimestamp, UInteger.valueOf(DeadbandType.None.getValue()), null);
ExtensionObject eoFilter = ExtensionObject.encode(client.getSerializationContext(), filter);
return new MonitoringParameters(
                uaSubscription.nextClientHandle(),
                (double) monitoredNodeSettings.getSamplingIntervalInMillis(),
                eoFilter,
                uint(monitoredNodeSettings.getQueueSize()),
                true
);

But this does not seem to work with a Siemens S7-1500. We receive callbacks when the values change, but if the same value is written no callback is generated for the monitored item.

Did anyone here ever try to do something similar?
Any idea on why this method would fail on an S7?

Kind regards,

Guy Mahieu
_______________________________________________
milo-dev mailing list
milo-dev@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/milo-dev
_______________________________________________
milo-dev mailing list
milo-dev@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/milo-dev
_______________________________________________
milo-dev mailing list
milo-dev@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/milo-dev
_______________________________________________
milo-dev mailing list
milo-dev@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/milo-dev

Back to the top