Exemplo n.º 1
0
        private void densityCalculation()
        {
            calculationStatus.Value = 0;
            var densities = GetDensities(densityTextBox.Text);

            if (densities.Count == 0)
            {
                MessageBox.Show("Установите начальную концентрацию изотопов", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            Reactor.SetDensityArray(densities);

            if (!string.IsNullOrWhiteSpace(radiationTimeTextBox.Text))
            {
                var str     = timesComBox.SelectedItem.ToString();
                var timestr = radiationTimeTextBox.Text;
                int scale;
                try { scale = NuclearCalculation.Models.Globals.TimeScale[str]; } catch (Exception) { return; }
                double _time = Convert.ToDouble(timestr);
                double time  = _time * scale;
                Reactor.Calculate(time);

                var data  = new List <BaseAbundance>();
                var table = new AbundanceDataTable("Abundances");
                foreach (var iso in Reactor.DensityArray.NuclideDensities)
                {
                    var cs = 0.0;
                    //if (!iso.Isotope.Stable) continue;
                    try { cs = iso.Isotope.CrossSections[Constants.REACT.N_G].AvgCs; } catch (Exception) { }
                    data.Add(new BaseAbundance()
                    {
                        IsotopeName  = iso.NuclideName,
                        Density      = iso.Density,
                        AvgCs        = cs,
                        AtomicWeight = iso.AtomicWeight,
                        Zaid         = iso.Isotope.ZAID,
                        HalfLife     = iso.Isotope.HalfLife
                    });
                }
                table.FillTable(data);
                var dataGraphView = new DataGraphView <BaseAbundance>(table);
                this.mainViewPanel.Controls.Clear();
                this.mainViewPanel.Controls.Add(dataGraphView);
                dataGraphView.Dock = DockStyle.Fill;
            }
        }