private void Sim()
        {
            // gets the parameter values for the simulations
            double Pmin, Pmax, Imin, Imax, Cycles;

            Pmin   = double.Parse(tbPmin.Text); Pmax = double.Parse(tbPmax.Text);
            Imin   = double.Parse(tbImin.Text); Imax = double.Parse(tbImax.Text);
            Cycles = double.Parse(tbCycles.Text);
            int nPeriods, nCurrents, trials;

            nPeriods = int.Parse(tbNPeriods.Text); nCurrents = int.Parse(tbNCurrents.Text);
            trials   = int.Parse(tbTrials.Text);
            string type;

            if (rbAC.Checked == true)
            {
                type = "AC";
            }
            else
            {
                type = "DC";
            };
            // Initiates the classes to be used by the program
            Lock_Interface(true);
            Stopwatch sw = new Stopwatch();

            sw.Start();
            Magnetic_Simulator_Demag Switcher = new Magnetic_Simulator_Demag();

            Switcher.Ac_Switching_A_w_Phase_Space(mp, trials, Pmin, Pmax, nPeriods, Imin, Imax, nCurrents, Cycles, type, tbCompleted, prgBar);
            sw.Stop();
            Lock_Interface(false);
            MessageBox.Show(sw.Elapsed.ToString());
        }
        private void btn_start_simulation_Click(object sender, EventArgs e)
        {
            // Initiates the classes to be used by the program
            Magnetic_Simulator_Demag Switcher = new Magnetic_Simulator_Demag();
            double PulseTime     = double.Parse(tbPTime.Text);
            double DownPulseTime = double.Parse(tbDownPulse.Text);
            double MaxTime       = double.Parse(tbSTime.Text);
            bool   Save          = cbSave.Checked;

            // runs the major loop the switching simulator.
            if (submit_status == true)
            {
                string type = cbType.SelectedItem.ToString();
                Switcher.Magnetic_Trajectory(ref matlab, ref mp, type, 0.0, MaxTime, PulseTime, DownPulseTime, 3 * Math.PI, 1.0, Save, manual_initial_conditions);
                //Switcher.Magnetic_Trajectory_Fit_Alpha(ref mp, 0.0, MaxTime, PulseTime, DownPulseTime, 3 * Math.PI, 1.0, Save);
                //Switcher.Magnetic_Trajectory_Fit_Freq(ref mp, 0.0, MaxTime, PulseTime, DownPulseTime, 3 * Math.PI, 1.0, Save);
                //Switcher.Magnetic_Trajectory_Fit_Current(ref mp, 0.0, MaxTime, PulseTime, DownPulseTime, 3 * Math.PI, 1.0, Save);

                submit_status = false;
            }
            else
            {
                MessageBox.Show("Convert values to unitless before starting simulations.");
            }
        }
        private void btn_start_simulation_Click(object sender, EventArgs e)
        {
            // Initiates the classes to be used by the program
            int iTheta;
            Magnetic_Simulator_Demag Simulator = new Magnetic_Simulator_Demag();

            for (iTheta = 1; iTheta <= 17; iTheta++)
            {
                H_theta_ent.Text = (iTheta * 10).ToString();
                H_theta_ent.Update();
                UpdateUnits();
                filename = tbSaveDirectory.Text + "\\maxima data Temp = " + Temp_ent.Text + " Theta = " + H_theta_ent.Text + ".dat";
                // runs the major loop the switching simulator.
                if (submit_status == true)
                {
                    Simulator.Noise_Analyser(mp, double.Parse(tbMaxTime.Text), ref switch_prog_bar, ref tbThetaAverage, ref tbPhiAverage, filename);
                }
                else
                {
                    MessageBox.Show("Convert values to unitless before starting simulations.");
                }
                prgbarFullRun.Value = (int)(100 * iTheta / 17.0);
                prgbarFullRun.Update();
            }
            MessageBox.Show("Finished!");
        }
        private void Sim()
        {
            Lock_Interface(true);
            Magnetic_Simulator_Demag Switcher = new Magnetic_Simulator_Demag();

            Switcher.Switching_Probability_Loop(ref matlab, mp, int.Parse(tbTrials.Text), 100, double.Parse(tbTmax.Text), false, ref tbAveTime, prgBar);
            Lock_Interface(false);
        }
Beispiel #5
0
        private void Sim()
        {
            Lock_Interface(true);
            Magnetic_Simulator_Demag Q_check = new Magnetic_Simulator_Demag();

            double[] Q       = tb_Q_values.Text.Split(',').Select(s => double.Parse(s)).ToArray();
            int      h_steps = int.Parse(tb_h_steps.Text);

            Q_check.Quality_Factor_Check(mp, Q, h_steps, ref matlab, prgBar);
            Lock_Interface(false);
        }
Beispiel #6
0
        private void btn_start_simulation_Click(object sender, EventArgs e)
        {
            // Initiates the classes to be used by the program
            Magnetic_Simulator_Demag Switcher = new Magnetic_Simulator_Demag();

            // runs the major loop the switching simulator.
            if (submit_status == true)
            {
                string type = cbType.SelectedItem.ToString();
                Switcher.Magnetic_Trajectory(ref matlab, ref mp, type, 1000.0, 2000.0, 10000.0, 0.0, 10.0, 1, true, false);
                submit_status = false;
            }
            else
            {
                MessageBox.Show("Convert values to unitless before starting simulations.");
            }
        }
        private void Sim()
        {
            Magnetic_Simulator_Demag Switcher = new Magnetic_Simulator_Demag();

            if (cbCurrentHyst.Checked == true)
            {
                Switcher.Hysteresis_Loop_Current_Amplitude(ref matlab, mp, mp.j_ac, mp.j_dc, int.Parse(tbSteps.Text));
                submit_status = false;
            }
            else if (cbFreqHyst.Checked == true)
            {
                mp.I_to_j_dc(0.0);
                mp.I_to_j_ac(double.Parse(tbIac.Text));
                double PerMin = double.Parse(tbPerMin.Text);
                double PerMax = double.Parse(tbPerMax.Text);
                double tpf    = 1000.0;
                Switcher.Hysteresis_Loop_Frequency(ref matlab, ref mp, PerMin, PerMax, tpf, true);
                submit_status = false;
            }
        }