gpt4 book ai didi

尝试将 OPC UA 数据写入云时,Azure OPC Publisher 显示 "no job received"

转载 作者:行者123 更新时间:2023-12-03 02:39:12 27 4
gpt4 key购买 nike

我正在尝试遵循这些教程:

https://sandervandevelde.wordpress.com/2018/11/06/getting-started-with-opc-ua-on-azure-iot-edge/https://learn.microsoft.com/en-us/azure/iot-accelerators/howto-opc-publisher-run

将数据从 opc-ua 服务器传输到 Azure 云。

我已经成功玩过https://learn.microsoft.com/en-us/azure/iot-edge/quickstart教程。

我想也许OPCPublisher找不到配置文件?!

我在 C:\iiotedge\pn.json 下设置了配置文件(更改了 ip):

[
{
"EndpointUrl": "opc.tcp://my.machine.ip:53530/OPCUA/SimulationServer",
"UseSecurity": false,
"OpcNodes": [
{
"Id": "ns=3;s=Counter"
},
{
"Id": "ns=3;s=Random"
}
]
}
]

容器创建选项如下:

{
"Hostname": "publisher",
"Cmd": [
"publisher",
"--ll=debug",
"--pf=./pn.json",
"--di=60",
"--to",
"--aa",
"--si",
"0",
"--ms",
"0"
],
"HostConfig": {
"PortBindings": {
"62222/tcp": [
{
"HostPort": "62222"
}
]
},
"ExtraHosts": [
"localhost:127.0.0.1"
],
"Binds": [
"c:/iiotedge:c:/appdata"
]
}
}

opc-publisher 的日志输出是:

PS C:\Users\azureuser> iotedge logs OPCPublisher
[06:02:52 INF] Connecting all clients to edgevm using MqttOverTcp. (Microsoft.Azure.IIoT.Module.Framework.Client.IoTSdkFactory)
[06:02:53 DBG] Starting Module Host... (Microsoft.Azure.IIoT.Module.Framework.Hosting.ModuleHost)
[06:02:53 WRN] Bypassing certificate validation for client. (Microsoft.Azure.IIoT.Module.Framework.Client.IoTSdkFactory)
[06:02:53 INF] Running in iotedge context. (Microsoft.Azure.IIoT.Module.Framework.Client.IoTSdkFactory)
[06:02:53 DBG] [Info] Informational: IotHubConnectionString#50048984 .ctor IAuthenticationMethod is AuthenticationWithTokenRefresh: ModuleAuthenticationWithHsm#5560998 (Microsoft.Azure.Devices.Device.Client)
[06:02:53 DBG] [Info] Informational: PipelineContext#2327487 Set ITransportSettings[] = Microsoft.Azure.Devices.Client.ITransportSettings[1] (Microsoft.Azure.Devices.Device.Client)
[06:02:53 DBG] [Info] Informational: PipelineContext#2327487 Set IotHubConnectionString = IotHubConnectionString#50048984 (Microsoft.Azure.Devices.Device.Client)
[06:02:53 DBG] [Info] Informational: PipelineContext#2327487 Set OnMethodCalledDelegate = OnMethodCalledDelegate#1525631264 (Microsoft.Azure.Devices.Device.Client)
[06:02:53 DBG] [Info] Informational: PipelineContext#2327487 Set Action`1 = System.Action`1[Microsoft.Azure.Devices.Shared.TwinCollection] (Microsoft.Azure.Devices.Device.Client)
[06:02:53 DBG] [Info] Informational: PipelineContext#2327487 Set ConnectionStatusChangesHandler = ConnectionStatusChangesHandler#1558992671 (Microsoft.Azure.Devices.Device.Client)
[06:02:53 DBG] [Info] Informational: PipelineContext#2327487 Set OnReceiveEventMessageCalledDelegate = OnReceiveEventMessageCalledDelegate#1523701015 (Microsoft.Azure.Devices.Device.Client)
[06:02:53 DBG] [Info] Informational: PipelineContext#2327487 Set ProductInfo = .NET/1.24.0 (.NET Core 3.1.3; Microsoft Windows 10.0.17763 WindowsProduct:0x00000030; X64; 176FF90A-591F-574A-86D3-34024A506733) (Microsoft.Azure.Devices.Device.Client)
[06:02:53 DBG] [CreateFromConnectionString] Informational: InternalClient#45596481 HostName=edgevm;DeviceId=myEdgeDevice;ModuleId=OPCPublisher Mqtt_Tcp_Only (Microsoft.Azure.Devices.Device.Client)
[06:02:53 DBG] [Info] Informational: InternalClient#45596481 SetConnectionStatusChangesHandler ConnectionStatusChangesHandler#1809274109 (Microsoft.Azure.Devices.Device.Client)
[06:02:53 DBG] [Info] Informational: RetryDelegatingHandler#39070558 EnsureOpenedAsync Opening connection (Microsoft.Azure.Devices.Device.Client)
[06:02:53 DBG] [Info] Informational: ProtocolRoutingDelegatingHandler#36936550 ProtocolRoutingDelegatingHandler.OpenAsync Trying Mqtt_Tcp_Only (Microsoft.Azure.Devices.Device.Client)
[06:02:53 DBG] [Info] Informational: PipelineContext#2327487 Set ITransportSettings = MqttTransportSettings#12674872 (Microsoft.Azure.Devices.Device.Client)
[06:02:54 DBG] [Info] Informational: (null) GetEventLoopGroup EventLoopGroup threads count was not set. (Microsoft.Azure.Devices.Device.Client)
[06:02:54 DBG] [Info] Informational: MqttTransportHandler#46964992 CreateChannelFactory Connecting to 172.23.40.21 (Microsoft.Azure.Devices.Device.Client)
[06:02:54 DBG] [GenerateToken] Informational: ModuleAuthenticationWithHsm#5560998 2020-05-22T06:02:54.4013728Z 2020-05-22T07:02:54.0000000Z (Microsoft.Azure.Devices.Device.Client)
[06:02:54 INF] 0: Module myEdgeDevice_OPCPublisher reconnected due to Connection_Ok. (Microsoft.Azure.IIoT.Module.Framework.Client.IoTSdkFactory)
[06:02:54 DBG] [Info] Informational: MqttIotHubAdapter#14347911 SendMessageAsync id=0 qos=AtMostOnce topic=$iothub/twin/GET/?$rid=71fb2065-fb60-41e3-b4a5-c15d95292cd1 (Microsoft.Azure.Devices.Device.Client)
[06:02:54 INF] Initialize device twin for myEdgeDevice - OPCPublisher (Microsoft.Azure.IIoT.Module.Framework.Hosting.ModuleHost)
[06:02:54 INF] Applying initial desired state. (Microsoft.Azure.IIoT.Module.Framework.Hosting.ModuleHost)
[06:02:54 INF] Reporting currently initial state. (Microsoft.Azure.IIoT.Module.Framework.Hosting.ModuleHost)
[06:02:54 DBG] Reporting controller state... (Microsoft.Azure.IIoT.Module.Framework.Hosting.ModuleHost)
[06:02:54 DBG] [Info] Informational: MqttIotHubAdapter#14347911 SendMessageAsync id=0 qos=AtMostOnce topic=$iothub/twin/PATCH/properties/reported/?$rid=b536d6e8-9ae0-4245-86a2-53e2688e4c06 (Microsoft.Azure.Devices.Device.Client)
[06:02:54 DBG] Complete controller state reported (properties: ["JobCheckInterval", "HeartbeatInterval", "MaxWorkers", "IdentityToken"]). (Microsoft.Azure.IIoT.Module.Framework.Hosting.ModuleHost)
[06:02:54 DBG] [Info] Informational: MqttIotHubAdapter#14347911 SendMessageAsync id=0 qos=AtMostOnce topic=$iothub/twin/PATCH/properties/reported/?$rid=b7d3c2a6-1daa-4431-8448-10430c29ab8f (Microsoft.Azure.Devices.Device.Client)
[06:02:54 INF] Module Host started. (Microsoft.Azure.IIoT.Module.Framework.Hosting.ModuleHost)
[06:02:54 INF] Creating new worker... (Microsoft.Azure.IIoT.Agent.Framework.Agent.WorkerSupervisor)
[06:02:54 INF] Creating new worker... (Microsoft.Azure.IIoT.Agent.Framework.Agent.WorkerSupervisor)
[06:02:54 INF] Creating new worker... (Microsoft.Azure.IIoT.Agent.Framework.Agent.WorkerSupervisor)
[06:02:54 INF] Creating new worker... (Microsoft.Azure.IIoT.Agent.Framework.Agent.WorkerSupervisor)
[06:02:54 INF] Creating new worker... (Microsoft.Azure.IIoT.Agent.Framework.Agent.WorkerSupervisor)
[06:02:54 INF] Starting worker 'myEdgeDevice_OPCPublisher_0'... (Microsoft.Azure.IIoT.Agent.Framework.Agent.WorkerSupervisor)
[06:02:54 INF] Worker WorkerId: myEdgeDevice_OPCPublisher_0 {"Type": "publisher", "SiteId": "myEdgeDevice", "DeviceId": "myEdgeDevice", "ModuleId": "OPCPublisher"} (Microsoft.Azure.IIoT.Agent.Framework.Agent.Worker)
[06:02:54 INF] Starting worker 'myEdgeDevice_OPCPublisher_1'... (Microsoft.Azure.IIoT.Agent.Framework.Agent.WorkerSupervisor)
[06:02:54 INF] Worker WorkerId: myEdgeDevice_OPCPublisher_1 {"Type": "publisher", "SiteId": "myEdgeDevice", "DeviceId": "myEdgeDevice", "ModuleId": "OPCPublisher"} (Microsoft.Azure.IIoT.Agent.Framework.Agent.Worker)
[06:02:54 INF] Starting worker 'myEdgeDevice_OPCPublisher_2'... (Microsoft.Azure.IIoT.Agent.Framework.Agent.WorkerSupervisor)
[06:02:54 INF] Worker WorkerId: myEdgeDevice_OPCPublisher_2 {"Type": "publisher", "SiteId": "myEdgeDevice", "DeviceId": "myEdgeDevice", "ModuleId": "OPCPublisher"} (Microsoft.Azure.IIoT.Agent.Framework.Agent.Worker)
[06:02:54 INF] Starting worker 'myEdgeDevice_OPCPublisher_3'... (Microsoft.Azure.IIoT.Agent.Framework.Agent.WorkerSupervisor)
[06:02:54 INF] Worker WorkerId: myEdgeDevice_OPCPublisher_3 {"Type": "publisher", "SiteId": "myEdgeDevice", "DeviceId": "myEdgeDevice", "ModuleId": "OPCPublisher"} (Microsoft.Azure.IIoT.Agent.Framework.Agent.Worker)
[06:02:54 INF] Starting worker 'myEdgeDevice_OPCPublisher_4'... (Microsoft.Azure.IIoT.Agent.Framework.Agent.WorkerSupervisor)
[06:02:54 INF] Worker WorkerId: myEdgeDevice_OPCPublisher_4 {"Type": "publisher", "SiteId": "myEdgeDevice", "DeviceId": "myEdgeDevice", "ModuleId": "OPCPublisher"} (Microsoft.Azure.IIoT.Agent.Framework.Agent.Worker)
[06:02:54 DBG] Worker starting... (Microsoft.Azure.IIoT.Agent.Framework.Agent.Worker)
[06:02:54 DBG] Try querying available job... (Microsoft.Azure.IIoT.Agent.Framework.Agent.Worker)
[06:02:54 INF] Worker: myEdgeDevice_OPCPublisher_4, no job received, wait 00:00:05 ... (Microsoft.Azure.IIoT.Agent.Framework.Agent.Worker)
[06:02:54 DBG] Sending heartbeat... (Microsoft.Azure.IIoT.Agent.Framework.Agent.Worker)
[06:02:54 DBG] Could not send worker heartbeat. (Microsoft.Azure.IIoT.Agent.Framework.Agent.Worker)
Microsoft.Azure.IIoT.Exceptions.InvalidConfigurationException: Job orchestrator not configured
at Microsoft.Azure.IIoT.Api.Jobs.Clients.JobOrchestratorClient.SendHeartbeatAsync(HeartbeatModel heartbeat, CancellationToken ct) in D:\a\1\s\api\src\Microsoft.Azure.IIoT.Api.Edge\src\Jobs\Clients\JobOrchestratorClient.cs:line 69
at Microsoft.Azure.IIoT.Agent.Framework.Agent.Worker.HeartbeatTimer_ElapsedAsync(Object sender) in D:\a\1\s\common\src\Microsoft.Azure.IIoT.Agent.Framework\src\Agent\Default\Worker.cs:line 147

(编辑以显示日志级别调试)

我希望在日志中读到一些与 OPC UA 相关的内容,但事实并非如此。似乎工作人员无法向作业编排器发送心跳?

最佳答案

遇到同样的问题。看起来容器不是在 appdata 中运行,而是在 app 中运行。我已将 createOptions 更改为:

{
"Hostname": "publisher",
"Cmd": [
"publisher",
"--pf=C:/appdata/pn.json",
"--di=60",
"--to",
"--aa",
"--si=0",
"--ms=0"
],
"ExposedPorts": {
"62222/tcp": {}
},
"HostConfig": {
"Dns": [
"1.1.1.1"
],
"Binds": [
"c:/iotedge:c:/appdata"
],
"PortBindings": {
"62222/tcp": [
{
"HostPort": "62222"
}
]
}
}
}

关于尝试将 OPC UA 数据写入云时,Azure OPC Publisher 显示 "no job received",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61938039/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com