亿迅智能制造网
工业4.0先进制造技术信息网站!
首页 | 制造技术 | 制造设备 | 工业物联网 | 工业材料 | 设备保养维修 | 工业编程 |
home  MfgRobots >> 亿迅智能制造网 >  >> Manufacturing Technology >> 工业技术

在 OCI 容器中使用 grpcurl 与 PLCnext Control 进行本地 gRPC 交互

这是关于使用 gRPC 与 PLCnext Control 设备上 PLCnext Runtime 交互系列的最新篇章。

系列早期文章包括:

上述文章展示如何从远程客户端设备访问 PLCnext Control 设备上的 gRPC 服务器。本文给出本地 gRPC 客户端示例——即运行在 PLCnext Control 设备上、访问同一设备上 gRPC 服务器的 gRPC 客户端。

PLCnext Control 设备上其他本地 gRPC 客户端示例:

因 PLCnext Control 设备标准未安装 gRPC 客户端软件,本文展示如何用 Podman 和 dockerhub 合适镜像在 OCI 容器中运行 gRPC 客户端(本例为 grpcurl)。

前提条件

  1. 合适的 PLCnext Control 设备,有互联网访问。例:固件 2025.0 或更高的 AXC F 3152;固件 2026.0 或更高的 AXC F 1252。目前本文用的 OCI 镜像不适用于 armv7 目标如 AXC F 2152。

  2. 在浏览器打开设备 Web 管理 (WBM) 站点,在系统服务页确保 GRPC LOCAL SERVER 功能已激活。

步骤:

  1. 用 admin 用户账户在 PLCnext Control 设备打开安全 shell 会话。

  2. 在 shell 会话执行:

     podman pull docker.io/fullstorydev/grpcurl:latest-alpine 

    下载含 grpcurl 命令行工具的 OCI 镜像到 PLCnext Control 设备。

  3. 列出本地 PLCnext Control 设备可用 gRPC 服务:

     podman run -it --rm -v /run/plcnext/:/run/plcnext/ --userns=keep-id docker.io/fullstorydev/grpcurl:latest-alpine --plaintext unix:///run/plcnext/grpc.sock list 

    响应:

    Arp.Device.Interface.Services.Grpc.IDeviceControlService Arp.Device.Interface.Services.Grpc.IDeviceInfoService Arp.Device.Interface.Services.Grpc.IDeviceSettingsService Arp.Device.Interface.Services.Grpc.IDeviceStatusService Arp.Io.Axioline.Services.Grpc.IAcyclicCommunicationService Arp.Io.Axioline.Services.Grpc.IAxioMasterService Arp.Plc.Gds.Services.Grpc.IDataAccessService Arp.Plc.Gds.Services.Grpc.IForceService Arp.Plc.Gds.Services.Grpc.ISubscriptionService Arp.Services.DataLogger.Services.Grpc.IDataLoggerService2 Arp.Services.NotificationLogger.Services.Grpc.INotificationLoggerService Arp.System.Commons.Services.Io.Grpc.IDirectoryService Arp.System.Commons.Services.Io.Grpc.IFileService Arp.System.Commons.Services.Io.Grpc.IFileSystemInfoService Arp.System.Lm.Services.Grpc.ILicenseStatusService Arp.System.Nm.Services.Grpc.INotificationManagerService Arp.System.Security.Services.Grpc.IAuthenticationService Arp.System.Um.Services.Grpc.IAuthorizationInfoService Arp.System.Um.Services.Grpc.IPasswordAuthenticationService grpc.reflection.v1.ServerReflection grpc.reflection.v1alpha.ServerReflection 
  4. (可选) 创建别名简化后续 grpcurl 命令:

     alias grpcurl="podman run -it --rm -v /run/plcnext/:/run/plcnext/ --userns=keep-id docker.io/fullstorydev/grpcurl:latest-alpine" 
  5. 从 PLCnext Control 设备获取板载温度:

    grpcurl -format json -d '{"identifier":"Status.Board.Temperature.Centigrade"}' --plaintext unix:///run/plcnext/grpc.sock Arp.Device.Interface.Services.Grpc.IDeviceStatusService.GetItem 

    响应:

    { "_ReturnValue": { "TypeCode": "CT_Int8", "Int8Value": 46 } } 

注意:

Makers Blog 展示社区成员应用和用户故事,未经 Phoenix Contact 测试或审核。使用风险自负。

工业技术

  1. 精益生产与工业4.0协同:博世实证成功
  2. 合作大蒙特利尔地区机械加工车间的 5 大优势
  3. 电源电路:类型、设计原则与性能
  4. 读懂云计算安全:你的数据为何在云端更安全
  5. 攻克工业采购全链路:从品牌认知到采购订单的实战方法论
  6. 借助全新 Fusion 360 管理扩展掌握变更管理
  7. 解锁效能:制造企业落地工业4.0的实战指南
  8. 以入站营销强化口碑推荐:制造商品牌增长新路径
  9. 数据分析赋能油气上游资产主:提效增利的六大实战场景
  10. 进口合规四大核心原则:品名、价值、产地、数量——通关无忧的关键
  11. 太阳能能否在不侵犯人权前提下替代化石燃料?
  12. 强化供应链韧性的三大实证策略:去中心化、国内分布式制造、零工经济赋能