如何在尝试从Opc Server获取历史数据时修复“BadServiceUnsupported”错误

问题描述 投票:0回答:2

我试图从opc服务器获取标签的历史数据,但我收到'BadServiceUnsupported'错误。我已经为KepserverEX V6中的特定标签配置了Opc服务器和本地历史数据库。

我正在使用这个opc库https://github.com/OPCFoundation/UA-.NETStandard

我成功读取了标记值,但是我遇到了历史数据的问题,正是在调用HistoryRead方法时:

m_Session.HistoryRead( null, new ExtensionObject(details), TimestampsToReturn.Source, false, nodesToRead, out results, out diagnosticInfos);

获得'BadServiceUnsupported'异常。

我还在KepserverEx中的项目设置上启用了HDA连接,但它似乎没有解决问题。

我该如何解决这个问题?

c# opc-ua
2个回答
0
投票

在这种情况下没有什么可以解决的。 Kepserver仅支持OPC Classic(COM / DCOM)的HDA,而不支持OPC UA。


1
投票

要解决此问题,您可以运行OPC UA Wrapper Server:https://github.com/OPCFoundation/UA-.NETStandard/blob/master/ComIOP/README.md

Wrapper Server将成为您的应用程序和KepServerEX之间的桥梁。它是这样的:

[Your Application] --- (OPC-UA) ---> [OPC UA Wrapper Server] --- (OPC-HDA) ---> [KepServerEX]

我已经测试了上面的场景,使用m_Session.HistoryRead()我可以成功读取KepServerEX v6.6的历史值

要使Server Wrapper打开与KepServerEX的HDA连接,请打开Opc.Ua.ComServerWrapper.Config.xml并为HDA启用ComClientConfiguration。它应该看起来像这样:

<ComClientConfiguration i:type="ComHdaClientConfiguration">
    <ServerUrl>opc.com://localhost/Kepware.KEPServerEX_HDA.V6/{5C905440-YOUR_CLSID_HERE}</ServerUrl>
    <ServerName>HDA</ServerName>
    <MaxReconnectWait>10000</MaxReconnectWait>
    <SeperatorChars></SeperatorChars>
    <AddCapabilitiesToServerObject>true</AddCapabilitiesToServerObject>
    <AttributeSamplingInterval>1000</AttributeSamplingInterval>
    <TreatUncertainAsBad>true</TreatUncertainAsBad>
    <PercentDataBad>0</PercentDataBad>
    <PercentDataGood>100</PercentDataGood>
    <SteppedSlopedExtrapolation>false</SteppedSlopedExtrapolation>
</ComClientConfiguration>
© www.soinside.com 2019 - 2024. All rights reserved.