Browse Source

PLC类库测试初步完成

yc_t 7 years ago
parent
commit
56518b016c

+ 68 - 0
dllTest/App.config

@@ -3,4 +3,72 @@
     <startup> 
         <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6" />
     </startup>
+  <appSettings>
+    <!--PLC相关配置文件配置文件-->
+    <!--<add key="PLC_ip_address" value="192.168.0.10" />-->
+    <add key="PLC_ip_address" value="127.0.0.1" />
+    <add key="PLC_port" value="30000" />
+    <add key="PLC_station" value="1" />
+    <add key="PLC_start_address" value="0" />
+    <add key="PLC_address_length" value="110" />
+    <add key="PLC_refresh_interval" value="200"/>
+    <add key="equipmentStatus_address" value="20" />
+    <!--PLC停取完成-->
+    <add key="park_start_address" value="1" />
+    <add key="park_completed_address" value="21" />
+    <add key="park_completed_acknowledge_address" value="5" />
+    <add key="fetch_completed_address" value="22" />
+    <add key="fetch_completed_acknowledge_address" value="6" />
+    <!--启动机械手-->
+    <add key="parking_startRobot_address" value="3" />
+    <add key="fetching_startRobot_address" value="4" />
+    <add key="fetch_to_address" value="2" />
+    <!--机械手停车所需数据-->
+    <add key="parkingSpaceID_address" value="16" />
+    <add key="parkingSpaceX_address" value="17" />
+    <add key="parkingSpaceY_address" value="18" />
+    <add key="parkingSpaceZ_address" value="19" />
+    <add key="parkingLaserCenterX_address" value="13" />
+    <add key="frontWheelbase_address" value="85" />
+    <add key="rearWheelbase_address" value="86" />
+    <add key="wheelbase_status_address" value="87" />
+    <!--激光设备配置-->
+    <add key="laser_start_address" value="10" />
+    <add key="laser1_status_address" value="89" />
+    <add key="laser_rescan_count" value="3" />
+    <add key="laser_countdown" value="100" />
+    
+    <!--缓冲位配置--><!--
+    <add key ="bufferAddress" value ="7"/>
+    <add key ="completeStatusAddress" value ="9"/>
+    --><!--队列线程参数--><!--
+    <add key="fetch_store_ratio" value="3" />
+    <add key="licenseTime" value="10" />
+    <add key="userTime" value="10" />
+    <add key="bookTime" value="120" />
+    --><!--上位机(Web线程)IP地址及配置serverScoket的端口--><!--
+    <add key="WebConfig" value="192.168.111.254:9000" />
+    --><!--<add key ="WebConfig" value="192.168.0.197:9000"/>--><!--
+
+    --><!--车库入口--><!--
+    <add key="parkingEntX" value="0" />
+    <add key="parkingEntY" value="0" />
+    <add key="parkingEntZ" value="0" />
+    --><!--监控线程--><!--
+    --><!--数据更新间隔(毫秒数)--><!--
+    <add key="monitor_timGap" value="1000"/>
+
+    --><!--号牌机ip位置映射表--><!--
+    --><!--位置编号;基点横坐标;车位宽度;宽度补偿--><!--
+    <add key="192.168.0.20" value="1" />
+    <add key="192.168.0.21" value="2" />
+    <add key="filterRatio" value="0.7" />
+    --><!--车库基本信息--><!--
+    <add key ="garageID" value ="1"/>
+    <add key ="bufferCount" value ="2"/>
+    <add key="xWeight" value="1"/>
+    <add key="yWeight" value="1"/>
+    <add key="zWeight" value="1"/>-->
+
+  </appSettings>
 </configuration>

+ 27 - 0
dllTest/Program.cs

@@ -2,7 +2,9 @@
 using System.Collections.Generic;
 using System.Linq;
 using System.Text;
+using System.Threading;
 using System.Threading.Tasks;
+using PLCLinker;
 
 namespace dllTest
 {
@@ -10,6 +12,31 @@ namespace dllTest
     {
         static void Main(string[] args)
         {
+            IEquipments p = new PLCLinker.PLCLinker();
+            p.Start();
+            Task.Factory.StartNew(()=> {
+                string temp = "";
+                while (true)
+                {
+                    if (p != null)
+                    {
+                        temp = "[ ";
+                        PLCMessage msg = (PLCMessage)p.GetMessage();
+                        for (int i = 0; i < msg.originalPlcList.Count(); i++)
+                        {
+                            temp += " <" + msg.originalPlcList[i].Address + "," + msg.originalPlcList[i].Value+"> ";
+                            if (i + 1 % 15 == 0)
+                            {
+                                temp += "\n";
+                            }
+                        }
+                        temp += " ]";
+                        Console.WriteLine(temp);
+                    }
+                    Thread.Sleep(500);
+                }
+            });
+            Console.ReadLine();
         }
     }
 }

+ 20 - 0
dllTest/dllTest.csproj

@@ -32,6 +32,18 @@
     <WarningLevel>4</WarningLevel>
   </PropertyGroup>
   <ItemGroup>
+    <Reference Include="HslCommunication, Version=4.3.2.0, Culture=neutral, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>resource\HslCommunication.dll</HintPath>
+    </Reference>
+    <Reference Include="Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>resource\Newtonsoft.Json.dll</HintPath>
+    </Reference>
+    <Reference Include="PLCLinker, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>resource\PLCLinker.dll</HintPath>
+    </Reference>
     <Reference Include="System" />
     <Reference Include="System.Core" />
     <Reference Include="System.Xml.Linq" />
@@ -48,5 +60,13 @@
   <ItemGroup>
     <None Include="App.config" />
   </ItemGroup>
+  <ItemGroup>
+    <Content Include="resource\HslCommunication.dll" />
+    <Content Include="resource\HslCommunication.xml" />
+    <Content Include="resource\Newtonsoft.Json.dll" />
+    <Content Include="resource\Newtonsoft.Json.xml" />
+    <Content Include="resource\PLCLinker.dll" />
+    <Content Include="resource\PLCLinker.pdb" />
+  </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
 </Project>

BIN
dllTest/resource/HslCommunication.dll


File diff suppressed because it is too large
+ 8402 - 0
dllTest/resource/HslCommunication.xml


BIN
dllTest/resource/Newtonsoft.Json.dll


File diff suppressed because it is too large
+ 8944 - 0
dllTest/resource/Newtonsoft.Json.xml


BIN
dllTest/resource/PLCLinker.dll


BIN
dllTest/resource/新plc模拟.mbs