@@ -134,28 +134,32 @@ public IirSpecificationBuilder WithStopbandAttenuationDb(double StopbandAttenuat
134134 return this with { StopGain = stop_gain } ;
135135 }
136136
137- /// <summary>Создать экземпляр фильтра</summary>
138- /// <returns>Экземпляр IIR- фильтра</returns>
139- public Filter Create ( ) => ( Family , PassType ) switch
137+ /// <summary>Получить объект спецификации фильтра</summary>
138+ /// <returns>Спецификация фильтра</returns>
139+ public IirFilterSpecification GetSpecification ( ) => ( Family , PassType ) switch
140140 {
141- ( IirFilterFamily . Butterworth , FrequencyPassType . LowPass ) => new ButterworthLowPass ( Dt , PassLowFrequency , StopLowFrequency , PassGain , StopGain ) ,
142- ( IirFilterFamily . Butterworth , FrequencyPassType . HighPass ) => new ButterworthHighPass ( Dt , StopLowFrequency , PassLowFrequency , PassGain , StopGain ) ,
143- ( IirFilterFamily . Butterworth , FrequencyPassType . BandPass ) => new ButterworthBandPass ( Dt , StopLowFrequency , PassLowFrequency , PassHighFrequency , StopHighFrequency , PassGain , StopGain ) ,
144- ( IirFilterFamily . Butterworth , FrequencyPassType . BandStop ) => new ButterworthBandStop ( Dt , PassLowFrequency , StopLowFrequency , StopHighFrequency , PassHighFrequency , PassGain , StopGain ) ,
141+ ( IirFilterFamily . Butterworth , FrequencyPassType . LowPass ) => new ButterworthLowPassSpecification ( Dt , PassLowFrequency , StopLowFrequency , PassGain , StopGain ) ,
142+ ( IirFilterFamily . Butterworth , FrequencyPassType . HighPass ) => new ButterworthHighPassSpecification ( Dt , StopLowFrequency , PassLowFrequency , PassGain , StopGain ) ,
143+ ( IirFilterFamily . Butterworth , FrequencyPassType . BandPass ) => new ButterworthBandPassSpecification ( Dt , StopLowFrequency , PassLowFrequency , PassHighFrequency , StopHighFrequency , PassGain , StopGain ) ,
144+ ( IirFilterFamily . Butterworth , FrequencyPassType . BandStop ) => new ButterworthBandStopSpecification ( Dt , PassLowFrequency , StopLowFrequency , StopHighFrequency , PassHighFrequency , PassGain , StopGain ) ,
145145
146- ( IirFilterFamily . Chebyshev , FrequencyPassType . LowPass ) => new ChebyshevLowPass ( Dt , PassLowFrequency , StopLowFrequency , PassGain , StopGain , ChebyshevType ) ,
147- ( IirFilterFamily . Chebyshev , FrequencyPassType . HighPass ) => new ChebyshevHighPass ( Dt , StopLowFrequency , PassLowFrequency , PassGain , StopGain , ChebyshevType ) ,
148- ( IirFilterFamily . Chebyshev , FrequencyPassType . BandPass ) => new ChebyshevBandPass ( Dt , StopLowFrequency , PassLowFrequency , PassHighFrequency , StopHighFrequency , PassGain , StopGain , ChebyshevType ) ,
149- ( IirFilterFamily . Chebyshev , FrequencyPassType . BandStop ) => new ChebyshevBandStop ( Dt , PassLowFrequency , StopLowFrequency , StopHighFrequency , PassHighFrequency , PassGain , StopGain , ChebyshevType ) ,
146+ ( IirFilterFamily . Chebyshev , FrequencyPassType . LowPass ) => new ChebyshevLowPassSpecification ( Dt , PassLowFrequency , StopLowFrequency , PassGain , StopGain , ChebyshevType ) ,
147+ ( IirFilterFamily . Chebyshev , FrequencyPassType . HighPass ) => new ChebyshevHighPassSpecification ( Dt , StopLowFrequency , PassLowFrequency , PassGain , StopGain , ChebyshevType ) ,
148+ ( IirFilterFamily . Chebyshev , FrequencyPassType . BandPass ) => new ChebyshevBandPassSpecification ( Dt , StopLowFrequency , PassLowFrequency , PassHighFrequency , StopHighFrequency , PassGain , StopGain , ChebyshevType ) ,
149+ ( IirFilterFamily . Chebyshev , FrequencyPassType . BandStop ) => new ChebyshevBandStopSpecification ( Dt , PassLowFrequency , StopLowFrequency , StopHighFrequency , PassHighFrequency , PassGain , StopGain , ChebyshevType ) ,
150150
151- ( IirFilterFamily . Elliptic , FrequencyPassType . LowPass ) => new EllipticLowPass ( Dt , PassLowFrequency , StopLowFrequency , PassGain , StopGain ) ,
152- ( IirFilterFamily . Elliptic , FrequencyPassType . HighPass ) => new EllipticHighPass ( Dt , StopLowFrequency , PassLowFrequency , PassGain , StopGain ) ,
153- ( IirFilterFamily . Elliptic , FrequencyPassType . BandPass ) => new EllipticBandPass ( Dt , StopLowFrequency , PassLowFrequency , PassHighFrequency , StopHighFrequency , PassGain , StopGain ) ,
154- ( IirFilterFamily . Elliptic , FrequencyPassType . BandStop ) => new EllipticBandStop ( Dt , PassLowFrequency , StopLowFrequency , StopHighFrequency , PassHighFrequency , PassGain , StopGain ) ,
151+ ( IirFilterFamily . Elliptic , FrequencyPassType . LowPass ) => new EllipticLowPassSpecification ( Dt , PassLowFrequency , StopLowFrequency , PassGain , StopGain ) ,
152+ ( IirFilterFamily . Elliptic , FrequencyPassType . HighPass ) => new EllipticHighPassSpecification ( Dt , StopLowFrequency , PassLowFrequency , PassGain , StopGain ) ,
153+ ( IirFilterFamily . Elliptic , FrequencyPassType . BandPass ) => new EllipticBandPassSpecification ( Dt , StopLowFrequency , PassLowFrequency , PassHighFrequency , StopHighFrequency , PassGain , StopGain ) ,
154+ ( IirFilterFamily . Elliptic , FrequencyPassType . BandStop ) => new EllipticBandStopSpecification ( Dt , PassLowFrequency , StopLowFrequency , StopHighFrequency , PassHighFrequency , PassGain , StopGain ) ,
155155
156156 _ => throw new InvalidOperationException ( $ "Неподдерживаемая комбинация Family={ Family } PassType={ PassType } ")
157157 } ;
158158
159+ /// <summary>Создать экземпляр фильтра</summary>
160+ /// <returns>Экземпляр IIR-фильтра</returns>
161+ public Filter Create ( ) => GetSpecification ( ) . CreateFilter ( ) ;
162+
159163 /// <summary>Создать несколько независимых экземпляров фильтра</summary>
160164 /// <param name="Count">Количество экземпляров</param>
161165 /// <returns>Перечисление экземпляров фильтра</returns>
@@ -446,9 +450,13 @@ static double Require(double? Value, string Name)
446450 } ;
447451 }
448452
453+ /// <summary>Получить объект спецификации фильтра</summary>
454+ /// <returns>Спецификация фильтра</returns>
455+ public IirFilterSpecification GetSpecification ( ) => ToSpecification ( ) . GetSpecification ( ) ;
456+
449457 /// <summary>Создать фильтр на основе DSL-спецификации</summary>
450458 /// <returns>Экземпляр IIR-фильтра</returns>
451- public Filter Create ( ) => ToSpecification ( ) . Create ( ) ;
459+ public Filter Create ( ) => GetSpecification ( ) . CreateFilter ( ) ;
452460}
453461
454462/// <summary>Построитель RC-фильтров</summary>
@@ -488,8 +496,12 @@ public readonly record struct IirRlcBuilder(double Dt)
488496/// <param name="CutoffFrequency">Частота среза</param>
489497public readonly record struct RcLowPassSpecificationBuilder ( double Dt , double CutoffFrequency )
490498{
499+ /// <summary>Получить объект спецификации фильтра</summary>
500+ /// <returns>Спецификация фильтра</returns>
501+ public RcLowPassSpecification GetSpecification ( ) => new ( Dt , CutoffFrequency ) ;
502+
491503 /// <summary>Создать экземпляр фильтра</summary>
492- public RCLowPass Create ( ) => new ( Dt , CutoffFrequency ) ;
504+ public RCLowPass Create ( ) => ( RCLowPass ) GetSpecification ( ) . CreateFilter ( ) ;
493505
494506 /// <summary>Создать несколько независимых экземпляров фильтра</summary>
495507 /// <param name="Count">Количество экземпляров</param>
@@ -514,8 +526,12 @@ public IEnumerable<RCLowPass> CreateMany(int Count)
514526/// <param name="CutoffFrequency">Частота среза</param>
515527public readonly record struct RcExponentialLowPassSpecificationBuilder ( double Dt , double CutoffFrequency )
516528{
529+ /// <summary>Получить объект спецификации фильтра</summary>
530+ /// <returns>Спецификация фильтра</returns>
531+ public RcExponentialLowPassSpecification GetSpecification ( ) => new ( Dt , CutoffFrequency ) ;
532+
517533 /// <summary>Создать экземпляр фильтра</summary>
518- public RCExponentialLowPass Create ( ) => new ( Dt , CutoffFrequency ) ;
534+ public RCExponentialLowPass Create ( ) => ( RCExponentialLowPass ) GetSpecification ( ) . CreateFilter ( ) ;
519535
520536 /// <summary>Создать несколько независимых экземпляров фильтра</summary>
521537 /// <param name="Count">Количество экземпляров</param>
@@ -540,8 +556,12 @@ public IEnumerable<RCExponentialLowPass> CreateMany(int Count)
540556/// <param name="CutoffFrequency">Частота среза</param>
541557public readonly record struct RcHighPassSpecificationBuilder ( double Dt , double CutoffFrequency )
542558{
559+ /// <summary>Получить объект спецификации фильтра</summary>
560+ /// <returns>Спецификация фильтра</returns>
561+ public RcHighPassSpecification GetSpecification ( ) => new ( Dt , CutoffFrequency ) ;
562+
543563 /// <summary>Создать экземпляр фильтра</summary>
544- public RCHighPass Create ( ) => new ( CutoffFrequency , Dt ) ;
564+ public RCHighPass Create ( ) => ( RCHighPass ) GetSpecification ( ) . CreateFilter ( ) ;
545565
546566 /// <summary>Создать несколько независимых экземпляров фильтра</summary>
547567 /// <param name="Count">Количество экземпляров</param>
@@ -567,8 +587,12 @@ public IEnumerable<RCHighPass> CreateMany(int Count)
567587/// <param name="Bandwidth">Полоса пропускания</param>
568588public readonly record struct RlcBandPassSpecificationBuilder ( double Dt , double ResonanceFrequency , double Bandwidth )
569589{
590+ /// <summary>Получить объект спецификации фильтра</summary>
591+ /// <returns>Спецификация фильтра</returns>
592+ public RlcBandPassSpecification GetSpecification ( ) => new ( Dt , ResonanceFrequency , Bandwidth ) ;
593+
570594 /// <summary>Создать экземпляр фильтра</summary>
571- public RLCBandPass Create ( ) => new ( ResonanceFrequency , Bandwidth , Dt ) ;
595+ public RLCBandPass Create ( ) => ( RLCBandPass ) GetSpecification ( ) . CreateFilter ( ) ;
572596
573597 /// <summary>Создать несколько независимых экземпляров фильтра</summary>
574598 /// <param name="Count">Количество экземпляров</param>
@@ -594,8 +618,12 @@ public IEnumerable<RLCBandPass> CreateMany(int Count)
594618/// <param name="Bandwidth">Полоса заграждения</param>
595619public readonly record struct RlcBandStopSpecificationBuilder ( double Dt , double ResonanceFrequency , double Bandwidth )
596620{
621+ /// <summary>Получить объект спецификации фильтра</summary>
622+ /// <returns>Спецификация фильтра</returns>
623+ public RlcBandStopSpecification GetSpecification ( ) => new ( Dt , ResonanceFrequency , Bandwidth ) ;
624+
597625 /// <summary>Создать экземпляр фильтра</summary>
598- public RLCBandStop Create ( ) => new ( ResonanceFrequency , Bandwidth , Dt ) ;
626+ public RLCBandStop Create ( ) => ( RLCBandStop ) GetSpecification ( ) . CreateFilter ( ) ;
599627
600628 /// <summary>Создать несколько независимых экземпляров фильтра</summary>
601629 /// <param name="Count">Количество экземпляров</param>
0 commit comments