Hello, I am a Chinese user and I greatly appreciate your company's products

Based on the Pro6 Ver8152 test, the S7_interface AreaReadWriteMode DB test found the following issues (everything is normal in non AreaReadWriteMode mode, but the communication load is high):


﻿1.At the beginning, the O/I of my DB5 corresponded to PLC Output/Input and S7_interface settings:

AreaReadWriteMode:True

DBOutputs:5

MinAreaDBOutput:0

MaxAreaDBOutput:143

DBInputs:5

MinAreaDBInput:144

MaxAreaDBInput:277

ArgumentException: Offset and length were out of bounds for the array or count is greater than the number of elements from index to the end of the source collection.

System.Buffer.BlockCopy (System.Array src, System.Int32 srcOffset, System.Array dst, System.Int32 dstOffset, System.Int32 count) (at :0)

realvirtual.S7Interface.WriteS7 () (at Assets/realvirtual/Interfaces/S7TCPIP/S7Interface.cs:933)

realvirtual.S7Interface.CommunicationThreadUpdate () (at Assets/realvirtual/Interfaces/S7TCPIP/S7Interface.cs:1083)

realvirtual.InterfaceThreadedBaseClass.CommunicationThread (System.Threading.CancellationToken token) (at Assets/realvirtual/Interfaces/InterfaceThreadedBaseClass.cs:226)

realvirtual.InterfaceThreadedBaseClass.b__36_0 () (at Assets/realvirtual/Interfaces/InterfaceThreadedBaseClass.cs:124)

System.Threading.ThreadHelper.ThreadStart_Context (System.Object state) (at :0)

System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) (at :0)

System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) (at :0)

System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state) (at :0)

System.Threading.ThreadHelper.ThreadStart () (at :0)

UnityEngine.<>c:b__0_0(Object, UnhandledExceptionEventArgs)


﻿2. Through debugging and positioning, I modified some of the code and wrote it to PLC.DB.tags normally, but all reads failed without any errors:

WriteS7()

{

...

if (AreaReadWriteMode)

{

...

case S7InterfaceSignal.S7TYPE.BYTE:

Buffer.BlockCopy(bytes, 0, dstarea, pos, 1);

break;

case S7InterfaceSignal.S7TYPE.WORD:

Buffer.BlockCopy(bytes, 0, dstarea, pos, 2);

break;

case S7InterfaceSignal.S7TYPE.DWORD:

Buffer.BlockCopy(bytes, 0, dstarea, pos, 4);

break;

case S7InterfaceSignal.S7TYPE.SINT:

Buffer.BlockCopy(bytes, 0, dstarea, pos, 2);

break;

case S7InterfaceSignal.S7TYPE.INT:

Buffer.BlockCopy(bytes, 0, dstarea, pos, 2);

break;

case S7InterfaceSignal.S7TYPE.DINT:

Buffer.BlockCopy(bytes, 0, dstarea, pos, 4);

break;

case S7InterfaceSignal.S7TYPE.USINT:

Buffer.BlockCopy(bytes, 0, dstarea, pos, 1);

break;

case S7InterfaceSignal.S7TYPE.UINT:

Buffer.BlockCopy(bytes, 0, dstarea, pos, 2);

break;

...

}

...

}


﻿3. Clone PLC DB5 to DB3, set DBInputs to 3, MinAreaDBInput to 0, and read/write everything is normal


﻿4. Modify MinAreaDBInput: 2, the last 2Byte Read in the Read area is invalid

Modify MinAreaDBInput: 4, the last 4Byte Read in the Read area is invalid

... and so on


﻿5.In OPCUA mode, Unity is played twice, but the value of PLCINput is restored to default, but the PLC memory remains in the same state as when the first attempt ended without any changes


﻿6. I debugged the same Unity simulation project implementation based on our own S7.NET communication program: the conveyor belt transfers the tray until the PLC detects the Unity sensor signal and stops, and the OPCUA signal of RealVirtual.io always detects it and runs for a distance before stopping (the faster the speed, the farther it exceeds the distance). However, our own use of S7.NET does not have this problem (we use S7.NET.ReadClass to batch read, parse, update the drive object, update the ValueChange, update the WriteData, and WriteClass to time 50ms WirteData to the PLC).



Could you please help analyze and provide feedback on the above issues? Additionally, I have code to convert the DB exported by the PLC into complete XML, and I hope to modify it into the tag import mechanism of OPCUA in the future (as RealVirtual 6 does not support DB import, I am currently using OPCUA to import PLCTags, and then using OpcuaTagoS7 to change the OPCUA tag to S7Interface AreaReadWriteMode for communication, as I am concerned about the performance issues of OPCUA's subscription mode for large-scale PLCTAGS)



I have sent you the relevant attachments via email. Regarding the method of generating PlcTagsXML from DB, you can also contact me if you need it, because we have successfully tested and verified this aspect through the project (the method found online has multiple bugs in the calculation of S7 address offset).



Looking forward to your reply~



By:Liuxingsuifeng

Email: 410701881@qq.com		




=========================================================================================================================================================================

您好，我是一位中国用户，非常欣赏贵公司的产品
基于Pro6 Ver8152测试，S7_Interface AreaReadWriteMode DB测试发现以下问题（非 AreaReadWriteMode 模式一切正常，但通讯负载很高）：
1.最开始,我的DB5的O/I分别对应了PLC Output/Input，S7_Interface设定：
AreaReadWriteMode:True
DBOutputs:5
MinAreaDBOutput:0
MaxAreaDBOutput:143
DBInputs:5
MinAreaDBInput:144
MaxAreaDBInput:277

ArgumentException: Offset and length were out of bounds for the array or count is greater than the number of elements from index to the end of the source collection.
System.Buffer.BlockCopy (System.Array src, System.Int32 srcOffset, System.Array dst, System.Int32 dstOffset, System.Int32 count) (at <ed969b0e627d471da4848289f9c322df>:0)
realvirtual.S7Interface.WriteS7 () (at Assets/realvirtual/Interfaces/S7TCPIP/S7Interface.cs:933)
realvirtual.S7Interface.CommunicationThreadUpdate () (at Assets/realvirtual/Interfaces/S7TCPIP/S7Interface.cs:1083)
realvirtual.InterfaceThreadedBaseClass.CommunicationThread (System.Threading.CancellationToken token) (at Assets/realvirtual/Interfaces/InterfaceThreadedBaseClass.cs:226)
realvirtual.InterfaceThreadedBaseClass.<OpenInterface>b__36_0 () (at Assets/realvirtual/Interfaces/InterfaceThreadedBaseClass.cs:124)
System.Threading.ThreadHelper.ThreadStart_Context (System.Object state) (at <ed969b0e627d471da4848289f9c322df>:0)
System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) (at <ed969b0e627d471da4848289f9c322df>:0)
System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) (at <ed969b0e627d471da4848289f9c322df>:0)
System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state) (at <ed969b0e627d471da4848289f9c322df>:0)
System.Threading.ThreadHelper.ThreadStart () (at <ed969b0e627d471da4848289f9c322df>:0)
UnityEngine.<>c:<RegisterUECatcher>b__0_0(Object, UnhandledExceptionEventArgs)

2.通过调试定位我修改了部分代码，Write到PLC.DB.tags正常，但Read全部失效，也无报错：
WriteS7()
{
...
	if (AreaReadWriteMode)
	{
		...
		case S7InterfaceSignal.S7TYPE.BYTE:
			Buffer.BlockCopy(bytes, 0, dstarea, pos, 1);
			break;
		case S7InterfaceSignal.S7TYPE.WORD:
			Buffer.BlockCopy(bytes, 0, dstarea, pos, 2);
			break;
		case S7InterfaceSignal.S7TYPE.DWORD:
			Buffer.BlockCopy(bytes, 0, dstarea, pos, 4);
			break;
		case S7InterfaceSignal.S7TYPE.SINT:
			Buffer.BlockCopy(bytes, 0, dstarea, pos, 2);
			break;
		case S7InterfaceSignal.S7TYPE.INT:
			Buffer.BlockCopy(bytes, 0, dstarea, pos, 2);
			break;
		case S7InterfaceSignal.S7TYPE.DINT:
			Buffer.BlockCopy(bytes, 0, dstarea, pos, 4);
			break;
		case S7InterfaceSignal.S7TYPE.USINT:
			Buffer.BlockCopy(bytes, 0, dstarea, pos, 1);
			break;
		case S7InterfaceSignal.S7TYPE.UINT:
			Buffer.BlockCopy(bytes, 0, dstarea, pos, 2);
			break;
		
		...
	}
	...
}

3.克隆PLC DB5为DB3，设置DBInputs:3，MinAreaDBInput:0,Read/Write一切正常

4.修改MinAreaDBInput：2，Read区最后2Byte Read失效
  修改MinAreaDBInput：4，Read区最后4Byte Read失效	
  ...依次类推
  
5.OPCUA模式下，Unity二次Play但PLCINput的Value恢复默认，但PLC的内存依旧是第一次结束时的状态而不发生改变

6.我基于我们自己写的S7.NET通讯程序调试同一个Unity仿真项目实现：皮带传输托盘直到PLC检测到Unity传感器信号而停止，RealVirtual.io的OPCUA信号总是会检测到后运行一段距离才停下来（速度越快，超出距离越远），但我们自己的使用S7.NET方式不会存在这种问题（我们采用S7.NET.ReadClass批量读取解析ValueChange更新驱动对象/ValueChange更新WriteData由WriteClass定时50ms WirteData至PLC）。
  
以上问题，烦请帮忙分析并反馈，另外我有将PLC导出的DB转为完整的XML的代码，后期期望改造进OPCUA的标签导入机制(因为RealVirtual 6并不支持DB的导入，所以我目前是使用OPCUA导入PLCTag，然后通过OpcuaTagToS7将OPCUA的tag改为S7Interface AreaReadWriteMode的方式负责通讯，因为担心OPCUA的订阅模式对于大批量PLCTAGS性能存在问题)
相关的附件我有一并发送给你，关于DB生成PlcTagsXml的方法，如果你有需要也可以联系我，因为这块我们已经测试成功并经过项目验证了(网上找到的方法在于S7地址计算偏移存在多处Bug)。

期待你的回复~

By:Liuxingsuifeng
Email:410701881@qq.com
									


