最近的一个项目需要调试,主要是通过OPC访问PLC的DB块,上位机和PLC程序基本备妥,苦于没有实际的PLC可用,遂想到PLCSIM进行仿真,PLCSIM能很好的和STEP 7一起工作,这点毫无疑问。关键在于我需要将PLCSIM与OPC Server进行组态,以方便OPC客户端程序的访问。
研究了一整天,昨天我还不知道怎么用step7给PLC下程序。今天终于搞定:建立S7项目,对硬件进行组态,然后下载程序和DB块,最后和OPC Server组态,终于成功地访问了PLCSIM里的DB块。网上查了不少资料,感谢老鸟们提到的NetToPLC,我正是用它连接成功的。简单的写一下步骤,方便后来的人。
1.建立STEP7项目,硬件组态,建立程序块、DB块啥的;
设置好PLC要使用的IP地址
2.打开PLCSIM,并下载;
需要使用PLCSIM V5.4 以上版本,V5.4 sp3以后开始支持TCP/IP模式,尚不清楚是否必须使用sp3以上版本,我这里用的是V5.4+sp4
此时STEP7已经和PLCSIM建立连接,已经可以进行仿真调试,这不是偶的工作,直接略过。
3.然后修改操作系统的网络IP地址和PLCSIM中的一致;
4.使用NET STOP s7ioehsx,停止服务
5.打开NetToPLCSIM,并按下Start
如果成功了,应该可看到已经和PLCSIM建立连接。和OPCserver组态后会看到 Clinent 地址和端口信息。
5.在Simatect Net下使用以太网的方式和PLCSIM建立组态连接
6.使用客户端访问PLCSIM中的DB块
注意不能使用OPC Scout访问DB块,我也是在NetToPLC的文档里发现这么一个问题。文档中说是因为OPC Scout需要向中PLC查询有哪些DB块,不清楚为什么不可以。
NetTopPLC支持并经过测试的一些 SCADA/HMI-Systems:
- Wonderware InTouch with DAServer
Works well. - Libnodave itself
Works well. - WinCC (V6.2 / V7)
Works. But you have to uncheck all options in system parameters at TCP/IP of the SIMATIC S7 Protocol Suite (Cycle management: by AS/ change driven transfer; Lifebeat monitoring; Monitoring of CPU-Stop) - WinCCflexible 2007/2008
Siemens WinCCflexible sometimes uses special protocol commands which NetToPLCSim doesn't support. But simple projects will mostly work. If you have large amounts of data and many cyclic data for alarming, WinCCflexible requests the PLC to send cyclic messages with this data without any request from flexible. - Simatic Net OPC Server
Works well. But you can't browse the PLC with the OPC-Scout, because it asks the PLC which data blocks are present in the PLC. Nevertheless you can read/write this data.
NetToPLCSim uses the S7ProSim COM-Interface of PLCSim, to read/write the data out of it.
A background thread waits for connections on port 102 and handles the S7 communication (ISO on TCP).