public void Close()
        {
            //
            Keys         = null;
            ModelSignals = null;

            AVG = null;

            ResultSignals = null;
            VyazovkinE    = null;
            alpha         = null;
            func          = null;

            ViewTG = null;
        }
        public Model(List <List <string> > paths, Dictionary <string, int> _Keys, ViewSignal _ViewTG, ViewSignal _ViewE, ViewSignal _ViewAlpha, ViewSignal _ViewEHidd, ViewSignal _ViewAlphaHidd, int[] _DataIndex) // скорость <эксперимент>
        {
            ViewTG        = _ViewTG;
            ViewE         = _ViewE;
            ViewAlpha     = _ViewAlpha;
            ViewEHidd     = _ViewEHidd;
            ViewAlphaHidd = _ViewAlphaHidd;
            DataIndex     = _DataIndex;

            Keys         = _Keys;
            ModelSignals = new List <List <SimpleSignal> >();

            foreach (List <string> P in paths)
            {
                List <SimpleSignal> newSignalList = new List <SimpleSignal>();
                foreach (string str in P)
                {
                    newSignalList.Add(new SimpleSignal(str, Keys, DataIndex));
                }
                ModelSignals.Add(newSignalList);
            }

            double dBetta = 0;
            bool   bFlag  = true;

            for (int i = 0; i < ModelSignals.Count; i++)
            {
                if (bFlag || ModelSignals[i][0].Betta > dBetta)
                {
                    dBetta = ModelSignals[i][0].Betta;
                    TemperatureRangeLeft  = ModelSignals[i][0].Tstart;
                    TemperatureRangeRight = ModelSignals[i][0].Tend;
                    bFlag = false;
                }
            }

            double Tstart = Tmin(), Tend = Tmax();

            AVG = new AVGModel(this, TemperatureRangeLeft, TemperatureRangeRight, DataIndex);
            TemperatureRangeRight = Math.Ceiling((TemperatureRangeRight - TemperatureRangeLeft) * 0.25);
        }
Beispiel #3
0
        private void LoadData()
        {
            if (TermoModel != null)
            {
                TermoModel.Close();
            }

            DataIndex[0] = Convert.ToInt32(ConfigurationManager.AppSettings["ColumnTemperature"]) - 1;
            DataIndex[1] = Convert.ToInt32(ConfigurationManager.AppSettings["ColumnTime"]) - 1;             // Задаем формат исходных файлов - порядок столбцов
            DataIndex[2] = Convert.ToInt32(ConfigurationManager.AppSettings["ColumnMass"]) - 1;
            Int32.TryParse(ConfigurationManager.AppSettings["ColumnDSC"], out DataIndex[3]);
            DataIndex[3]--;

            List <List <string> > Paths = new List <List <string> >();
            int c = 0;

            while (grInitData.Rows[0].Cells[c].FormattedValue.ToString().Length > 0)
            {
                List <string> SpeedFiles = new List <string>();
                int           r          = 0;
                while (grInitData.Rows[r].Cells[c].FormattedValue.ToString().Length > 0)
                {
                    SpeedFiles.Add(grInitData.Rows[r].Cells[c].FormattedValue.ToString());
                    r++;
                }
                Paths.Add(SpeedFiles);
                c++;
            }
            if (c == 0)
            {
                return;
            }

            Dictionary <string, int> keys = new Dictionary <string, int>();

            keys.Add("T", 0);
            keys.Add("t", 1);
            keys.Add("Mass", 2);
            keys.Add("DSC", 3);

            List <string> Titles = new List <string>();

            Titles.Add("DTA");
            Titles.Add("TG");
            Titles.Add("DTG");

            ViewSignal ViewTG        = new ViewSignal(plot1chart, Titles, DataIndex);
            ViewSignal ViewE         = new ViewSignal(chartActivationEnergy, "E");
            ViewSignal ViewAlpha     = new ViewSignal(chartNormalizedReactionModel, "d_alpha/dt");
            ViewSignal ViewEHidd     = new ViewSignal(chart1hidden, "E");
            ViewSignal ViewAlphaHidd = new ViewSignal(chart2hidden, "d_alpha/dt");

            TermoModel = new Model(Paths, keys, ViewTG, ViewE, ViewAlpha, ViewEHidd, ViewAlphaHidd, DataIndex);

            List <double> Betta = TermoModel.GetBettaGrid();

            for (int i = 0; i < Betta.Count; i++)
            {
                grInitData.Columns[i].HeaderText = Math.Round(Betta[i], 2).ToString() + "\t K/min";
            }

            TermoModel.plotTG_DTG_DTF(DataIndex);
            TemperatureRangeLeft        = TermoModel.TminPlot();
            TemperatureRangeRight       = TermoModel.TmaxPlot();
            lTemperatureRangeLeft.Text  = TermoModel.TminPlot().ToString();
            lTemperatureRangeRight.Text = TermoModel.TmaxPlot().ToString();
            bNext.Enabled = true;
            if (tabPage3.Parent != tabControl1)
            {
                tabControl1.TabPages.Insert(1, tabPage3);
            }
            Application.DoEvents();
        }