예제 #1
0
 //мощность двигателя
 private void pbxClearMtPrPower_Click(object sender, EventArgs e)
 {
     dgvcCmbPowMtPr.DefaultCellStyle.BackColor = Color.White;
     bs_mtPowMtPr.DataSource = EquipServices.GetAllMotorPow();
     motorPowerMtPr          = null;
     cboMtPrPower.ResetText();
     SearchContByParams(null);
 }
예제 #2
0
 //номинальный ток
 private void pbxClearContCur_Click(object sender, EventArgs e)
 {
     dgvcCmbCurCont.DefaultCellStyle.BackColor = Color.White;
     bs_contCurCont.DataSource = EquipServices.GetAllContCur();
     contCurCont = null;
     cboContCur.ResetText();
     SearchContByParams(null);
 }
예제 #3
0
        /// <summary>
        /// Sets table with parameter values.
        /// </summary>
        void SetParametersValues(int percentDeviation, int countParam)
        {
            listParametersName = "Index" + Configs.ColumnSeparator + "Parameter name" + Environment.NewLine;
            countStratParams   = 0;
            cycles             = 0;
            deviationSteps     = 2 * percentDeviation + 1;

            tableParameters      = new Over_optimization_Data_Table(percentDeviation, countParam);
            tableParameters.Name = "Values of the Parameters";

            for (int slot = 0; slot < Data.Strategy.Slots; slot++)
            {
                for (int numParam = 0; numParam < 6; numParam++)
                {
                    if (Data.Strategy.Slot[slot].IndParam.NumParam[numParam].Enabled && countStratParams < countParam)
                    {
                        NumericParam currentParam  = Data.Strategy.Slot[slot].IndParam.NumParam[numParam];
                        double       minVal        = currentParam.Min;
                        double       maxVal        = currentParam.Max;
                        int          point         = currentParam.Point;
                        double       originalValue = currentParam.Value;
                        double       deltaStep     = originalValue / 100.0;

                        for (int p = 0; p < deviationSteps; p++)
                        {
                            int    index = percentDeviation - p;
                            double value = originalValue + index * deltaStep;
                            value = Math.Round(value, point);

                            if (index == 0)
                            {
                                value = originalValue;
                            }
                            if (value < minVal)
                            {
                                value = minVal;
                            }
                            if (value > maxVal)
                            {
                                value = maxVal;
                            }

                            tableParameters.SetData(index, countStratParams, value);
                            cycles++;
                        }

                        listParametersName += (countStratParams + 1).ToString() + Configs.ColumnSeparator + currentParam.Caption + Environment.NewLine;
                        countStratParams++;
                    }
                }
            }

            for (int prm = countStratParams; prm < countParam; prm++)
            {
                listParametersName += (prm + 1).ToString() + Environment.NewLine;
            }
            listParametersName += Environment.NewLine;
        }
예제 #4
0
        public IndicatorParam()
        {
            SlotNumber = 0;
            IsDefined = false;
            SlotType = SlotTypes.NotDefined;
            IndicatorName = String.Empty;
            IndicatorType = TypeOfIndicator.Indicator;
            ExecutionTime = ExecutionTime.DuringTheBar;
            IsDeafultGroupAll = false;
            IsAllowLTF = true;
            ListParam = new ListParam[5];
            NumParam = new NumericParam[6];
            CheckParam = new CheckParam[2];

            for (int i = 0; i < 5; i++)
                ListParam[i] = new ListParam();

            for (int i = 0; i < 6; i++)
                NumParam[i] = new NumericParam();

            for (int i = 0; i < 2; i++)
                CheckParam[i] = new CheckParam();
        }
예제 #5
0
        private void btnContClear_Click(object sender, EventArgs e)
        {
            //MtPrDataSourceLoad();

            foreach (DataGridViewColumn column in dataGridViewCont.Columns)
            {
                column.DefaultCellStyle.BackColor = Color.White;
            }

            contCurCont   = null;
            coordTypeCont = null;
            coilCont      = null;

            SearchContByParams(null);

            foreach (Control ctr in gbxFilterCont.Controls)
            {
                if (ctr.GetType() == typeof(ComboBox))
                {
                    ctr.ResetText();
                }
            }
        }
예제 #6
0
        public static PageResult <ProductModel> Get(
            GiaSinhVienEntities db,
            PageArg <ProductModel.Select, ProductModel.Sort> pageArg,
            long[] id                      = null,
            StringParam str_Name           = null,
            NumericParam num_CategoryId    = null,
            NumericParam num_SubCategoryId = null,
            NumericParam num_Price         = null,
            NumericParam num_Status        = null,
            DateTimeParam date_CreateDate  = null,
            NumericParam num_PostUserId    = null,
            NumericParam num_DictrictId    = null,
            NumericParam num_ProviceId     = null)
        {
            return(DAOCore.DoPage <ProductModel, ProductModel.Select, ProductModel.Sort>(pageArg, (c, p) =>
            {
                var total = new ObjectParameter("Total", typeof(int));
                var query = new ObjectParameter("Query", typeof(string));

                var data = db.usp_Product_Get(
                    pageArg.SelectQuery(), pageArg.SortQuery(), p.PageIndex, p.PageSize, pageArg.DebugQuery,
                    id == null ? null : string.Join(",", id),
                    str_Name == null ? null : str_Name.ToString(),
                    num_CategoryId == null ? null : num_CategoryId.ToString(),
                    num_SubCategoryId == null ? null : num_SubCategoryId.ToString(),
                    num_Price == null ? null : num_Price.ToString(),
                    num_Status == null ? null : num_Status.ToString(),
                    date_CreateDate == null ? null : date_CreateDate.ToString(),
                    num_PostUserId == null ? null : num_PostUserId.ToString(),
                    num_DictrictId == null ? null : num_DictrictId.ToString(),
                    num_ProviceId == null ? null : num_ProviceId.ToString(),
                    total, query).FirstOrDefault();

                c.SetResult(p, c.ConvertFromXml(data), (int)total.Value, query.Value == DBNull.Value ? null : (string)query.Value);
            }));
        }
예제 #7
0
파일: UserInfoDAO.cs 프로젝트: GSVien/Code
        public static PageResult <UserInfoModel> Get(
            GiaSinhVienEntities db,
            PageArg <UserInfoModel.Select, UserInfoModel.Sort> pageArg,
            long[] id               = null,
            StringParam str_Name    = null,
            NumericParam num_Status = null)
        {
            return(DAOCore.DoPage <UserInfoModel, UserInfoModel.Select, UserInfoModel.Sort>(pageArg, (c, p) =>
            {
                var total = new ObjectParameter("Total", typeof(int));
                var query = new ObjectParameter("Query", typeof(string));

                string data = null;

                //db.usp_Badwords_Get(
                //    pageArg.SelectQuery(), pageArg.SortQuery(), p.PageIndex, p.PageSize, pageArg.DebugQuery,
                //    id == null ? null : string.Join(",", id),
                //    str_Value == null ? null : str_Value.ToString(),
                //    num_Status == null ? null : num_Status.ToString(),
                //    total, query).FirstOrDefault();

                c.SetResult(p, c.ConvertFromXml(data), (int)total.Value, query.Value == DBNull.Value ? null : (string)query.Value);
            }));
        }
예제 #8
0
        /* [ Очистить все ] */

        private void btnMtPrClear_Click(object sender, EventArgs e)
        {
            MtPrDataSourceLoad();

            foreach (DataGridViewColumn column in dataGridViewMtPr.Columns)
            {
                column.DefaultCellStyle.BackColor = Color.White;
            }

            motorPowerMtPr = null;
            hasRelayMtPr   = null;
            coordTypeMtPr  = null;
            coilMtPr       = null;

            SearchContByParams(null);

            foreach (Control ctr in gbxFilterMtPr.Controls)
            {
                if (ctr.GetType() == typeof(ComboBox))
                {
                    ctr.ResetText();
                }
            }
        }
예제 #9
0
        /// <summary>
        /// Normalizes the numeric parameters.
        /// </summary>
        void ReduceTheValuesOfNumericParams(BackgroundWorker worker)
        {
            bool isDoAgain;

            for (int slot = 0; slot < Data.Strategy.Slots; slot++)
            {
                if (bestBalance < 500)
                {
                    break;
                }
                if (Data.Strategy.Slot[slot].SlotStatus == StrategySlotStatus.Locked)
                {
                    continue;
                }

                // Numeric parameters
                for (int param = 0; param < 6; param++)
                {
                    if (!Data.Strategy.Slot[slot].IndParam.NumParam[param].Enabled)
                    {
                        continue;
                    }

                    do
                    {
                        if (worker.CancellationPending)
                        {
                            break;
                        }
                        isDoAgain = false;

                        IndicatorSlot indSlot = Data.Strategy.Slot[slot];
                        NumericParam  num     = Data.Strategy.Slot[slot].IndParam.NumParam[param];
                        if (num.Caption == "Level" && !indSlot.IndParam.ListParam[0].Text.Contains("Level"))
                        {
                            break;
                        }

                        Indicator indicator    = Indicator_Store.ConstructIndicator(indSlot.IndicatorName, indSlot.SlotType);
                        double    defaultValue = indicator.IndParam.NumParam[param].Value;

                        double numOldValue = num.Value;
                        if (num.Value == defaultValue)
                        {
                            break;
                        }

                        double step  = Math.Pow(10, -num.Point);
                        double value = num.Value;
                        double delta = (defaultValue - value) * 3 / 4;
                        value += delta;
                        value  = Math.Round(value, num.Point);

                        if (Math.Abs(value - numOldValue) < value)
                        {
                            break;
                        }

                        num.Value = value;

                        RecalculateSlots();
                        isDoAgain = CalculateTheResult(true);
                        if (!isDoAgain)
                        {
                            RestoreFromBest();
                        }
                    } while (isDoAgain);
                }
            }
        }
        /// <summary>
        /// Sets table with parameter values.
        /// </summary>
        private void SetParametersValues(int percentDeviation, int countParam)
        {
            _paramNames         = new List <string>();
            _listParametersName = "Index" + Configs.ColumnSeparator + "Parameter name" + Environment.NewLine;
            _countStratParams   = 0;
            _cycles             = 0;
            _deviationSteps     = 2 * percentDeviation + 1;

            _tableParameters = new OverOptimizationDataTable(percentDeviation, countParam)
            {
                Name = "Values of the Parameters"
            };

            for (int slot = 0; slot < Data.Strategy.Slots; slot++)
            {
                for (int numParam = 0; numParam < 6; numParam++)
                {
                    if (Data.Strategy.Slot[slot].IndParam.NumParam[numParam].Enabled && _countStratParams < countParam)
                    {
                        NumericParam currentParam  = Data.Strategy.Slot[slot].IndParam.NumParam[numParam];
                        double       minVal        = currentParam.Min;
                        double       maxVal        = currentParam.Max;
                        int          point         = currentParam.Point;
                        double       originalValue = currentParam.Value;
                        double       deltaStep     = originalValue / 100.0;

                        for (int p = 0; p < _deviationSteps; p++)
                        {
                            int    index = p - percentDeviation;
                            double value = originalValue + index * deltaStep;
                            value = Math.Round(value, point);

                            if (index == 0)
                            {
                                value = originalValue;
                            }
                            if (value < minVal)
                            {
                                value = minVal;
                            }
                            if (value > maxVal)
                            {
                                value = maxVal;
                            }

                            _tableParameters.SetData(index, _countStratParams, value);
                            _cycles++;
                        }

                        _paramNames.Add(currentParam.Caption);
                        _listParametersName += (_countStratParams + 1) + Configs.ColumnSeparator + currentParam.Caption +
                                               Environment.NewLine;
                        _countStratParams++;
                    }
                }
            }

            for (int prm = _countStratParams; prm < countParam; prm++)
            {
                _listParametersName += (prm + 1) + Environment.NewLine;
            }
            _listParametersName += Environment.NewLine;
        }
예제 #11
0
 private void SetNumParam(StringBuilder sb, NumericParam param)
 {
     sb.AppendLine($"  * **{param.Caption}** ({param.Value}). {param.ToolTip} Minimum: {param.Min}, Maximum: {param.Max}.");
 }
예제 #12
0
 //номинальный ток контактора
 private void cboContCur_SelectionChangeCommitted(object sender, EventArgs e)
 {
     contCurCont = cboContCur.SelectedItem as NumericParam;
     SearchContByParams(dgvcCmbCurCont);
 }
예제 #13
0
 //мощность двигателя
 private void cboMtPrPower_SelectionChangeCommitted(object sender, EventArgs e)
 {
     motorPowerMtPr = cboMtPrPower.SelectedItem as NumericParam;
     SearchContByParams(dgvcCmbPowMtPr);
 }