예제 #1
0
        /**********************************************************/

        public void addIntervalResourceStatus(DateTime startUTC, string rID, uint confidence, float accuracy, DataQuality dataQuality, bool online, bool manualOverride,
                                              float capacityMin, float capacityMax, float capacityCurrent, float capacityNormal,
                                              float levelOffsetMin, float levelOffsetMax, float levelOffsetCurrent, float levelOffsetNormal,
                                              float percentOffsetMin, float percentOffsetMax, float percentOffsetCurrent, float percentOffsetNormal,
                                              float setPointMin, float setPointMax, float setPointCurrent, float setPointNormal, int duration = -1, DurationModifier durationModifier = null)
        {
            oadrReportPayloadType reportPayload = new oadrReportPayloadType();

            reportPayload.rID        = rID;
            reportPayload.confidence = confidence;
            reportPayload.accuracy   = accuracy;

            reportPayload.oadrDataQuality = dataQuality.QualityType;

            oadrPayloadResourceStatusType resourceStatus = new oadrPayloadResourceStatusType();

            resourceStatus.oadrOnline         = online;
            resourceStatus.oadrManualOverride = manualOverride;

            resourceStatus.oadrLoadControlState = new oadrLoadControlStateType();
            resourceStatus.oadrLoadControlState.oadrCapacity      = helper.OadrObjectFactory.createLoadControlStateType(capacityMin, capacityMax, capacityCurrent, capacityNormal);
            resourceStatus.oadrLoadControlState.oadrLevelOffset   = helper.OadrObjectFactory.createLoadControlStateType(levelOffsetMin, levelOffsetMax, levelOffsetCurrent, levelOffsetNormal);
            resourceStatus.oadrLoadControlState.oadrPercentOffset = helper.OadrObjectFactory.createLoadControlStateType(percentOffsetMin, percentOffsetMax, percentOffsetCurrent, percentOffsetNormal);
            resourceStatus.oadrLoadControlState.oadrSetPoint      = helper.OadrObjectFactory.createLoadControlStateType(setPointMin, setPointMax, setPointCurrent, setPointNormal);

            reportPayload.Item = resourceStatus;

            addIntervalPayload(startUTC, rID, reportPayload, duration, durationModifier);
        }
예제 #2
0
        public void properOrder()
        {
            ReportWrapper reportWrapper = new ReportWrapper("specifier1", ReportName.TELEMETRY_USAGE, 5, DurationModifier.HOURS);

            DateTime start = DateTime.Now.ToUniversalTime();

            start = start.AddMilliseconds(-start.Millisecond);
            start = start.AddSeconds(-start.Second);

            addIntervalResourceStatus(reportWrapper, "rid1", start, (float)3.0);
            addIntervalResourceStatus(reportWrapper, "rid2", start.AddSeconds(30), (float)2.0);
            addIntervalResourceStatus(reportWrapper, "rid3", start.AddSeconds(60), (float)1.0);
            addIntervalResourceStatus(reportWrapper, "rid4", start.AddSeconds(-30), (float)4.0);
            addIntervalResourceStatus(reportWrapper, "rid5", start.AddSeconds(-50), (float)5.0);
            addIntervalResourceStatus(reportWrapper, "rid6", start.AddSeconds(90), (float)0.0);

            oadrReportType report = reportWrapper.generateReport("requestID");

            Assert.IsTrue(report.dtstart.datetime == report.intervals[0].dtstart.datetime);

            for (int index = 0; index < report.intervals.Length - 1; index++)
            {
                oadrReportPayloadType         reportPayload = (oadrReportPayloadType)report.intervals[index].streamPayloadBase[0];
                oadrPayloadResourceStatusType status        = (oadrPayloadResourceStatusType)reportPayload.Item;

                Assert.IsTrue(report.intervals[index].dtstart.datetime > report.intervals[index + 1].dtstart.datetime);
                Assert.AreEqual(index, (int)status.oadrLoadControlState.oadrCapacity.oadrMin);
            }

            string xml = SerializeOadrObject.serializeOjbect(report, report.GetType());

            Console.Out.WriteLine(xml);
        }