From 176cd7b598345523a81da975f57ef1e2a926c117 Mon Sep 17 00:00:00 2001 From: hanqiangqiang <1364346467@qq.com> Date: Thu, 21 May 2026 15:23:06 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9PLC=E7=9A=84IO=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E5=90=8E=EF=BC=8C=E4=BB=BF=E7=9C=9F=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E8=BF=90=E8=A1=8C=E9=97=AE=E9=A2=98=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SicModules/Config/PM/PM1/_ioDefinePM1.xml | 48 +- SicRT/Config/IoProviderConfig.xml | 14 +- SicSimulator/App.xaml | 4 +- SicSimulator/Config/_ioDefinePM.xml | 923 +++++++++--------- .../Instances/SimulatorAdsPlcService.cs | 36 + SicSimulator/Instances/SimulatorModulePlc.cs | 4 + 6 files changed, 544 insertions(+), 485 deletions(-) diff --git a/Modules/SicModules/Config/PM/PM1/_ioDefinePM1.xml b/Modules/SicModules/Config/PM/PM1/_ioDefinePM1.xml index 2087c53..d094556 100644 --- a/Modules/SicModules/Config/PM/PM1/_ioDefinePM1.xml +++ b/Modules/SicModules/Config/PM/PM1/_ioDefinePM1.xml @@ -694,18 +694,20 @@ - - - - - - - - - - - + + + + + + + + + + + + + @@ -939,17 +941,19 @@ - - - - - - - - - - - + + + + + + + + + + + + + \ No newline at end of file diff --git a/SicRT/Config/IoProviderConfig.xml b/SicRT/Config/IoProviderConfig.xml index d44e972..37548f8 100644 --- a/SicRT/Config/IoProviderConfig.xml +++ b/SicRT/Config/IoProviderConfig.xml @@ -25,11 +25,11 @@ - - - - - + @@ -57,8 +57,8 @@ - - + + diff --git a/SicSimulator/App.xaml b/SicSimulator/App.xaml index 928ba9d..26aee98 100644 --- a/SicSimulator/App.xaml +++ b/SicSimulator/App.xaml @@ -21,8 +21,8 @@ - - + + diff --git a/SicSimulator/Config/_ioDefinePM.xml b/SicSimulator/Config/_ioDefinePM.xml index bdb9838..0b8d023 100644 --- a/SicSimulator/Config/_ioDefinePM.xml +++ b/SicSimulator/Config/_ioDefinePM.xml @@ -482,463 +482,478 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/SicSimulator/Instances/SimulatorAdsPlcService.cs b/SicSimulator/Instances/SimulatorAdsPlcService.cs index bee2419..079dcf3 100644 --- a/SicSimulator/Instances/SimulatorAdsPlcService.cs +++ b/SicSimulator/Instances/SimulatorAdsPlcService.cs @@ -32,12 +32,18 @@ namespace SicSimulator.Instances case "GVL_IO.PM1_AI_G_2": data = IoManager.Instance.GetAiBuffer("PM1.PLC")[1]; break; + case "GVL_IO.PM1_AI_G_3": + data = IoManager.Instance.GetAiBuffer("PM1.PLC")[2]; + break; case "GVL_IO.PM1_AO_G": data = IoManager.Instance.GetAoBuffer("PM1.PLC")[0]; break; case "GVL_IO.PM1_AO_G_2": data = IoManager.Instance.GetAoBuffer("PM1.PLC")[1]; break; + case "GVL_IO.PM1_AO_G_3": + data = IoManager.Instance.GetAoBuffer("PM1.PLC")[2]; + break; case "GVL_IO.PM2_DI_G": data = IoManager.Instance.GetDiBuffer("PM2.PLC")[0]; @@ -51,12 +57,18 @@ namespace SicSimulator.Instances case "GVL_IO.PM2_AI_G_2": data = IoManager.Instance.GetAiBuffer("PM2.PLC")[1]; break; + case "GVL_IO.PM2_AI_G_3": + data = IoManager.Instance.GetAiBuffer("PM2.PLC")[2]; + break; case "GVL_IO.PM2_AO_G": data = IoManager.Instance.GetAoBuffer("PM2.PLC")[0]; break; case "GVL_IO.PM2_AO_G_2": data = IoManager.Instance.GetAoBuffer("PM2.PLC")[1]; break; + case "GVL_IO.PM2_AO_G_3": + data = IoManager.Instance.GetAoBuffer("PM2.PLC")[2]; + break; } return true; @@ -73,6 +85,13 @@ namespace SicSimulator.Instances IoManager.Instance.GetDoBuffer("PM1.PLC")[0][index] = (bool)value; break; case "GVL_IO.PM1_AI_G": + IoManager.Instance.GetAiBuffer("PM1.PLC")[0][index] = (float)value; + break; + case "GVL_IO.PM1_AI_G_2": + IoManager.Instance.GetAiBuffer("PM1.PLC")[1][index] = (float)value; + break; + case "GVL_IO.PM1_AI_G_3": + IoManager.Instance.GetAiBuffer("PM1.PLC")[2][index] = (float)value; break; case "GVL_IO.PM1_AO_G": IoManager.Instance.GetAoBuffer("PM1.PLC")[0][index] = (float)value; @@ -80,20 +99,37 @@ namespace SicSimulator.Instances case "GVL_IO.PM1_AO_G_2": IoManager.Instance.GetAoBuffer("PM1.PLC")[1][index] = (float)value; break; + case "GVL_IO.PM1_AO_G_3": + IoManager.Instance.GetAoBuffer("PM1.PLC")[2][index] = (float)value; + break; case "GVL_IO.PM2_DI_G": break; case "GVL_IO.PM2_DO_G": IoManager.Instance.GetDoBuffer("PM2.PLC")[0][index] = (bool)value; break; + case "GVL_IO.PM2_AI_G": + IoManager.Instance.GetAiBuffer("PM2.PLC")[0][index] = (float)value; break; + case "GVL_IO.PM2_AI_G_2": + IoManager.Instance.GetAiBuffer("PM2.PLC")[1][index] = (float)value; + break; + case "GVL_IO.PM2_AI_G_3": + IoManager.Instance.GetAiBuffer("PM2.PLC")[2][index] = (float)value; + break; + + + case "GVL_IO.PM2_AO_G": IoManager.Instance.GetAoBuffer("PM2.PLC")[0][index] = (float)value; break; case "GVL_IO.PM2_AO_G_2": IoManager.Instance.GetAoBuffer("PM2.PLC")[1][index] = (float)value; break; + case "GVL_IO.PM2_AO_G_3": + IoManager.Instance.GetAoBuffer("PM2.PLC")[2][index] = (float)value; + break; } return true; } diff --git a/SicSimulator/Instances/SimulatorModulePlc.cs b/SicSimulator/Instances/SimulatorModulePlc.cs index 0f7a61d..395b3a1 100644 --- a/SicSimulator/Instances/SimulatorModulePlc.cs +++ b/SicSimulator/Instances/SimulatorModulePlc.cs @@ -38,6 +38,8 @@ namespace SicSimulator.Instances _buffers.Add(new PlcBuffer() { Buffer = new byte[BufferSize], Type = IoType.AO, Offset = 0, Size = BufferSize, FloatValue = new float[BufferSize] }); _buffers.Add(new PlcBuffer() { Buffer = new byte[BufferSize], Type = IoType.AI, Offset = 1, Size = BufferSize, FloatValue = new float[BufferSize] }); _buffers.Add(new PlcBuffer() { Buffer = new byte[BufferSize], Type = IoType.AO, Offset = 1, Size = BufferSize, FloatValue = new float[BufferSize] }); + _buffers.Add(new PlcBuffer() { Buffer = new byte[BufferSize], Type = IoType.AI, Offset = 2, Size = BufferSize, FloatValue = new float[BufferSize] }); + _buffers.Add(new PlcBuffer() { Buffer = new byte[BufferSize], Type = IoType.AO, Offset = 2, Size = BufferSize, FloatValue = new float[BufferSize] }); List lstBuffers = new List(); lstBuffers.Add(new IoBlockItem() { Type = IoType.DI, Index = 0, Size = BufferSize }); @@ -46,6 +48,8 @@ namespace SicSimulator.Instances lstBuffers.Add(new IoBlockItem() { Type = IoType.AO, Index = 0, Size = BufferSize }); lstBuffers.Add(new IoBlockItem() { Type = IoType.AI, Index = 1, Size = BufferSize }); lstBuffers.Add(new IoBlockItem() { Type = IoType.AO, Index = 1, Size = BufferSize }); + lstBuffers.Add(new IoBlockItem() { Type = IoType.AI, Index = 2, Size = BufferSize }); + lstBuffers.Add(new IoBlockItem() { Type = IoType.AO, Index = 2, Size = BufferSize }); SimulatorIoManager.Instance.CreateBuffer(source, lstBuffers); SimulatorIoManager.Instance.SetIoMap(source, ioMapPathFile, module);