Example #1
0
        /**********************************************************/

        public void addDescriptionPowerItem(string rID, string resourceID, ReportEnumeratedType reportType, ReadingTypeEnumeratedType readingType,
                                            string marketContext, int minSamplingPeriod, int maxSamplingPeriod, bool onChange, DurationModifier durationModifier,
                                            ePowerItemType powerItemType, string description, string units, SiScaleCodeType siScaleCode, decimal hertz, decimal voltage, bool ac)
        {
            PowerItemType powerItem = null;

            switch (powerItemType)
            {
            case ePowerItemType.PowerApparent:
                powerItem = new PowerApparentType();
                break;

            case ePowerItemType.PowerReactive:
                powerItem = new PowerReactiveType();
                break;

            case ePowerItemType.PowerReal:
                powerItem = new PowerRealType();
                break;

            default:
                powerItem = new PowerApparentType();
                break;
            }

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

            powerItem.powerAttributes         = new PowerAttributesType();
            powerItem.powerAttributes.hertz   = hertz;
            powerItem.powerAttributes.voltage = voltage;

            addDescription(rID, resourceID, reportType, readingType, marketContext, minSamplingPeriod, maxSamplingPeriod, onChange, durationModifier, powerItem);
        }
Example #2
0
        /******************************************************************************/

        private PowerItemType generatePower(ePowerItemType powerType, decimal hertz, decimal voltage)
        {
            PowerItemType power = null;

            switch (powerType)
            {
            case ePowerItemType.PowerApparent:
                power = new PowerApparentType();
                break;

            case ePowerItemType.PowerReactive:
                power = new PowerReactiveType();
                break;

            case ePowerItemType.PowerReal:
                power = new PowerRealType();
                break;
            }

            power.itemDescription = "";
            power.itemUnits       = "W";
            power.siScaleCode     = SiScaleCodeType.none;

            power.powerAttributes         = new PowerAttributesType();
            power.powerAttributes.hertz   = hertz;
            power.powerAttributes.voltage = voltage;

            return(power);
        }
Example #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"));
        }
Example #4
0
        public void powerReal()
        {
            PowerRealType power = new PowerRealType();

            testPowerItemType(power);
        }