예제 #1
0
        public static async Task <DateTime> getValNextDate(string iess, DateTime dateStart, DateTime dateEnd, string func, double limitVal)
        {
            TabularRequest req = new TabularRequest();

            req.period = new TimePeriod()
            {
                from = new Timestamp()
                {
                    second = EDSClass.toTS(dateStart)
                },
                till = new Timestamp()
                {
                    second = EDSClass.toTS(dateEnd)
                }
            };

            req.step = new TimeDuration()
            {
                seconds = (long)(dateEnd - dateStart).TotalSeconds
            };

            List <TabularRequestItem> list = new List <TabularRequestItem>();

            list.Add(new TabularRequestItem()
            {
                function = func,
                pointId  = new PointId()
                {
                    iess = iess
                },
                @params = new double[] { limitVal }
            });

            req.items = list.ToArray();
            uint id = 0;

            try
            {
                id = EDSClass.Client.requestTabular(EDSClass.AuthStr, req);
            }
            catch (Exception e)
            {
                Logger.Info(e.ToString());
            }
            TabularRow[] rows;
            bool         ok = await EDSClass.ProcessQueryAsync(id);

            PointId[] points = EDSClass.Client.getTabular(EDSClass.AuthStr, id, out rows);
            if (rows.Length > 0)
            {
                TabularRow row = rows[0];
                double     ts  = getVal(row.values[0].value);
                return(EDSClass.fromTS((long)ts));
            }
            else
            {
                return(dateEnd);
            }
        }
예제 #2
0
        public static async Task <double> getValFromServer(string iess, DateTime date)
        {
            TabularRequest req = new TabularRequest();

            req.period = new TimePeriod()
            {
                from = new Timestamp()
                {
                    second = EDSClass.toTS(date)
                },
                till = new Timestamp()
                {
                    second = EDSClass.toTS(date) + 1
                }
            };

            req.step = new TimeDuration()
            {
                seconds = 1
            };

            List <TabularRequestItem> list = new List <TabularRequestItem>();

            list.Add(new TabularRequestItem()
            {
                function = "VALUE",
                pointId  = new PointId()
                {
                    iess = iess
                },
                shadePriority = ShadePriority.REGULAROVERSHADE
            });

            req.items = list.ToArray();
            uint id = EDSClass.Client.requestTabular(EDSClass.AuthStr, req);

            TabularRow[] rows;
            bool         ok = await EDSClass.ProcessQueryAsync(id);

            PointId[]  points = EDSClass.Client.getTabular(EDSClass.AuthStr, id, out rows);
            double     val    = Double.MinValue;
            TabularRow row    = rows[0];

            {
                val = getVal(row.values[0].value);
            }
            return(val);
        }