Exemple #1
0
        private void Initialize()
        {
            // Load constant variables
            int    i     = 1;
            string key   = $"CH{i}";
            string param = Resource.Ini.GetString("Constant.Channel", key);

            Const.Clear();

            while (string.IsNullOrWhiteSpace(param) == false)
            {
                string[] @params = param.Split(new[] { ',' }, StringSplitOptions.None);

                EUnitType   type   = (EUnitType)Enum.Parse(typeof(EUnitType), @params[1]);
                int         unitNo = GetUnitNo(type, @params[2]);
                UnitConvert unit   = new UnitConvert(type, unitNo, unitNo);

                ValueRow row = new ValueRow(i - 1, @params[0], 0f, @params[3],
                                            unit, bool.Parse(@params[4]), bool.Parse(@params[5]), type);

                Const.Add(@params[0], row);

                i++;
                key   = $"CH{i}";
                param = Resource.Ini.GetString("Constant.Channel", key);
            }

            Const["Total.Rated.Capacity"].Unit.Enabled = false;
            Const["Total.Rated.EER_COP"].Unit.Enabled  = false;

            // Load calculated variables
            i     = 1;
            key   = $"CH{i}";
            param = Resource.Ini.GetString("Calculated.Channel", key);
            Calcurated.Clear();

            while (string.IsNullOrWhiteSpace(param) == false)
            {
                string[] @params = param.Split(new[] { ',' }, StringSplitOptions.None);

                EUnitType   type   = (EUnitType)Enum.Parse(typeof(EUnitType), @params[1]);
                int         unitNo = GetUnitNo(type, @params[2]);
                UnitConvert unit   = new UnitConvert(type, unitNo, unitNo);

                ValueRow row = new ValueRow(i - 1, @params[0], 0f, @params[3],
                                            unit, bool.Parse(@params[4]), bool.Parse(@params[5]), type);

                Calcurated.Add(@params[0], row);

                i++;
                key   = $"CH{i}";
                param = Resource.Ini.GetString("Calculated.Channel", key);
            }

            // Load measured variables
            i     = 1;
            key   = $"CH{i}";
            param = Resource.Ini.GetString("Measured.Channel", key);
            Measured.Clear();

            while (string.IsNullOrWhiteSpace(param) == false)
            {
                string[] @params = param.Split(new[] { ',' }, StringSplitOptions.None);

                EUnitType   type   = (EUnitType)Enum.Parse(typeof(EUnitType), @params[1]);
                int         unitNo = GetUnitNo(type, @params[2]);
                UnitConvert unit   = new UnitConvert(type, unitNo, unitNo);

                ValueRow row = new ValueRow(i - 1, @params[0], 0f, @params[3],
                                            unit, bool.Parse(@params[4]), bool.Parse(@params[5]), type);

                Measured.Add(@params[0], row);

                i++;
                key   = $"CH{i}";
                param = Resource.Ini.GetString("Measured.Channel", key);
            }

            foreach (KeyValuePair <string, ValueRow> row in Calcurated)
            {
                if (row.Value.Chart == true)
                {
                    Graph.Add(row.Key, row.Value);
                }
            }
            foreach (KeyValuePair <string, ValueRow> row in Measured)
            {
                if (row.Value.Chart == true)
                {
                    Graph.Add(row.Key, row.Value);
                }
            }
        }