public IEnumerable <IniValueObject> ExportParameters()
        {
            List <IniValueObject> obj = new List <IniValueObject>();

            obj.Add(new IniValueObject(AcceptsConfigs, "Slope", Slope.ToString()));
            obj.Add(new IniValueObject(AcceptsConfigs, "Slip", AllowedSlip.ToString()));

            return(obj);
        }
        /// <summary>
        ///   Returns a System.String representing the regression.
        /// </summary>
        ///
        public string ToString(string format, IFormatProvider formatProvider)
        {
            string a = format != null?
                       Slope.ToString(format, formatProvider) :
                           Slope.ToString(formatProvider);

            string b = format != null?
                       Intercept.ToString(format, formatProvider) :
                           Intercept.ToString(formatProvider);

            return(String.Format("y(x) = {0}x + {1}", a, b));
        }
Example #3
0
        public void Slope_IsVerticalUpward()
        {
            var slope = new Slope();

            slope.setFromXY(0.0, 1.0);

            Assert.IsTrue(slope.isVertical());

            Assert.AreEqual(expected: "Vertical", actual: slope.ToString());

            Assert.IsTrue(slope.isSlopeUp());
        }
Example #4
0
        public override string ToString()
        {
            string name = (IsReversed ? "-" : "") + Planet.Glyphs[Owner].ToString() + (Centric == SeFlg.HELIOCENTRIC ? "(H)" : "");

            return(String.Format("{0} {1}+{2} {3} {4}",
                                 IsLocked?"#":"",
                                 name,
                                 Offset,
                                 Pivot == null ? "" : "&" + Pivot.ToString(),
                                 Slope == 1 ? "" : "*" + Slope.ToString()));
            //return String.Format("{0}{1}{2}{3}{4}{5:F2}*{6}", IsLocked?"#":"", IsReversed ? "-" : "",
            //    Planet.Glyphs[Owner], Centric == SeFlg.HELIOCENTRIC ? "(H)" : "",
            //    Offset < 0 ? "-" : "+", Math.Abs(Offset), Slope);
        }
        private void button1_Click(object sender, EventArgs e)
        {
            if (temperatureBox1.Text == String.Empty)
            {
                MessageBox.Show(
                    "Please, select temperature reservoir",
                    "Warning",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Information,
                    MessageBoxDefaultButton.Button1
                    );

                return;
            }

            try
            {
                AcceptInputValues();
            }
            catch (Exception ex)
            {
                MessageBox.Show(
                    ex.Message,
                    "Error",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error,
                    MessageBoxDefaultButton.Button1
                    );

                return;
            }

            definitionOfZ.gazComposition.ComputeAll();
            definitionOfZ.ComputeAll();

            zedGraphControl1.Visible = true;

            // Получим панель для рисования
            GraphPane pane = zedGraphControl1.GraphPane;

            // Очистим список кривых на тот случай, если до этого сигналы уже были нарисованы
            pane.CurveList.Clear();

            // Создадим список точек
            PointPairList list = new PointPairList();

            //double xmin = InputData.GasExtraction.Min();  // 0
            //double xmax = InputData.GasExtraction.Max() + 100;

            double[] xAxis = InputData.GasExtraction.ToArray();
            double[] yAxis = definitionOfZ.P_z.ToArray();

            // добавим в список точки
            list.Add(xAxis, yAxis);

            // Создадим кривую с названием "Sinc",
            // которая будет рисоваться голубым цветом (Color.Blue),
            // Опорные точки выделяться не будут (SymbolType.None)
            LineItem myCurve = pane.AddCurve("Sinc", list, Color.Blue, SymbolType.Circle);

            myCurve.Line.IsSmooth      = true;
            myCurve.Line.SmoothTension = 0.5F;

            // Вызываем метод AxisChange (), чтобы обновить данные об осях.
            // В противном случае на рисунке будет показана только часть графика,
            // которая умещается в интервалы по осям, установленные по умолчанию
            zedGraphControl1.GraphPane.AxisChange();

            // Обновляем график
            zedGraphControl1.Invalidate();

            Slope              = SlopeDefinition(xAxis, yAxis);
            Intercept          = InterceptDefinition(xAxis, yAxis, Slope);
            InitialGasCapacity = InitialGasCapacityDefinition(Intercept, Slope);

            slopeBox.Text      = Slope.ToString("f3");
            interceptBox.Text  = Intercept.ToString("f3");
            initialGasBox.Text = Math.Round(InitialGasCapacity).ToString();
        }
Example #6
0
        private void button1_Click(object sender, EventArgs e)
        {
            zedGraphControl1.Visible = true;

            // Получим панель для рисования
            GraphPane pane = zedGraphControl1.GraphPane;

            // Очистим список кривых на тот случай, если до этого сигналы уже были нарисованы
            pane.CurveList.Clear();

            // Создадим список точек
            PointPairList list  = new PointPairList();
            PointPairList point = new PointPairList();

            try
            {
                AcceptInputValues();
            }
            catch (Exception ex)
            {
                MessageBox.Show(
                    ex.Message,
                    "Error",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error,
                    MessageBoxDefaultButton.Button1
                    );

                return;
            }

            InputData.Compute_W();

            double[] xAxis = new double[InputData.X.Count - 1];
            double[] yAxis = new double[InputData.Y.Count - 1];

            for (int i = 0; i < InputData.X.Count; i++)
            {
                if (i < InputData.X.Count - 1)
                {
                    xAxis[i] = InputData.X[i];
                    yAxis[i] = InputData.Y[i];
                }
                else
                {
                    point.Add(InputData.X[i], InputData.Y[i]);
                }
            }

            list.Add(xAxis, yAxis);


            // Создадим кривую с названием "Sinc",
            // которая будет рисоваться голубым цветом (Color.Blue),
            // Опорные точки выделяться не будут (SymbolType.None)
            LineItem myCurve = pane.AddCurve("Sinc", list, Color.Blue, SymbolType.Diamond);
            LineItem Point   = pane.AddCurve("Point", point, Color.Brown, SymbolType.Square);

            Point.Line.IsVisible       = false;
            myCurve.Line.IsSmooth      = true;
            myCurve.Line.SmoothTension = 0.5F;
            // Вызываем метод AxisChange (), чтобы обновить данные об осях.
            // В противном случае на рисунке будет показана только часть графика,
            // которая умещается в интервалы по осям, установленные по умолчанию
            zedGraphControl1.GraphPane.AxisChange();

            // Обновляем график
            zedGraphControl1.Invalidate();

            Slope               = SlopeDefinition(xAxis, yAxis);
            Intercept           = InterceptDefinition(InputData.X[InputData.X.Count - 1], InputData.Y[InputData.Y.Count - 1], Slope);
            PotentialProduction = PotentialProductionDefinition(Slope, Intercept);

            slopeBox.Text         = Slope.ToString("0.00e+00");
            interceptBox.Text     = Intercept.ToString("f3");
            PotentialProdBox.Text = Math.Round(PotentialProduction).ToString();
        }
Example #7
0
        public override string ToString()
        {
            string slope = (Slope.CompareTo(double.MaxValue) == 0) ? "INF" : Slope.ToString();

            return(string.Format("Quadrant: {0}, Slope: {1} From {2} to {3}, RayLength: {4}, {5}", Quadrant, slope, Anchor, Target, RayLength, Unique ? "Unique" : ""));
        }