//******************************************************************************************************
// Common.cs - Gbtc
//
// Copyright © 2012, 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:
// ----------------------------------------------------------------------------------------------------
// 04/26/2009 - J. Ritchie Carroll
// Generated original version of source code.
// 09/15/2009 - Stephen C. Wills
// Added new header and license agreement.
// 12/17/2012 - Starlynn Danyelle Gilliam
// Modified Header.
//
//******************************************************************************************************
using System;
namespace GSF.PhasorProtocols.SelFastMessage
{
#region [ Enumerations ]
///
/// SEL Fast Message PMDATA setting frame size enumeration.
///
[Serializable]
public enum FrameSize : byte
{
///
/// Positive sequence voltage phasor.
///
V1 = 0x28,
///
/// Three-phase and positive sequence voltage phasors.
///
V = 0x40,
///
/// Three-phase and positive sequence voltage and current phasors.
///
A = 0x60
}
///
/// SEL Fast Message status word flags enumeration.
///
[Flags, Serializable]
public enum StatusFlags : ushort
{
///
/// Time synchronization OK, 1 when OK.
///
TSOK = (ushort)Bits.Bit00,
///
/// Phasor measurement data OK, 1 when OK.
///
PMDOK = (ushort)Bits.Bit01,
///
/// User programmable bit 1.
///
PSV51 = (ushort)Bits.Bit02,
///
/// User programmable bit 2.
///
PSV52 = (ushort)Bits.Bit03,
///
/// User programmable bit 3.
///
PSV53 = (ushort)Bits.Bit04,
///
/// User programmable bit 4.
///
PSV54 = (ushort)Bits.Bit05,
///
/// User programmable bit 5.
///
PSV55 = (ushort)Bits.Bit06,
///
/// User programmable bit 6.
///
PSV56 = (ushort)Bits.Bit07,
///
/// User programmable bit 7.
///
PSV57 = (ushort)Bits.Bit08,
///
/// User programmable bit 8.
///
PSV58 = (ushort)Bits.Bit09,
///
/// User programmable bit 9.
///
PSV59 = (ushort)Bits.Bit10,
///
/// User programmable bit 10.
///
PSV60 = (ushort)Bits.Bit11,
///
/// User programmable bit 11.
///
PSV61 = (ushort)Bits.Bit12,
///
/// User programmable bit 12.
///
PSV62 = (ushort)Bits.Bit13,
///
/// User programmable bit 13.
///
PSV63 = (ushort)Bits.Bit14,
///
/// User programmable bit 14.
///
PSV64 = (ushort)Bits.Bit15,
///
/// No flags.
///
NoFlags = (ushort)Bits.Nil
}
///
/// SEL Fast Message frame rate enumeration.
///
[Serializable]
public enum MessagePeriod : ushort
{
///
/// Default message rate, 20 messages per second.
///
DefaultRate = 0x0000,
///
/// 20 messages per second.
///
TwentyPerSecond = 0x0005,
///
/// 10 messages per second.
///
TenPerSecond = 0x000A,
///
/// 5 messages per second.
///
FivePerSecond = 0x0016,
///
/// 4 messages per second.
///
FourPerSecond = 0x0019,
///
/// 2 messages per second.
///
TwoPerSecond = 0x0032,
///
/// 1 packet per second, or 60 messages per minute.
///
OnePerSecond = 0x0064,
///
/// 30 messages per minute, or 1/2 packet per second.
///
ThirtyPerMinute = 0x00C8,
///
/// 20 messages per minute.
///
/// Only supported by SEL 300 series relays.
TwentyPerMinute = 0x012C,
///
/// 15 messages per minute.
///
/// Only supported by SEL 300 series relays.
FifteenPerMinute = 0x0190,
///
/// 12 messages per minute.
///
/// Only supported by SEL 300 series relays.
TwelvePerMinute = 0x01F4,
///
/// 10 messages per minute.
///
/// Only supported by SEL 300 series relays.
TenPerMinute = 0x0258,
///
/// 6 messages per minute.
///
/// Only supported by SEL 300 series relays.
SixPerMinute = 0x03E8,
///
/// 4 messages per minute.
///
/// Only supported by SEL 300 series relays.
FourPerMinute = 0x05DC,
///
/// 3 messages per minute.
///
/// Only supported by SEL 300 series relays.
ThreePerMinute = 0x07D0,
///
/// 2 messages per minute.
///
/// Only supported by SEL 300 series relays.
TwoPerMinute = 0x0BB8,
///
/// 1 message per minute.
///
/// Only supported by SEL 300 series relays.
OnePerMinute = 0x1770
}
///
/// SEL Fast Message device commands enumeration.
///
[Serializable]
public enum DeviceCommand : byte
{
///
/// Enable unsolicited write messages.
///
EnableUnsolicitedMessages = 0x01,
///
/// Disable unsolicited write messages.
///
DisableUnsolicitedMessages = 0x02,
///
/// Undefined command.
///
Undefined = 0xFF
}
#endregion
///
/// Common SEL Fast Message declarations and functions.
///
public static class Common
{
///
/// SEL Fast message data frame header byte 1.
///
public const byte HeaderByte1 = 0xA5;
///
/// SEL Fast message data frame header byte 2.
///
public const byte HeaderByte2 = 0x46;
///
/// Absolute maximum number of possible phasor values that could fit into a data frame.
///
public const ushort MaximumPhasorValues = 8;
///
/// Absolute maximum number of possible analog values that could fit into a data frame.
///
public const ushort MaximumAnalogValues = 0;
///
/// Absolute maximum number of possible digital values that could fit into a data frame.
///
public const ushort MaximumDigitalValues = 0;
///
/// Absolute maximum data length (in bytes) that could fit into any frame.
///
public const ushort MaximumDataLength = (ushort)FrameSize.A;
///
/// Absolute maximum number of bytes of extended data that could fit into a command frame.
///
public const ushort MaximumExtendedDataLength = 0;
}
}