Example #1
0
        private static Channel ParseSeries(SeriesDefinition seriesDefinition)
        {
            ChannelDefinition channelDefinition = seriesDefinition.ChannelDefinition;

            // Populate series properties
            Series series = new Series();

            series.Channel       = new Channel();
            series.SeriesType    = new SeriesType();
            series.SourceIndexes = string.Empty;

            // Populate channel properties
            Channel channel = series.Channel;

            channel.Series = new List <Series>()
            {
                series
            };
            channel.MeasurementType           = new MeasurementType();
            channel.MeasurementCharacteristic = new MeasurementCharacteristic();
            channel.Phase         = new openXDA.Model.Phase();
            channel.Name          = channelDefinition.ChannelName;
            channel.HarmonicGroup = 0;
            channel.Series.Add(series);

            if (seriesDefinition.HasElement(SeriesDefinition.SeriesNominalQuantityTag))
            {
                channel.PerUnitValue = seriesDefinition.SeriesNominalQuantity;
            }

            // Populate measurement type properties
            QuantityMeasured quantityMeasured = channelDefinition.QuantityMeasured;

            channel.MeasurementType.Name = quantityMeasured.ToString();

            // Populate characteristic properties
            Guid quantityTypeID           = channelDefinition.QuantityTypeID;
            Guid quantityCharacteristicID = seriesDefinition.QuantityCharacteristicID;

            // Workaround for bad quantity characteristic in files produced by PQube Classic
            if (quantityTypeID == QuantityType.Phasor && quantityCharacteristicID == QuantityCharacteristic.Instantaneous)
            {
                quantityCharacteristicID = QuantityCharacteristic.RMS;
            }

            channel.MeasurementCharacteristic.Name        = QuantityCharacteristic.ToName(quantityCharacteristicID) ?? quantityCharacteristicID.ToString();
            channel.MeasurementCharacteristic.Description = QuantityCharacteristic.ToString(quantityCharacteristicID);

            // Popuplate phase properties
            Phase phase = channelDefinition.Phase;

            channel.Phase.Name = phase.ToString();

            // Populate series type properties
            series.SeriesType.Name        = SeriesValueType.ToString(seriesDefinition.ValueTypeID) ?? seriesDefinition.ValueTypeName ?? seriesDefinition.ValueTypeID.ToString();
            series.SeriesType.Description = seriesDefinition.ValueTypeName;

            return(channel);
        }
Example #2
0
        private static Channel ParseSeries(SeriesDefinition seriesDefinition)
        {
            ChannelDefinition channelDefinition = seriesDefinition.ChannelDefinition;
            QuantityMeasured  quantityMeasured  = channelDefinition.QuantityMeasured;
            Phase             phase             = channelDefinition.Phase;

            // Populate series properties
            Series series = new Series();

            series.Channel       = new Channel();
            series.SeriesType    = new SeriesType();
            series.SourceIndexes = string.Empty;

            // Populate channel properties
            Channel channel = series.Channel;

            channel.Series = new List <Series>()
            {
                series
            };
            channel.MeasurementType           = new MeasurementType();
            channel.MeasurementCharacteristic = new MeasurementCharacteristic();
            channel.Phase         = new openXDA.Model.Phase();
            channel.Name          = channelDefinition.ChannelName;
            channel.HarmonicGroup = 0;
            channel.Series.Add(series);

            if (seriesDefinition.HasElement(SeriesDefinition.SeriesNominalQuantityTag))
            {
                channel.PerUnitValue = seriesDefinition.SeriesNominalQuantity;
            }

            // Populate measurement type properties
            channel.MeasurementType.Name = quantityMeasured.ToString();

            // Populate characteristic properties
            channel.MeasurementCharacteristic.Name        = QuantityCharacteristic.ToName(seriesDefinition.QuantityCharacteristicID) ?? seriesDefinition.QuantityCharacteristicID.ToString();
            channel.MeasurementCharacteristic.Description = QuantityCharacteristic.ToString(seriesDefinition.QuantityCharacteristicID);

            // Popuplate phase properties
            channel.Phase.Name = phase.ToString();

            // Populate series type properties
            series.SeriesType.Name        = SeriesValueType.ToString(seriesDefinition.ValueTypeID) ?? seriesDefinition.ValueTypeName ?? seriesDefinition.ValueTypeID.ToString();
            series.SeriesType.Description = seriesDefinition.ValueTypeName;

            return(channel);
        }