public SwitchPoint(string[] segments, DateTime realTime) { if (segments == null || segments.Length != 15) { IsValid = false; return; } try { PointCode = GetPointCode(segments[0]); SubstationCode = GetPointCode(segments[1]); PointName = segments[2]; PointLocation = segments[3]; //UnitType = (UnitType)Enum.Parse(typeof(UnitType), segments[4]); //PointAreaLocation = (AreaLocation)Enum.Parse(typeof(AreaLocation), segments[5]); //PointType = (PointType)Enum.Parse(typeof(PointType), segments[6]); SensorTypeCode = segments[7]; OnDescription = segments[8]; OffDescription = segments[9]; AlarmState = segments[10].ToInt(); DismissAlarmState = segments[11].ToInt(); SwitchOffState = segments[12].ToInt(); ResumeState = segments[13].ToInt(); ControlRelations = segments[14]; SwitchPointModel = new SwitchPointModel() { EquipId = GetSensorEquipId(PointCode, PointTypeConverter.D), SubstationEquipId = SubstationCode.ToInt(), SubstationId = SubstationCode.Substring(0, 3).ToInt(), PortNO = PointCode.Substring(3, 3).ToInt(), SensorId = SensorTypeHelper.GetTargetSensorId(SensorTypeCode.ToInt()), State0Name = "断线", State1Name = OnDescription, State2Name = OffDescription, State0Warning = true, State1Warning = true, State2Warning = true }; var sensorInfo = SensorTypeHelper.GetTargetSensorInfo(SensorTypeCode.ToInt()); EquipmentInfo = new EquipmentInfoModel() { EquipId = SwitchPointModel.EquipId, PointCode = PointCode, Name = sensorInfo.SensorName, ETCode = sensorInfo.EtCode, PointId = 0, Location = PointLocation, LDate = realTime, RDate = realTime }; } catch { IsValid = false; return; } IsValid = true; }
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; }
public AnalogPoint(string[] segments, DateTime realTime) { if (segments == null || segments.Length != 20) { IsValid = false; return; } try { var pointCode = GetPointCode(segments[0]); //0 测点编号 var substationCode = GetPointCode(segments[1]); //1 分站号 var pointName = segments[2]; //2 测点名称 var pointLocation = segments[3]; //3 测点所属区域名称 //var unitType = (UnitType)Enum.Parse(typeof(UnitType), segments[4]); //4 所在区域类型 //var pointAreaLocation = (AreaLocation)Enum.Parse(typeof(AreaLocation), segments[5]); //5 传感器所在区域的位置编码 //var pointType = (PointType)Enum.Parse(typeof(PointType), segments[6]); //6 测点值的类型编码 var sensorTypeCode = segments[7]; //7 测点类型编码 var unitName = segments[8]; //8 工程单位 var measureHigh = segments[9].ToFloat(); //9 高量程 var measureLow = segments[10].ToFloat(); //10 低量程 var upperLimitWarning = segments[11].ToFloat(); //11 上限报警门限 var lowerLimitWarning = segments[13].ToFloat(); var upperLimitSwitchingOff = segments[15].ToFloat(); var upperLimitResume = segments[16].ToFloat(); var lowerLimitSwitchingOff = segments[17].ToFloat(); var lowerLimitResume = segments[18].ToFloat(); AnalogPointModel = new AnalogPointModel() { EquipId = GetSensorEquipId(pointCode, PointTypeConverter.A), UnitName = unitName, SubstationId = substationCode.Substring(0, 3).ToInt(), SubstationEquipId = substationCode.ToInt(), PortNO = pointCode.Substring(3, 3).ToInt(), SensorId = SensorTypeHelper.GetTargetSensorId(sensorTypeCode.ToInt()), MeasureHigh = measureHigh, MeasureLow = measureLow, UpperLimitWarning = upperLimitWarning, UpperLimitResume = upperLimitResume, UpperLimitSwitchingOff = upperLimitSwitchingOff, LowerLimitWarning = lowerLimitWarning, LowerLimitResume = lowerLimitResume, LowerLimitSwitchingOff = lowerLimitSwitchingOff }; var sensorInfo = SensorTypeHelper.GetTargetSensorInfo(sensorTypeCode.ToInt()); EquipmentInfo = new EquipmentInfoModel() { EquipId = AnalogPointModel.EquipId, PointCode = pointCode, Name = sensorInfo.SensorName, ETCode = sensorInfo.EtCode, PointId = 0, Location = pointLocation, LDate = realTime, RDate = realTime }; } catch { IsValid = false; return; } IsValid = true; }