예제 #1
0
 /// <summary>
 /// 根据点位生成2位字符串或者1位字符串
 /// </summary>
 /// <param name="str2byte">字符串数组</param>
 /// <param name="stateid">状态id</param>
 /// <param name="plcEqu">设备实体</param>
 /// <param name="bitCount">点位个数</param>
 private void Add2OR1Str(string[] str2byte, int stateid, PLCEqu plcEqu, int bitCount)
 {
     if (plcEqu.plc_pro.yxcfgList.Count > bitCount)
     {
         for (int i = 0; i < 4; i++)
         {
             yx yx = new yx();
             yx.EquID      = plcEqu.equ.EquID;
             yx.IsState    = 1;
             yx.YXInfoMesg = str2byte[i];
             yx.EquStateID = stateid++;
             plcEqu.plc_pro.yxList.Add(yx);
         }
     }
     else
     {
         for (int i = 0; i < 2; i++)
         {
             yx yx2 = new yx();
             yx2.EquID      = plcEqu.equ.EquID;
             yx2.IsState    = 1;
             yx2.YXInfoMesg = i == 0 ? "1" : "0";
             yx2.EquStateID = stateid++;
             plcEqu.plc_pro.yxList.Add(yx2);
             stateid++;
         }
     }
 }
예제 #2
0
        /// <summary>
        /// 创建故障
        /// </summary>
        /// <param name="plcEqu"></param>
        /// <param name="faultid"></param>
        private static void CreateFaulte(PLCEqu plcEqu, int faultid)
        {
            yx yx = new yx();

            yx.EquID      = plcEqu.equ.EquID;
            yx.IsState    = 0;//故障
            yx.YXInfoMesg = "1";
            yx.EquStateID = faultid;
            plcEqu.plc_pro.yxList.Add(yx);
        }
예제 #3
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="strs">字符串</param>
 /// <param name="plcEqu">实体</param>
 /// <param name="stateid">状态id</param>
 private void AddYXStr(string[] strs, PLCEqu plcEqu, int stateid)
 {
     for (int i = 0; i < strs.Length; i++)
     {
         yx yx = new yx();
         yx.EquID      = plcEqu.equ.EquID;
         yx.IsState    = 1;
         yx.YXInfoMesg = strs[i];
         yx.EquStateID = stateid++;
         if (plcEqu.equtype == MyObject.ObjectType.P_JF)
         {
             if (i == strs.Length - 2)
             {
                 yx.EquStateID = 202;
             }
             else if (i == strs.Length - 1)
             {
                 yx.EquStateID = 232;
             }
         }
         plcEqu.plc_pro.yxList.Add(yx);
     }
 }