Files
DP44/Common/DTS.Common.Utilities/ChannelFilter.cs
2026-04-17 14:55:32 -04:00

254 lines
8.0 KiB
C#

/*
ChannelFilter.cs
$Log: ChannelFilter.cs,v $
Revision 1.2 2007/04/20 17:46:32 Paul Hrissikopoulos
Added integration and differentiation to standard filter set.
Revision 1.1 2006/10/26 22:06:47 Paul Hrissikopoulos
Added channel data filtering.
Copyright © 2006
Diversified Technical Systems, Inc.
All Righst Reserved
*/
using System;
using System.ComponentModel;
namespace DTS.Common.Utilities
{
/// <summary>
/// Enumeration of all possible filters that may be applied to channel
/// data. These can be used as software filters in data review.
///
/// </summary>
public enum ChannelFilter
{
/// <summary>
/// no filter is applied
/// </summary>
[Description("UnfilteredZero")]
[CFCValue(0)]
[IsoDescription("0")]
[Enumerability(true)]
UnfilteredZero = -2,
/// <summary>
/// no filter is applied
/// </summary>
[Description("Unfiltered")]
[CFCValue(0)]
[IsoDescription("0")]
[Enumerability(true)]
Unfiltered = 0,
/// <summary>
/// filter at 17Hz (Channel Frequency Class)
/// </summary>
[Description("CFC 10")]
[CFCValue(10)]
[IsoDescription("Q")]
[Enumerability(true)]
Class10 = 17,
/// <summary>
/// filter at 100Hz (Channel Frequency Class)
/// 3 dB limit Frequncy
/// stop damping -30 dB
/// sample frequency > 600Hz
/// </summary>
[Description("CFC 60")]
[CFCValue(60)]
[IsoDescription("D")]
[Enumerability(true)]
Class60 = 100,
/// <summary>
/// filter at 300Hz (Channel Frequency Class)
/// 3 dB limit frequency
/// stop damping -30Db
/// sampling frequency > 1800Hz
/// </summary>
[Description("CFC 180")]
[CFCValue(180)]
[IsoDescription("C")]
[Enumerability(true)]
Class180 = 300,
/// <summary>
/// 3Db limit frequency 1000Hz (channel frequency class)
/// stop damping -40Db
/// sampling frequency > 6 khz
/// </summary>
[Description("CFC 600")]
[CFCValue(600)]
[IsoDescription("B")]
[Enumerability(true)]
Class600 = 1000,
/// <summary>
/// 3dB limit frequency 1650Hz
/// stop damping -40dB
/// sampling frequency > 10khz
/// </summary>
[Description("CFC 1000")]
[CFCValue(1000)]
[IsoDescription("A")]
[Enumerability(true)]
Class1000 = 1650,
[Description("Custom")]
[CFCValue(-1)]
//FB 13120 AdHoc ISO code is S
[IsoDescription("S")]
[Enumerability(false)]
AdHoc = -1
//[Description( "1st Integration")]
//[IsoDescription( "?" )]
//Integral = 2000,
//[Description( "1st Derivative")]
//[IsoDescription( "?" )]
//Derivative = 2001,
}
/// <summary>
/// Attribute for specifying the ISO code fragment description of the attached
/// field's representation. Intended to be applied to enumerations that
/// represent ISO-codeable elements.
/// </summary>
[AttributeUsage(AttributeTargets.Field)]
public class IsoDescriptionAttribute : Attribute
{
////////////////////////////////////////////////////////////////////////////////
/// <summary>
/// Get the <see cref="string"/> that ISO-describes whatever this attribute
/// is attached to.
/// </summary>
public string IsoDescription { get; }
////////////////////////////////////////////////////////////////////////////////
/// <inheritdoc />
/// <summary>
/// Initializes an instance of the IsoDescriptionAttribute class.
/// </summary>
/// <param name="isoDescription">
/// The <see cref="T:System.String" /> that ISO-describes whatever this attribute
/// is attached to.
/// </param>
public IsoDescriptionAttribute(string isoDescription)
{
IsoDescription = isoDescription;
}
}
/// <summary>
/// Tool for manipulating <see cref="ChannelFilter"/>-attached <see cref="IsoDescriptionAttribute"/>s.
/// </summary>
public class IsoDescriptionAttributeCoder
: AttributeCoder<ChannelFilter, IsoDescriptionAttribute, string>
{
/// <summary>
/// Initializes an instance of the IsoDescriptionAttributeCoder class.
/// </summary>
public IsoDescriptionAttributeCoder()
: base(attribute => attribute.IsoDescription, null)
{
}
}
/// <summary>
/// Attribute for specifying the "enumerability" of the attached
/// field's representation. Intended to be applied to enumerations that
/// contain valid, but special case elements that should never be automatically
/// enumerated.
/// </summary>
///
[AttributeUsage(AttributeTargets.Field)]
public class EnumerabilityAttribute : Attribute
{
////////////////////////////////////////////////////////////////////////////////
/// <summary>
/// Get the <see cref="bool"/> that describes enumerability.
/// </summary>
public bool IsEnumerable { get; private set; }
////////////////////////////////////////////////////////////////////////////////
/// <summary>
/// Initializes an instance of the EnumerablilityAttribute class.
/// </summary>
///
/// <param name="isEnumerable">
/// The <see cref="bool"/> that describes the attached object's enumerability.
/// </param>
///
public EnumerabilityAttribute(bool isEnumerable)
{
IsEnumerable = isEnumerable;
}
}
/// <summary>
/// Tool for manipulating <see cref="ChannelFilter"/>-attached <see cref="EnumerabilityAttribute"/>s.
/// </summary>
public class EnumerabilityAttributeCoder
: AttributeCoder<ChannelFilter, EnumerabilityAttribute, bool>
{
/// <summary>
/// Initializes an instance of the EnumerabilityAttributeCoder class.
/// </summary>
public EnumerabilityAttributeCoder()
: base(attribute => attribute.IsEnumerable, null)
{
}
}
/// <summary>
/// Attribute for specifying the numeric value of the filter CFC.
/// </summary>
[AttributeUsage(AttributeTargets.Field)]
public class CFCValueAttribute : Attribute
{
////////////////////////////////////////////////////////////////////////////////
/// <summary>
/// Get the <see cref="double"/> value of the CFC this attribute is attached to.
/// </summary>
public double CFCValue => _cfcValue;
private readonly double _cfcValue;
////////////////////////////////////////////////////////////////////////////////
/// <summary>
/// Initializes an instance of the CFCValueAttribute class.
/// </summary>
///
/// <param name="cfcValue">
/// The <see cref="double"/> value of the CFC this attribute is attached to.
/// </param>
///
public CFCValueAttribute(double cfcValue)
{
_cfcValue = cfcValue;
}
}
/// <summary>
/// Tool for manipulating <see cref="ChannelFilter"/>-attached <see cref="CFCValueAttribute"/>s.
/// </summary>
public class CfcValueAttributeCoder
: AttributeCoder<ChannelFilter, CFCValueAttribute, double>
{
/// <summary>
/// Initializes an instance of the CfcValueAttributeCoder class.
/// </summary>
public CfcValueAttributeCoder()
: base(attribute => attribute.CFCValue, null)
{
}
}
}