瀏覽代碼

中控块增加摆扫数据,用于校验

yc_t 6 年之前
父節點
當前提交
8859e551b5
共有 2 個文件被更改,包括 40 次插入11 次删除
  1. 5 5
      PLCLinker/newPLCS7/PLCS7.cs
  2. 35 6
      PLCLinker/newPLCS7/entity.cs

+ 5 - 5
PLCLinker/newPLCS7/PLCS7.cs

@@ -29,7 +29,7 @@ namespace PLCS7
     }
     public abstract class AbstractPLCLinker : IPLCS7
     {
-        protected const int mainBlockOffset = 52;
+        //protected const int mainBlockOffset = 52;
         protected const int parkingSpaceOffset = 18;
         protected const int terminalLength = 46;
         protected const int parkingSpaceLength = 48;
@@ -358,10 +358,10 @@ namespace PLCS7
                         //只允许中控写入
                         MainBlockStru mbs = (MainBlockStru)msg.abstractPLCMsg;
                         //byte[] temp = BitConverter.GetBytes(BytesRevert(mbs.licenseReceived));
-                        if (mbs.centralHearbeat != (short)-1) { plc.WriteBytes(DataType.DataBlock, centralDB, mainBlockOffset + 8, BitConverter.GetBytes(BytesRevert(mbs.centralHearbeat))); }
-                        if (mbs.licenseReceived != (short)-1) { plc.WriteBytes(DataType.DataBlock, centralDB, mainBlockOffset, BitConverter.GetBytes(BytesRevert(mbs.licenseReceived))); }
-                        if (mbs.bookParkCmd != (short)-1) { plc.WriteBytes(DataType.DataBlock, centralDB, mainBlockOffset - 4, BitConverter.GetBytes(BytesRevert(mbs.bookParkCmd))); }
-                        if (mbs.bookFetchCmd != (short)-1) { plc.WriteBytes(DataType.DataBlock, centralDB, mainBlockOffset - 2, BitConverter.GetBytes(BytesRevert(mbs.bookFetchCmd))); }
+                        if (mbs.centralHearbeat != (short)-1) { plc.WriteBytes(DataType.DataBlock, centralDB, 60, BitConverter.GetBytes(BytesRevert(mbs.centralHearbeat))); }
+                        if (mbs.licenseReceived != (short)-1) { plc.WriteBytes(DataType.DataBlock, centralDB, 52, BitConverter.GetBytes(BytesRevert(mbs.licenseReceived))); }
+                        if (mbs.bookParkCmd != (short)-1) { plc.WriteBytes(DataType.DataBlock, centralDB, 48, BitConverter.GetBytes(BytesRevert(mbs.bookParkCmd))); }
+                        if (mbs.bookFetchCmd != (short)-1) { plc.WriteBytes(DataType.DataBlock, centralDB, 50, BitConverter.GetBytes(BytesRevert(mbs.bookFetchCmd))); }
                         if (mbs.processCompleted != (short)-1) { plc.WriteBytes(DataType.DataBlock, centralDB, 16, BitConverter.GetBytes(BytesRevert(mbs.processCompleted))); }
                         //ErrorCode ec = plc.WriteBytes(DataType.DataBlock, centralDB, mainBlockOffset, temp);
                         //if (!ec.Equals(ErrorCode.NoError)) { return false; }

+ 35 - 6
PLCLinker/newPLCS7/entity.cs

@@ -151,11 +151,11 @@ namespace PLCS7
         /// <summary>
         /// 流程完成
         /// </summary>
-        public short processCompleted;
+        public short processCompleted;//16
         /// <summary>
         /// 流程中断
         /// </summary>
-        public short processStopped;
+        public short processStopped;//18
         /// <summary>
         /// 摆扫激光状态
         /// </summary>
@@ -201,7 +201,7 @@ namespace PLCS7
         /// <summary>
         /// 中控心跳
         /// </summary>
-        public short centralHearbeat;
+        public short centralHearbeat;//60
         /// <summary>
         /// 预约车位总数
         /// </summary>
@@ -210,15 +210,44 @@ namespace PLCS7
         /// 当前需更新车位ID
         /// </summary>
         public short currentParkingSpaceID;//64
+        /// <summary>
+        /// 当前车辆长度
+        /// </summary>
+        public short currentCarLength;//66
+        /// <summary>
+        /// 当前车辆宽度
+        /// </summary>
+        public short currentCarWidth;//68
+        /// <summary>
+        /// 当前车辆高度
+        /// </summary>
+        public short currentCarHeight;//70
+        /// <summary>
+        /// 当前车辆轴距
+        /// </summary>
+        public short currentCarWheelbase;//72
+        /// <summary>
+        /// 当前车辆中心X坐标
+        /// </summary>
+        public short currentCarCenterX;//74
+        /// <summary>
+        /// 当前车辆中心Y坐标
+        /// </summary>
+        public short currentCarCenterY;//76
+        /// <summary>
+        /// 当前车辆偏转角
+        /// </summary>
+        public short currentCarAngle;//78
 
         public override string ToString()
         {
             return "[id(0):" + terminalID + ",号牌(2):" + numMachineLaunch + ",摆扫(4):" + sweepLaserLaunch + ",轮距(6):" + wheelbaseLaserLaunch + ",急停(8):" + stop
                 + ",就绪(10):" + ready + ",停车启动(12):" + parkingRunning + ",取车启动(14):" + fetchingRunning + ",流程完成(16):" + processCompleted + ",流程中止(18):" +
                 processStopped + ",摆扫状态(20):" + sweepLaserStatus + ",轮距状态(22):" + wheelbaseLaserStatus + ",号牌获取(52):" + licenseReceived
-                + ",本地自动(54):" + localAutoMode + ",远程模式(56):" + remoteMode + ",本地手动(58):" + localManualMode + ",中控心跳(60):" + centralHearbeat + ",预约车位总数(62):" + 
-                reserveTotalSpace + ",待更新车位ID(64):" + currentParkingSpaceID + "," + groundAStatus
-                + "," + groundBStatus + "," + groundCStatus + "," + arriveAAndOpen + "," + arriveBAndOpen + "," + arriveCAndOpen
+                + ",本地自动(54):" + localAutoMode + ",远程模式(56):" + remoteMode + ",本地手动(58):" + localManualMode + ",中控心跳(60):" + centralHearbeat +
+                ",预约车位总数(62):" + reserveTotalSpace + ",待更新车位ID(64):" + currentParkingSpaceID + ",车辆长度(66):" + currentCarLength + ",车辆宽度(68):" + currentCarWidth +
+                ",车辆高度(70):" + currentCarHeight + ",车辆轴距(72):" + currentCarWheelbase + ",车辆中心X(74)" + currentCarCenterX + ",车辆中心Y(76):" + currentCarCenterY +
+                ",车辆偏转角(78):" + currentCarAngle + "," + groundAStatus + "," + groundBStatus + "," + groundCStatus + "," + arriveAAndOpen + "," + arriveBAndOpen + "," + arriveCAndOpen
                  + "]";
         }
         public override int GetHashCode()