Exemple #1
0
        private void modifyParameterValuesToolStripMenuItem_Click(object sender, EventArgs e)
        {
            firstIndicator = false;
            t.Stop();
            count = 0;
            bucketlist.Clear();
            frmParameterDialog pd = new frmParameterDialog();

            pd.Text = "Enter the parameter values for the system";
            // just some default values
            pd.Data.R_       = paras.R;
            pd.Data.QInflow_ = paras.QInflow;
            pd.Data.Qc_      = paras.Qc;
            pd.Data.K_       = paras.K;
            pd.Data.Sigma_   = paras.Sigma;
            pd.Data.Rho_     = paras.Rho;
            pd.Data.Numb_    = paras.Numb;
            pd.Data.Tlength_ = paras.Tlength;
            pd.Data.Omega_   = paras.Omega;

            DialogResult d = pd.ShowDialog();

            if (d == DialogResult.OK)
            {
                paras.R       = pd.Data.R_;
                paras.QInflow = pd.Data.QInflow_;
                paras.Qc      = pd.Data.Qc_;
                paras.K       = pd.Data.K_;
                paras.Sigma   = pd.Data.Sigma_;
                paras.Rho     = pd.Data.Rho_;
                paras.Numb    = pd.Data.Numb_;
                paras.Tlength = pd.Data.Tlength_;
                paras.Omega   = pd.Data.Omega_;
            }
            //reset bucketlist
            for (i = 0; i < paras.Numb; i++)
            {
                bucketlist.Add(new Bucket());
            }
            for (j = 0; j < bucketlist.Count; j++)
            {
                bucketlist[j].Width  = 4 * (float)Math.Pow(0.9, paras.Numb - 8); // when there are 8 buckets, looks best if bucket width and height is 4
                bucketlist[j].Height = 4 * (float)Math.Pow(0.9, paras.Numb - 8); // adjust depending on number of buckets according to this formula: width = 4*(0.9)^(n-8)
                bucketlist[j].X      = (float)(paras.R * Math.Sin(-theta - j * 2 * Math.PI / bucketlist.Count));
                bucketlist[j].Y      = (float)(-paras.R * Math.Cos(-theta - j * 2 * Math.PI / bucketlist.Count));
            }

            this.Refresh();
            firstIndicator = false;
        }
Exemple #2
0
        private void FrmMain_Load(object sender, EventArgs e)
        {
            SetupTransform();

            //receive user input
            // some initial values
            paras.R       = 7;
            paras.QInflow = 10;
            paras.Qc      = 10;
            paras.Sigma   = 10;
            paras.Rho     = 28;
            paras.Numb    = 8;
            paras.Tlength = 5;
            paras.K       = 1;
            paras.Omega   = 0.1f;

            frmParameterDialog pd = new frmParameterDialog();

            pd.Text = "Enter the parameter values for the system";
            // just some default values
            pd.Data.R_       = paras.R;
            pd.Data.QInflow_ = paras.QInflow;
            pd.Data.Qc_      = paras.Qc;
            pd.Data.K_       = paras.K;
            pd.Data.Sigma_   = paras.Sigma;
            pd.Data.Rho_     = paras.Rho;
            pd.Data.Numb_    = paras.Numb;
            pd.Data.Tlength_ = paras.Tlength;
            pd.Data.Omega_   = paras.Omega;

            DialogResult d = pd.ShowDialog();

            if (d == DialogResult.OK)
            {
                paras.R       = pd.Data.R_;
                paras.QInflow = pd.Data.QInflow_;
                paras.Qc      = pd.Data.Qc_;
                paras.K       = pd.Data.K_;
                paras.Sigma   = pd.Data.Sigma_;
                paras.Rho     = pd.Data.Rho_;
                paras.Numb    = pd.Data.Numb_;
                paras.Tlength = pd.Data.Tlength_;
                paras.Omega   = pd.Data.Omega_;
            }



            // set the initial positions of the buckets

            for (i = 0; i < paras.Numb; i++)
            {
                bucketlist.Add(new Bucket());
            }


            for (j = 0; j < bucketlist.Count; j++)
            {
                bucketlist[j].Width  = 3.5f * (float)Math.Pow(0.9, paras.Numb - 8); // when there are 8 buckets, looks best if bucket width and height is 3.5
                bucketlist[j].Height = 3.5f * (float)Math.Pow(0.9, paras.Numb - 8); // adjust depending on number of buckets according to this formula: width = 3.5*(0.9)^(n-8)
                bucketlist[j].X      = (float)(paras.R * Math.Sin(-theta - j * 2 * Math.PI / bucketlist.Count));
                bucketlist[j].Y      = (float)(-paras.R * Math.Cos(-theta - j * 2 * Math.PI / bucketlist.Count));
            }

            frmWorking fw1 = new frmWorking();

            fw1.Show();
            fw1.Refresh();
            //System.Threading.Thread.Sleep(100);
            ml = MathLinkFactory.CreateKernelLink();
            ml.WaitAndDiscardAnswer();
            //load the prepared package
            ml.Evaluate(@"<<C:\ChaosWheel\ChaosWheel2.m");
            //dont need the result
            ml.WaitAndDiscardAnswer();
            //call method for new theta
            string input = string.Format("ChaosWheel2[{0},{1},{2},{3},{4},{5},{6},{7},{8}]", paras.R, paras.Sigma, paras.Rho, paras.K, paras.QInflow, paras.Qc, paras.Numb, paras.Tlength, paras.Omega);

            ml.Evaluate(input); // went for 45 seconds on time interval of 10
            ml.WaitForAnswer();
            //move the system according to theta
            //thetalist = (double[])ml.GetArray(typeof(double),1);
            datalist       = (double[, ])ml.GetArray(typeof(double), 2);
            numrows        = datalist.GetLength(0);
            numcolumns     = datalist.GetLength(1);
            firstIndicator = true;
            fw1.Close();
        }
Exemple #3
0
        private void modifyParameterValuesToolStripMenuItem_Click(object sender, EventArgs e)
        {
            firstIndicator = false;
            t.Stop();
            count = 0;
            bucketlist.Clear();
            frmParameterDialog pd = new frmParameterDialog();
            pd.Text = "Enter the parameter values for the system";
            // just some default values
            pd.Data.R_ = paras.R;
            pd.Data.QInflow_ = paras.QInflow;
            pd.Data.Qc_ = paras.Qc;
            pd.Data.K_ = paras.K;
            pd.Data.Sigma_ = paras.Sigma;
            pd.Data.Rho_ = paras.Rho;
            pd.Data.Numb_ = paras.Numb;
            pd.Data.Tlength_ = paras.Tlength;
            pd.Data.Omega_ = paras.Omega;

            DialogResult d = pd.ShowDialog();
            if (d == DialogResult.OK)
            {
                paras.R = pd.Data.R_;
                paras.QInflow = pd.Data.QInflow_;
                paras.Qc = pd.Data.Qc_;
                paras.K = pd.Data.K_;
                paras.Sigma = pd.Data.Sigma_;
                paras.Rho = pd.Data.Rho_;
                paras.Numb = pd.Data.Numb_;
                paras.Tlength = pd.Data.Tlength_;
                paras.Omega = pd.Data.Omega_;
            }
            //reset bucketlist
            for (i = 0; i < paras.Numb; i++) bucketlist.Add(new Bucket());
            for (j = 0; j < bucketlist.Count; j++)
            {
                bucketlist[j].Width = 4 * (float)Math.Pow(0.9, paras.Numb - 8); // when there are 8 buckets, looks best if bucket width and height is 4
                bucketlist[j].Height = 4 * (float)Math.Pow(0.9, paras.Numb - 8); // adjust depending on number of buckets according to this formula: width = 4*(0.9)^(n-8)
                bucketlist[j].X = (float)(paras.R * Math.Sin(-theta - j * 2 * Math.PI / bucketlist.Count));
                bucketlist[j].Y = (float)(-paras.R * Math.Cos(-theta - j * 2 * Math.PI / bucketlist.Count));
            }

            this.Refresh();
            firstIndicator = false;
        }
Exemple #4
0
        private void FrmMain_Load(object sender, EventArgs e)
        {
            SetupTransform();

            //receive user input
            // some initial values
            paras.R = 7;
            paras.QInflow = 10;
            paras.Qc = 10;
            paras.Sigma = 10;
            paras.Rho = 28;
            paras.Numb = 8;
            paras.Tlength = 5;
            paras.K = 1;
            paras.Omega = 0.1f;

            frmParameterDialog pd = new frmParameterDialog();
            pd.Text = "Enter the parameter values for the system";
            // just some default values
            pd.Data.R_ = paras.R;
            pd.Data.QInflow_ = paras.QInflow;
            pd.Data.Qc_ = paras.Qc;
            pd.Data.K_ = paras.K;
            pd.Data.Sigma_ = paras.Sigma;
            pd.Data.Rho_ = paras.Rho;
            pd.Data.Numb_ = paras.Numb;
            pd.Data.Tlength_ = paras.Tlength;
            pd.Data.Omega_ = paras.Omega;

            DialogResult d = pd.ShowDialog();
            if (d == DialogResult.OK)
            {
                paras.R = pd.Data.R_;
                paras.QInflow = pd.Data.QInflow_;
                paras.Qc = pd.Data.Qc_;
                paras.K = pd.Data.K_;
                paras.Sigma = pd.Data.Sigma_;
                paras.Rho = pd.Data.Rho_;
                paras.Numb = pd.Data.Numb_;
                paras.Tlength = pd.Data.Tlength_;
                paras.Omega = pd.Data.Omega_;
            }

            // set the initial positions of the buckets

            for (i = 0; i < paras.Numb; i++)
            {
                bucketlist.Add(new Bucket());
            }

            for (j = 0; j < bucketlist.Count; j++)
            {
                bucketlist[j].Width = 3.5f * (float)Math.Pow(0.9, paras.Numb - 8); // when there are 8 buckets, looks best if bucket width and height is 3.5
                bucketlist[j].Height = 3.5f * (float)Math.Pow(0.9, paras.Numb - 8); // adjust depending on number of buckets according to this formula: width = 3.5*(0.9)^(n-8)
                bucketlist[j].X = (float)(paras.R * Math.Sin(-theta - j * 2 * Math.PI / bucketlist.Count));
                bucketlist[j].Y = (float)(-paras.R * Math.Cos(-theta - j * 2 * Math.PI / bucketlist.Count));
            }

            frmWorking fw1 = new frmWorking();
            fw1.Show();
            fw1.Refresh();
            //System.Threading.Thread.Sleep(100);
            ml = MathLinkFactory.CreateKernelLink();
            ml.WaitAndDiscardAnswer();
            //load the prepared package
            ml.Evaluate(@"<<C:\ChaosWheel\ChaosWheel2.m");
            //dont need the result
            ml.WaitAndDiscardAnswer();
            //call method for new theta
            string input = string.Format("ChaosWheel2[{0},{1},{2},{3},{4},{5},{6},{7},{8}]", paras.R, paras.Sigma, paras.Rho, paras.K, paras.QInflow, paras.Qc, paras.Numb, paras.Tlength, paras.Omega);
            ml.Evaluate(input); // went for 45 seconds on time interval of 10
            ml.WaitForAnswer();
            //move the system according to theta
            //thetalist = (double[])ml.GetArray(typeof(double),1);
            datalist = (double[,])ml.GetArray(typeof(double), 2);
            numrows = datalist.GetLength(0);
            numcolumns = datalist.GetLength(1);
            firstIndicator = true;
            fw1.Close();
        }