Beispiel #1
0
        private void bt_show_maxtorque_capa_curve_Click(object sender, EventArgs e)
        {
            try
            {
                double Imax      = double.Parse(tb_Imax.Text);
                double Umax      = double.Parse(tb_Umax.Text);
                double max_speed = double.Parse(tb_maxSpeed.Text);
                MaxtorqueCapabilityCurve mtcc = buildMaxtorqueCapabilityCurve(50, Imax, Umax, max_speed);
                VoltageLimitCurve        vlc  = buildVoltageLimitCurve(50, Imax, Umax, max_speed);

                GraphWindow tc = new GraphWindow();
                tc.addData("Torque-speed", new PointPairList(mtcc.speeds.ToArray(), mtcc.maxtorques.ToArray()));
                tc.addData("Current-speed", new PointPairList(mtcc.speeds.ToArray(), mtcc.currents.Select(f => f.Magnitude).ToArray()));
                tc.addData("CurrentPhase-speed", new PointPairList(mtcc.speeds.ToArray(), mtcc.currents.Select(f => f.Phase).ToArray()));
                tc.addData("Voltage-speed", new PointPairList(mtcc.speeds.ToArray(), mtcc.voltages.Select(f => f.Magnitude).ToArray()));
                tc.addData("Power-speed", new PointPairList(mtcc.speeds.ToArray(), mtcc.power.ToArray()));
                tc.addData("Efficiency", new PointPairList(mtcc.speeds.ToArray(), mtcc.effs.ToArray()));
                tc.addData("Boundary-Torque-speed1", new PointPairList(vlc.speeds.ToArray(), vlc.torques.ToArray()));
                tc.addData("(iq,id)", new PointPairList(mtcc.currents.Select(f => f.d).ToArray(), mtcc.currents.Select(f => f.q).ToArray()));
                tc.addData("id-speed", new PointPairList(mtcc.speeds.ToArray(), mtcc.currents.Select(f => f.d).ToArray()));
                tc.addData("iq-speed", new PointPairList(mtcc.speeds.ToArray(), mtcc.currents.Select(f => f.q).ToArray()));

                tc.Show();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error: " + ex.Message);
            }
        }
Beispiel #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            var gw = new GraphWindow();

            var mtpa = buildTableMaxtorquePerAmple();

            int count = 10;

            try
            {
                double Imax      = double.Parse(tb_Imax.Text);
                double Umax      = double.Parse(tb_Umax.Text);
                double max_speed = double.Parse(tb_maxSpeed.Text);

                gw.addData("mtpa: iq(id)", new PointPairList(mtpa.idqs.Select(f => f.d).ToArray(), mtpa.idqs.Select(f => f.q).ToArray()));

                for (int i = 1; i < count + 1; i++)
                {
                    double     I    = Imax * i / count;
                    double     t    = mtpa.GetMaxTorqueWithCurrentMagnitude(I);
                    List <Fdq> idqs = curveSameTorque(t, 300);

                    gw.addData("maxt=" + t + ",Imag=" + I, new PointPairList(idqs.Select(f => f.d).ToArray(), idqs.Select(f => f.q).ToArray()));
                }

                for (int i = 1; i < count + 1; i++)
                {
                    double speed = max_speed * i / count;

                    var        vle  = buildVoltageLimitEllipse(speed, 300, 300, Umax);
                    List <Fdq> idqs = vle.curve;

                    gw.addData("speed=" + speed, new PointPairList(idqs.Select(f => f.d).ToArray(), idqs.Select(f => f.q).ToArray()));

                    gw.addData("Moment-id-speed=" + speed, new PointPairList(idqs.Select(f => f.d).ToArray(), vle.torques.ToArray()));
                }

                gw.Show();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error " + ex.Message);
            }
        }
Beispiel #3
0
        void ta_OnFinishedAnalysis(object sender, AbstractResults e)
        {
            if (InvokeRequired)
            {
                BeginInvoke((Action) delegate() { ta_OnFinishedAnalysis(sender, e); });
            }

            FEMM.CloseFemm();

            var         tr = e as Transient3PhaseMotorResults;
            GraphWindow gw = new GraphWindow();
            IDictionary <string, object> dict = tr.BuildResultsForDisplay();

            foreach (String name in dict.Keys)
            {
                var graphdata = dict[name] as ListPointD;
                if (graphdata != null)
                {
                    gw.addData(name, graphdata.ToZedGraphPointPairList());
                }
            }
            gw.Show();
        }
        private void dgv_results_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex != 3)
            {
                return;
            }

            if (e.RowIndex < 0)
            {
                return;
            }

            DataGridView      dgv  = (DataGridView)sender;
            List <ResultItem> list = (List <ResultItem>)dgv.DataSource;

            ResultItem resultItem = list[e.RowIndex];
            object     femValue   = list[e.RowIndex].femValue;

            if (resultItem.femName == "OpenResults")
            {
                string path = resultItem.femValue as string;
                try
                {
                    Process.Start(path);
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Cannot open " + path + "\n" + ex.Message);
                }
            }
            // if click pointpairlist, open graph windows
            else if (femValue.GetType().Equals(typeof(PointPairList)))
            {
                GraphWindow tc = new GraphWindow();
                tc.MdiParent = this.MdiParent;
                foreach (ResultItem ri in list)
                {
                    if ((ri.femValue != null) &&
                        ri.femValue.GetType().Equals(typeof(PointPairList)))
                    {
                        PointPairList data = (PointPairList)ri.femValue;
                        tc.addData(ri.femName, data);
                    }
                }
                tc.Text = currentPath;
                tc.Show();
            }
            else if (femValue.GetType().Equals(typeof(List <CoreLossResults>)))
            {
                CoreLossVisualizer visualizer = new CoreLossVisualizer();
                visualizer.MdiParent = this.MdiParent;
                visualizer.Text      = currentPath;
                visualizer.Show();

                var cl = femValue as List <CoreLossResults>;
                visualizer.SetListCorelossResults(cl);
            }
            else if (femValue.GetType().Equals(typeof(DQCurrentMap)))
            {
                var data = femValue as DQCurrentMap;
                EfficiencyMapViewer emv = new EfficiencyMapViewer();

                emv.Text = "Efficiency map viewer";
                emv.setData(data);
                emv.Show();
            }
        }