//******************************************************************************************************
// SignalKind.cs - Gbtc
//
// Copyright © 2010, Grid Protection Alliance. All Rights Reserved.
//
// Licensed to the Grid Protection Alliance (GPA) under one or more contributor license agreements. See
// the NOTICE file distributed with this work for additional information regarding copyright ownership.
// The GPA licenses this file to you under the MIT License (MIT), the "License"; you may
// not use this file except in compliance with the License. You may obtain a copy of the License at:
//
// http://www.opensource.org/licenses/MIT
//
// Unless agreed to in writing, the subject software distributed under the License is distributed on an
// "AS-IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. Refer to the
// License for the specific language governing permissions and limitations.
//
// Code Modification History:
// ----------------------------------------------------------------------------------------------------
// 05/05/2009 - J. Ritchie Carroll
// Generated original version of source code
//
//******************************************************************************************************
using System;
using System.Diagnostics.CodeAnalysis;
namespace GSF.Units.EE
{
///
/// Fundamental signal type enumeration for common EE measurements that represents a kind of signal, not an explicit type.
///
///
///
/// This enumeration represents the basic type of a signal used to suffix a formatted signal
/// reference. When used in context along with an optional index the fundamental signal type
/// will identify a signal's location within a frame of data (see ).
///
///
/// Contrast this to the enumeration which further defines an explicit
/// type for a signal (e.g., a voltage or current type for an angle).
///
///
[Serializable]
public enum SignalKind
{
///
/// Phase angle.
///
Angle,
///
/// Phase magnitude.
///
Magnitude,
///
/// Line frequency.
///
Frequency,
///
/// Frequency delta over time (dF/dt).
///
DfDt,
///
/// Status flags.
///
Status,
///
/// Digital value.
///
Digital,
///
/// Analog value.
///
Analog,
///
/// Calculated value.
///
Calculation,
///
/// Statistical value.
///
Statistic,
///
/// Alarm value.
///
Alarm,
///
/// Quality flags.
///
Quality,
///
/// Undetermined signal type.
///
Unknown
}
///
/// Defines extension functions for the enumeration.
///
public static class SignalKindExtensions
{
///
/// Gets the acronym for the specified .
///
/// to convert to an acronym.
/// The acronym for the specified .
public static string GetAcronym(this SignalKind signal)
{
switch (signal)
{
case SignalKind.Angle:
return "PA"; // Phase Angle
case SignalKind.Magnitude:
return "PM"; // Phase Magnitude
case SignalKind.Frequency:
return "FQ"; // Frequency
case SignalKind.DfDt:
return "DF"; // dF/dt
case SignalKind.Status:
return "SF"; // Status Flags
case SignalKind.Digital:
return "DV"; // Digital Value
case SignalKind.Analog:
return "AV"; // Analog Value
case SignalKind.Calculation:
return "CV"; // Calculated Value
case SignalKind.Statistic:
return "ST"; // Statistical Value
case SignalKind.Alarm:
return "AL"; // Alarm Value
case SignalKind.Quality:
return "QF"; // Quality Flags
default:
return "??";
}
}
///
/// Gets the for the specified .
///
/// Acronym of the desired .
/// The for the specified .
[SuppressMessage("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")]
public static SignalKind ParseSignalKind(this string acronym)
{
switch (acronym)
{
case "PA": // Phase Angle
return SignalKind.Angle;
case "PM": // Phase Magnitude
return SignalKind.Magnitude;
case "FQ": // Frequency
return SignalKind.Frequency;
case "DF": // dF/dt
return SignalKind.DfDt;
case "SF": // Status Flags
return SignalKind.Status;
case "DV": // Digital Value
return SignalKind.Digital;
case "AV": // Analog Value
return SignalKind.Analog;
case "CV": // Calculated Value
return SignalKind.Calculation;
case "ST": // Statistical Value
return SignalKind.Statistic;
case "AL": // Alarm Value
return SignalKind.Alarm;
case "QF": // Quality Flags
return SignalKind.Quality;
default:
return SignalKind.Unknown;
}
}
}
}