Skip to content

Commit

Permalink
1、SiemensClient、SiemensServer 的批量读取
Browse files Browse the repository at this point in the history
2、显示操作耗时
3、其他优化
  • Loading branch information
zhaopeiym committed Jul 24, 2020
1 parent 7e072b5 commit a997a90
Show file tree
Hide file tree
Showing 24 changed files with 1,767 additions and 777 deletions.
2 changes: 1 addition & 1 deletion IoTClient.Tests/IoTClient.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<TargetFramework>netcoreapp3.0</TargetFramework>

<IsPackable>false</IsPackable>
</PropertyGroup>
Expand Down
54 changes: 54 additions & 0 deletions IoTClient.Tests/PLCTests/SiemensClient_Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
using System.Net;
using Xunit;
using IoTServer.Common;
using System.Collections.Generic;
using IoTClient.Enums;

namespace IoTClient.Tests.PLCTests
{
Expand Down Expand Up @@ -96,5 +98,57 @@ public void 长连接主动开关()

client?.Close();
}

[Fact]
public void test()
{
//string address = "I1.1";
//ushort readNumber = 20;
//test2(address, readNumber);

//TODO 最多只能批量读取 19个?
Dictionary<string, DataTypeEnum> addresses = new Dictionary<string, DataTypeEnum>();

addresses.Add("V1000", DataTypeEnum.Float);
addresses.Add("I0.0", DataTypeEnum.Bool);
addresses.Add("V4109", DataTypeEnum.Byte);
//addresses.Add("V1004", DataTypeEnum.Float);

//addresses.Add("V1000", DataTypeEnum.Float);
//addresses.Add("V1004", DataTypeEnum.Float);
//addresses.Add("V1008", DataTypeEnum.Float);
//addresses.Add("V1012", DataTypeEnum.Float);
//addresses.Add("V1016", DataTypeEnum.Float);
//addresses.Add("V1020", DataTypeEnum.Float);
//addresses.Add("V1024", DataTypeEnum.Float);
//addresses.Add("V1032", DataTypeEnum.Float);
//addresses.Add("V1036", DataTypeEnum.Float);
//addresses.Add("V1040", DataTypeEnum.Float);
//addresses.Add("V1044", DataTypeEnum.Float);
//addresses.Add("V1048", DataTypeEnum.Float);
//addresses.Add("V1052", DataTypeEnum.Float);
//addresses.Add("V1230", DataTypeEnum.Float);
//addresses.Add("V1234", DataTypeEnum.Float);
//addresses.Add("V1238", DataTypeEnum.Float);
//addresses.Add("V1242", DataTypeEnum.Float);
//addresses.Add("V1246", DataTypeEnum.Float);
//addresses.Add("V1250", DataTypeEnum.Float);

//addresses.Add("V1254", DataTypeEnum.Float);
//addresses.Add("V1258", DataTypeEnum.Float);

var obj = client.Read(addresses);
}

private void test2(string address, ushort readNumber)
{

var reuslt2 = client.ReadBoolean(address, readNumber);

var reuslt = client.ReadFloat("V1088", 4);
var reuslt3 = client.ReadUInt16("V1", 5);

var reuslt4 = client.ReadByte("V10", 5);
}
}
}
4 changes: 4 additions & 0 deletions IoTClient.Tool/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.4.1" newVersion="4.0.4.1" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.IO.Ports" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
32 changes: 16 additions & 16 deletions IoTClient.Tool/Controls/BACnetControl.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit a997a90

Please sign in to comment.