Example #1
0
        public static List <MagicFormulaArguments> ConstArgToViewer(MagicFormulaArguments arg)
        {
            var list = new List <MagicFormulaArguments>();

            list.Add(arg);
            return(list);
        }
Example #2
0
        public SeriesEditor(MultiTireDataViewer viewer, string id, Control owner = null)
            : this(viewer, 0, owner)
        {
            init = true;
            string[] stArrayData = id.Split('_');

            ID     = id;
            suffix = int.Parse(stArrayData[0]);
            InitSourceList();
            Args = Viewer.GetArguments(ID)[0];
            if (Args == null)
            {
                Args = new MagicFormulaArguments(0, 0, 1000, 0, 75, 50);
            }
            if (ID != null)
            {
                Reload(ID);
            }
            ShowCB.Checked = Viewer.GetEnable(ID);
            if (Viewer.GetTableInfo(ID) != null)
            {
                TableCB.SelectedItem = Viewer.GetTableInfo(ID);
            }
            init = false;
        }
Example #3
0
        public SeriesEditor(SeriesEditor other, int surf)
            : this(other.Viewer, surf, other.Owner)
        {
            init = true;
            string[] stArrayData = other.ID.Split('_');

            ID = suffix.ToString("000") + "_" + stArrayData[1];
            InitSourceList();
            Reload(other.ID);
            if (Args == null)
            {
                Args = new MagicFormulaArguments(0, 0, 1000, 0, 75, 50);
            }
            ShowCB.Checked = Viewer.GetEnable(other.ID);
            init           = false;
        }
Example #4
0
        private void BarValueChanged(object sender, EventArgs e)
        {
            MagicFormulaArguments max = new MagicFormulaArguments(SABar.valueR, SRBar.valueR, FZBar.valueR, IABar.valueR, PBar.valueR, TBar.valueR);
            MagicFormulaArguments min = new MagicFormulaArguments(SABar.valueL, SRBar.valueL, FZBar.valueL, IABar.valueL, PBar.valueL, TBar.valueL);
            var c = CenterValue;

            if (NormalizedCB.Checked == true)
            {
                max = MFFD.MagicFormula.GetNormalizedValue(max);
                min = MFFD.MagicFormula.GetNormalizedValue(min);
                c   = MFFD.MagicFormula.GetNormalizedValue(c);
            }
            FzMax.Text = max.FZ.ToString("f2");
            FzMin.Text = min.FZ.ToString("f2");
            FzC.Text   = c.FZ.ToString("f2");
            IAMax.Text = max.IA.ToString("f2");
            IAMin.Text = min.IA.ToString("f2");
            IAC.Text   = c.IA.ToString("f2");
            PMax.Text  = max.P.ToString("f2");
            PMin.Text  = min.P.ToString("f2");
            PC.Text    = c.P.ToString("f2");
            TMax.Text  = max.T.ToString("f2");
            TMin.Text  = min.T.ToString("f2");
            TC.Text    = c.T.ToString("f2");
            SAMax.Text = max.SA.ToString("f2");
            SAMin.Text = min.SA.ToString("f2");
            SAC.Text   = c.SA.ToString("f2");
            SRMax.Text = max.SR.ToString("f2");
            SRMin.Text = min.SR.ToString("f2");
            SRC.Text   = c.SR.ToString("f2");
            var bar = sender as CustomTrackBar.DoubleTrackBar;

            Changed = true;
            if (ValueChanged != null && bar != null && !bar.ThumbClicked)
            {
                ValueChanged(this, new EventArgs());
            }
        }
Example #5
0
        void RePlot()
        {
            if (stopReplot)
            {
                return;
            }
            int tabIndex            = TabControl.SelectedIndex;
            var transientTable      = TDSs[tabIndex].SelectedData().GetDataSet().TransientTable;
            var transientTableIndex = TDSs[tabIndex].SelectedData().GetDataSet().TransientTableIndexHolder;
            var data        = TDSs[tabIndex].SelectedData().GetDataSet().SplitedTransientTable(testNumTrackBar.Value - 1);
            var indexToDraw = new List <int>();

            /*for (int i = 0; i < TDSs[tabIndex].SelectedData().GetDataSet().TransientTableIndexHolder.Count; ++i)
             * {
             *  indexToDraw.Add(i);
             * }*/

            indexToDraw.Add(testNumTrackBar.Value - 1);

            List <MagicFormulaArguments> centerValue = new List <MagicFormulaArguments>();
            List <MagicFormulaArguments> upperValue  = new List <MagicFormulaArguments>();
            List <MagicFormulaArguments> lowerValue  = new List <MagicFormulaArguments>();
            double dt = data[1].ET - data[0].ET;


            for (int i = 0; i < data.Count; ++i)
            {
                MagicFormulaArguments arg1 = new MagicFormulaArguments(data[i]);
                var arg2 = TDSs[tabIndex].UpperValue;
                var arg3 = TDSs[tabIndex].LowerValue;

                arg1.dt = arg2.dt = arg3.dt = dt;
                arg1.SA = arg2.SA = arg3.SA = data[i].SA;
                arg1.SR = arg2.SR = arg3.SR = data[i].SR;
                centerValue.Add(arg1);
                upperValue.Add(arg2);
                lowerValue.Add(arg3);
            }
            centerValue[0].SA = 0;
            upperValue[0].SA  = 0;
            lowerValue[0].SA  = 0;

            centerValue[0].SR = 0;
            upperValue[0].SR  = 0;
            lowerValue[0].SR  = 0;

            Viewers[tabIndex].SetMagicFormula(MFFD.MagicFormula, centerValue, formulaLegend);
            Viewers[tabIndex].SetMagicFormula(MFFD.MagicFormula, upperValue, formulaLegendU);
            Viewers[tabIndex].SetMagicFormula(MFFD.MagicFormula, lowerValue, formulaLegendL);

            if (ReplotData || !FirstPlot[tabIndex])
            {
                Viewers[tabIndex].SetDataList(transientTable, Table.TransientTable, dataLegend, transientTableIndex, indexToDraw);
                Viewers[tabIndex].DrawGraph(dataLegend);
                Viewers[tabIndex].DrawGraph(formulaLegend);
                ReplotData = false;
                //return;
            }
            if ((ReplotFormula || !FirstPlot[tabIndex]))
            {
                //Viewers[tabIndex].DrawGraph(formulaLegendU);
                //Viewers[tabIndex].DrawGraph(formulaLegendL);
                ReplotFormula       = false;
                FirstPlot[tabIndex] = true;
            }
        }
Example #6
0
        public void BeforeReplot()
        {
            CheckInitialized();
            Table t = (TableCB.SelectedItem as Table?).Value;

            if (Initialized)
            {
                if (SourceCB.SelectedIndex < numDataList)
                {
                    var node = SourceCB.SelectedItem as ProjectTree.Node_TireDataSet;
                    if (node != null && ID != null && ID != suffix.ToString("000") + "_" + node.ID.ToString())
                    {
                        OnDelete();
                    }
                    ID = suffix.ToString("000") + "_" + node.ID.ToString();
                    List <int> transientIndex = null;
                    if (t == Table.TransientTable)
                    {
                        transientIndex = node.IDataSet.GetDataSet().TransientTableIndexHolder;
                    }

                    Viewer.SetDataList(node.IDataSet.GetDataSet().GetDataList(t), t, ID, transientIndex);
                    if (MFSourceCB.SelectedIndex >= 0)
                    {
                        if (Args == null)
                        {
                            var mfnode = MFSourceCB.SelectedItem as ProjectTree.Node_MagicFormula;
                            var data   = mfnode.MFFD.IDataset.GetDataSet().MaxminSet.Limit(t).Mean;
                            Args = new MagicFormulaArguments(data);
                        }
                        var nodeMF = MFSourceCB.SelectedItem as ProjectTree.Node_MagicFormula;
                        Viewer.SetDataListRefMF(ID, nodeMF.ID.ToString());

                        Viewer.SetMagicFormula(nodeMF.MFFD.MagicFormula, StaticFunctions.ConstArgToViewer(Args), nodeMF.ID.ToString());
                    }
                    else
                    {
                        Viewer.SetDataListRefMF(ID, null);
                    }
                }
                else
                {
                    var node = SourceCB.SelectedItem as ProjectTree.Node_MagicFormula;
                    if (node != null && ID != null && ID != suffix.ToString("000") + "_" + node.ID.ToString())
                    {
                        OnDelete();
                        DialogResult result = MessageBox.Show("引数をリセットしますか?", "確認",
                                                              MessageBoxButtons.YesNo,
                                                              MessageBoxIcon.Exclamation,
                                                              MessageBoxDefaultButton.Button2);
                        if (result == DialogResult.Yes)
                        {
                            var data = node.MFFD.IDataset.GetDataSet().MaxminSet.Limit(t).Mean;
                            Args = new MagicFormulaArguments(data);
                        }
                    }
                    if (Args == null)
                    {
                        var data = node.MFFD.IDataset.GetDataSet().MaxminSet.Limit(t).Mean;
                        Args = new MagicFormulaArguments(data);
                    }
                    ID = suffix.ToString("000") + "_" + node.ID.ToString();
                    Viewer.SetMagicFormula(node.MFFD.MagicFormula, StaticFunctions.ConstArgToViewer(Args), ID);
                }
                KnownColor color = (KnownColor)(ColorCB.SelectedIndex + 1);
                var        ct    = PlotTypeCB.SelectedIndex == 0 ? SeriesChartType.FastLine : SeriesChartType.FastPoint;
                Viewer.SetChartType(ct, ID);

                Viewer.SetColor(Color.FromKnownColor(color), ID);
                Viewer.SetLineWidth(int.Parse(SizeTB.Text), ID);
                Viewer.LegendTextOverride(ID, NameTB.Text);
                Viewer.SetEnable(ShowCB.Checked, ID);
            }
        }
Example #7
0
        void RePlot()
        {
            if (stopReplot)
            {
                return;
            }
            int tabIndex = TabControl.SelectedIndex;

            if (tabIndex != 5)
            {
                if (ReplotData || !FirstPlot[tabIndex])
                {
                    var driveBrakeTable = TDSs[tabIndex].SelectedData().GetDataSet().DriveBrakeTable;
                    Viewers[tabIndex].SetDataList(driveBrakeTable, Table.DriveBrakeTable, dataLegend);
                    Viewers[tabIndex].SetMagicFormula(MFFD.MagicFormula, StaticFunctions.ConstArgToViewer(TDSs[tabIndex].CenterValue), formulaLegend);
                    Viewers[tabIndex].SetMagicFormula(MFFD.MagicFormula, StaticFunctions.ConstArgToViewer(TDSs[tabIndex].UpperValue), formulaLegendU);
                    Viewers[tabIndex].SetMagicFormula(MFFD.MagicFormula, StaticFunctions.ConstArgToViewer(TDSs[tabIndex].LowerValue), formulaLegendL);

                    Viewers[tabIndex].DrawGraph(dataLegend);
                    ReplotData = false;
                }
                if ((ReplotFormula || !FirstPlot[tabIndex]))
                {
                    Viewers[tabIndex].SetMagicFormula(MFFD.MagicFormula, StaticFunctions.ConstArgToViewer(TDSs[tabIndex].CenterValue), formulaLegend);
                    Viewers[tabIndex].SetMagicFormula(MFFD.MagicFormula, StaticFunctions.ConstArgToViewer(TDSs[tabIndex].UpperValue), formulaLegendU);
                    Viewers[tabIndex].SetMagicFormula(MFFD.MagicFormula, StaticFunctions.ConstArgToViewer(TDSs[tabIndex].LowerValue), formulaLegendL);
                    Viewers[tabIndex].DrawGraph(formulaLegend);
                    Viewers[tabIndex].DrawGraph(formulaLegendU);
                    Viewers[tabIndex].DrawGraph(formulaLegendL);
                    ReplotFormula       = false;
                    FirstPlot[tabIndex] = true;
                }
            }
            else
            {
                //-(1+0.5c^2) < E < 1
                var driveBrakeTable = TDSs[tabIndex].SelectedData().GetDataSet().DriveBrakeTable;
                var maxmin          = TDSs[tabIndex].SelectedData().GetDataSet().MaxminSet.DriveBrakeTableLimit;
                EList.Clear();
                var Eupper = new List <TireDataViewer.XY>(driveBrakeTable.Count);
                var Elower = new List <TireDataViewer.XY>(driveBrakeTable.Count);
                Eupper.Add(new TireDataViewer.XY(new MagicFormulaArguments(maxmin.Max), 1));
                Eupper.Add(new TireDataViewer.XY(new MagicFormulaArguments(maxmin.Min), 1));

                var C = MFFD.MagicFormula.GetVariables(MagicFormulaOutputVariables.FY_C, new MagicFormulaArguments(maxmin.Max));
                Elower.Add(new TireDataViewer.XY(new MagicFormulaArguments(maxmin.Max), -(1 + 0.5 * C * C)));
                Elower.Add(new TireDataViewer.XY(new MagicFormulaArguments(maxmin.Min), -(1 + 0.5 * C * C)));

                foreach (var data in driveBrakeTable)
                {
                    var inputData = new MagicFormulaArguments(data);
                    var E         = MFFD.MagicFormula.GetVariables(MagicFormulaOutputVariables.FY_E, inputData);

                    EList.Add(new TireDataViewer.XY(inputData, E));
                }
                Viewers[tabIndex].SetNonManagedData(EList, dataLegend);
                Viewers[tabIndex].DrawGraph(dataLegend);

                Viewers[tabIndex].SetNonManagedData(Eupper, EUpperLegend);
                Viewers[tabIndex].DrawGraph(EUpperLegend);
                Viewers[tabIndex].SetNonManagedData(Elower, ELowerLegend);
                Viewers[tabIndex].DrawGraph(ELowerLegend);
            }
        }