Example #1
0
        public DevAnalogGrp(IniDocument docIni, int index)
        {
            string name = docIni.GetString("模拟量类型", (index+1).ToString());
            if (string.IsNullOrEmpty(name)) return;
            this.Name = name;
            int type = docIni.GetInt(name, "类型",0);
            if (type <= 0) return;
            this.Type = type;
            this.Unit = docIni.GetString(name, "单位");
            int analogNum = docIni.GetInt(name, "数目", 0);

            float val = docIni.GetFloat(name, "AD最小", float.NaN);
            this.ADMin = float.IsNaN(val) ? 0 : val;
            val = docIni.GetFloat(name, "AD最大", float.NaN);
            this.ADMax = float.IsNaN(val) ? 0 : val;

            for (int i = 0; i < analogNum; i++)
            {
                DevAnalog analog = new DevAnalog(docIni,this,i);
                if (analog.IsValid)
                {
                    if (dicAnalog.ContainsKey(analog.Name) == false)
                    {
                        dicAnalog.Add(analog.Name, analog);
                    }
                }
            }
            if (dicAnalog.Count <= 0) return;

            this.IsValid = true;
        }
Example #2
0
        public HHDevice(IniDocument ini, int index, HHDeviceGrp devGrp)
        {
            this.DevGroup = devGrp;
            string sectionName = devGrp.Name + "\\设备" + (index + 1);
            this.Name = ini.GetString(sectionName, "设备名称");
            if (string.IsNullOrEmpty(this.Name)) return;
            IList<HHDeviceProperty> props = devGrp.Properties;
            for (int i = 0; i < props.Count; i++)
            {
                string propName = props[i].Name;

                string bindName = ini.GetString(sectionName, propName);

                listProp.Add(props[i].Bind(bindName));

            }
            this.IsValid = true;
            for (int i = 0; i < listProp.Count; i++)
            {
                if (listProp[i].IsBind==false)
                {
                    this.IsValid = false;
                    break;
                }
            }
        }
Example #3
0
        public HHDevice(IniDocument ini, int index, HHDeviceGrp devGrp)
        {
            this.DevGroup = devGrp;
            string sectionName = devGrp.Name + "\\设备" + (index + 1);

            this.Name = ini.GetString(sectionName, "设备名称");
            if (string.IsNullOrEmpty(this.Name))
            {
                return;
            }
            IList <HHDeviceProperty> props = devGrp.Properties;

            for (int i = 0; i < props.Count; i++)
            {
                string propName = props[i].Name;

                string bindName = ini.GetString(sectionName, propName);


                listProp.Add(props[i].Bind(bindName));
            }
            this.IsValid = true;
            for (int i = 0; i < listProp.Count; i++)
            {
                if (listProp[i].IsBind == false)
                {
                    this.IsValid = false;
                    break;
                }
            }
        }
Example #4
0
        public DevCurve(IniDocument ini, CurveGroup grp, int index)
        {
            this.Group = grp;
            this.Index = index;
            string section = grp.Name + "\\" + (index + 1);

            this.Name = ini.GetString(section, "设备名称");
            if (string.IsNullOrEmpty(this.Name))
            {
                return;
            }
            if (this.Name.ToUpper() == "DUMMY")
            {
                return;
            }

            this.ADMax = grp.ADMax;
            this.ADMin = grp.ADMin;

            float limit = ini.GetFloat(section, "AD最小", float.NaN);

            if (float.IsNaN(limit) == false)
            {
                this.ADMin = limit;
            }
            limit = ini.GetFloat(section, "AD最大", float.NaN);
            if (float.IsNaN(limit) == false)
            {
                this.ADMax = limit;
            }

            this.Tag = ini.GetInt(grp.Name + "\\" + (index + 1), "标志", 0);

            this.TimeInterval = grp.TimeInterval;
            float  interval = ini.GetFloat(grp.Name + "\\" + (index + 1), "时间间隔", float.NaN);
            string monitor  = ini.GetString(grp.Name + "\\" + (index + 1), "室外监测类型");

            this.MonitorType = SignalType.SignalACCurve;
            if (monitor == "直流道岔")
            {
                this.MonitorType = SignalType.SignalDCCurve;
            }
            if (float.IsNaN(interval) == false)
            {
                this.TimeInterval = interval;
            }



            this.IsValid = true;
        }
Example #5
0
        public DevAnalog(IniDocument ini, DevAnalogGrp grp, int index)
        {
            this.Group = grp;
            this.Index = index;

            string section = grp.Name + "\\" + (index + 1);

            this.Name = ini.GetString(section, "设备名称");
            if (string.IsNullOrEmpty(this.Name))
            {
                return;
            }
            if (this.Name.ToUpper() == "DUMMY")
            {
                return;
            }



            float val = ini.GetFloat(section, "AD最小", float.NaN);

            this.ADMin = float.IsNaN(val) ? grp.ADMin : val;


            val = ini.GetFloat(section, "AD最大", float.NaN);

            this.ADMax = float.IsNaN(val) ? grp.ADMax : val;

            this.IsValid = true;
        }
Example #6
0
        public HHDeviceGrp(IniDocument ini, int index)
        {
            string name = ini.GetString("设备", (index + 1).ToString());
            if (string.IsNullOrEmpty(name)) return;

            this.DevType = ini.GetInt(name, "设备类型", 0);
            if (this.DevType <= 0) return;

            this.Name = name;

            int propNum = ini.GetInt(name, "属性数目", 0);
            if (propNum <= 0) return;

            int devNum = ini.GetInt(name, "设备数目", 0);
            if (devNum <= 0) return;

            for (int i = 0; i < propNum; i++)
            {

                HHDeviceProperty prop = new HHDeviceProperty(ini, this, i);
                if (prop.IsValid)
                {
                    listProperty.Add(prop);
                    if (prop.Type == "模拟量")
                    {
                        listAnalogProperty.Add(prop);
                    }
                    else if (prop.Type == "曲线")
                    {
                        listCurveProperty.Add(prop);
                    }
                }
            }
            if (this.DevType != 4 && this.DevType != 8)
            {
                if (listProperty.Count <= 0) return;
            }
            if (listAnalogProperty.Count > 0)
            {
                SelectProperty(0, true);
            }
            for (int i = 0; i < devNum; i++)
            {
                HHDevice device = new HHDevice(ini, i, this);

                if (device.IsValid)
                {
                    listDevice.Add(device);
                }

            }

            this.BuildGroup();
            this.Level = 1;
            this.IsValid = true;
        }
Example #7
0
        public DevAnalogGrp(IniDocument docIni, int index)
        {
            string name = docIni.GetString("模拟量类型", (index + 1).ToString());

            if (string.IsNullOrEmpty(name))
            {
                return;
            }
            this.Name = name;
            int type = docIni.GetInt(name, "类型", 0);

            if (type <= 0)
            {
                return;
            }
            this.Type = type;
            this.Unit = docIni.GetString(name, "单位");
            int analogNum = docIni.GetInt(name, "数目", 0);

            float val = docIni.GetFloat(name, "AD最小", float.NaN);

            this.ADMin = float.IsNaN(val) ? 0 : val;
            val        = docIni.GetFloat(name, "AD最大", float.NaN);
            this.ADMax = float.IsNaN(val) ? 0 : val;

            for (int i = 0; i < analogNum; i++)
            {
                DevAnalog analog = new DevAnalog(docIni, this, i);
                if (analog.IsValid)
                {
                    if (dicAnalog.ContainsKey(analog.Name) == false)
                    {
                        dicAnalog.Add(analog.Name, analog);
                    }
                }
            }
            if (dicAnalog.Count <= 0)
            {
                return;
            }

            this.IsValid = true;
        }
Example #8
0
        public DevCurve(IniDocument ini, CurveGroup grp, int index)
        {
            this.Group = grp;
               this.Index = index;
               string section = grp.Name + "\\" + (index + 1);
               this.Name = ini.GetString(section, "设备名称");
               if (string.IsNullOrEmpty(this.Name)) return;
               if (this.Name.ToUpper() == "DUMMY") return;

               this.ADMax = grp.ADMax;
               this.ADMin = grp.ADMin;

               float limit = ini.GetFloat(section, "AD最小", float.NaN);
               if (float.IsNaN(limit) == false)
               {
               this.ADMin = limit;
               }
               limit = ini.GetFloat(section, "AD最大", float.NaN);
               if (float.IsNaN(limit) == false)
               {
               this.ADMax = limit;
               }

               this.Tag = ini.GetInt(grp.Name + "\\" + (index + 1), "标志", 0);

               this.TimeInterval = grp.TimeInterval;
               float interval = ini.GetFloat(grp.Name + "\\" + (index + 1), "时间间隔", float.NaN);
               string monitor = ini.GetString(grp.Name + "\\" + (index + 1), "室外监测类型");
               this.MonitorType = SignalType.SignalACCurve;
               if (monitor == "直流道岔")
               {
               this.MonitorType = SignalType.SignalDCCurve;
               }
               if (float.IsNaN(interval) == false)
               {
               this.TimeInterval = interval;
               }

               this.IsValid = true;
        }
Example #9
0
        public CurveGroup(IniDocument docIni, int index)
        {
            this.Name = docIni.GetString("记录曲线类型", (index + 1).ToString());
            if (string.IsNullOrEmpty(Name))
            {
                return;
            }

            this.Type = docIni.GetInt(this.Name, "类型", 0);
            if (this.Type <= 0)
            {
                return;
            }
            this.TimeInterval = docIni.GetFloat(this.Name, "时间间隔", 0);

            float limit = docIni.GetFloat(this.Name, "AD最小", float.NaN);

            if (float.IsNaN(limit) == false)
            {
                this.ADMin = limit;
            }
            limit = docIni.GetFloat(this.Name, "AD最大", float.NaN);
            if (float.IsNaN(limit) == false)
            {
                this.ADMax = limit;
            }
            int curveNum = docIni.GetInt(this.Name, "数目", 0);

            for (int i = 0; i < curveNum; i++)
            {
                DevCurve curve = new DevCurve(docIni, this, i);
                if (curve.IsValid)
                {
                    if (dicCurve.ContainsKey(curve.Name) == false)
                    {
                        List <DevCurve> listCurve = new List <DevCurve>();
                        listCurve.Add(curve);
                        dicCurve.Add(curve.Name, listCurve);
                    }
                    else
                    {
                        dicCurve[curve.Name].Add(curve);
                    }
                }
            }
            if (dicCurve.Count <= 0)
            {
                return;
            }

            this.IsValid = true;
        }
        public HHDeviceProperty(IniDocument ini, HHDeviceGrp grp, int index)
        {
            this.DevGrp = grp;
            string sectionName = grp.Name + "\\属性" + (index + 1);
            this.Type = ini.GetString(sectionName, "类型");
            if (string.IsNullOrEmpty(Type)) return;
            this.DisplayName = ini.GetString(sectionName, "显示名称");
            if (string.IsNullOrEmpty(DisplayName)) return;
            this.Name = ini.GetString(sectionName, "名称");
            if (string.IsNullOrEmpty(Name)) return;
            this.DataSrc = ini.GetString(sectionName, "数据来源");
            if (string.IsNullOrEmpty(DataSrc)) return;
            string monitorType = ini.GetString(sectionName, "室外监测类型");
            if (string.IsNullOrEmpty(monitorType)) return;
            this.MonitorType = SignalType.SignalAC;
            switch (monitorType)
            {
                case "直流":
                    this.MonitorType = SignalType.SignalDC;
                    break;
                case "载频":
                    this.MonitorType = SignalType.SignalCarrier;
                    break;
                case "低频":
                    this.MonitorType = SignalType.SignalLow;
                    break;
                case "直流道岔":
                    this.MonitorType = SignalType.SignalDCCurve;
                    break;
                case "交流道岔":
                    this.MonitorType = SignalType.SignalACCurve;
                    break;
                case "相位角":
                    this.MonitorType = SignalType.SignalAngle;
                    break;
            }

            string monitorGrp = ini.GetString(sectionName, "室外监测数据源");
            if (string.IsNullOrEmpty(monitorGrp)) return;

            string[] grps = monitorGrp.Split(new char[]{'-'},StringSplitOptions.RemoveEmptyEntries);
            this.GroupIndex = int.Parse(grps[0]);
            this.GroupCount = 1;
            if (grps.Length > 1)
            {
                this.GroupCount = int.Parse(grps[1]);
            }

            this.Unit = ini.GetString(sectionName, "单位");

            this.IsValid = true;
        }
Example #11
0
        public CurveGroup(IniDocument docIni, int index)
        {
            this.Name = docIni.GetString("记录曲线类型", (index + 1).ToString());
            if (string.IsNullOrEmpty(Name)) return;

            this.Type = docIni.GetInt(this.Name, "类型", 0);
            if (this.Type <= 0) return;
            this.TimeInterval = docIni.GetFloat(this.Name, "时间间隔", 0);

            float limit = docIni.GetFloat(this.Name, "AD最小", float.NaN);
            if (float.IsNaN(limit) == false)
            {
                this.ADMin = limit;
            }
            limit = docIni.GetFloat(this.Name, "AD最大", float.NaN);
            if (float.IsNaN(limit) == false)
            {
                this.ADMax = limit;
            }
            int curveNum = docIni.GetInt(this.Name, "数目", 0);
            for (int i = 0; i < curveNum; i++)
            {
                DevCurve curve = new DevCurve(docIni, this, i);
                if (curve.IsValid)
                {
                    if (dicCurve.ContainsKey(curve.Name) == false)
                    {
                        List<DevCurve> listCurve = new List<DevCurve>();
                        listCurve.Add(curve);
                        dicCurve.Add(curve.Name, listCurve);
                    }
                    else
                    {
                        dicCurve[curve.Name].Add(curve);
                    }
                }
            }
            if (dicCurve.Count <= 0) return;

            this.IsValid = true;
        }
Example #12
0
        public HHDeviceProperty(IniDocument ini, HHDeviceGrp grp, int index)
        {
            this.DevGrp = grp;
            string sectionName = grp.Name + "\\属性" + (index + 1);

            this.Type = ini.GetString(sectionName, "类型");
            if (string.IsNullOrEmpty(Type))
            {
                return;
            }
            this.DisplayName = ini.GetString(sectionName, "显示名称");
            if (string.IsNullOrEmpty(DisplayName))
            {
                return;
            }
            this.Name = ini.GetString(sectionName, "名称");
            if (string.IsNullOrEmpty(Name))
            {
                return;
            }
            this.DataSrc = ini.GetString(sectionName, "数据来源");
            if (string.IsNullOrEmpty(DataSrc))
            {
                return;
            }
            string monitorType = ini.GetString(sectionName, "室外监测类型");

            if (string.IsNullOrEmpty(monitorType))
            {
                return;
            }
            this.MonitorType = SignalType.SignalAC;
            switch (monitorType)
            {
            case "直流":
                this.MonitorType = SignalType.SignalDC;
                break;

            case "载频":
                this.MonitorType = SignalType.SignalCarrier;
                break;

            case "低频":
                this.MonitorType = SignalType.SignalLow;
                break;

            case "直流道岔":
                this.MonitorType = SignalType.SignalDCCurve;
                break;

            case "交流道岔":
                this.MonitorType = SignalType.SignalACCurve;
                break;

            case "相位角":
                this.MonitorType = SignalType.SignalAngle;
                break;
            }

            string monitorGrp = ini.GetString(sectionName, "室外监测数据源");

            if (string.IsNullOrEmpty(monitorGrp))
            {
                return;
            }

            string[] grps = monitorGrp.Split(new char[] { '-' }, StringSplitOptions.RemoveEmptyEntries);
            this.GroupIndex = int.Parse(grps[0]);
            this.GroupCount = 1;
            if (grps.Length > 1)
            {
                this.GroupCount = int.Parse(grps[1]);
            }


            this.Unit = ini.GetString(sectionName, "单位");

            this.IsValid = true;
        }
Example #13
0
        public HHDeviceGrp(IniDocument ini, int index)
        {
            string name = ini.GetString("设备", (index + 1).ToString());

            if (string.IsNullOrEmpty(name))
            {
                return;
            }

            this.DevType = ini.GetInt(name, "设备类型", 0);
            if (this.DevType <= 0)
            {
                return;
            }

            this.Name = name;

            int propNum = ini.GetInt(name, "属性数目", 0);

            if (propNum <= 0)
            {
                return;
            }

            int devNum = ini.GetInt(name, "设备数目", 0);

            if (devNum <= 0)
            {
                return;
            }

            for (int i = 0; i < propNum; i++)
            {
                HHDeviceProperty prop = new HHDeviceProperty(ini, this, i);
                if (prop.IsValid)
                {
                    listProperty.Add(prop);
                    if (prop.Type == "模拟量")
                    {
                        listAnalogProperty.Add(prop);
                    }
                    else if (prop.Type == "曲线")
                    {
                        listCurveProperty.Add(prop);
                    }
                }
            }
            if (this.DevType != 4 && this.DevType != 8)
            {
                if (listProperty.Count <= 0)
                {
                    return;
                }
            }
            if (listAnalogProperty.Count > 0)
            {
                SelectProperty(0, true);
            }
            for (int i = 0; i < devNum; i++)
            {
                HHDevice device = new HHDevice(ini, i, this);

                if (device.IsValid)
                {
                    listDevice.Add(device);
                }
            }

            this.BuildGroup();
            this.Level   = 1;
            this.IsValid = true;
        }