Esempio n. 1
0
        private void Calc_MM()
        {
            string MM;

            if (Arg_Qp == QpItemsRepr.QPB)
            {
                var cells     = tables.OperInfoHydro.Column("MQP").GetCells();
                var values_MM = from cell in cells
                                where !cell.IsEmpty
                                select cell.IntValue;

                MM = values_MM.First().ToString();
                if (MM.Length == 1)
                {
                    MM = "0" + MM;
                }
            }
            else //Q12..Q03
            {
                MM = DayAndMonthItemsRepr.QMM_to_MM(Arg_Qp);
            }

            tables.CalcsHydro.Column("MM").Fill(MM);
            calcMemory["MM"] = MM;
        }
Esempio n. 2
0
        private void Calc_dS()
        {
            tables.CalcsHydro.AddColumn(tables.BazaInfoHydro.Column("Hr_D"));

            var value_D = DayAndMonthItemsRepr.DD_MM_to_D(
                userInput[CalculationsForm.Arg_DayAndMonth]);

            tables.CalcsHydro.Column("D").Fill(value_D);

            tables.CalcsHydro.IterateRows(row =>
            {
                var calculate_dS = GetCalculator_dS(row["TR"].DoubleValue,
                                                    row["TR0"].DoubleValue, out var dS_Formula);

                row.Set("Формула dS", dS_Formula);

                if (calculate_dS == null)
                {
                    return;
                }

                var res = calculate_dS(value_D, row["Hr_D"].DoubleValue);
                row.Set("dS", res, CellMapper.ZeroOrGreaterRounded2);
            }, "Формула dS", "dS");

            tables.Result.AddColumn(tables.CalcsHydro.Column("dS"));
        }
        private void InitComboBoxes()
        {
            dayAndMonthItemsRepr  = new DayAndMonthItemsRepr(dayAndMonthComboBox);
            yearItemsRepr         = new YearItemsRepr(yearComboBox);
            qpItemsRepr           = new QpItemsRepr(QPComboBox);
            dsItemsRepr           = new DsItemsRepr(dSComboBox);
            allowedRangeItemsRepr = new AllowedRangeItemsRepr(allowedRangeComboBox);
            x1NormItemsRepr       = new NormItemsRepr(X1ComboBox);
            x2NormItemsRepr       = new NormItemsRepr(X2ComboBox);

            dayAndMonthItemsRepr.SelectedItemChanged += DayAndMonthItemsRepr_SelectedItemChanged;
        }
        private void Calc_LR()
        {
            if (calcBranch.DSm)
            {
                tables.CalcsMeteo.AddColumn(
                    tables.OperInfoMeteo.Column("Lm"));

                tables.CalcsMeteo.IterateRows(row =>
                {
                    var dt       = GetDate(row["Lm"]);
                    var dayMonth = dateParser.ToDayMonth(dt, "_");

                    Etc.NoThrow(() =>
                    {
                        var columnName_L = DayAndMonthItemsRepr
                                           .DD_MM_to_LDD_MM(dayMonth);

                        row.Set("L_Column", columnName_L);
                    });
                }, "L_Column");

                var operRows = tables.OperInfoMeteo.GetRows();

                tables.CalcsMeteo.IterateRows(calcRow =>
                {
                    Etc.NoThrow(() =>
                    {
                        var colName = calcRow["L_Column"].StringValue;
                        var operRow = operRows[calcRow.Index];
                        calcRow.Set("LR", operRow[colName]);
                    });
                }, "LR");
            }
            else
            {
                var DD_MM = userInput[CalculationsForm.Arg_DayAndMonth];

                Etc.NoThrow(() =>
                {
                    var columnName_L = DayAndMonthItemsRepr.DD_MM_to_LDD_MM(DD_MM);

                    var column_oper_L = tables.OperInfoMeteo.Column(columnName_L);

                    tables.CalcsMeteo.Column("LR").SetDataFrom(column_oper_L);
                });
            }
        }
Esempio n. 5
0
        private string[][] Get_DP_Clauses_Values()
        {
            string[][] DP_Clauses_Values =
            {
                new[]
                {
                    DayAndMonthItemsRepr.CreateDayMonth(5, 1),
                    DayAndMonthItemsRepr.CreateDayMonth(10, 1),
                    DayAndMonthItemsRepr.CreateDayMonth(15, 1),
                    DayAndMonthItemsRepr.CreateDayMonth(20, 1)
                },

                new[]
                {
                    DayAndMonthItemsRepr.CreateDayMonth(25, 1),
                    DayAndMonthItemsRepr.CreateDayMonth(31, 1),
                    DayAndMonthItemsRepr.CreateDayMonth(5, 2),
                    DayAndMonthItemsRepr.CreateDayMonth(10, 2),
                    DayAndMonthItemsRepr.CreateDayMonth(15, 2),
                    DayAndMonthItemsRepr.CreateDayMonth(20, 2)
                },

                new[]
                {
                    DayAndMonthItemsRepr.CreateDayMonth(25, 2),
                    DayAndMonthItemsRepr.CreateDayMonth(28, 2),
                    DayAndMonthItemsRepr.CreateDayMonth(5, 3),
                    DayAndMonthItemsRepr.CreateDayMonth(10, 3),
                    DayAndMonthItemsRepr.CreateDayMonth(15, 3),
                    DayAndMonthItemsRepr.CreateDayMonth(20, 3),
                    DayAndMonthItemsRepr.CreateDayMonth(25, 3),
                    DayAndMonthItemsRepr.CreateDayMonth(31, 3),
                    DayAndMonthItemsRepr.CreateDayMonth(5, 4),
                    DayAndMonthItemsRepr.CreateDayMonth(10, 4)
                }
            };

            return(DP_Clauses_Values);
        }