Exemple #1
0
        private string GetControlStateName(PointState valueState, ControlPointModel controlPointModel)
        {
            switch (valueState)
            {
            case PointState.Control_State0:
                return(controlPointModel.State0Name);

            case PointState.Control_State1:
                return(controlPointModel.State1Name);

            default:
                return("未知");
            }
        }
Exemple #2
0
 public ControlPoint(string[] segments, DateTime realTime)
 {
     if (segments == null || segments.Length != 4)
     {
         IsValid = false;
         return;
     }
     try
     {
         var pointCode = GetPointCode(segments[0]); //0 测点编号
         //var pointType = (PointType)Enum.Parse(typeof(PointType), segments[6]);      //1  测点值的类型编码
         var pointName      = segments[2];          //2 测点名称
         var sensorTypeCode = segments[3];          //3   测点类型编码
         ControlPointModel = new ControlPointModel()
         {
             EquipId           = GetSensorEquipId(pointCode, PointTypeConverter.C),
             SubstationEquipId = pointCode.Replace("C", "0").ToInt(),
             SubstationId      = pointCode.Substring(0, 3).ToInt(),
             PortNO            = pointCode.Substring(3, 3).ToInt(),
             SensorId          = SensorTypeHelper.GetTargetSensorId(sensorTypeCode.ToInt()),
         };
         var sensorInfo = SensorTypeHelper.GetTargetSensorInfo(sensorTypeCode.ToInt());
         EquipmentInfo = new EquipmentInfoModel()
         {
             EquipId   = ControlPointModel.EquipId,
             PointCode = pointCode,
             Name      = sensorInfo.SensorName,
             ETCode    = sensorInfo.EtCode,
             PointId   = 0,
             Location  = "",
             LDate     = realTime,
             RDate     = realTime
         };
     }
     catch
     {
         IsValid = false;
         return;
     }
     IsValid = true;
 }