2019年10月12日

使用Thingworx监控Kepware OPC和PLC连接状态

PTC Thingworx是当前流行的IoT平台,可以很方便地建立和Kepware OPC Server的通信,在绑定Tag后,也很容易对PLC进行读写。
Manufacturing Apps工具包自带的Controls Advisor,能够监控OPC的实时状态,但遗憾的是,不能监控Device(如PLC)级别的状态。
但是我们可以利用Thingworx平台已有的功能,通过自建Thing和Mashup进行监控,下面进行简单的说明。

1. 监控Kepware OPC Server:
1) 在Controls Advisor中,新建Gateway Server。
2) Thingworx将自动创建同名的Industrial Thing,template = PTC.Factory.KepServerThingTemplate。
3) Thingworx也将自动创建Industrial Connection,文件名后缀增加-GW, template = IndustrialGateway。
4) 我们可以利用这两个Thing的isConnected属性来监控Kepware。

2. 监控设备Device(PLC):
1) 在Controls Advisor,点击"Discover Devices",完成以后,Thingworx将为每个设备自动创建一个Thing,
  名称 = Gateway名称 + "_" + Channel名称 + "." + Device名称,
  template = PTC.Factory.DeviceThingTemplate,
  IndustrialThing属性 = Thingworx自动创建的Industrial Connection,
  OPCDAThingName属性 = Controls Advisor中创建的Gateway Server
  (IndustrialThing只能绑定用户创建的Tag, OPCDAThingName能够绑定系统Tag)
2) Enabled属性表示设备已启用,ErrorState属性表示设备出错,
  Enabled = device._System._Enabled
  ErrorState = device._System._Error
 

没有评论: