Exemple #1
0
        public static DataType NodeType(TreeNode Node)
        {
            TVal val = (TVal)Node.Tag;

            Debug.Assert(val != null);
            return(val.Type);
        }
Exemple #2
0
 /// <summary>
 /// Construct a TVal, linked to itself.
 /// </summary>
 public TVal(object val, long point)
 {
     _val   = val;
     _point = point;
     _prior = this;
     _next  = this;
 }
Exemple #3
0
        static Parser.Error parse_prefs_e(Parser p)
        {
            int tvi, a;

            prefs_data d = p.priv as prefs_data;

            Misc.assert(d != null);
            if (d.bypass)
            {
                return(Parser.Error.NONE);
            }

            tvi = TVal.find_idx(p.getsym("tval"));
            if (tvi < 0 || tvi >= Misc.tval_to_attr.Length)
            {
                return(Parser.Error.UNRECOGNISED_TVAL);
            }

            a = p.getint("attr");
            if (a != 0)
            {
                Misc.tval_to_attr[tvi] = Utilities.num_to_attr(a);
            }

            return(Parser.Error.NONE);
        }
Exemple #4
0
        static BatchNormalization <T> SetupBatchnorm <T>(BatchNormParameter param, List <BlobProto> blobs, string name, string[] inputNames, string[] outputNames) where T : unmanaged, IComparable <T>
        {
            TVal <T> decay = (TVal <T>)param.MovingAverageFraction;
            TVal <T> eps   = (TVal <T>)param.Eps;
            int      size  = (int)blobs[0].Shape.Dims[0];

            float[] avgMean = blobs[0].Datas;
            float[] avgVar  = blobs[1].Datas;

            if (blobs.Count >= 3)
            {
                float scalingFactor = blobs[2].Datas[0];

                for (int i = 0; i < avgMean.Length; i++)
                {
                    avgMean[i] /= scalingFactor;
                }

                for (int i = 0; i < avgVar.Length; i++)
                {
                    avgVar[i] /= scalingFactor;
                }
            }

            BatchNormalization <T> batchNormalization = new BatchNormalization <T>(size, decay, eps, name: name, inputNames: inputNames, outputNames: outputNames);

            Array.Copy(avgMean, batchNormalization.AvgMean.Data, avgMean.Length);
            Array.Copy(avgVar, batchNormalization.AvgVar.Data, avgVar.Length);

            return(batchNormalization);
        }
Exemple #5
0
 public TreeItem(Tkey key, TVal value, TreeItem parent = null, TreeItem left = null, TreeItem right = null)
 {
     _pair   = new KeyValuePair <Tkey, TVal>(key, value);
     _parent = parent;
     _left   = left;
     _right  = right;
 }
Exemple #6
0
 /// <summary>
 ///  Construct a ref with given initial value and metadata.
 /// </summary>
 /// <param name="initVal">The initial value.</param>
 /// <param name="meta">The metadat to attach.</param>
 public Ref(object initval, IPersistentMap meta)
     : base(meta)
 {
     _id     = _ids.getAndIncrement();
     _faults = new AtomicInteger();
     _lock   = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion);
     _tvals  = new TVal(initval, 0);
 }
Exemple #7
0
 /// <summary>
 ///  Construct a ref with given initial value and metadata.
 /// </summary>
 /// <param name="initVal">The initial value.</param>
 /// <param name="meta">The metadat to attach.</param>
 public Ref(object initval, IPersistentMap meta)
     : base(meta)
 {
     _id     = _ids.getAndIncrement();
     _faults = new AtomicInteger();
     _lock   = new ReaderWriterLockSlim(LockRecursionPolicy.NoRecursion);
     _tvals  = new TVal(initval, 0, System.Environment.TickCount);
 }
Exemple #8
0
 public TVal(object val, long point, int msecs)
 {
     _val   = val;
     _point = point;
     //_msecs = msecs;
     _prior = this;
     _next  = this;
 }
Exemple #9
0
 /// <summary>
 /// Construct a TVal, linked to a previous TVal.
 /// </summary>
 public TVal(object val, long point, TVal prior)
 {
     _val         = val;
     _point       = point;
     _prior       = prior;
     _next        = _prior._next;
     _prior._next = this;
     _next._prior = this;
 }
 private void btnOK_Click(object sender, EventArgs e)
 {
     if ((((_Type != DataType.Dictionary) && (_Type != DataType.List)) || ((IndexToType(cboKeyType.SelectedIndex) != DataType.String) && (IndexToType(cboKeyType.SelectedIndex) != DataType.Int))) || (MessageBox.Show("Converting from " + dTable[_Type] + " to " + dTable[IndexToType(cboKeyType.SelectedIndex)] + " will result the lost of all the node childs, are you sure?", Application.ProductName + Application.ProductVersion, MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) != DialogResult.No))
     {
         TVal val = new TVal(IndexToType(cboKeyType.SelectedIndex), txtKeyValue.Text);
         _StructUpdateCallback(_path, txtKeyName.Text, val);
         Dispose(true);
     }
 }
 public TKey this[TVal val] // parametreli prop overload :)
 {
     get
     {
         int  index = _vals.IndexOf(val);
         TKey key   = _keys[index];
         return(key);
     }
 }
 public TVal this[TKey key] // parametreli prop :)
 {
     get
     {
         int  index = _keys.IndexOf(key);
         TVal value = _vals[index];
         return(value);
     }
 }
Exemple #13
0
        public static string NodeVal(TreeNode Node)
        {
            if (Node == null)
            {
                return("");
            }
            TVal val = (TVal)Node.Tag;

            Debug.Assert(val != null);
            return(val.GetValueString());
        }
Exemple #14
0
            public void Add(TKey key, TVal val)
            {
                List <TVal> list;

                if (parent.innerList.TryGetValue(key, out list) == false)
                {
                    list = new List <TVal>();
                    parent.innerList.Add(key, list);
                }

                list.Add(val);
            }
        public void Add(TKey key, TVal val)
        {
            _keys.ForEach(k => // foreach in başka bir kullanımı
            {
                if (k.Equals(key))
                {
                    throw new ArgumentException(); // hata fırlatma bilmeyenler önemsemesin
                }
            });

            _keys.Add(key);
            _vals.Add(val);
        }
Exemple #16
0
            void IIndexUpdate.Update(TVal newRecord)
            {
                TKey key = this.keySelector(newRecord);

                IList <TVal> records;

                if (this.map.TryGetValue(key, out records) == false)
                {
                    records       = new List <TVal>();
                    this.map[key] = records;
                }

                records.Add(newRecord);
            }
Exemple #17
0
 int HistCount()
 {
     if (_tvals == null)
     {
         return(0);
     }
     else
     {
         int count = 0;
         for (TVal tv = _tvals.Next; tv != _tvals; tv = tv.Next)
         {
             count++;
         }
         return(count);
     }
 }
Exemple #18
0
 /// <summary>
 /// Set the value.
 /// </summary>
 /// <param name="val">The new value.</param>
 /// <param name="commitPoint">The transaction's commit point.</param>
 /// <param name="msecs">The clock time.</param>
 internal void SetValue(object val, long commitPoint, int msecs)
 {
     if (_tvals == null)
     {
         _tvals = new TVal(val, commitPoint, msecs);
     }
     else if (_faults.get() > 0)
     {
         _tvals = new TVal(val, commitPoint, msecs, _tvals);
         _faults.set(0);
     }
     else
     {
         _tvals = _tvals.Next;
         _tvals.SetValue(val, commitPoint, msecs);
     }
 }
Exemple #19
0
        /// <summary>
        /// Set the value.
        /// </summary>
        /// <param name="val">The new value.</param>
        /// <param name="commitPoint">The transaction's commit point.</param>
        internal void SetValue(object val, long commitPoint)
        {
            int hcount = HistCount();

            if (_tvals == null)
            {
                _tvals = new TVal(val, commitPoint);
            }
            else if ((_faults.get() > 0 && hcount < _maxHistory) || hcount < _minHistory)
            {
                _tvals = new TVal(val, commitPoint, _tvals);
                _faults.set(0);
            }
            else
            {
                _tvals = _tvals.Next;
                _tvals.SetValue(val, commitPoint);
            }
        }
        private void WriteData(TreeNode Node)
        {
            _NodeIndex++;
            TVal val = (TVal)Node.Tag;

            _file.Write(val.GetTypeStr());
            switch (val.Type)
            {
            case DataType.Dictionary:
            case DataType.List:
                foreach (TreeNode SubNode in Node.Nodes)
                {
                    _file.WriteLine();
                    WriteTabs(SubNode.Level);
                    _file.Write(NodeName(SubNode) + "\t");
                    WriteData(SubNode);
                }
                break;

            default:
                _file.Write("\t" + dNode.NodeVal(Node));
                break;
            }
        }
Exemple #21
0
 public bool TryGetValue(TKey key, out TVal val)
 {
     return(parent.innerList.TryGetValue(key, out val));
 }
Exemple #22
0
 public Node(Tkey key, TVal val, bool color) : this(key, val)
 {
     Color = color;
 }
Exemple #23
0
 public Node(Tkey key, TVal val)
 {
     Key   = key;
     Val   = val;
     Count = 1;
 }
Exemple #24
0
            void IIndexUpdate.Remove(TVal record)
            {
                TKey key = this.keySelector(record);

                this.map.Remove(key);
            }
 public Node(TKey key, TVal val, int height)
 {
     Val  = val;
     Key  = key;
     next = new Node[height];
 }
 public Node(TKey key, TVal val)
 {
     this.key = key;
     this.val = val;
 }
Exemple #27
0
 public bool TryGetValue(TKey key, out TVal val)
 {
     return(parent.dictionary.TryGetValue(key, out val));
 }
Exemple #28
0
        public static DataTableEx ExecuteFormulasValueExpand(FormulasResult formulasResult, ArchivesValues_List2 archivesList,
                                                             IVisualDataRequestObjectsNames getNameInterface, int doublePrecision, DateTime dtStart, DateTime dtEnd, enumTimeDiscreteType discreteType, string timeZoneId,
                                                             ArchivesTPValueAllChannels archivesTpList = null, SectionIntegralActsTotalResults?archivesSection = null,
                                                             bool isSumTiForChart = false, FormulaConstantArchives constantArchives             = null, ArchTariffIntegralsTIs cumulativeIntegrals = null,
                                                             ForecastConsumptionResult fResult = null, List <TRowObjectForGrid> listTiViewModel = null, bool isDetailOv = true,
                                                             BalanceFreeHierarchyResults balanceFreeHierarchy = null)
        {
            if (archivesList == null && formulasResult == null && archivesTpList == null && archivesSection == null &&
                constantArchives == null && cumulativeIntegrals == null && fResult == null && balanceFreeHierarchy == null)
            {
                return(null);
            }

#if DEBUG
            var sw = new System.Diagnostics.Stopwatch();
            sw.Start();
#endif

            var dts           = getNameInterface.GetDateTimeListForPeriod(dtStart, dtEnd, discreteType, timeZoneId.GeTimeZoneInfoById());
            var numbersValues = dts.Count;
            //Расчетный ли это профиль
            var deltaDiscrete = (int)discreteType + 1;

            //-------------Таблица для представления данных----------------------------
            var userTable = new DataTableEx();
            userTable.BeginLoadData();
            try
            {
                userTable.Columns.Add("EventDateTime", typeof(DateTime));

                #region Создаем колонки в пользовательском представлениее

                var vType = typeof(IFValue);
                var k     = 0;

                #region ------------Перебираем точки---------------------------------------------

                var tiColumnValues = userTable.AddColumnsTi(ref k, archivesList, isSumTiForChart, isDetailOv);

                #endregion

                #region ------------ТП---------------------------------------------

                var tpColumnValues = userTable.AddColumnsTp(ref k, archivesTpList, listTiViewModel);

                //      var tpArchives = new List<Tuple<TPoint, Dictionary<byte, List<TPointValue>>>>();

                //if (archivesTpList != null)
                //{

                //}

                #endregion

                #region ------------Перебираем формулы---------------------------------------------

                var formulaArchives = new List <Tuple <IFormulaInfo, TFormulasResult, List <TFormulaConsist> > >();
                if (formulasResult != null && formulasResult.Result_Values != null)
                {
                    foreach (var formulas in formulasResult.Result_Values
                             .Select(f => new Tuple <IFormulaInfo, TFormulasResult, List <TFormulaConsist> >(f.GetFormulaInfo(getNameInterface),
                                                                                                             f.Result_Values.FirstOrDefault(), f.FormulaConsist))
                             .Where(f => f.Item1 != null)
                             .OrderBy(f => f.Item1.FormulaName))
                    {
                        var fVal = formulas.Item2;
                        if (fVal != null && fVal.Val_List != null && fVal.Val_List.Count > 0)
                        {
                            var col = new DataColumn("F_VALUE" + k, vType)
                            {
                                ReadOnly = true,
                            };

                            userTable.Columns.Add(col);
                            k++;
                        }

                        //------------ТИ которые входят в формулу-------------------------------------------------------
                        if (formulasResult.IsValuesAllTIEnabled && formulas.Item3 != null)
                        {
                            foreach (var archivesValue in formulas.Item3)
                            {
                                if (archivesValue.Val_List == null)
                                {
                                    continue;
                                }

                                //var hierObj =
                                //    getNameInterface.GetHierarchyDbTreeObject(archivesValue.TI_Ch_ID.TI_ID.ToString(),
                                //        archivesValue.TypeTIinFormula);

                                var col = new DataColumn("F_VALUE" + k, vType)
                                {
                                    ReadOnly = true,
                                };

                                userTable.Columns.Add(col);
                                k++;
                            }
                        }

                        formulaArchives.Add(formulas);
                    }
                }

                #endregion

                #region ------------Перебираем константы---------------------------------------------

                if (constantArchives != null && constantArchives.FormulaConstantDict != null)
                {
                    foreach (var formulaConstant in constantArchives.FormulaConstantDict.Values)
                    {
                        if (formulaConstant.ArchiveValues != null && formulaConstant.ArchiveValues.Count > 0)
                        {
                            var col = new DataColumn("F_VALUE" + k, vType)
                            {
                                //Caption = "Конст. -" + formulaConstant.ConstantaParams.FormulaConstantName,
                                ReadOnly = true,
                            };

                            userTable.Columns.Add(col);
                            //namesFormulas.Add(new GridTitle
                            //{
                            //    //TitleString = "Конст. -" + formulaConstant.ConstantaParams.FormulaConstantName,
                            //    TitleString = "Конст. -" + formulaConstant.ConstantaParams.FormulaConstantName
                            //});

                            k++;
                        }
                    }
                }

                #endregion

                #region ------------Перебираем сечения---------------------------------------------

                if (archivesSection != null && archivesSection.Value.Total_Result != null &&
                    archivesSection.Value.Total_Result.Count > 0)
                {
                    foreach (var sectionPair in archivesSection.Value.Total_Result)
                    {
                        var section = sectionPair.Value;
                        if (section.TotalVals != null && section.TotalVals.Count > 0)
                        {
                            var sectionName = getNameInterface.GetSectionName(sectionPair.Key);

                            var col = new DataColumn("F_VALUE" + k, vType)
                            {
                                //Caption = "Сеч. -" + sectionName,
                                ReadOnly = true,
                            };

                            userTable.Columns.Add(col);
                            //namesFormulas.Add(new GridTitle
                            //{
                            //    //TitleString = "Сеч. -" + sectionName,
                            //    TitleString = "Сеч. -" + sectionName
                            //});

                            k++;
                        }
                    }
                }

                #endregion

                #region ------------Перебираем накопительные интегралы------------------------------

                if (cumulativeIntegrals != null && cumulativeIntegrals.IntegralsValue30orHour != null)
                {
                    var nType = typeof(IConvertible);

                    foreach (var integral in cumulativeIntegrals.IntegralsValue30orHour)
                    {
                        if (integral.Cumulate_Val_List == null || integral.Cumulate_Val_List.Count == 0)
                        {
                            continue;
                        }

                        //var tiName = getNameInterface.GetTIName(integral.TI_Ch_ID.TI_ID, integral.TI_Ch_ID.IsCA);
                        //var psName = getNameInterface.GetPSName(integral.PS_ID, integral.TI_Ch_ID.IsCA);

                        var col = new DataColumn("F_VALUE" + k, nType)
                        {
                            //Caption = tiName +
                            //          getNameInterface.GetChanelTypeNameByID(integral.TI_Ch_ID.TI_ID,
                            //              integral.TI_Ch_ID.ChannelType, false,
                            //              cumulativeIntegrals.DTStart, cumulativeIntegrals.DTEnd) + " \n" +
                            //          psName,
                            ReadOnly = true,
                        };

                        userTable.Columns.Add(col);
                        k++;
                    }
                }

                #endregion

                #region ------------Прогнозирование------------------------------

                if (fResult != null && fResult.Result_Values != null)
                {
                    var hierarchyObject =
                        getNameInterface.GetHierarchyDbTreeObject(fResult.ID.ID, fResult.ID.TypeHierarchy);

                    if (hierarchyObject != null)
                    {
                        foreach (var archive in fResult.Result_Values)
                        {
                            if (archive.Value == null)
                            {
                                continue;
                            }

                            var col = new DataColumn("F_VALUE" + k, vType)
                            {
                                Caption  = hierarchyObject.Name + " " + getNameInterface.GetChanelTypeNameByID(archive.Key.Channel, false),
                                ReadOnly = true,
                            };

                            userTable.Columns.Add(col);
                            k++;
                        }
                    }
                }

                #endregion

                #region ------------Перебираем балансы---------------------------------------------

                var balanceColumnValues = userTable.AddColumnsBalances(ref k, balanceFreeHierarchy);

                #endregion

                #endregion

#if DEBUG
                sw.Stop();
                Console.WriteLine("Создаем колонки в пользовательском представлениее - > {0} млс", sw.ElapsedMilliseconds);
                sw.Restart();
#endif

                #region Наполняем поставщик

                if (archivesList != null)
                {
                    userTable.Description = new DataTableDescription
                    {
                        DtStart      = archivesList.DTStart,
                        DiscreteType = archivesList.DiscreteType,
                        TimeZoneId   = archivesList.TimeZoneId,
                    };
                }
                else
                {
                    userTable.Description = null;
                }

                for (var i = 0; i < numbersValues; i++)
                {
                    k = 0;

                    //--------колонки в промежуточную таблицу-----------
                    var row = userTable.NewRow() as DataRowEx;
                    var dt  = dts[i];

                    row["EventDateTime"] = dt;
                    //row["Time"] = dt.TimeOfDay;

                    //-------пишем в промежуточную таблицу значения--------

                    //TVALUES_DB mainChannelVal = null;

                    #region ТИ

                    userTable.PopulateRowsTi(ref k, tiColumnValues, numbersValues, isSumTiForChart, row, i);

                    #endregion

                    #region ТП

                    userTable.PopulateRowsTp(ref k, tpColumnValues, row, i);

                    #endregion

                    #region Формулы

                    if (formulasResult != null && formulasResult.Result_Values != null)
                    {
                        foreach (var formulas in formulaArchives)
                        {
                            enumTypeHierarchy typeHierarchy;
                            switch (formulas.Item1.FormulasTable)
                            {
                            case enumFormulasTable.Info_Formula_Description:
                                typeHierarchy = enumTypeHierarchy.Formula;
                                break;

                            case enumFormulasTable.Info_TP2_OurSide_Formula_Description:
                                typeHierarchy = enumTypeHierarchy.Formula_TP_OurSide;
                                break;

                            case enumFormulasTable.Info_TP2_Contr_Formula_Description:
                                typeHierarchy = enumTypeHierarchy.Formula_TP_CA;
                                break;

                            default:
                                typeHierarchy = enumTypeHierarchy.Unknown;
                                break;
                            }

                            var id = new ID_Hierarchy
                            {
                                ID            = formulas.Item1.Formula_UN,
                                TypeHierarchy = typeHierarchy
                            };

                            var fVal = formulas.Item2;
                            if (fVal != null && fVal.Val_List != null && fVal.Val_List.Count > 0)
                            {
                                var v = fVal.Val_List.ElementAtOrDefault(i);
                                if (v != null)
                                {
                                    var useMeasureModule =
                                        string.IsNullOrEmpty(fVal.MeasureUnit_UN)
                                        &&
                                        (string.Equals(fVal.MeasureQuantityType_UN, "EnergyUnit") ||
                                         string.Equals(fVal.MeasureQuantityType_UN, "PowerUnit"));

                                    //row["F_VALUE" + k] = v;
                                    row.SetValue("F_VALUE" + k, i, 0, id, null, fVal.MeasureUnit_UN, v, useMeasureModule);
                                }

                                k++;
                            }

                            if (formulasResult.IsValuesAllTIEnabled && formulas.Item3 != null)
                            {
                                foreach (var archivesValue in formulas.Item3)
                                {
                                    if (archivesValue.Val_List == null)
                                    {
                                        continue;
                                    }

                                    var v = archivesValue.Val_List.ElementAtOrDefault(i);
                                    if (v != null)
                                    {
                                        if (archivesValue.Id == null)
                                        {
                                            row["F_VALUE" + k] = new TVALUES_DB
                                            {
                                                F_VALUE = v.F_VALUE,
                                                F_FLAG  = v.F_FLAG,
                                            };
                                        }
                                        else
                                        {
                                            row.SetValue("F_VALUE" + k, i, archivesValue.ChannelType, archivesValue.Id, null, null, v);
                                        }
                                    }

                                    k++;
                                }
                            }
                        }
                    }

                    #endregion

                    #region Константы

                    if (constantArchives != null && constantArchives.FormulaConstantDict != null)
                    {
                        foreach (var formulaConstant in constantArchives.FormulaConstantDict.Values)
                        {
                            if (formulaConstant.ArchiveValues != null)
                            {
                                var v = formulaConstant.ArchiveValues.ElementAtOrDefault(i);
                                if (v != null)
                                {
                                    row.SetValue("F_VALUE" + k, i, 0, new ID_Hierarchy
                                    {
                                        ID            = formulaConstant.ConstantaParams.FormulaConstant_UN,
                                        TypeHierarchy = enumTypeHierarchy.FormulaConstant
                                    }, null, null, v);
                                }

                                k++;
                            }
                        }
                    }

                    #endregion

                    #region Сечения

                    if (archivesSection != null && archivesSection.Value.Total_Result != null &&
                        archivesSection.Value.Total_Result.Count > 0)
                    {
                        foreach (var sectionPair in archivesSection.Value.Total_Result)
                        {
                            var section = sectionPair.Value;
                            List <TVALUES_DB> values;
                            if (section.TotalVals != null && section.TotalVals.Count > 0 &&
                                section.TotalVals.TryGetValue(enumInputType.Saldo, out values))
                            {
                                var v = values.ElementAtOrDefault(i);
                                if (v != null)
                                {
                                    //row["F_VALUE" + k] = v;
                                    row.SetValue("F_VALUE" + k, i, 0, new ID_Hierarchy
                                    {
                                        ID            = sectionPair.Key.ToString(),
                                        TypeHierarchy = enumTypeHierarchy.Section
                                    }, null, null, v);
                                }

                                k++;
                            }
                        }
                    }

                    #endregion

                    #region ------------Перебираем накопительные интегралы------------------------------

                    if (cumulativeIntegrals != null && cumulativeIntegrals.IntegralsValue30orHour != null)
                    {
                        var unitDigitCoeff = (double)cumulativeIntegrals.UnitDigit;

                        foreach (var integral in cumulativeIntegrals.IntegralsValue30orHour)
                        {
                            if (integral.Cumulate_Val_List == null || integral.Cumulate_Val_List.Count == 0)
                            {
                                continue;
                            }

                            var val = integral.Cumulate_Val_List.ElementAtOrDefault(i);
                            if (val != null)
                            {
                                var v = new TVal
                                {
                                    F_FLAG  = val.F_FLAG,
                                    F_VALUE = val.Value / unitDigitCoeff,
                                };

                                //var v = val.Value / unitDigitCoeff;

                                //------------ТИ ФСК-----------------------------

                                row.SetValue("F_VALUE" + k, i, integral.TI_Ch_ID.ChannelType, new ID_Hierarchy
                                {
                                    ID            = integral.TI_Ch_ID.TI_ID.ToString(),
                                    TypeHierarchy = enumTypeHierarchy.Info_TI
                                }, integral.TI_Ch_ID.DataSourceType, null, v);

                                //row["F_VALUE" + k] = v;
                                //if (integral.TI_Ch_ID.ChannelType < 3 && v > 0)
                                //{
                                //    mainChannelVal = v;
                                //}
                            }

                            k++;
                        }
                    }

                    #endregion

                    #region ------------Прогнозирование------------------------------

                    if (fResult != null && fResult.Result_Values != null)
                    {
                        var hierarchyObject =
                            getNameInterface.GetHierarchyDbTreeObject(fResult.ID.ID, fResult.ID.TypeHierarchy);

                        if (hierarchyObject != null)
                        {
                            var unitDigitCoeff = (double)fResult.UnitDigit;

                            foreach (var archive in fResult.Result_Values)
                            {
                                if (archive.Value == null)
                                {
                                    continue;
                                }

                                var val = archive.Value.ElementAtOrDefault(i);
                                if (val != null)
                                {
                                    var v = new TVALUES_DB
                                    {
                                        F_FLAG  = val.F_FLAG,
                                        F_VALUE = val.F_VALUE / unitDigitCoeff,
                                    };

                                    //------------ТИ ФСК-----------------------------
                                    //row["F_VALUE" + k] = v;

                                    row.SetValue("F_VALUE" + k, i, archive.Key.Channel, new ID_Hierarchy
                                    {
                                        ID            = archive.Key.ID,
                                        TypeHierarchy = archive.Key.TypeHierarchy,
                                    }, null, null, v);
                                }

                                k++;
                            }
                        }
                    }

                    #endregion

                    #region Балансы

                    userTable.PopulateRowsBalances(ref k, balanceColumnValues, row, i);

                    #endregion

                    //      if (consumptionSchedule != null && mainChannelVal != null && mainChannelVal.F_VALUE != null &&
                    //    mainChannelVal.F_FLAG.HasFlag(VALUES_FLAG_DB.ConsumptionScheduleOverflow))
                    //{
                    //    //Ищем значение типового графика для данной получасовки
                    //    var cs_val =
                    //        consumptionSchedule.ConsumptionScheduleValues.FirstOrDefault(
                    //            cs => cs.TotalDay == (dt.Date - dtStart.Date).TotalDays && cs.TotalNumberPerDay ==
                    //                  dt.TimeOfDay.TotalMinutes / (30 * deltaDiscrete));

                    //    if (cs_val != null && cs_val.F_VALUE.HasValue)
                    //    {
                    //        double delta = 0;
                    //        if (mainChannelVal.F_VALUE > cs_val.MAX_VALUE)
                    //        {
                    //            delta = mainChannelVal.F_VALUE - cs_val.F_VALUE.Value;
                    //        }
                    //        else
                    //        {
                    //            delta = mainChannelVal.F_VALUE - cs_val.F_VALUE.Value;
                    //        }

                    //        row["ConsumptionSchedule"] = delta;
                    //        row["ConsumptionSchedulePercent"] = delta / mainChannelVal.F_VALUE * 100;
                    //    }
                    //}

                    userTable.Rows.Add(row);
                }

                #endregion
            }
            finally
            {
                userTable.EndLoadData();
                userTable.AcceptChanges();
            }

#if DEBUG
            sw.Stop();
            Console.WriteLine("ExecuteFormulasValueExpand - > {0} млс", sw.ElapsedMilliseconds);
#endif

            return(userTable);
        }
Exemple #29
0
 public void Add(TKey key, TVal val)
 {
     parent.dictionary[key] = val;
 }
Exemple #30
0
 public void Add(TKey key, TVal val)
 {
     parent.innerList[key] = val;
 }