Browse Source

Revert "同步更新新增W,DW"

pull/17/head
zhangfl0220 8 years ago
committed by GitHub
parent
commit
7d680322ea
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. BIN
      Document/FAQ.doc
  2. 4
      SCADA/DataConfig/host.ini
  3. BIN
      SCADA/Example/BatchCoreTest.exe
  4. BIN
      SCADA/Example/ClientDriver.dll
  5. BIN
      SCADA/Example/CoreTest.exe
  6. BIN
      SCADA/Example/DataHelper.dll
  7. BIN
      SCADA/Example/DataService.dll
  8. BIN
      SCADA/Example/HMIControl.dll
  9. BIN
      SCADA/Example/TagConfig.exe
  10. 32
      SCADA/Program/BatchCoreService/DAService.cs
  11. 3
      SCADA/Program/BatchCoreService/SqlMapping.cs
  12. 137
      SCADA/Program/ClientDriver/ClientDriver.cs
  13. 2
      SCADA/Program/CoreTest/ClientService.cs
  14. 12
      SCADA/Program/CoreTest/WindowHelper.cs
  15. 29
      SCADA/Program/DataHelper/HDAIOHelper.cs
  16. 185
      SCADA/Program/DataService/CacheReader.cs
  17. 30
      SCADA/Program/DataService/Enums.cs
  18. 14
      SCADA/Program/DataService/Eval.cs
  19. 49
      SCADA/Program/DataService/ExtensionMethods.cs
  20. 7
      SCADA/Program/DataService/IGroup.cs
  21. 4
      SCADA/Program/DataService/IReader.cs
  22. 137
      SCADA/Program/DataService/ITag.cs
  23. 52
      SCADA/Program/DataService/PLCGroup.cs
  24. 57
      SCADA/Program/DataService/Storage.cs
  25. 38
      SCADA/Program/FileDriver/DatabaseDriver.cs
  26. 69
      SCADA/Program/FileDriver/FileDeviceGroup.cs
  27. 44
      SCADA/Program/FileDriver/MemoryDriver.cs
  28. 22
      SCADA/Program/FileDriver/TagDriver.cs
  29. 115
      SCADA/Program/ModbusDriver/ModbusRTUDriver.cs
  30. 52
      SCADA/Program/ModbusDriver/ModbusTCPDriver.cs
  31. 49
      SCADA/Program/OPCDriver/OPCDriver.cs
  32. 1
      SCADA/Program/OmronPlcDriver/OmronPlcDriver.csproj
  33. 30
      SCADA/Program/OmronPlcDriver/OmronUdpReader.cs
  34. 4
      SCADA/Program/PanasonicDriver/PanasonicDriver.csproj
  35. 74
      SCADA/Program/PanasonicDriver/PanasonicSerialReader.cs
  36. 68
      SCADA/Program/SiemensPLCDriver/SiemensPLCDriver.cs
  37. 0
      SCADA/Program/TagConfig/TagConfig/DataHelper.cs
  38. 20
      SCADA/Program/TagConfig/TagConfig/Form1.cs
  39. 2
      SCADA/Program/TagConfig/TagConfig/TagConfig.csproj
  40. BIN
      SCADA/dll/ClientDriver.dll
  41. BIN
      SCADA/dll/DataHelper.dll
  42. BIN
      SCADA/dll/DataService.dll
  43. BIN
      SCADA/dll/FileDriver.dll
  44. BIN
      SCADA/dll/ModbusDriver.dll
  45. BIN
      SCADA/dll/OPCDriver.dll
  46. BIN
      SCADA/dll/OmronPlcDriver.dll
  47. BIN
      SCADA/dll/PanasonicDriver.dll
  48. BIN
      SCADA/dll/SiemensPLCDriver.dll

BIN
Document/FAQ.doc

Binary file not shown.

4
SCADA/DataConfig/host.ini

@ -1,11 +1,7 @@
[HOST]
SERVER=lochost
[DATABASE]
CONNSTRING=Data Source=.\SQLEXPRESS;Initial Catalog=SCADA;Integrated Security=True
ARCHIVE=D:\HDA
TYPE=MSSQL

BIN
SCADA/Example/BatchCoreTest.exe

Binary file not shown.

BIN
SCADA/Example/ClientDriver.dll

Binary file not shown.

BIN
SCADA/Example/CoreTest.exe

Binary file not shown.

BIN
SCADA/Example/DataHelper.dll

Binary file not shown.

BIN
SCADA/Example/DataService.dll

Binary file not shown.

BIN
SCADA/Example/HMIControl.dll

Binary file not shown.

BIN
SCADA/Example/TagConfig.exe

Binary file not shown.

32
SCADA/Program/BatchCoreService/DAService.cs

@ -837,14 +837,10 @@ namespace BatchCoreService
value.Byte = buffer[6];
break;
case DataType.WORD:
value.Word = BitConverter.ToUInt16(buffer, 6);
break;
case DataType.SHORT:
value.Int16 = BitConverter.ToInt16(buffer, 6);
break;
case DataType.DWORD:
value.DWord = BitConverter.ToUInt32(buffer, 6);
break;
case DataType.TIME:
case DataType.INT:
value.Int32 = BitConverter.ToInt32(buffer, 6);
break;
@ -895,14 +891,10 @@ namespace BatchCoreService
values.Add(tag, buffer[j]);
break;
case DataType.WORD:
values.Add(tag, BitConverter.ToUInt16(buffer, j));
break;
case DataType.SHORT:
values.Add(tag, BitConverter.ToInt16(buffer, j));
break;
case DataType.DWORD:
values.Add(tag, BitConverter.ToUInt32(buffer, j));
break;
case DataType.TIME:
case DataType.INT:
values.Add(tag, BitConverter.ToInt32(buffer, j));
break;
@ -1288,7 +1280,7 @@ namespace BatchCoreService
DataHelper.Instance.ExecuteStoredProcedure("AddEventLog",
DataHelper.CreateParam("@StartTime", SqlDbType.DateTime, tag.TimeStamp),
DataHelper.CreateParam("@Source", SqlDbType.NVarChar, tag.ID.ToString(), 50),
DataHelper.CreateParam("@Comment", SqlDbType.NVarChar, tag.ToString(), 50));
DataHelper.CreateParam("@StartTime", SqlDbType.NVarChar, tag.ToString(), 50));
}
public HistoryData[] BatchRead(DataSource source, bool sync, params ITag[] itemArray)
@ -1426,13 +1418,6 @@ namespace BatchCoreService
sendBuffer[j++] = data[i].Value.Byte;
break;
case DataType.WORD:
{
sendBuffer[j++] = 2;
byte[] bt = BitConverter.GetBytes(data[i].Value.Word);
sendBuffer[j++] = bt[0];
sendBuffer[j++] = bt[1];
}
break;
case DataType.SHORT:
{
sendBuffer[j++] = 2;
@ -1441,16 +1426,7 @@ namespace BatchCoreService
sendBuffer[j++] = bt[1];
}
break;
case DataType.DWORD:
{
sendBuffer[j++] = 4;
byte[] bt = BitConverter.GetBytes(data[i].Value.DWord);
sendBuffer[j++] = bt[0];
sendBuffer[j++] = bt[1];
sendBuffer[j++] = bt[2];
sendBuffer[j++] = bt[3];
}
break;
case DataType.TIME:
case DataType.INT:
{
sendBuffer[j++] = 4;

3
SCADA/Program/BatchCoreService/SqlMapping.cs

@ -510,12 +510,9 @@ namespace BatchCoreService
return ff > -2E-38 && ff < 2E-38 ? 0f : ff;
case DataType.BOOL:
return _enumer.Current.Value.Boolean ? 1f : 0f;
case DataType.DWORD:
return _enumer.Current.Value.DWord;
case DataType.INT:
return _enumer.Current.Value.Int32;
case DataType.WORD:
return _enumer.Current.Value.Word;
case DataType.SHORT:
return _enumer.Current.Value.Int16;
case DataType.BYTE:

137
SCADA/Program/ClientDriver/ClientDriver.cs

@ -414,14 +414,9 @@ namespace ClientDriver
value.Byte = temp[j];
break;
case DataType.WORD:
value.Word = BitConverter.ToUInt16(temp, j);//需测试
break;
case DataType.SHORT:
value.Int16 = BitConverter.ToInt16(temp, j);//需测试
break;
case DataType.DWORD:
value.DWord = BitConverter.ToUInt32(temp, j);//需测试
break;
case DataType.INT:
value.Int32 = BitConverter.ToInt32(temp, j);//需测试
break;
@ -488,14 +483,9 @@ namespace ClientDriver
value.Byte = bytes[j];
break;
case DataType.WORD:
value.Word = BitConverter.ToUInt16(bytes, j);//需测试
break;
case DataType.SHORT:
value.Int16 = BitConverter.ToInt16(bytes, j);//需测试
break;
case DataType.DWORD:
value.DWord = BitConverter.ToUInt32(bytes, j);//需测试
break;
case DataType.INT:
value.Int32 = BitConverter.ToInt32(bytes, j);//需测试
break;
@ -575,17 +565,13 @@ namespace ClientDriver
dataItem = new ByteTag(meta.ID, addr, this);
break;
case DataType.WORD:
dataItem = new UShortTag(meta.ID, addr, this);
break;
case DataType.SHORT:
dataItem = new ShortTag(meta.ID, addr, this);
break;
case DataType.TIME:
case DataType.INT:
dataItem = new IntTag(meta.ID, addr, this);
break;
case DataType.DWORD:
dataItem = new UIntTag(meta.ID, addr, this);
break;
case DataType.FLOAT:
dataItem = new FloatTag(meta.ID, addr, this);
break;
@ -692,14 +678,9 @@ namespace ClientDriver
values[i].Value.Byte = tcpBuffer[j];
break;
case DataType.WORD:
values[i].Value.Word = BitConverter.ToUInt16(tcpBuffer, j);
break;
case DataType.SHORT:
values[i].Value.Int16 = BitConverter.ToInt16(tcpBuffer, j);
break;
case DataType.DWORD:
values[i].Value.DWord = BitConverter.ToUInt32(tcpBuffer, j);
break;
case DataType.INT:
values[i].Value.Int32 = BitConverter.ToInt32(tcpBuffer, j);
break;
@ -746,14 +727,9 @@ namespace ClientDriver
list.Add(Convert.ToByte(item.Value));
break;
case DataType.WORD:
list.AddRange(BitConverter.GetBytes(Convert.ToUInt16(item.Value)));
break;
case DataType.SHORT:
list.AddRange(BitConverter.GetBytes(Convert.ToInt16(item.Value)));
break;
case DataType.DWORD:
list.AddRange(BitConverter.GetBytes(Convert.ToUInt32(item.Value)));
break;
case DataType.INT:
list.AddRange(BitConverter.GetBytes(Convert.ToInt32(item.Value)));
break;
@ -830,14 +806,10 @@ namespace ClientDriver
data.Value.Byte = tcpBuffer[index];
break;
case DataType.WORD:
data.Value.Word = BitConverter.ToUInt16(temp, 2);
break;
case DataType.SHORT:
data.Value.Int16 = BitConverter.ToInt16(temp, 2);
break;
case DataType.DWORD:
data.Value.DWord = BitConverter.ToUInt32(temp, 2);
break;
case DataType.TIME:
case DataType.INT:
data.Value.Int32 = BitConverter.ToInt32(temp, 2);
break;
@ -873,14 +845,10 @@ namespace ClientDriver
data.Value.Byte = tcpBuffer[index];
break;
case DataType.WORD:
data.Value.Word = BitConverter.ToUInt16(tcpBuffer, index);
break;
case DataType.SHORT:
data.Value.Int16 = BitConverter.ToInt16(tcpBuffer, index);
break;
case DataType.DWORD:
data.Value.DWord = BitConverter.ToUInt32(tcpBuffer, index);
break;
case DataType.TIME:
case DataType.INT:
data.Value.Int32 = BitConverter.ToInt32(tcpBuffer, index);
break;
@ -956,81 +924,6 @@ namespace ClientDriver
index += 12 - result;//丢弃一个值
} while (result > 0);
break;
case DataType.SHORT:
do
{
result = _tcpSend.Receive(tcpBuffer, 0, tcpBuffer.Length, SocketFlags.None, out error);
if (error == SocketError.ConnectionReset || error == SocketError.Interrupted || error == SocketError.HostDown || error == SocketError.NetworkDown || error == SocketError.Shutdown)
{
_tcpSend.Dispose();
yield break;
}
while (index + 10 <= result)
{
data.Value.Int16 = BitConverter.ToInt16(tcpBuffer, index);//未来可考虑量程转换和其他数据类型
index += 2;
long fileTime = BitConverter.ToInt64(tcpBuffer, index);
if (fileTime == -1) yield break;
data.TimeStamp = DateTime.FromFileTime(fileTime);
index += 8;
yield return data;
}
if (index == result)
index = 0;
else
index += 10 - result;//丢弃一个值
} while (result > 0);
break;
case DataType.WORD:
do
{
result = _tcpSend.Receive(tcpBuffer, 0, tcpBuffer.Length, SocketFlags.None, out error);
if (error == SocketError.ConnectionReset || error == SocketError.Interrupted || error == SocketError.HostDown || error == SocketError.NetworkDown || error == SocketError.Shutdown)
{
_tcpSend.Dispose();
yield break;
}
while (index + 10 <= result)
{
data.Value.Word = BitConverter.ToUInt16(tcpBuffer, index);//未来可考虑量程转换和其他数据类型
index += 2;
long fileTime = BitConverter.ToInt64(tcpBuffer, index);
if (fileTime == -1) yield break;
data.TimeStamp = DateTime.FromFileTime(fileTime);
index += 8;
yield return data;
}
if (index == result)
index = 0;
else
index += 10 - result;//丢弃一个值
} while (result > 0);
break;
case DataType.DWORD:
do
{
result = _tcpSend.Receive(tcpBuffer, 0, tcpBuffer.Length, SocketFlags.None, out error);
if (error == SocketError.ConnectionReset || error == SocketError.Interrupted || error == SocketError.HostDown || error == SocketError.NetworkDown || error == SocketError.Shutdown)
{
_tcpSend.Dispose();
yield break;
}
while (index + 12 <= result)
{
data.Value.DWord = BitConverter.ToUInt32(tcpBuffer, index);//未来可考虑量程转换和其他数据类型
index += 4;
long fileTime = BitConverter.ToInt64(tcpBuffer, index);
if (fileTime == -1) yield break;
data.TimeStamp = DateTime.FromFileTime(fileTime);
index += 8;
yield return data;
}
if (index == result)
index = 0;
else
index += 12 - result;//丢弃一个值
} while (result > 0);
break;
case DataType.INT:
do
{
@ -1152,20 +1045,6 @@ namespace ClientDriver
new ItemData<int>(BitConverter.ToInt32(data, 0), 0, QUALITIES.QUALITY_GOOD);
}
public ItemData<uint> ReadUInt32(DeviceAddress address, DataSource source = DataSource.Cache)
{
var data = ReadSingleData(address, source);
return data == null ? new ItemData<uint>(0, 0, QUALITIES.QUALITY_BAD) :
new ItemData<uint>(BitConverter.ToUInt32(data, 0), 0, QUALITIES.QUALITY_GOOD);
}
public ItemData<ushort> ReadUInt16(DeviceAddress address, DataSource source = DataSource.Cache)
{
var data = ReadSingleData(address, source);
return data == null ? new ItemData<ushort>(0, 0, QUALITIES.QUALITY_BAD) :
new ItemData<ushort>(BitConverter.ToUInt16(data, 0), 0, QUALITIES.QUALITY_GOOD);
}
public ItemData<short> ReadInt16(DeviceAddress address, DataSource source = DataSource.Cache)
{
var data = ReadSingleData(address, source);
@ -1211,16 +1090,6 @@ namespace ClientDriver
return WriteSingleData(address, BitConverter.GetBytes(value));
}
public int WriteUInt32(DeviceAddress address, uint value)
{
return WriteSingleData(address, BitConverter.GetBytes(value));
}
public int WriteUInt16(DeviceAddress address, ushort value)
{
return WriteSingleData(address, BitConverter.GetBytes(value));
}
public int WriteInt16(DeviceAddress address, short value)
{
return WriteSingleData(address, BitConverter.GetBytes(value));

2
SCADA/Program/CoreTest/ClientService.cs

@ -823,7 +823,7 @@ namespace CoreTest
case DataType.SHORT:
max = short.MaxValue; min = short.MinValue;
break;
case DataType.DWORD:
case DataType.TIME:
max = uint.MaxValue; min = 0;
break;
case DataType.INT:

12
SCADA/Program/CoreTest/WindowHelper.cs

@ -591,14 +591,10 @@ namespace CoreTest
source.SetYMapping(Y => Y.Value.Byte);
break;
case DataType.WORD:
source.SetYMapping(Y => Y.Value.Word);
break;
case DataType.SHORT:
source.SetYMapping(Y => Y.Value.Int16);
break;
case DataType.DWORD:
source.SetYMapping(Y => Y.Value.DWord);
break;
case DataType.TIME:
case DataType.INT:
source.SetYMapping(Y => Y.Value.Int32);
break;
@ -622,14 +618,10 @@ namespace CoreTest
source.SetYMapping(Y => Y.Value.Byte);
break;
case DataType.WORD:
source.SetYMapping(Y => Y.Value.Word);
break;
case DataType.SHORT:
source.SetYMapping(Y => Y.Value.Int16);
break;
case DataType.DWORD:
source.SetYMapping(Y => Y.Value.DWord);
break;
case DataType.TIME:
case DataType.INT:
source.SetYMapping(Y => Y.Value.Int32);
break;

29
SCADA/Program/DataHelper/HDAIOHelper.cs

@ -169,14 +169,9 @@ namespace DatabaseLib
w.Write((byte)dataReader.GetFloat(1));
break;
case DataType.WORD:
w.Write((ushort)dataReader.GetFloat(1));
break;
case DataType.SHORT:
w.Write((short)dataReader.GetFloat(1));
break;
case DataType.DWORD:
w.Write((uint)dataReader.GetFloat(1));
break;
case DataType.INT:
w.Write((int)dataReader.GetFloat(1));
break;
@ -310,17 +305,10 @@ namespace DatabaseLib
pos++;
break;
case DataType.WORD:
data.Value.Word = acc.ReadUInt16(pos);
pos += 2;
break;
case DataType.SHORT:
data.Value.Int16 = acc.ReadInt16(pos);
pos += 2;
break;
case DataType.DWORD:
data.Value.DWord = acc.ReadUInt32(pos);
pos += 4;
break;
case DataType.INT:
data.Value.Int32 = acc.ReadInt32(pos);
pos += 4;
@ -428,17 +416,10 @@ namespace DatabaseLib
pos++;
break;
case DataType.WORD:
data.Value.Word = acc2.ReadUInt16(pos);
pos += 2;
break;
case DataType.SHORT:
data.Value.Int16 = acc2.ReadInt16(pos);
pos += 2;
break;
case DataType.DWORD:
data.Value.DWord = acc2.ReadUInt32(pos);
pos += 4;
break;
case DataType.INT:
data.Value.Int32 = acc2.ReadInt32(pos);
pos += 4;
@ -483,14 +464,9 @@ namespace DatabaseLib
data.Value.Byte = Convert.ToByte(dataReader.GetFloat(ivalue));
break;
case DataType.WORD:
data.Value.Word = Convert.ToUInt16(dataReader.GetFloat(ivalue));
break;
case DataType.SHORT:
data.Value.Int16 = Convert.ToInt16(dataReader.GetFloat(ivalue));
break;
case DataType.DWORD:
data.Value.DWord = Convert.ToUInt32(dataReader.GetFloat(ivalue));
break;
case DataType.INT:
data.Value.Int32 = Convert.ToInt32(dataReader.GetFloat(ivalue));
break;
@ -535,14 +511,9 @@ namespace DatabaseLib
data.Value.Byte = Convert.ToByte(dataReader.GetFloat(ivalue));
break;
case DataType.WORD:
data.Value.Word = Convert.ToUInt16(dataReader.GetFloat(ivalue));
break;
case DataType.SHORT:
data.Value.Int16 = Convert.ToInt16(dataReader.GetFloat(ivalue));
break;
case DataType.DWORD:
data.Value.DWord = Convert.ToUInt32(dataReader.GetFloat(ivalue));
break;
case DataType.INT:
data.Value.Int32 = Convert.ToInt32(dataReader.GetFloat(ivalue));
break;

185
SCADA/Program/DataService/CacheReader.cs

@ -34,24 +34,14 @@ namespace DataService
return start.Area == end.Area && start.DBNumber == end.DBNumber ? start.Start - end.Start : ushort.MaxValue;
}
public ItemData<bool> ReadBit(DeviceAddress address)
{
return new ItemData<bool>((_cache[address.CacheIndex] & (1 << address.Bit)) != 0, 0, QUALITIES.QUALITY_GOOD);
}
public ItemData<int> ReadInt32(DeviceAddress address)
{
return new ItemData<int>(BitConverter.ToInt32(_cache, address.CacheIndex), 0, QUALITIES.QUALITY_GOOD);
}
public ItemData<uint> ReadUInt32(DeviceAddress address)
{
return new ItemData<uint>(BitConverter.ToUInt32(_cache, address.CacheIndex), 0, QUALITIES.QUALITY_GOOD);
}
public ItemData<ushort> ReadUInt16(DeviceAddress address)
public ItemData<bool> ReadBit(DeviceAddress address)
{
return new ItemData<ushort>(BitConverter.ToUInt16(_cache, address.CacheIndex), 0, QUALITIES.QUALITY_GOOD);
return new ItemData<bool>((_cache[address.CacheIndex] & (1 << address.Bit)) != 0, 0, QUALITIES.QUALITY_GOOD);
}
public ItemData<short> ReadInt16(DeviceAddress address)
@ -100,24 +90,6 @@ namespace DataService
return 0;
}
public unsafe int WriteUInt16(DeviceAddress address, ushort value)
{
fixed (byte* p1 = _cache)
{
Marshal.WriteInt16((IntPtr)(p1 + address.CacheIndex), (short)value);
}
return 0;
}
public unsafe int WriteUInt32(DeviceAddress address, uint value)
{
fixed (byte* p1 = _cache)
{
Marshal.WriteInt32((IntPtr)(p1 + address.CacheIndex), (int)value);
}
return 0;
}
public unsafe int WriteInt32(DeviceAddress address, int value)
{
fixed (byte* p1 = _cache)
@ -196,24 +168,14 @@ namespace DataService
return start.Area == end.Area && start.DBNumber == end.DBNumber ? start.Start - end.Start : ushort.MaxValue;
}
public ItemData<bool> ReadBit(DeviceAddress address)
{
return new ItemData<bool>((_cache[address.CacheIndex] & (1 << address.Bit)) != 0, 0, QUALITIES.QUALITY_GOOD);
}
public ItemData<int> ReadInt32(DeviceAddress address)
{
return new ItemData<int>(Utility.NetToInt32(_cache, address.CacheIndex), 0, QUALITIES.QUALITY_GOOD);
}
public ItemData<uint> ReadUInt32(DeviceAddress address)
{
return new ItemData<uint>((uint)Utility.NetToInt32(_cache, address.CacheIndex), 0, QUALITIES.QUALITY_GOOD);
}
public ItemData<ushort> ReadUInt16(DeviceAddress address)
public ItemData<bool> ReadBit(DeviceAddress address)
{
return new ItemData<ushort>((ushort)Utility.NetToInt16(_cache, address.CacheIndex), 0, QUALITIES.QUALITY_GOOD);
return new ItemData<bool>((_cache[address.CacheIndex] & (1 << address.Bit)) != 0, 0, QUALITIES.QUALITY_GOOD);
}
public ItemData<short> ReadInt16(DeviceAddress address)
@ -262,24 +224,6 @@ namespace DataService
return 0;
}
public unsafe int WriteUInt16(DeviceAddress address, ushort value)
{
fixed (byte* p1 = _cache)
{
Marshal.WriteInt16((IntPtr)(p1 + address.CacheIndex), IPAddress.HostToNetworkOrder((short)value));
}
return 0;
}
public unsafe int WriteUInt32(DeviceAddress address, uint value)
{
fixed (byte* p1 = _cache)
{
Marshal.WriteInt32((IntPtr)(p1 + address.CacheIndex), IPAddress.HostToNetworkOrder((int)value));
}
return 0;
}
public unsafe int WriteInt32(DeviceAddress address, int value)
{
fixed (byte* p1 = _cache)
@ -374,11 +318,6 @@ namespace DataService
return start.Area == end.Area && start.DBNumber == end.DBNumber ? start.Start - end.Start : ushort.MaxValue;
}
public unsafe ItemData<bool> ReadBit(DeviceAddress address)
{
return new ItemData<bool>((_cache[address.CacheIndex] & (1 << address.Bit)) != 0, 0, QUALITIES.QUALITY_GOOD);
}
public ItemData<int> ReadInt32(DeviceAddress address)
{
int startIndex = address.CacheIndex;
@ -394,9 +333,9 @@ namespace DataService
return new ItemData<int>(result, 0, QUALITIES.QUALITY_GOOD);
}
public ItemData<uint> ReadUInt32(DeviceAddress address)
public unsafe ItemData<bool> ReadBit(DeviceAddress address)
{
return new ItemData<uint>((uint)ReadInt32(address).Value, 0, QUALITIES.QUALITY_GOOD);
return new ItemData<bool>((_cache[address.CacheIndex] & (1 << address.Bit)) != 0, 0, QUALITIES.QUALITY_GOOD);
}
public ItemData<short> ReadInt16(DeviceAddress address)
@ -404,11 +343,6 @@ namespace DataService
return new ItemData<short>(_cache[address.CacheIndex], 0, QUALITIES.QUALITY_GOOD);
}
public ItemData<ushort> ReadUInt16(DeviceAddress address)
{
return new ItemData<ushort>((ushort)_cache[address.CacheIndex], 0, QUALITIES.QUALITY_GOOD);
}
public ItemData<byte> ReadByte(DeviceAddress address)
{
return new ItemData<byte>((byte)_cache[address.CacheIndex], 0, QUALITIES.QUALITY_GOOD);
@ -453,27 +387,12 @@ namespace DataService
return 0;
}
public int WriteInt16(DeviceAddress address, short value)
public unsafe int WriteInt16(DeviceAddress address, short value)
{
_cache[address.CacheIndex] = value;
return 0;
}
public int WriteUInt16(DeviceAddress address, ushort value)
{
_cache[address.CacheIndex] = (short)value;
return 0;
}
public unsafe int WriteUInt32(DeviceAddress address, uint value)
{
fixed (short* p1 = _cache)
{
Marshal.WriteInt32((IntPtr)(p1 + address.CacheIndex), (int)value);
}
return 0;
}
public unsafe int WriteInt32(DeviceAddress address, int value)
{
fixed (short* p1 = _cache)
@ -567,11 +486,6 @@ namespace DataService
return start.Area == end.Area && start.DBNumber == end.DBNumber ? start.Start - end.Start : ushort.MaxValue;
}
public unsafe ItemData<bool> ReadBit(DeviceAddress address)
{
return new ItemData<bool>((_cache[address.CacheIndex] & (1 << address.Bit)) != 0, 0, QUALITIES.QUALITY_GOOD);
}
public ItemData<int> ReadInt32(DeviceAddress address)
{
int startIndex = address.CacheIndex;
@ -587,14 +501,9 @@ namespace DataService
return new ItemData<int>(result, 0, QUALITIES.QUALITY_GOOD);
}
public ItemData<uint> ReadUInt32(DeviceAddress address)
{
return new ItemData<uint>((uint)ReadInt32(address).Value, 0, QUALITIES.QUALITY_GOOD);
}
public ItemData<ushort> ReadUInt16(DeviceAddress address)
public unsafe ItemData<bool> ReadBit(DeviceAddress address)
{
return new ItemData<ushort>((ushort)IPAddress.HostToNetworkOrder(_cache[address.CacheIndex]), 0, QUALITIES.QUALITY_GOOD);
return new ItemData<bool>((_cache[address.CacheIndex] & (1 << address.Bit)) != 0, 0, QUALITIES.QUALITY_GOOD);
}
public ItemData<short> ReadInt16(DeviceAddress address)
@ -652,18 +561,12 @@ namespace DataService
return 0;
}
public int WriteInt16(DeviceAddress address, short value)
public unsafe int WriteInt16(DeviceAddress address, short value)
{
_cache[address.CacheIndex] = value;
return 0;
}
public int WriteUInt16(DeviceAddress address, ushort value)
{
_cache[address.CacheIndex] = (short)value;
return 0;
}
public unsafe int WriteInt32(DeviceAddress address, int value)
{
fixed (short* p1 = _cache)
@ -673,15 +576,6 @@ namespace DataService
return 0;
}
public unsafe int WriteUInt32(DeviceAddress address, uint value)
{
fixed (short* p1 = _cache)
{
Marshal.WriteInt32((IntPtr)(p1 + address.CacheIndex), IPAddress.HostToNetworkOrder((int)value));
}
return 0;
}
public unsafe int WriteFloat(DeviceAddress address, float value)
{
fixed (short* p1 = _cache)
@ -767,24 +661,15 @@ namespace DataService
return start.Area == end.Area && start.DBNumber == end.DBNumber ? start.Start - end.Start : ushort.MaxValue;
}
public unsafe ItemData<bool> ReadBit(DeviceAddress address)
{
return new ItemData<bool>((_cache[address.CacheIndex] & (1 << address.Bit)) != 0, 0, QUALITIES.QUALITY_GOOD);
}
public ItemData<int> ReadInt32(DeviceAddress address)
{
return new ItemData<int>(_cache[address.CacheIndex], 0, QUALITIES.QUALITY_GOOD);
}
public ItemData<uint> ReadUInt32(DeviceAddress address)
{
return new ItemData<uint>((uint)_cache[address.CacheIndex], 0, QUALITIES.QUALITY_GOOD);
return new ItemData<int>(_cache[address.CacheIndex], 0, QUALITIES.QUALITY_GOOD);
}
public ItemData<ushort> ReadUInt16(DeviceAddress address)
public unsafe ItemData<bool> ReadBit(DeviceAddress address)
{
return new ItemData<ushort>((ushort)_cache[address.CacheIndex], 0, QUALITIES.QUALITY_GOOD);
return new ItemData<bool>((_cache[address.CacheIndex] & (1 << address.Bit)) != 0, 0, QUALITIES.QUALITY_GOOD);
}
public ItemData<short> ReadInt16(DeviceAddress address)
@ -833,18 +718,6 @@ namespace DataService
return 0;
}
public unsafe int WriteUInt16(DeviceAddress address, ushort value)
{
_cache[address.CacheIndex] = value;
return 0;
}
public unsafe int WriteUInt32(DeviceAddress address, uint value)
{
_cache[address.CacheIndex] = (int)value;
return 0;
}
public unsafe int WriteInt32(DeviceAddress address, int value)
{
_cache[address.CacheIndex] = value;
@ -936,25 +809,15 @@ namespace DataService
return start.Area == end.Area && start.DBNumber == end.DBNumber ? start.Start - end.Start : ushort.MaxValue;
}
public unsafe ItemData<bool> ReadBit(DeviceAddress address)
{
return new ItemData<bool>(((int)_cache[address.CacheIndex] & (1 << address.Bit)) != 0, 0, QUALITIES.QUALITY_GOOD);
}
public ItemData<int> ReadInt32(DeviceAddress address)
{
return new ItemData<int>((int)_cache[address.CacheIndex], 0, QUALITIES.QUALITY_GOOD);
}
public ItemData<uint> ReadUInt32(DeviceAddress address)
{
return new ItemData<uint>((uint)_cache[address.CacheIndex], 0, QUALITIES.QUALITY_GOOD);
}
public ItemData<ushort> ReadUInt16(DeviceAddress address)
public unsafe ItemData<bool> ReadBit(DeviceAddress address)
{
return new ItemData<ushort>((ushort)_cache[address.CacheIndex], 0, QUALITIES.QUALITY_GOOD);
return new ItemData<bool>(((int)_cache[address.CacheIndex] & (1 << address.Bit)) != 0, 0, QUALITIES.QUALITY_GOOD);
}
public ItemData<short> ReadInt16(DeviceAddress address)
@ -996,31 +859,19 @@ namespace DataService
return 0;
}
public int WriteInt16(DeviceAddress address, short value)
{
_cache[address.CacheIndex] = value;
return 0;
}
public int WriteUInt16(DeviceAddress address, ushort value)
{
_cache[address.CacheIndex] = value;
return 0;
}
public int WriteUInt32(DeviceAddress address, uint value)
public unsafe int WriteInt16(DeviceAddress address, short value)
{
_cache[address.CacheIndex] = value;
return 0;
}
public int WriteInt32(DeviceAddress address, int value)
public unsafe int WriteInt32(DeviceAddress address, int value)
{
_cache[address.CacheIndex] = value;
return 0;
}
public int WriteFloat(DeviceAddress address, float value)
public unsafe int WriteFloat(DeviceAddress address, float value)
{
_cache[address.CacheIndex] = value;
return 0;

30
SCADA/Program/DataService/Enums.cs

@ -16,7 +16,7 @@ namespace DataService
BYTE = 3,
SHORT = 4,
WORD = 5,
DWORD = 6,
TIME = 6,
INT = 7,
FLOAT = 8,
SYS = 9,
@ -96,32 +96,4 @@ namespace DataService
Absolute = 0,
Percent = 1
}
public enum QUALITIES : short
{
// Fields
LIMIT_CONST = 3,
LIMIT_HIGH = 2,
LIMIT_LOW = 1,
//LIMIT_MASK = 3,
//LIMIT_OK = 0,
QUALITY_BAD = 0,
QUALITY_COMM_FAILURE = 0x18,
QUALITY_CONFIG_ERROR = 4,
QUALITY_DEVICE_FAILURE = 12,
QUALITY_EGU_EXCEEDED = 0x54,
QUALITY_GOOD = 0xc0,
QUALITY_LAST_KNOWN = 20,
QUALITY_LAST_USABLE = 0x44,
QUALITY_LOCAL_OVERRIDE = 0xd8,
QUALITY_MASK = 0xc0,
QUALITY_NOT_CONNECTED = 8,
QUALITY_OUT_OF_SERVICE = 0x1c,
QUALITY_SENSOR_CAL = 80,
QUALITY_SENSOR_FAILURE = 0x10,
QUALITY_SUB_NORMAL = 0x58,
QUALITY_UNCERTAIN = 0x40,
QUALITY_WAITING_FOR_INITIAL_DATA = 0x20,
STATUS_MASK = 0xfc,
}
}

14
SCADA/Program/DataService/Eval.cs

@ -531,7 +531,7 @@ namespace DataService
case DataType.BYTE:
case DataType.WORD:
case DataType.SHORT:
case DataType.DWORD:
case DataType.TIME:
case DataType.INT:
return Expression.Call(_param1, _intinfo, Expression.Constant(tagName));
case DataType.FLOAT:
@ -554,11 +554,9 @@ namespace DataService
case DataType.BYTE:
return Convert.ToBoolean(tag.Value.Byte);
case DataType.WORD:
return Convert.ToBoolean(tag.Value.Word);
case DataType.SHORT:
return Convert.ToBoolean(tag.Value.Int16);
case DataType.DWORD:
return Convert.ToBoolean(tag.Value.DWord);
case DataType.TIME:
case DataType.INT:
return Convert.ToBoolean(tag.Value.Int32);
case DataType.FLOAT:
@ -586,13 +584,11 @@ namespace DataService
case DataType.BOOL:
return tag.Value.Boolean ? 1 : 0;
case DataType.BYTE:
return tag.Value.Byte;
return (int)tag.Value.Byte;
case DataType.WORD:
return tag.Value.Word;
case DataType.SHORT:
return tag.Value.Int16;
case DataType.DWORD:
return (int)tag.Value.DWord;
return (int)tag.Value.Int16;
case DataType.TIME:
case DataType.INT:
return tag.Value.Int32;
case DataType.FLOAT:

49
SCADA/Program/DataService/ExtensionMethods.cs

@ -115,14 +115,10 @@ namespace DataService
var bt = reader.ReadByte(address);
return new ItemData<object>(bt.Value, bt.TimeStamp, bt.Quality);
case DataType.WORD:
var ush = reader.ReadUInt16(address);
return new ItemData<object>(ush.Value, ush.TimeStamp, ush.Quality);
case DataType.SHORT:
var sh = reader.ReadInt16(address);
return new ItemData<object>(sh.Value, sh.TimeStamp, sh.Quality);
case DataType.DWORD:
var dw = reader.ReadUInt32(address);
return new ItemData<object>(dw.Value, dw.TimeStamp, dw.Quality);
case DataType.TIME:
case DataType.INT:
var it = reader.ReadInt32(address);
return new ItemData<object>(it.Value, it.TimeStamp, it.Quality);
@ -145,11 +141,9 @@ namespace DataService
case DataType.BYTE:
return writer.WriteBits(address, Convert.ToByte(value));
case DataType.WORD:
return writer.WriteUInt16(address, Convert.ToUInt16(value));
case DataType.SHORT:
return writer.WriteInt16(address, Convert.ToInt16(value));
case DataType.DWORD:
return writer.WriteUInt32(address, Convert.ToUInt32(value));
case DataType.TIME:
case DataType.INT:
return writer.WriteInt32(address, Convert.ToInt32(value));
case DataType.FLOAT:
@ -273,14 +267,10 @@ namespace DataService
items[i].Value.Byte = cache.ReadByte(addrsArr[i]).Value;
break;
case DataType.WORD:
items[i].Value.Word = cache.ReadUInt16(addrsArr[i]).Value;
break;
case DataType.SHORT:
items[i].Value.Int16 = cache.ReadInt16(addrsArr[i]).Value;
break;
case DataType.DWORD:
items[i].Value.DWord = cache.ReadUInt32(addrsArr[i]).Value;
break;
case DataType.TIME:
case DataType.INT:
items[i].Value.Int32 = cache.ReadInt32(addrsArr[i]).Value;
break;
@ -375,9 +365,8 @@ namespace DataService
case DataType.SHORT:
return typeof(short);
case DataType.INT:
case DataType.TIME:
return typeof(int);
case DataType.DWORD:
return typeof(uint);
case DataType.FLOAT:
return typeof(float);
case DataType.STR:
@ -444,14 +433,10 @@ namespace DataService
value.Byte = Convert.ToByte(obj);
break;
case DataType.WORD:
value.Word = Convert.ToUInt16(obj);
break;
case DataType.SHORT:
value.Int16 = Convert.ToInt16(obj);
break;
case DataType.DWORD:
value.DWord = Convert.ToUInt32(obj);
break;
case DataType.TIME:
case DataType.INT:
value.Int32 = Convert.ToInt32(obj);
break;
@ -471,11 +456,8 @@ namespace DataService
case DataType.BYTE:
return new byte[] { tag.Value.Byte };
case DataType.WORD:
return BitConverter.GetBytes(tag.Value.Word);
case DataType.SHORT:
return BitConverter.GetBytes(tag.Value.Int16);
case DataType.DWORD:
return BitConverter.GetBytes(tag.Value.DWord);
case DataType.INT:
return BitConverter.GetBytes(tag.Value.Int32);
case DataType.FLOAT:
@ -496,11 +478,8 @@ namespace DataService
case DataType.BYTE:
return new byte[] { value.Byte };
case DataType.WORD:
return BitConverter.GetBytes(value.Word);
case DataType.SHORT:
return BitConverter.GetBytes(value.Int16);
case DataType.DWORD:
return BitConverter.GetBytes(value.DWord);
case DataType.INT:
return BitConverter.GetBytes(value.Int32);
case DataType.FLOAT:
@ -521,11 +500,9 @@ namespace DataService
case DataType.BYTE:
return value.Byte;
case DataType.WORD:
return value.Word;
case DataType.SHORT:
return value.Int16;
case DataType.DWORD:
return value.DWord;
case DataType.TIME:
case DataType.INT:
return value.Int32;
case DataType.FLOAT:
@ -567,15 +544,12 @@ namespace DataService
switch (type)
{
case DataType.BYTE:
return value.Byte;
return (float)value.Byte;
case DataType.WORD:
return value.Word;
case DataType.SHORT:
return value.Int16;
case DataType.DWORD:
return value.DWord;
return (float)value.Int16;
case DataType.INT:
return value.Int32;
return (float)value.Int32;
case DataType.FLOAT:
return value.Single;
case DataType.STR:
@ -593,14 +567,9 @@ namespace DataService
temp = (value.Byte - meta.RawLo) / (meta.RawHi - meta.RawLo);
break;
case DataType.WORD:
temp = (value.Word - meta.RawLo) / (meta.RawHi - meta.RawLo);
break;
case DataType.SHORT:
temp = (value.Int16 - meta.RawLo) / (meta.RawHi - meta.RawLo);
break;
case DataType.DWORD:
temp = (value.DWord - meta.RawLo) / (meta.RawHi - meta.RawLo);
break;
case DataType.INT:
temp = (value.Int32 - meta.RawLo) / (meta.RawHi - meta.RawLo);
break;

7
SCADA/Program/DataService/IGroup.cs

@ -20,25 +20,18 @@ namespace DataService
ITag FindItemByAddress(DeviceAddress addr);
HistoryData[] BatchRead(DataSource source, bool isSync, params ITag[] itemArray);
int BatchWrite(SortedDictionary<ITag, object> items, bool isSync = true);
ItemData<int> ReadInt32(DeviceAddress address, DataSource source = DataSource.Cache);
ItemData<uint> ReadUInt32(DeviceAddress address, DataSource source = DataSource.Cache);
ItemData<short> ReadInt16(DeviceAddress address, DataSource source = DataSource.Cache);
ItemData<ushort> ReadUInt16(DeviceAddress address, DataSource source = DataSource.Cache);
ItemData<byte> ReadByte(DeviceAddress address, DataSource source = DataSource.Cache);
ItemData<float> ReadFloat(DeviceAddress address, DataSource source = DataSource.Cache);
ItemData<bool> ReadBool(DeviceAddress address, DataSource source = DataSource.Cache);
ItemData<string> ReadString(DeviceAddress address, DataSource source = DataSource.Cache);
int WriteInt32(DeviceAddress address, int value);
int WriteUInt32(DeviceAddress address, uint value);
int WriteInt16(DeviceAddress address, short value);
int WriteUInt16(DeviceAddress address, ushort value);
int WriteFloat(DeviceAddress address, float value);
int WriteString(DeviceAddress address, string value);
int WriteBit(DeviceAddress address, bool value);
int WriteBits(DeviceAddress address, byte value);
event DataChangeEventHandler DataChange;
}

4
SCADA/Program/DataService/IReader.cs

@ -6,9 +6,7 @@ namespace DataService
public interface IReaderWriter
{
byte[] ReadBytes(DeviceAddress address, ushort size);
ItemData<uint> ReadUInt32(DeviceAddress address);
ItemData<int> ReadInt32(DeviceAddress address);
ItemData<ushort> ReadUInt16(DeviceAddress address);
ItemData<short> ReadInt16(DeviceAddress address);
ItemData<byte> ReadByte(DeviceAddress address);
ItemData<string> ReadString(DeviceAddress address, ushort size);
@ -20,9 +18,7 @@ namespace DataService
int WriteBit(DeviceAddress address, bool bit);
int WriteBits(DeviceAddress address, byte bits);
int WriteInt16(DeviceAddress address, short value);
int WriteUInt16(DeviceAddress address, ushort value);
int WriteInt32(DeviceAddress address, int value);
int WriteUInt32(DeviceAddress address, uint value);
int WriteFloat(DeviceAddress address, float value);
int WriteString(DeviceAddress address, string str);
int WriteValue(DeviceAddress address, object value);

137
SCADA/Program/DataService/ITag.cs

@ -366,75 +366,6 @@ namespace DataService
}
}
public sealed class UShortTag : ITag
{
public UShortTag(short id, DeviceAddress addr, IGroup group)
: base(id, addr, group)
{
}
#region IDevice Members
public override bool Refresh(DataSource source = DataSource.Device)
{
var _newvalue = _group.ReadUInt16(_plcAddress, source);
if (_newvalue.Value != _value.Word)
{
Storage value = Storage.Empty;
value.Word = _newvalue.Value;
DateTime time = _newvalue.TimeStamp.ToDateTime();
if (ValueChanging != null)
{
ValueChanging(this, new ValueChangingEventArgs<Storage>(_newvalue.Quality, _value, value, _timeStamp, time));
}
_timeStamp = time;
_quality = _newvalue.Quality;
if (_quality == QUALITIES.QUALITY_GOOD)
{
_value = value;
if (ValueChanged != null)
{
ValueChanged(this, new ValueChangedEventArgs(value));
}
}
return true;
}
return false;
}
public override Storage Read(DataSource source = DataSource.Cache)
{
Storage value = Storage.Empty;
value.Word = _group.ReadUInt16(_plcAddress, source).Value;
return value;
}
public override int Write(object value)
{
var temp = _value.Word;
var str = value as string;
if (str == null)
temp = Convert.ToUInt16(value);
else if (!ushort.TryParse(str, out temp))
return -1;
_timeStamp = DateTime.Now;
return _group.WriteUInt16(_plcAddress, temp);
}
protected override int InnerWrite(Storage value)
{
return _group.WriteUInt16(_plcAddress, value.Word);
}
#endregion
public override string ToString()
{
return _value.Word.ToString();
}
}
public sealed class IntTag : ITag
{
@ -503,74 +434,6 @@ namespace DataService
}
}
public sealed class UIntTag : ITag
{
public UIntTag(short id, DeviceAddress addr, IGroup group)
: base(id, addr, group)
{
}
#region IDevice Members
public override bool Refresh(DataSource source = DataSource.Device)
{
var _newvalue = _group.ReadUInt32(_plcAddress, source);
if (_newvalue.Value != _value.DWord)
{
Storage value = Storage.Empty;
value.DWord = _newvalue.Value;
DateTime time = _newvalue.TimeStamp.ToDateTime();
if (ValueChanging != null)
{
ValueChanging(this, new ValueChangingEventArgs<Storage>(_newvalue.Quality, _value, value, _timeStamp, time));
}
_timeStamp = time;
_quality = _newvalue.Quality;
if (_quality == QUALITIES.QUALITY_GOOD)
{
_value = value;
if (ValueChanged != null)
{
ValueChanged(this, new ValueChangedEventArgs(value));
}
}
return true;
}
return false;
}
public override Storage Read(DataSource source = DataSource.Cache)
{
Storage value = Storage.Empty;
value.DWord = _group.ReadUInt32(_plcAddress, source).Value;
return value;
}
public override int Write(object value)
{
var temp = _value.DWord;
var str = value as string;
if (str == null)
temp = Convert.ToUInt32(value);
else if (!uint.TryParse(str, out temp))
return -1;
_timeStamp = DateTime.Now;
return _group.WriteUInt32(_plcAddress, temp);
}
protected override int InnerWrite(Storage value)
{
return _group.WriteUInt32(_plcAddress, value.DWord);
}
#endregion
public override string ToString()
{
return _value.DWord.ToString();
}
}
public sealed class FloatTag : ITag
{

52
SCADA/Program/DataService/PLCGroup.cs

@ -163,14 +163,10 @@ namespace DataService
dataItem = new ByteTag(meta.ID, addr, this);
break;
case DataType.WORD:
dataItem = new UShortTag(meta.ID, addr, this);
break;
case DataType.SHORT:
dataItem = new ShortTag(meta.ID, addr, this);
break;
case DataType.DWORD:
dataItem = new UIntTag(meta.ID, addr, this);
break;
case DataType.TIME:
case DataType.INT:
dataItem = new IntTag(meta.ID, addr, this);
break;
@ -528,16 +524,6 @@ namespace DataService
return source == DataSource.Cache ? _cacheReader.ReadInt32(address) : _plcReader.ReadInt32(address);
}
public ItemData<uint> ReadUInt32(DeviceAddress address, DataSource source = DataSource.Cache)
{
return source == DataSource.Cache ? _cacheReader.ReadUInt32(address) : _plcReader.ReadUInt32(address);
}
public ItemData<ushort> ReadUInt16(DeviceAddress address, DataSource source = DataSource.Cache)
{
return source == DataSource.Cache ? _cacheReader.ReadUInt16(address) : _plcReader.ReadUInt16(address);
}
public ItemData<short> ReadInt16(DeviceAddress address, DataSource source = DataSource.Cache)
{
return source == DataSource.Cache ? _cacheReader.ReadInt16(address) : _plcReader.ReadInt16(address);
@ -583,42 +569,6 @@ namespace DataService
return rs;
}
public int WriteUInt32(DeviceAddress address, uint value)
{
int rs = _plcReader.WriteUInt32(address, value);
if (rs >= 0)
{
if (DataChange != null)
{
ITag tag = GetTagByAddress(address);
if (tag != null)
DataChange(this, new DataChangeEventArgs(1, new HistoryData[1]
{
new HistoryData(tag.ID,QUALITIES.QUALITY_GOOD,new Storage{DWord=value}, DateTime.Now)
}));
}
}
return rs;
}
public int WriteUInt16(DeviceAddress address, ushort value)
{
int rs = _plcReader.WriteUInt16(address, value);
if (rs >= 0)
{
if (DataChange != null)
{
ITag tag = GetTagByAddress(address);
if (tag != null)
DataChange(this, new DataChangeEventArgs(1, new HistoryData[1]
{
new HistoryData(tag.ID,QUALITIES.QUALITY_GOOD,new Storage{Word=value}, DateTime.Now)
}));
}
}
return rs;
}
public int WriteInt16(DeviceAddress address, short value)
{
int rs = _plcReader.WriteInt16(address, value);

57
SCADA/Program/DataService/Storage.cs

@ -17,10 +17,6 @@ namespace DataService
public int Int32;
[FieldOffset(0)]
public float Single;
[FieldOffset(0)]
public ushort Word;
[FieldOffset(0)]
public uint DWord;
public static readonly Storage Empty ;//只读属性
@ -37,21 +33,17 @@ namespace DataService
return this.Int32 == ((Storage)obj).Int32;
else
{
if (type == typeof(int))
return this.Int32 == (int)obj;
if (type == typeof(short))
return this.Int16 == (short)obj;
if (type == typeof(byte))
return this.Byte == (byte)obj;
if (type == typeof(bool))
return this.Boolean == (bool)obj;
if (type == typeof(float))
return this.Single == (float)obj;
if (type == typeof(ushort))
return this.Word == (ushort)obj;
if (type == typeof(uint))
return this.DWord == (uint)obj;
if (type == typeof(string))
if (type == typeof(Int32))
return this.Int32 == (Int32)obj;
if (type == typeof(Int16))
return this.Int16 == (Int16)obj;
if (type == typeof(Byte))
return this.Byte == (Byte)obj;
if (type == typeof(Boolean))
return this.Boolean == (Boolean)obj;
if (type == typeof(Single))
return this.Single == (Single)obj;
if (type == typeof(String))
return this.ToString() == obj.ToString();
}
return false;
@ -73,4 +65,31 @@ namespace DataService
}
}
public enum QUALITIES : short
{
// Fields
LIMIT_CONST = 3,
LIMIT_HIGH = 2,
LIMIT_LOW = 1,
//LIMIT_MASK = 3,
//LIMIT_OK = 0,
QUALITY_BAD = 0,
QUALITY_COMM_FAILURE = 0x18,
QUALITY_CONFIG_ERROR = 4,
QUALITY_DEVICE_FAILURE = 12,
QUALITY_EGU_EXCEEDED = 0x54,
QUALITY_GOOD = 0xc0,
QUALITY_LAST_KNOWN = 20,
QUALITY_LAST_USABLE = 0x44,
QUALITY_LOCAL_OVERRIDE = 0xd8,
QUALITY_MASK = 0xc0,
QUALITY_NOT_CONNECTED = 8,
QUALITY_OUT_OF_SERVICE = 0x1c,
QUALITY_SENSOR_CAL = 80,
QUALITY_SENSOR_FAILURE = 0x10,
QUALITY_SUB_NORMAL = 0x58,
QUALITY_UNCERTAIN = 0x40,
QUALITY_WAITING_FOR_INITIAL_DATA = 0x20,
STATUS_MASK = 0xfc,
}
}

38
SCADA/Program/FileDriver/DatabaseDriver.cs

@ -245,18 +245,6 @@ namespace FileDriver
return data;
}
public ItemData<uint> ReadUInt32(DeviceAddress address)
{
var res = ReadInt32(address);
return new ItemData<uint>((uint)res.Value, res.TimeStamp, res.Quality);
}
public ItemData<ushort> ReadUInt16(DeviceAddress address)
{
var res = ReadInt16(address);
return new ItemData<ushort>((ushort)res.Value, res.TimeStamp, res.Quality);
}
public ItemData<short> ReadInt16(DeviceAddress address)
{
ItemData<short> data = new ItemData<short>();
@ -405,20 +393,6 @@ namespace FileDriver
new SqlParameter("@Value", SqlDbType.Variant) { Value = value });
}
public int WriteUInt16(DeviceAddress address, ushort value)
{
return ExecuteStoredProcedure("UpdateValueByID",
new SqlParameter("@ID", SqlDbType.SmallInt) { Value = address.CacheIndex },
new SqlParameter("@Value", SqlDbType.Variant) { Value = value });
}
public int WriteUInt32(DeviceAddress address, uint value)
{
return ExecuteStoredProcedure("UpdateValueByID",
new SqlParameter("@ID", SqlDbType.SmallInt) { Value = address.CacheIndex },
new SqlParameter("@Value", SqlDbType.Variant) { Value = value });
}
public int WriteInt32(DeviceAddress address, int value)
{
return ExecuteStoredProcedure("UpdateValueByID",
@ -476,14 +450,10 @@ namespace FileDriver
itemArr[i].Value.Byte = dataReader.GetByte(0);
break;
case DataType.WORD:
itemArr[i].Value.Word = (ushort)dataReader.GetInt16(0);
break;
case DataType.SHORT:
itemArr[i].Value.Int16 = dataReader.GetInt16(0);
break;
case DataType.DWORD:
itemArr[i].Value.DWord = (uint)dataReader.GetInt32(0);
break;
case DataType.TIME:
case DataType.INT:
itemArr[i].Value.Int32 = dataReader.GetInt32(0);
break;
@ -537,14 +507,10 @@ namespace FileDriver
list[i].Value.Byte = Convert.ToByte(reader.GetValue(2));
break;
case DataType.WORD:
list[i].Value.Word = Convert.ToUInt16(reader.GetValue(2));
break;
case DataType.SHORT:
list[i].Value.Int16 = Convert.ToInt16(reader.GetValue(2));
break;
case DataType.DWORD:
list[i].Value.DWord = Convert.ToUInt32(reader.GetValue(2));
break;
case DataType.TIME:
case DataType.INT:
list[i].Value.Int32 = Convert.ToInt32(reader.GetValue(2));
break;

69
SCADA/Program/FileDriver/FileDeviceGroup.cs

@ -202,14 +202,10 @@ namespace FileDriver
dataItem = new ByteTag(meta.ID, addr, this);
break;
case DataType.WORD:
dataItem = new UShortTag(meta.ID, addr, this);
break;
case DataType.SHORT:
dataItem = new ShortTag(meta.ID, addr, this);
break;
case DataType.DWORD:
dataItem = new UIntTag(meta.ID, addr, this);
break;
case DataType.TIME:
case DataType.INT:
dataItem = new IntTag(meta.ID, addr, this);
break;
@ -422,14 +418,10 @@ namespace FileDriver
value.Byte = Convert.ToByte(d.Right(ind));
break;
case DataType.WORD:
value.Word = Convert.ToUInt16(d.Right(ind));
break;
case DataType.SHORT:
value.Int16 = Convert.ToInt16(d.Right(ind));
break;
case DataType.DWORD:
value.DWord = Convert.ToUInt32(d.Right(ind));
break;
case DataType.TIME:
case DataType.INT:
value.Int32 = Convert.ToInt32(d.Right(ind));
break;
@ -471,26 +463,6 @@ namespace FileDriver
}
}
public ItemData<uint> ReadUInt32(DeviceAddress address, DataSource source = DataSource.Cache)
{
if (source == DataSource.Device) return _fileReader.ReadUInt32(address);
else
{
ITag tag = _items[address.Start];
return new ItemData<uint>(tag.Value.DWord, 0, tag.Quality);
}
}
public ItemData<ushort> ReadUInt16(DeviceAddress address, DataSource source = DataSource.Cache)
{
if (source == DataSource.Device) return _fileReader.ReadUInt16(address);
else
{
ITag tag = _items[address.Start];
return new ItemData<ushort>(tag.Value.Word, 0, tag.Quality);
}
}
public ItemData<short> ReadInt16(DeviceAddress address, DataSource source = DataSource.Cache)
{
if (source == DataSource.Device) return _fileReader.ReadInt16(address);
@ -560,42 +532,6 @@ namespace FileDriver
return rs;
}
public int WriteUInt32(DeviceAddress address, uint value)
{
int rs = _fileReader.WriteUInt32(address, value);
if (rs >= 0)
{
Storage stor = new Storage { DWord = value };
_items[address.Start].Update(stor, DateTime.Now, QUALITIES.QUALITY_GOOD);
if (DataChange != null)
{
DataChange(this, new DataChangeEventArgs(1, new HistoryData[1]
{
new HistoryData( (short)address.CacheIndex,QUALITIES.QUALITY_GOOD,stor, DateTime.Now)
}));
}
}
return rs;
}
public int WriteUInt16(DeviceAddress address, ushort value)
{
int rs = _fileReader.WriteUInt16(address, value);
if (rs >= 0)
{
Storage stor = new Storage { Word = value };
_items[address.Start].Update(stor, DateTime.Now, QUALITIES.QUALITY_GOOD);
if (DataChange != null)
{
DataChange(this, new DataChangeEventArgs(1, new HistoryData[1]
{
new HistoryData( (short)address.CacheIndex,QUALITIES.QUALITY_GOOD,stor, DateTime.Now)
}));
}
}
return rs;
}
public int WriteInt16(DeviceAddress address, short value)
{
int rs = _fileReader.WriteInt16(address, value);
@ -697,4 +633,5 @@ namespace FileDriver
public event DataChangeEventHandler DataChange;
}
}

44
SCADA/Program/FileDriver/MemoryDriver.cs

@ -263,24 +263,6 @@ namespace FileDriver
catch { return new ItemData<int>(0, 0, QUALITIES.QUALITY_BAD); }
}
public ItemData<uint> ReadUInt32(DeviceAddress address)
{
try
{
return new ItemData<uint>(accessor.ReadUInt32(FindPosition(address)), 0, QUALITIES.QUALITY_GOOD);
}
catch { return new ItemData<uint>(0, 0, QUALITIES.QUALITY_BAD); }
}
public ItemData<ushort> ReadUInt16(DeviceAddress address)
{
try
{
return new ItemData<ushort>(accessor.ReadUInt16(FindPosition(address)), 0, QUALITIES.QUALITY_GOOD);
}
catch { return new ItemData<ushort>(0, 0, QUALITIES.QUALITY_BAD); }
}
public ItemData<short> ReadInt16(DeviceAddress address)
{
try
@ -373,26 +355,6 @@ namespace FileDriver
catch { return -1; }
}
public int WriteUInt16(DeviceAddress address, ushort value)
{
try
{
accessor.Write(FindPosition(address), value);
return 0;
}
catch { return -1; }
}
public int WriteUInt32(DeviceAddress address, uint value)
{
try
{
accessor.Write(FindPosition(address), value);
return 0;
}
catch { return -1; }
}
public int WriteInt32(DeviceAddress address, int value)
{
try
@ -458,14 +420,10 @@ namespace FileDriver
hdata[i].Value.Byte = accessor.ReadByte(pos);
break;
case DataType.WORD:
hdata[i].Value.Word = accessor.ReadUInt16(pos);
break;
case DataType.SHORT:
hdata[i].Value.Int16 = accessor.ReadInt16(pos);
break;
case DataType.DWORD:
hdata[i].Value.DWord = accessor.ReadUInt32(pos);
break;
case DataType.TIME:
case DataType.INT:
hdata[i].Value.Int32 = accessor.ReadInt32(pos);
break;

22
SCADA/Program/FileDriver/TagDriver.cs

@ -130,18 +130,6 @@ namespace FileDriver
return tag == null ? new ItemData<int>(0, 0, QUALITIES.QUALITY_BAD) : new ItemData<int>(tag.Value.Int32, 0, QUALITIES.QUALITY_GOOD);
}
public ItemData<uint> ReadUInt32(DeviceAddress address)
{
var tag = _parent[(short)address.CacheIndex];
return tag == null ? new ItemData<uint>(0, 0, QUALITIES.QUALITY_BAD) : new ItemData<uint>(tag.Value.DWord, 0, QUALITIES.QUALITY_GOOD);
}
public ItemData<ushort> ReadUInt16(DeviceAddress address)
{
var tag = _parent[(short)address.CacheIndex];
return tag == null ? new ItemData<ushort>(0, 0, QUALITIES.QUALITY_BAD) : new ItemData<ushort>(tag.Value.Word, 0, QUALITIES.QUALITY_GOOD);
}
public ItemData<short> ReadInt16(DeviceAddress address)
{
var tag = _parent[(short)address.CacheIndex];
@ -197,16 +185,6 @@ namespace FileDriver
return 0;
}
public int WriteUInt16(DeviceAddress address, ushort value)
{
return 0;
}
public int WriteUInt32(DeviceAddress address, uint value)
{
return 0;
}
public int WriteInt32(DeviceAddress address, int value)
{
return 0;

115
SCADA/Program/ModbusDriver/ModbusRTUDriver.cs

@ -1,10 +1,11 @@
using DataService;
using System;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.IO.Ports;
using System.Text;
using System.Timers;
using DataService;
namespace ModbusDriver
{
@ -110,8 +111,8 @@ namespace ModbusDriver
_serialPort.DataBits = 8;
_serialPort.Parity = Parity.Even;
_serialPort.StopBits = StopBits.One;
if (!string.IsNullOrEmpty(spare1)) byte.TryParse(spare1, out _slaveId);
}
private SerialPort _serialPort;
/*
@ -124,10 +125,10 @@ namespace ModbusDriver
   Long:64-9223372036854775808 9223372036854775808
   Ulong:640 18446744073709551615
*/
private byte[] CreateReadHeader(int id, int startAddress, ushort length, byte function)
private byte[] CreateReadHeader(int startAddress, ushort length, byte function)
{
byte[] data = new byte[8];
data[0] = (byte)id; // Slave id high byte 从站地址
data[0] = _slaveId; // Slave id high byte 从站地址
data[1] = function; // Message size
byte[] _adr = BitConverter.GetBytes((short)startAddress);//以字节数组的形式返回指定的 16 位无符号整数值。
//apply on small endian, TODO:support big endian
@ -144,10 +145,10 @@ namespace ModbusDriver
}
#region 写单个线圈或单个离散输出 功能码:0x05
public byte[] WriteSingleCoils(int id, int startAddress, bool OnOff)
public byte[] WriteSingleCoils(int startAddress, bool OnOff)
{
byte[] data = new byte[8];
data[0] = (byte)id; // Slave id high byte
data[0] = _slaveId; // Slave id high byte
data[1] = Modbus.fctWriteSingleCoil; // Function code
byte[] _adr = BitConverter.GetBytes((short)startAddress);
data[2] = _adr[1]; // Start address
@ -161,11 +162,11 @@ namespace ModbusDriver
#endregion
#region 写多个线圈 功能码:0x0F 15
public byte[] WriteMultipleCoils(int id, int startAddress, ushort numBits, byte[] values)
public byte[] WriteMultipleCoils(int startAddress, ushort numBits, byte[] values)
{
int len = values.Length;
byte[] data = new byte[len + 9];
data[0] = (byte)id; // Slave id high byte 从站地址高八位
data[0] = _slaveId; // Slave id high byte 从站地址高八位
data[1] = Modbus.fctWriteMultipleCoils; // Function code 功能码
byte[] _adr = BitConverter.GetBytes((short)startAddress);
data[2] = _adr[1]; // Start address 开始地址高八位
@ -183,10 +184,10 @@ namespace ModbusDriver
#endregion
#region 写单个保持寄存器 功能码:0x06
public byte[] WriteSingleRegister(int id, int startAddress, byte[] values)
public byte[] WriteSingleRegister(int startAddress, byte[] values)
{
byte[] data = new byte[8];
data[0] = (byte)id; // Slave id high byte 从站地址高八位
data[0] = _slaveId; // Slave id high byte 从站地址高八位
data[1] = Modbus.fctWriteSingleRegister; // Function code 功能码
byte[] _adr = BitConverter.GetBytes((short)startAddress);
data[2] = _adr[1]; // Start address 开始地址高八位
@ -201,12 +202,12 @@ namespace ModbusDriver
#endregion
#region 写多个保持寄存器 功能码:0x10 16
public byte[] WriteMultipleRegister(int id, int startAddress, byte[] values)
public byte[] WriteMultipleRegister(int startAddress, byte[] values)
{
int len = values.Length;
if (len % 2 > 0) len++;
byte[] data = new byte[len + 9];
data[0] = (byte)id; // Slave id high byte 从站地址
data[0] = _slaveId; // Slave id high byte 从站地址
data[1] = Modbus.fctWriteMultipleRegister; // Function code 功能码
byte[] _adr = BitConverter.GetBytes((short)startAddress);
data[2] = _adr[1]; // Start address 开始地址高八位
@ -236,47 +237,47 @@ namespace ModbusDriver
get { return 0xFD; } //0xFD 十进制为253
}
byte _slaveId;//设备ID 单元号 字节号
/// <summary>
/// 设备ID 单元号 字节号
/// </summary>
public byte SlaveId
{
get { return _slaveId; }
set { _slaveId = value; }
}
public DeviceAddress GetDeviceAddress(string address)
{
DeviceAddress dv = DeviceAddress.Empty;
if (string.IsNullOrEmpty(address))
return dv;
var sindex = address.IndexOf(':');
if (sindex > 0)
{
int slaveId;
if (int.TryParse(address.Substring(0, sindex), out slaveId))
dv.Area = slaveId;
address = address.Substring(sindex + 1);
}
switch (address[0])
{
case '0':
{
dv.DBNumber = Modbus.fctReadCoil;
dv.Area = Modbus.fctReadCoil;
int st;
int.TryParse(address, out st);
dv.Bit = (byte)(st % 16);
st /= 16;
dv.Start = st;
dv.Bit--;
}
break;
case '1':
{
dv.DBNumber = Modbus.fctReadDiscreteInputs;
dv.Area = Modbus.fctReadDiscreteInputs;
int st;
int.TryParse(address.Substring(1), out st);
dv.Bit = (byte)(st % 16);
st /= 16;
dv.Start = st;
dv.Bit--;
}
break;
case '4':
{
int index = address.IndexOf('.');
dv.DBNumber = Modbus.fctReadHoldingRegister;
dv.Area = Modbus.fctReadHoldingRegister;
if (index > 0)
{
dv.Start = int.Parse(address.Substring(1, index - 1));
@ -285,14 +286,12 @@ namespace ModbusDriver
else
dv.Start = int.Parse(address.Substring(1));
dv.Start--;
dv.Bit--;
dv.ByteOrder = ByteOrder.Network;
}
break;
case '3':
{
int index = address.IndexOf('.');
dv.DBNumber = Modbus.fctReadInputRegister;
dv.Area = Modbus.fctReadInputRegister;
if (index > 0)
{
dv.Start = int.Parse(address.Substring(1, index - 1));
@ -301,11 +300,10 @@ namespace ModbusDriver
else
dv.Start = int.Parse(address.Substring(1));
dv.Start--;
dv.Bit--;
dv.ByteOrder = ByteOrder.Network;
}
break;
}
dv.Bit--;
return dv;
}
@ -319,11 +317,11 @@ namespace ModbusDriver
object _async = new object();
public byte[] ReadBytes(DeviceAddress address, ushort size)
{
var func = (byte)address.DBNumber;
int area = address.Area;
try
{
byte[] header = func < 3 ? CreateReadHeader(address.Area, address.Start * 16, (ushort)(16 * size), func) :
CreateReadHeader(address.Area, address.Start, size, func);
byte[] header = area == Modbus.fctReadCoil ? CreateReadHeader(address.Start * 16, (ushort)(16 * size), (byte)area) :
CreateReadHeader(address.Start, size, (byte)area);
_serialPort.Write(header, 0, header.Length);
byte[] frameBytes = new byte[size * 2 + 5];
byte[] data = new byte[size * 2];
@ -332,7 +330,7 @@ namespace ModbusDriver
{
while (numBytesRead != frameBytes.Length)
numBytesRead += _serialPort.Read(frameBytes, numBytesRead, frameBytes.Length - numBytesRead);
if (frameBytes[0] == address.Area && Utility.CheckSumCRC(frameBytes))
if (frameBytes[0] == _slaveId && Utility.CheckSumCRC(frameBytes))
{
Array.Copy(frameBytes, 3, data, 0, data.Length);
return data;
@ -355,20 +353,6 @@ namespace ModbusDriver
new ItemData<int>(BitConverter.ToInt32(bit, 0), 0, QUALITIES.QUALITY_GOOD);
}
public ItemData<uint> ReadUInt32(DeviceAddress address)
{
byte[] bit = ReadBytes(address, 2);
return bit == null ? new ItemData<uint>(0, 0, QUALITIES.QUALITY_BAD) :
new ItemData<uint>(BitConverter.ToUInt32(bit, 0), 0, QUALITIES.QUALITY_GOOD);
}
public ItemData<ushort> ReadUInt16(DeviceAddress address)
{
byte[] bit = ReadBytes(address, 1);
return bit == null ? new ItemData<ushort>(0, 0, QUALITIES.QUALITY_BAD) :
new ItemData<ushort>(BitConverter.ToUInt16(bit, 0), 0, QUALITIES.QUALITY_GOOD);
}
public ItemData<short> ReadInt16(DeviceAddress address)
{
byte[] bit = ReadBytes(address, 1);
@ -411,7 +395,7 @@ namespace ModbusDriver
public int WriteBytes(DeviceAddress address, byte[] bit)
{
var data = WriteMultipleRegister(address.Area, address.Start, bit);
var data = WriteMultipleRegister(address.Start, bit);
_serialPort.Write(data, 0, data.Length);
_serialPort.ReadByte();
var chr = _serialPort.ReadByte();
@ -420,7 +404,7 @@ namespace ModbusDriver
public int WriteBit(DeviceAddress address, bool bit)
{
var data = WriteSingleCoils(address.Area, address.Start + address.Bit, bit);
var data = WriteSingleCoils(address.Start + address.Bit, bit);
_serialPort.Write(data, 0, data.Length);
_serialPort.ReadByte();
var chr = _serialPort.ReadByte();
@ -429,7 +413,7 @@ namespace ModbusDriver
public int WriteBits(DeviceAddress address, byte bits)
{
var data = WriteSingleRegister(address.Area, address.Start, new byte[] { bits });
var data = WriteSingleRegister(address.Start, new byte[] { bits });
_serialPort.Write(data, 0, data.Length);
_serialPort.ReadByte();
var chr = _serialPort.ReadByte();
@ -438,32 +422,15 @@ namespace ModbusDriver
public int WriteInt16(DeviceAddress address, short value)
{
var data = WriteSingleRegister(address.Area, address.Start, BitConverter.GetBytes(value));
var data = WriteSingleRegister(address.Start, BitConverter.GetBytes(value));
_serialPort.Write(data, 0, data.Length);
var chr = _serialPort.ReadByte();
return (chr & 0x80) > 0 ? -1 : 0;
}
public int WriteUInt16(DeviceAddress address, ushort value)
{
var data = WriteSingleRegister(address.Area, address.Start, BitConverter.GetBytes(value));
_serialPort.Write(data, 0, data.Length);
var chr = _serialPort.ReadByte();
return (chr & 0x80) > 0 ? -1 : 0;
}
public int WriteUInt32(DeviceAddress address, uint value)
{
var data = WriteMultipleRegister(address.Area, address.Start, BitConverter.GetBytes(value));
_serialPort.Write(data, 0, data.Length);
_serialPort.ReadByte();
var chr = _serialPort.ReadByte();
return (chr & 0x80) > 0 ? -1 : 0;
}
public int WriteInt32(DeviceAddress address, int value)
{
var data = WriteMultipleRegister(address.Area, address.Start, BitConverter.GetBytes(value));
var data = WriteMultipleRegister(address.Start, BitConverter.GetBytes(value));
_serialPort.Write(data, 0, data.Length);
_serialPort.ReadByte();
var chr = _serialPort.ReadByte();
@ -472,7 +439,7 @@ namespace ModbusDriver
public int WriteFloat(DeviceAddress address, float value)
{
var data = WriteMultipleRegister(address.Area, address.Start, BitConverter.GetBytes(value));
var data = WriteMultipleRegister(address.Start, BitConverter.GetBytes(value));
_serialPort.Write(data, 0, data.Length);
_serialPort.ReadByte();
var chr = _serialPort.ReadByte();
@ -481,11 +448,11 @@ namespace ModbusDriver
public int WriteString(DeviceAddress address, string str)
{
var data = WriteMultipleRegister(address.Area, address.Start, Encoding.ASCII.GetBytes(str));
var data = WriteMultipleRegister(address.Start, Encoding.ASCII.GetBytes(str));
_serialPort.Write(data, 0, data.Length);
_serialPort.ReadByte();
var chr = _serialPort.ReadByte();
return chr == address.DBNumber ? -1 : 0;
return chr == _slaveId ? -1 : 0;
}
public int WriteValue(DeviceAddress address, object value)

52
SCADA/Program/ModbusDriver/ModbusTCPDriver.cs

@ -32,14 +32,7 @@ namespace ModbusDriver
DeviceAddress dv = DeviceAddress.Empty;
if (string.IsNullOrEmpty(address))
return dv;
var sindex = address.IndexOf(':');
if (sindex > 0)
{
int slaveId;
if (int.TryParse(address.Substring(0, sindex), out slaveId))
dv.Area = slaveId;
address = address.Substring(sindex + 1);
}
dv.Area = _slaveId;
switch (address[0])
{
case '0':
@ -152,6 +145,16 @@ namespace ModbusDriver
set { _timeout = value; }
}
byte _slaveId;//设备ID 单元号 字节号
/// <summary>
/// 设备ID 单元号 字节号
/// </summary>
public byte SlaveId
{
get { return _slaveId; }
set { _slaveId = value; }
}
List<IGroup> _grps = new List<IGroup>(20);
public IEnumerable<IGroup> Groups
{
@ -164,13 +167,14 @@ namespace ModbusDriver
get { return _server; }
}
public ModbusTCPReader(IDataServer server, short id, string name, string ip, int timeOut = 500, string spare1 = null, string spare2 = null)
public ModbusTCPReader(IDataServer server, short id, string name, string ip, int timeOut = 500, string spare1 = "0", string spare2 = null)
{
_id = id;
_name = name;
_server = server;
_ip = ip;
_timeout = timeOut;
if (!string.IsNullOrEmpty(spare1)) byte.TryParse(spare1, out _slaveId);
}
public bool Connect()
@ -415,24 +419,6 @@ namespace ModbusDriver
return new ItemData<int>(IPAddress.HostToNetworkOrder(BitConverter.ToInt32(data, 0)), 0, QUALITIES.QUALITY_GOOD);
}
public ItemData<uint> ReadUInt32(DeviceAddress address)
{
byte[] data = WriteSyncData(CreateReadHeader(address.Area, address.Start, 2, (byte)address.DBNumber));
if (data == null)
return new ItemData<uint>(0, 0, QUALITIES.QUALITY_BAD);
else
return new ItemData<uint>((uint)IPAddress.HostToNetworkOrder(BitConverter.ToInt32(data, 0)), 0, QUALITIES.QUALITY_GOOD);
}
public ItemData<ushort> ReadUInt16(DeviceAddress address)
{
byte[] data = WriteSyncData(CreateReadHeader(address.Area, address.Start, 1, (byte)address.DBNumber));
if (data == null)
return new ItemData<ushort>(0, 0, QUALITIES.QUALITY_BAD);
else
return new ItemData<ushort>((ushort)IPAddress.HostToNetworkOrder(BitConverter.ToInt16(data, 0)), 0, QUALITIES.QUALITY_GOOD);
}
public ItemData<short> ReadInt16(DeviceAddress address)
{
byte[] data = WriteSyncData(CreateReadHeader(address.Area, address.Start, 1, (byte)address.DBNumber));
@ -524,18 +510,6 @@ namespace ModbusDriver
return data == null ? -1 : 0;
}
public int WriteUInt16(DeviceAddress address, ushort value)
{
var data = WriteSingleRegister(address.Area, address.Start, BitConverter.GetBytes((ushort)IPAddress.HostToNetworkOrder((short)value)));
return data == null ? -1 : 0;
}
public int WriteUInt32(DeviceAddress address, uint value)
{
var data = WriteMultipleRegister(address.Area, address.Start, BitConverter.GetBytes((uint)IPAddress.HostToNetworkOrder((int)value)));
return data == null ? -1 : 0;
}
public int WriteInt32(DeviceAddress address, int value)
{
var data = WriteMultipleRegister(address.Area, address.Start, BitConverter.GetBytes(IPAddress.HostToNetworkOrder(value)));

49
SCADA/Program/OPCDriver/OPCDriver.cs

@ -177,17 +177,13 @@ namespace OPCDriver
dataItem = new ByteTag((short)itemDef.hClient, new DeviceAddress(-0x100, 0, 0, Marshal.ReadInt32(pAddResults), 1, 0, DataType.BYTE), this);
break;
case DataType.WORD:
dataItem = new UShortTag((short)itemDef.hClient, new DeviceAddress(-0x100, 0, 0, Marshal.ReadInt32(pAddResults), 2, 0, DataType.WORD), this);
break;
case DataType.SHORT:
dataItem = new ShortTag((short)itemDef.hClient, new DeviceAddress(-0x100, 0, 0, Marshal.ReadInt32(pAddResults), 2, 0, DataType.SHORT), this);
break;
case DataType.INT:
case DataType.TIME:
dataItem = new IntTag((short)itemDef.hClient, new DeviceAddress(-0x100, 0, 0, Marshal.ReadInt32(pAddResults), 4, 0, DataType.INT), this);
break;
case DataType.DWORD:
dataItem = new UIntTag((short)itemDef.hClient, new DeviceAddress(-0x100, 0, 0, Marshal.ReadInt32(pAddResults), 4, 0, DataType.DWORD), this);
break;
case DataType.FLOAT:
dataItem = new FloatTag((short)itemDef.hClient, new DeviceAddress(-0x100, 0, 0, Marshal.ReadInt32(pAddResults), 4, 0, DataType.FLOAT), this);
break;
@ -325,14 +321,9 @@ namespace OPCDriver
values[i].Value.Byte = Marshal.ReadByte(pItemValues + 16);
break;
case DataType.WORD:
values[i].Value.Word = (ushort)Marshal.ReadInt16(pItemValues + 16);
break;
case DataType.SHORT:
values[i].Value.Int16 = Marshal.ReadInt16(pItemValues + 16);
break;
case DataType.DWORD:
values[i].Value.DWord = (uint)Marshal.ReadInt32(pItemValues + 16);
break;
case DataType.INT:
values[i].Value.Int32 = Marshal.ReadInt32(pItemValues + 16);
break;
@ -419,18 +410,6 @@ namespace OPCDriver
return rt;
}
public ItemData<uint> ReadUInt32(DeviceAddress address, DataSource source = DataSource.Cache)
{
var rt = ReadInt32(address, source);
return new ItemData<uint>((uint)rt.Value, rt.TimeStamp, rt.Quality);
}
public ItemData<ushort> ReadUInt16(DeviceAddress address, DataSource source = DataSource.Cache)
{
var rt = ReadInt16(address, source);
return new ItemData<ushort>((ushort)rt.Value, rt.TimeStamp, rt.Quality);
}
public ItemData<short> ReadInt16(DeviceAddress address, DataSource source = DataSource.Cache)
{
IntPtr pItemValues;
@ -561,22 +540,6 @@ namespace OPCDriver
return rt;
}
public int WriteUInt32(DeviceAddress address, uint value)
{
IntPtr pErrors;
int rt = _sync.Write(1, new int[1] { address.Start }, new object[] { value }, out pErrors);
Marshal.FreeCoTaskMem(pErrors);
return rt;
}
public int WriteUInt16(DeviceAddress address, ushort value)
{
IntPtr pErrors;
int rt = _sync.Write(1, new int[1] { address.Start }, new object[] { value }, out pErrors);
Marshal.FreeCoTaskMem(pErrors);
return rt;
}
public int WriteInt16(DeviceAddress address, short value)
{
IntPtr pErrors;
@ -693,14 +656,9 @@ namespace OPCDriver
value.Byte = Marshal.ReadByte(pvValues + 8);
break;
case DataType.WORD:
value.Word = (ushort)Marshal.ReadInt16(pvValues + 8);
break;
case DataType.SHORT:
value.Int16 = Marshal.ReadInt16(pvValues + 8);
break;
case DataType.DWORD:
value.DWord = (uint)Marshal.ReadInt32(pvValues + 8);
break;
case DataType.INT:
value.Int32 = Marshal.ReadInt32(pvValues + 8);
break;
@ -768,14 +726,9 @@ namespace OPCDriver
value.Byte = Marshal.ReadByte(pvValues + 8);
break;
case DataType.WORD:
value.Word = (ushort)Marshal.ReadInt16(pvValues + 8);
break;
case DataType.SHORT:
value.Int16 = Marshal.ReadInt16(pvValues + 8);
break;
case DataType.DWORD:
value.DWord = (uint)Marshal.ReadInt32(pvValues + 8);
break;
case DataType.INT:
value.Int32 = Marshal.ReadInt32(pvValues + 8);
break;

1
SCADA/Program/OmronPlcDriver/OmronPlcDriver.csproj

@ -30,7 +30,6 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />

30
SCADA/Program/OmronPlcDriver/OmronUdpReader.cs

@ -534,24 +534,6 @@ namespace OmronPlcDriver
else
return new ItemData<int>(IPAddress.HostToNetworkOrder(BitConverter.ToInt32(data, 0)), 0, QUALITIES.QUALITY_GOOD);
}
public ItemData<uint> ReadUInt32(DeviceAddress address)
{
byte[] data = WriteSyncData(CreateReadHeader(PcNodeId, address.Start, 2, (byte)address.DBNumber, (byte)address.Area));
if (data == null)
return new ItemData<uint>(0, 0, QUALITIES.QUALITY_BAD);
else
return new ItemData<uint>((uint)IPAddress.HostToNetworkOrder(BitConverter.ToInt32(data, 0)), 0, QUALITIES.QUALITY_GOOD);
}
public ItemData<ushort> ReadUInt16(DeviceAddress address)
{
byte[] data = WriteSyncData(CreateReadHeader(PcNodeId, address.Start, 1, (byte)address.DBNumber, (byte)address.Area));
if (data == null)
return new ItemData<ushort>(0, 0, QUALITIES.QUALITY_BAD);
else
return new ItemData<ushort>((ushort)IPAddress.HostToNetworkOrder(BitConverter.ToInt16(data, 0)), 0, QUALITIES.QUALITY_GOOD);
}
/// <summary>
/// 读取16位整数
/// </summary>
@ -671,18 +653,6 @@ namespace OmronPlcDriver
return data == null ? -1 : 0;
}
public int WriteUInt16(DeviceAddress address, ushort value)
{
var data = WriteSingleRegister(PcNodeId, address.Start, (byte)address.DBNumber, BitConverter.GetBytes((ushort)IPAddress.HostToNetworkOrder((short)value)), (byte)address.Area);
return data == null ? -1 : 0;
}
public int WriteUInt32(DeviceAddress address, uint value)
{
var data = WriteMultipleRegister(PcNodeId, address.Start, (byte)address.DBNumber, BitConverter.GetBytes((uint)IPAddress.HostToNetworkOrder((int)value)), (byte)address.Area);
return data == null ? -1 : 0;
}
public int WriteInt32(DeviceAddress address, int value)
{
var data = WriteMultipleRegister(PcNodeId, address.Start, (byte)address.DBNumber, BitConverter.GetBytes(IPAddress.HostToNetworkOrder(value)), (byte)address.Area);

4
SCADA/Program/PanasonicDriver/PanasonicDriver.csproj

@ -9,10 +9,8 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>PanasonicDriver</RootNamespace>
<AssemblyName>PanasonicDriver</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile>
</TargetFrameworkProfile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>

74
SCADA/Program/PanasonicDriver/PanasonicSerialReader.cs

@ -5,6 +5,7 @@ using System.ComponentModel;
using System.Globalization;
using System.IO;
using System.IO.Ports;
using System.Net;
using System.Text;
namespace PanasonicPLCriver
@ -42,7 +43,7 @@ namespace PanasonicPLCriver
_server = server;
_id = id;
//spare1 = {COM3,9600,Odd,8,One}
_serialPort = new SerialPort("COM2", 57600, Parity.Odd, 8, StopBits.One);
_serialPort = new SerialPort("COM2",57600,Parity.Odd,8,StopBits.One);
_devId = byte.Parse(spare2);
}
public bool IsClosed
@ -93,7 +94,7 @@ namespace PanasonicPLCriver
public IGroup AddGroup(string name, short id, int updateRate, float deadBand = 0, bool active = false)
{
ShortGroup grp = new ShortGroup(id, name, updateRate, active, this);
NetShortGroup grp = new NetShortGroup(id, name, updateRate, active, this);
_grps.Add(grp);
return grp;
}
@ -210,6 +211,7 @@ namespace PanasonicPLCriver
break;
}
}
dv.ByteOrder = ByteOrder.Network;
return dv;
}
#region 实现了四个命令 其余没有做
@ -298,7 +300,7 @@ namespace PanasonicPLCriver
/// <param name="values">写入的值</param>
/// <param name="respBeginStr">响应的开始帧</param>
/// <returns></returns>
public string CreateWDCmd(int start, short[] values, out string respBeginStr)
public string CreateWDCmd(int start, short[] values, out string respBeginStr)
{
string dataStr = string.Empty;
int size = values.Length;
@ -329,18 +331,17 @@ namespace PanasonicPLCriver
{
if (!isBool(startAddress.Area))//读寄存器的情况
{
cmd = CreateRDCmd(startAddress.Start, size, out respBeginStr);
cmd = CreateRDCmd(startAddress.Start,size,out respBeginStr);
}
else //读触点的情况
{
cmd = CreateRCCCmd(startAddress.Start, size, startAddress.Area, out respBeginStr);
cmd = CreateRCCCmd(startAddress.Start, size, startAddress.Area, out respBeginStr);
}
return WriteSyncData(respBeginStr, cmd);
}
catch (Exception e)
{
if (OnClose != null)
OnClose(this, new ShutdownRequestEventArgs(e.Message));
OnClose?.Invoke(this, new ShutdownRequestEventArgs(e.Message));
return null;
}
}
@ -350,7 +351,7 @@ namespace PanasonicPLCriver
byte[] writeData = Encoding.Default.GetBytes(cmd);
string recv = string.Empty;
lock (syncLock)//这里加锁 防止一个刚写完还没全读来 另一就去写
//但这就会造成锁死的情况 比如循环读的时候 触发去写 这时候必须要等读完才能去写
//但这就会造成锁死的情况 比如循环读的时候 触发去写 这时候必须要等读完才能去写
{
_serialPort.Write(writeData, 0, writeData.Length);
try
@ -359,16 +360,14 @@ namespace PanasonicPLCriver
}
catch (Exception)
{
if (OnClose != null)
OnClose(this, new ShutdownRequestEventArgs("读取超时"));
OnClose?.Invoke(this, new ShutdownRequestEventArgs("读取超时"));
return null;
}
}
}
if (recv.Substring(3, 1) == "!")//返回为错误代码
{
string err = recv.Substring(4, 2);
if (OnClose != null)
OnClose(this, new ShutdownRequestEventArgs(daveStrerror(err)));
OnClose?.Invoke(this, new ShutdownRequestEventArgs(daveStrerror(err)));
return null;
}
string needXorStr = recv.Substring(0, recv.Length - 2);//需要进行xor校验的字符串
@ -376,15 +375,14 @@ namespace PanasonicPLCriver
string checkStr = Utility.XorCheck(needXorStr);
if (checkStr != recvCheck)
{
if (OnClose != null)
OnClose(this, new ShutdownRequestEventArgs("校验失败"));
OnClose?.Invoke(this, new ShutdownRequestEventArgs("校验失败"));
return null;
}
else
{
if (recv.Substring(4, 1) == "W")//如果是写入命令
{
return new byte[0];
return new byte[0];
}
string dataStr = Utility.Pinchstring(recv, respBeginStr, checkStr);
return Utility.HexToBytes(dataStr);
@ -394,7 +392,7 @@ namespace PanasonicPLCriver
{
switch (code)
{
case "20": return "未定义";
case "20":return "未定义";
case "21": return "远程单元无法被正确识别,或者发生了数据错误.";
case "22": return "用于远程单元的接收缓冲区已满.";
case "23": return "远程单元编号(01 至16)设置与本地单元重复.";
@ -433,16 +431,12 @@ namespace PanasonicPLCriver
}
public ItemData<float> ReadFloat(DeviceAddress address)
{
throw new NotImplementedException();
throw new NotImplementedException();
}
public ItemData<short> ReadInt16(DeviceAddress address)
{
throw new NotImplementedException();
}
public ItemData<ushort> ReadUInt16(DeviceAddress address)
{
throw new NotImplementedException();
}
/// <summary>
/// 读取一个32位数 返回如果是6300 则认为是0063H 高低位要反 而且是16进账
/// </summary>
@ -451,10 +445,6 @@ namespace PanasonicPLCriver
{
throw new NotImplementedException();
}
public ItemData<uint> ReadUInt32(DeviceAddress address)
{
throw new NotImplementedException();
}
public ItemData<Storage>[] ReadMultiple(DeviceAddress[] addrsArr)
{
@ -478,10 +468,10 @@ namespace PanasonicPLCriver
public int WriteBit(DeviceAddress address, bool bit)
{
string respBeginStr = string.Empty;
string cmd = CreateWCSCmd(address.Start, address.Bit, address.Area, bit, out respBeginStr);
WriteSyncData(respBeginStr, cmd);
return 0;
string respBeginStr = string.Empty;
string cmd = CreateWCSCmd(address.Start,address.Bit,address.Area,bit,out respBeginStr);
WriteSyncData(respBeginStr, cmd);
return 0;
}
public int WriteBits(DeviceAddress address, byte bits)
@ -502,21 +492,11 @@ namespace PanasonicPLCriver
public int WriteInt16(DeviceAddress address, short value)
{
string respBeginStr = string.Empty;
string cmd = CreateWDCmd(address.Start, new short[1] { value }, out respBeginStr);
string cmd = CreateWDCmd(address.Start, new short[1] {value}, out respBeginStr);
WriteSyncData(respBeginStr, cmd);
return 0;
}
public int WriteUInt16(DeviceAddress address, ushort value)
{
return WriteInt16(address, (short)value);
}
public int WriteUInt32(DeviceAddress address, uint value)
{
throw new NotImplementedException();
}
public int WriteInt32(DeviceAddress address, int value)
{
throw new NotImplementedException();
@ -612,12 +592,12 @@ namespace PanasonicPLCriver
/// </summary>
public const string WDCmd = "WD";
public const byte Xarea = 0;//外部输入
public const byte Yarea = 1;//外部输出
public const byte Rarea = 2;//内部继电器
public const byte Tarea = 3;//定时器
public const byte Carea = 4;//计数器 不支持
public const byte Larea = 5;//链接继电器 不支持
public const byte Xarea = 0;//外部输入
public const byte Yarea = 1;//外部输出
public const byte Rarea = 2;//内部继电器
public const byte Tarea = 3;//定时器
public const byte Carea = 4;//计数器 不支持
public const byte Larea = 5;//链接继电器 不支持
public const byte DTarea = 6;//数据寄存器 DT
public const byte LDarea = 7;//链接寄存器 LD 不支持

68
SCADA/Program/SiemensPLCDriver/SiemensPLCDriver.cs

@ -133,7 +133,6 @@ namespace SiemensPLCDriver
case DataType.SHORT:
return string.Concat(addr, "W", address.Start);
case DataType.FLOAT:
case DataType.DWORD:
case DataType.INT:
return string.Concat(addr, "D", address.Start);
default:
@ -399,44 +398,6 @@ namespace SiemensPLCDriver
return new ItemData<int>(0, 0, QUALITIES.QUALITY_NOT_CONNECTED); ;
}
public ItemData<uint> ReadUInt32(DeviceAddress address)
{
if (dc != null)
{
int res = -1;
lock (_async)
{
res = dc.readBytes(address.Area, address.DBNumber, address.Start, 4, null);
if (res == 0) return new ItemData<uint>((uint)dc.getS32(), 0, QUALITIES.QUALITY_GOOD);
}
_closed = true; dc = null; _closeTime = DateTime.Now;
if (OnClose != null)
{
OnClose(this, new ShutdownRequestEventArgs(daveStrerror(res)));
}
}
return new ItemData<uint>(0, 0, QUALITIES.QUALITY_NOT_CONNECTED); ;
}
public ItemData<ushort> ReadUInt16(DeviceAddress address)
{
if (dc != null)
{
int res = -1;
lock (_async)
{
res = dc.readBytes(address.Area, address.DBNumber, address.Start, 2, null);
if (res == 0) return new ItemData<ushort>((ushort)dc.getS16(), 0, QUALITIES.QUALITY_GOOD);
}
_closed = true; dc = null; _closeTime = DateTime.Now;
if (OnClose != null)
{
OnClose(this, new ShutdownRequestEventArgs(daveStrerror(res)));
}
}
return new ItemData<ushort>(0, 0, QUALITIES.QUALITY_NOT_CONNECTED); ;
}
public ItemData<short> ReadInt16(DeviceAddress address)
{
if (dc != null)
@ -542,24 +503,6 @@ namespace SiemensPLCDriver
}
}
public int WriteUInt16(DeviceAddress address, ushort value)
{
byte[] b = BitConverter.GetBytes(value); Array.Reverse(b);
lock (_async)
{
return dc == null ? -1 : dc.writeBytes(address.Area, address.DBNumber, address.Start, 2, b);
}
}
public int WriteUInt32(DeviceAddress address, uint value)
{
byte[] b = BitConverter.GetBytes(value); Array.Reverse(b);
lock (_async)
{
return dc == null ? -1 : dc.writeBytes(address.Area, address.DBNumber, address.Start, 4, b);
}
}
public int WriteInt32(DeviceAddress address, int value)
{
byte[] b = BitConverter.GetBytes(value); Array.Reverse(b);
@ -662,14 +605,9 @@ namespace SiemensPLCDriver
itemArr[i].Value.Byte = (byte)dc.getU8();
break;
case DataType.WORD:
itemArr[i].Value.Word = (ushort)dc.getS16();
break;
case DataType.SHORT:
itemArr[i].Value.Int16 = (short)dc.getS16();
break;
case DataType.DWORD:
itemArr[i].Value.DWord = (uint)dc.getS32();
break;
case DataType.INT:
itemArr[i].Value.Int32 = dc.getS32();
break;
@ -743,12 +681,8 @@ namespace SiemensPLCDriver
b = BitConverter.GetBytes(Convert.ToInt16(buffer[i])); Array.Reverse(b);
p2.addVarToWriteRequest(addr.Area, addr.DBNumber, addr.Start, 2, b);
break;
case DataType.DWORD:
b = BitConverter.GetBytes(Convert.ToUInt32(buffer[i])); Array.Reverse(b);
p2.addVarToWriteRequest(addr.Area, addr.DBNumber, addr.Start, 4, b);
break;
case DataType.INT:
b = BitConverter.GetBytes(Convert.ToInt32(buffer[i])); Array.Reverse(b);
b = BitConverter.GetBytes((int)Convert.ToDouble(buffer[i])); Array.Reverse(b);
p2.addVarToWriteRequest(addr.Area, addr.DBNumber, addr.Start, 4, b);
break;
case DataType.FLOAT:

0
SCADA/Program/TagConfig/TagConfig/DataConvert.cs → SCADA/Program/TagConfig/TagConfig/DataHelper.cs

20
SCADA/Program/TagConfig/TagConfig/Form1.cs

@ -33,10 +33,24 @@ namespace TagConfig
SqlConnectionStringBuilder builder = new SqlConnectionStringBuilder();
public enum DataType : byte
{
NONE = 0,
BOOL = 1,
BYTE = 3,
SHORT = 4,
WORD = 5,
TIME = 6,
INT = 7,
FLOAT = 8,
SYS = 9,
STR = 11
}
public static readonly List<DataTypeSource> DataDict = new List<DataTypeSource>
{
new DataTypeSource (1,"开关型"),new DataTypeSource (3,"字节"), new DataTypeSource (4,"短整型"),
new DataTypeSource (5,"单字型"),new DataTypeSource (6,"双字型"),new DataTypeSource (7,"长整型"),
new DataTypeSource (5,"单字型"),new DataTypeSource (6,"时间型"),new DataTypeSource (7,"双字型"),
new DataTypeSource (8,"浮点型"),new DataTypeSource (9,"系统型"),new DataTypeSource (10,"ASCII字符串"),
new DataTypeSource (11,"UNICODE字符串"),new DataTypeSource(0,"")
};
@ -199,7 +213,7 @@ namespace TagConfig
list.Clear();
majorTop.Nodes.Clear();
using (XmlReader reader = XmlReader.Create(file))
using (XmlReader reader = XmlTextReader.Create(file))
{
while (reader.Read())
{
@ -328,7 +342,7 @@ namespace TagConfig
private void SaveToXml(string file)
{
using (var writer = XmlWriter.Create(file))
using (var writer = XmlTextWriter.Create(file))
{
writer.WriteStartDocument();
writer.WriteStartElement("Sever");

2
SCADA/Program/TagConfig/TagConfig/TagConfig.csproj

@ -64,7 +64,7 @@
<DependentUpon>AlarmParam.cs</DependentUpon>
</Compile>
<Compile Include="Condition.cs" />
<Compile Include="DataConvert.cs" />
<Compile Include="DataHelper.cs" />
<Compile Include="ExMethos.cs" />
<Compile Include="Form1.cs">
<SubType>Form</SubType>

BIN
SCADA/dll/ClientDriver.dll

Binary file not shown.

BIN
SCADA/dll/DataHelper.dll

Binary file not shown.

BIN
SCADA/dll/DataService.dll

Binary file not shown.

BIN
SCADA/dll/FileDriver.dll

Binary file not shown.

BIN
SCADA/dll/ModbusDriver.dll

Binary file not shown.

BIN
SCADA/dll/OPCDriver.dll

Binary file not shown.

BIN
SCADA/dll/OmronPlcDriver.dll

Binary file not shown.

BIN
SCADA/dll/PanasonicDriver.dll

Binary file not shown.

BIN
SCADA/dll/SiemensPLCDriver.dll

Binary file not shown.
Loading…
Cancel
Save