Esempio n. 1
0
        private void Draw()
        {
            try
            {
                string title = "k (cm^3/s or cm^6/s)";
                if (_mobility)
                {
                    title = "K0(cm ^ 2 / Vs)";
                }
                PlotModel model = new PlotModel()
                {
                    LegendSymbolLength = 24, IsLegendVisible = false
                };
                model.Axes.Add(new LinearAxis()
                {
                    Position = AxisPosition.Bottom, Title = "E (E/N)", MajorGridlineStyle = LineStyle.Dash
                });
                model.Axes.Add(new LogarithmicAxis()
                {
                    Position = AxisPosition.Left, MajorGridlineStyle = LineStyle.Solid, MinorGridlineStyle = LineStyle.Dot, IntervalLength = 100, Title = title
                });
                LineSeries fs = new LineSeries();

                if (comboBox1.SelectedItem.ToString() == "A")
                {
                    Constant new_constant = new Constant(Convertor(textBox2.Text), checkBox2.Checked);
                    for (int i = 0; i < 100; i++)
                    {
                        fs.Points.Add(new DataPoint(i, new_constant.Value(i)));
                    }
                    model.Series.Add(fs);
                    plot1.Model = model;
                }
                if (comboBox1.SelectedItem.ToString() == "A + B*(E/N)")
                {
                    Linear new_linear = new Linear(Convertor(textBox2.Text), Convertor(textBox3.Text), checkBox2.Checked, checkBox3.Checked);
                    for (int i = 0; i < 100; i++)
                    {
                        fs.Points.Add(new DataPoint(i, new_linear.Value(i)));
                    }
                    model.Series.Add(fs);
                    plot1.Model = model;
                }
                if (comboBox1.SelectedItem.ToString() == "A + B*(E/N) + C*(E/N)^2")
                {
                    Quadratic new_quadratic = new Quadratic(Convertor(textBox2.Text), Convertor(textBox3.Text), Convertor(textBox4.Text), checkBox2.Checked, checkBox3.Checked, checkBox4.Checked);
                    for (int i = 0; i < 100; i++)
                    {
                        fs.Points.Add(new DataPoint(i, new_quadratic.Value(i)));
                    }
                    model.Series.Add(fs);
                    plot1.Model = model;
                }
                if (comboBox1.SelectedItem.ToString() == "A + B*(E/N) + C*(E/N)^2 + D*(E/N)^3")
                {
                    Cubic new_cubic = new Cubic(Convertor(textBox2.Text), Convertor(textBox3.Text), Convertor(textBox4.Text), Convertor(textBox5.Text), checkBox2.Checked, checkBox3.Checked, checkBox4.Checked, checkBox5.Checked);
                    for (int i = 0; i < 100; i++)
                    {
                        fs.Points.Add(new DataPoint(i, new_cubic.Value(i)));
                    }
                    model.Series.Add(fs);
                    plot1.Model = model;
                }
                if (comboBox1.SelectedItem.ToString() == "A*EXP(B*(E/N))")
                {
                    Exponencional new_exponencional = new Exponencional(Convertor(textBox2.Text), Convertor(textBox3.Text), checkBox2.Checked, checkBox3.Checked);
                    for (int i = 0; i < 100; i++)
                    {
                        fs.Points.Add(new DataPoint(i, new_exponencional.Value(i)));
                    }
                    model.Series.Add(fs);
                    plot1.Model = model;
                }
                if (comboBox1.SelectedItem.ToString() == "A*EXP(B/Er(E/N))")
                {
                    Exponencional2 new_exponencional2 = new Exponencional2(Convertor(textBox2.Text), Convertor(textBox3.Text), checkBox2.Checked, checkBox3.Checked);
                    new_exponencional2.reactant_mobility = new Constant(10, true);
                    new_exponencional2.mass_element      = 16 * 1.66053904e-27;
                    model.Axes.Clear();
                    model.Axes.Add(new LinearAxis()
                    {
                        Position = AxisPosition.Bottom, Title = "E (V/cm)", MajorGridlineStyle = LineStyle.Dash
                    });
                    model.Axes.Add(new LogarithmicAxis()
                    {
                        Position = AxisPosition.Left, MajorGridlineStyle = LineStyle.Solid, MinorGridlineStyle = LineStyle.Dot, IntervalLength = 100, Title = "k for mass element 16u"
                    });
                    for (int i = 0; i < 100; i++)
                    {
                        fs.Points.Add(new DataPoint(i, new_exponencional2.Value(i)));
                    }
                    model.Series.Add(fs);
                    plot1.Model = model;
                }
                if (comboBox1.SelectedItem.ToString() == "C + A*EXP(B/(E/N))")
                {
                    Exponencional3 new_exponencional3 = new Exponencional3(Convertor(textBox2.Text), Convertor(textBox3.Text), Convertor(textBox4.Text), checkBox2.Checked, checkBox3.Checked, checkBox4.Checked);

                    for (int i = 0; i < 100; i++)
                    {
                        fs.Points.Add(new DataPoint(i, new_exponencional3.Value(i)));
                    }
                    model.Series.Add(fs);
                    plot1.Model = model;
                }
                if (comboBox1.SelectedItem.ToString() == "A/(1+(E/N))^B")
                {
                    Exponencional4 new_exponencional4 = new Exponencional4(Convertor(textBox2.Text), Convertor(textBox3.Text), checkBox2.Checked, checkBox3.Checked);
                    for (int i = 0; i < 100; i++)
                    {
                        fs.Points.Add(new DataPoint(i, new_exponencional4.Value(i)));
                    }
                    model.Series.Add(fs);
                    plot1.Model = model;
                }
                if (comboBox1.SelectedItem.ToString() == "A*EXP(B*(E/N)^2)")
                {
                    Exponencional5 new_exponencional = new Exponencional5(Convertor(textBox2.Text), Convertor(textBox3.Text), checkBox2.Checked, checkBox3.Checked);
                    for (int i = 0; i < 100; i++)
                    {
                        fs.Points.Add(new DataPoint(i, new_exponencional.Value(i)));
                    }
                    model.Series.Add(fs);
                    plot1.Model = model;
                }
                if (comboBox1.SelectedItem.ToString() == "A/Er(E/N)^B")
                {
                    Association new_acoss = new Association(Convertor(textBox2.Text), Convertor(textBox3.Text), checkBox2.Checked, checkBox3.Checked);
                    new_acoss.reactant_mobility = new Constant(10, true);
                    new_acoss.mass_element      = 16 * 1.66053904e-27;
                    model.Axes.Clear();
                    model.Axes.Add(new LinearAxis()
                    {
                        Position = AxisPosition.Bottom, Title = "E (V/cm)", MajorGridlineStyle = LineStyle.Dash
                    });
                    model.Axes.Add(new LogarithmicAxis()
                    {
                        Position = AxisPosition.Left, MajorGridlineStyle = LineStyle.Solid, MinorGridlineStyle = LineStyle.Dot, IntervalLength = 100, Title = "k for mass element 16u"
                    });


                    for (int i = 0; i < 100; i++)
                    {
                        fs.Points.Add(new DataPoint(i, new_acoss.Value(i)));
                    }
                    model.Series.Add(fs);
                    plot1.Model = model;
                }
            }
            catch { }
        }