Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [milo-dev] Subscribe to repeated values

Istvan,

The simplified "Managed" API generally hides this level of complexity.

You can set all the monitoring parameters that subsequent items will be created with on the ManagedSubscription itself though.

Looking again at ManagedDataItem I do think it should have additional get/set methods for changing its parameters though. Probably with support for batching like setSamplingIntervalAsync.

If you need more flexibility with that you can always use the "raw" APIs on OpcUaClient or OpcUaSubscription/OpcUaMonitoredItem.

On Tue, Mar 23, 2021 at 7:22 AM Békési István <istibekesi@xxxxxxxxx> wrote:
Hi Kevin,

I ran into this problem again after a while.
Your suggested solution works fine. However, I think the way how the monitoring parameters are derived from the subscription could be improved.

I kinda learn the OPC UA via the SDK, so it caused me a bit of a misunderstanding to see this figure:
image.png

Based on this, I believe the data change filter and other parameters (like default queue size, discard oldest) should be configurable per monitored items.
Currently only the sampling interval parameter can be passed to ManagedSubscription's createDataItemsAsync method. 

How about extending createDataItems methods by method overloading in ManagedSubscription?
Something like this:
public CompletableFuture<List<ManagedDataItem>> createDataItemsAsync(
double samplingInterval, ExtensionObject filter, UInteger queueSize, boolean discardOldest,
List
<ReadValueId> readValueIds,
Consumer<ManagedDataItem> consumer
)
...or add the complete MonitoringParameters object as an extra parameter?

Kind Regards,
Istvan



Békési István <istibekesi@xxxxxxxxx> ezt írta (időpont: 2020. nov. 17., K, 13:58):
Hi Kevin,

Awesome, thanks a lot for your rapid answer!
It works like a charm.

Isti

Kevin Herron <kevinherron@xxxxxxxxx> ezt írta (időpont: 2020. nov. 17., K, 13:08):
Isti,

If this can be accomplished at all it would be by creating your MonitoringItems with a filter that uses DataChangeTrigger.StatusValueTimestamp. The default is DataChangeTrigger.StatusValue, meaning only changes to Status or Value are reported. Unfortunately some servers do not record Timestamp-only changes, e.g. the embedded server in the Siemens S7-1500 does not update the timestamp unless the value has also changed.

If you are using the ManagedSubscription API you can set the DataChangeFilter (which defines the trigger) like this:

DataChangeFilter filter = new DataChangeFilter(
    DataChangeTrigger.StatusValueTimestamp,
    uint(DeadbandType.None.getValue()),
    0.0
);

subscription.setDefaultDataFilter(filter);

All subsequent MonitoredItems you create with that subscription will have the new filter.

On Tue, Nov 17, 2020 at 3:09 AM Békési István <istibekesi@xxxxxxxxx> wrote:
Hi There,

I'm pretty new to OPC UA and I was playing around with the tools and subscriptions.

My question is, how can I subscribe to a node that sometimes publishes the same value as the previous one?

Story in details:
I've created a simulated node, publishing random values between 1-6 in every second (basically a dice roller machine).
image.png
After subscribing to such a node, I cannot receive repeated values. Is there a way to do so?

Kind regards,
Isti




_______________________________________________
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