示例#1
0
        /**********************************************************/

        public void addDescriptionEnergyItem(string rID, string resourceID, ReportEnumeratedType reportType, ReadingTypeEnumeratedType readingType,
                                             string marketContext, int minSamplingPeriod, int maxSamplingPeriod, bool onChange, DurationModifier durationModifier,
                                             eEnergyItemType energyItemType, string description, string units, SiScaleCodeType siScaleCode)
        {
            EnergyItemType energyItem = null;

            switch (energyItemType)
            {
            case eEnergyItemType.EnergyApparent:
                energyItem = new EnergyApparentType();
                break;

            case eEnergyItemType.EnergyReactive:
                energyItem = new EnergyReactiveType();
                break;

            case eEnergyItemType.EnergyReal:
                energyItem = new EnergyRealType();
                break;

            default:
                energyItem = new EnergyApparentType();
                break;
            }

            energyItem.itemDescription = description;
            energyItem.itemUnits       = units;
            energyItem.siScaleCode     = siScaleCode;

            addDescription(rID, resourceID, reportType, readingType, marketContext, minSamplingPeriod, maxSamplingPeriod, onChange, durationModifier, energyItem);
        }
        public void serializeItemTypeBase()
        {
            EnergyRealType energyRealType = new EnergyRealType();

            energyRealType.itemDescription = "description";
            energyRealType.itemUnits       = "units";
            energyRealType.siScaleCode     = SiScaleCodeType.n;

            string output = SerializeOadrObject.serializeOjbect(energyRealType, typeof(ItemBaseType));

            oadrReportDescriptionType reportDescription = new oadrReportDescriptionType();

            reportDescription.itemBase = energyRealType;

            output = SerializeOadrObject.serializeOjbect(reportDescription, typeof(oadrReportDescriptionType));
        }
示例#3
0
        public void serializeItemBaseType()
        {
            EnergyApparentType energyApparent = new EnergyApparentType();

            energyApparent.itemDescription = "description";
            energyApparent.itemUnits       = "units";
            energyApparent.siScaleCode     = SiScaleCodeType.n;

            string output = SerializeOadrObject.serializeOjbect(energyApparent, typeof(EnergyApparentType));

            oadrReportDescriptionType reportDescription = new oadrReportDescriptionType();

            reportDescription.itemBase = energyApparent;

            output = SerializeOadrObject.serializeOjbect(reportDescription, typeof(oadrReportDescriptionType));

            // energy real
            EnergyRealType energyReal = new EnergyRealType();

            energyReal.itemDescription = "description";
            energyReal.itemUnits       = "units";
            energyReal.siScaleCode     = SiScaleCodeType.n;

            reportDescription.itemBase = energyReal;

            output = SerializeOadrObject.serializeOjbect(reportDescription, typeof(oadrReportDescriptionType));

            // power real
            PowerRealType powerReal = new PowerRealType();

            powerReal.itemDescription         = "description";
            powerReal.itemUnits               = "units";
            powerReal.siScaleCode             = SiScaleCodeType.n;
            powerReal.powerAttributes         = new PowerAttributesType();
            powerReal.powerAttributes.ac      = true;
            powerReal.powerAttributes.hertz   = 60;
            powerReal.powerAttributes.voltage = 110;

            reportDescription.itemBase = powerReal;

            output = SerializeOadrObject.serializeOjbect(reportDescription, typeof(oadrReportDescriptionType));

            Assert.IsTrue(output.Contains("powerReal"));
        }
示例#4
0
        /******************************************************************************/

        private EnergyItemType generateEnergy(eEnergyItemType energyType)
        {
            EnergyItemType energy = null;

            switch (energyType)
            {
            case eEnergyItemType.EnergyApparent:
                energy = new EnergyApparentType();
                break;

            case eEnergyItemType.EnergyReactive:
                energy = new EnergyReactiveType();
                break;

            case eEnergyItemType.EnergyReal:
                energy = new EnergyRealType();
                break;
            }

            return(energy);
        }
示例#5
0
        public void energyReal()
        {
            EnergyRealType energy = new EnergyRealType();

            testEnergyItemType(energy);
        }