|
Imports System.Collections.Generic
Imports System.ComponentModel
Imports BV.Core
''' <summary>
''' Array de Funciones. Permite disponer de una colleccion de funciones
''' que se habilitan o desabilitan a voluntad. Utilizado principalmente
''' en el analisis de FFT
''' </summary>
<CLSCompliant(True)> _
Public Class SpectrumContainer
Public Const DefaultArmonicNumber As Integer = 21
Protected intNroArmonics As Integer
Protected intArmonics As List(Of FunctionBase)
Protected intIgnore As List(Of Boolean)
Protected intFFTFn, intTFn As FunctionBase
Public Sub New()
Me.intArmonics = New List(Of FunctionBase)
Me.intIgnore = New List(Of Boolean)
Me.intNroArmonics = DefaultArmonicNumber
End Sub
#Region "Properties"
''' <summary>
''' Funcion analizada a la cual se le hace el estudio de FFT
''' </summary>
Public Property SelectedFunction() As FunctionBase
Get
Return Me.intFFTFn
End Get
Set(ByVal value As FunctionBase)
Me.intFFTFn = value
End Set
End Property
''' <summary>
''' Funci�n dependiente del tiempo resultante de la operatoria del espectro
''' </summary>
<Browsable(False)> _
Public ReadOnly Property TimeDomainFunction() As FunctionBase
Get
Return Me.intTFn
End Get
End Property
''' <summary>
''' N�mero de arm�nicas a utilizar
''' </summary>
<Browsable(False)> _
Public ReadOnly Property Armonics() As FunctionBase()
Get
Return Me.intArmonics.ToArray
End Get
End Property
''' <summary>
''' Array con los estados de las arm�nicas (si estan o no ignoradas).
''' </summary>
Public ReadOnly Property ArmonicsIgnoreStates() As Boolean()
Get
Return Me.intIgnore.ToArray
End Get
End Property
''' <summary>
''' Numero de armonicos a procesar en el analisis
''' </summary>
Public Property ArmonicCount() As Integer
Get
Return Me.intNroArmonics
End Get
Set(ByVal value As Integer)
If value < 1 Then
MessageManager.Send(Me, New MessageEventArgs("La cantidad de armonicas debe ser mayor a 1", MessageEventArgs.EMessageType.Error))
Exit Property
End If
If value > 200 Then
MessageManager.Send(Me, New MessageEventArgs("La cantidad de armonicas no puede superar 200", MessageEventArgs.EMessageType.Info))
Exit Property
End If
If Me.intNroArmonics = value Then
Exit Property
End If
Me.intNroArmonics = value
' Me.AnalizeSpectrum()
End Set
End Property
#End Region
Public Sub Begin()
End Sub
''' <summary>
''' Agrega la funcion indicada al Espectro
''' </summary>
''' <param name="Fn"></param>
Public Sub Add(ByVal Fn As FunctionBase)
Me.intArmonics.Add(Fn)
Me.intIgnore.Add(False)
End Sub
Public Function Finish() As FunctionBase
If Me.intTFn Is Nothing Then
Dim s As String = ""
Dim i As Integer
For i = 0 To Me.intArmonics.Count - 1
If i > 0 Then
s &= "+"
End If
s &= Me.intArmonics(i).Name
Next
Me.intTFn = FunctionManager.Add(s)
End If
Return Me.intTFn
End Function
'''' <summary>
'''' Crea un set de funciones de la serie de Fourier para la funcion especificada
'''' </summary>
'''' <remarks></remarks>
'Public Sub AnalizeSpectrum()
' If Me.intFFTFn Is Nothing Then
' MessageManager.Send(Me, New MessageEventArgs("Must select a function First", MessageEventArgs.EMessageType.Info))
' Exit Sub
' End If
' Dim i As Integer
' For i = 0 To Me.intNroArmonics - 1
' Next
'End Sub
End Class
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.