예제 #1
0
        async Task CreateMeterReadPolicy()
        {
            await _application.EnsureContainerAsync(_MsPolicyPath);

            await DeleteMeterReadPolicy();

            Trace.TraceInformation("Invoking Create Meter Read Policy API");

            await _application.AddContentInstanceAsync(
                _MsPolicyPath,
                MeterReadPolicyName,
                new MeterServicePolicy
            {
                MeterReadSchedule = new MeterReadSchedule
                {
                    ReadingType  = ReadingType.PowerQuality,
                    TimeSchedule = new TimeSchedule
                    {
                        RecurrencePeriod = 120,
                        ScheduleInterval = new ScheduleInterval
                        {
                            Start = DateTimeOffset.UtcNow,
                            End   = DateTimeOffset.UtcNow.AddDays(1),
                        }
                    }
                }
            }
                );
        }
예제 #2
0
        async Task CreateMeterRead(string readsContainer)
        {
            var summation = new global::Example.Types.Data.Summation
            {
                ReadTime = DateTimeOffset.UtcNow,
                Value    = new Random().NextDouble() * 100,
            };

            Console.WriteLine($"Create Read: @ {summation.ReadTime} = {summation.Value}");

            await _application.AddContentInstanceAsync(
                readsContainer,
                new global::Example.Types.Data
            {
                MeterId    = _application.AeId,
                UOM        = global::Example.Types.Data.Units.USGal,
                Summations = new[] { summation }
            }
                );
        }