My Project  0.0.16
QUCS Mapping
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
lc_filter.h
Go to the documentation of this file.
1 /***************************************************************************
2  lc_filter.h
3  -------------
4  begin : Wed Mar 02 2005
5  copyright : (C) 2005 by Toyoyuki Ishikawa
6  (C) 2005 by Vincent
7  (C) 2005 by Michael Margraf
8  (C) 2005 by Stefan Jahn
9  ***************************************************************************/
10 
11 /***************************************************************************
12  * *
13  * This program is free software; you can redistribute it and/or modify *
14  * it under the terms of the GNU General Public License as published by *
15  * the Free Software Foundation; either version 2 of the License, or *
16  * (at your option) any later version. *
17  * *
18  ***************************************************************************/
19 
20 #ifndef LC_FILTER_H
21 #define LC_FILTER_H
22 
23 #define CLASS_LOWPASS 0
24 #define CLASS_HIGHPASS 1
25 #define CLASS_BANDPASS 2
26 #define CLASS_BANDSTOP 3
27 
28 #define TYPE_BESSEL 0
29 #define TYPE_BUTTERWORTH 1
30 #define TYPE_CHEBYSHEV 2
31 #define TYPE_CAUER 3
32 
33 #include <math.h>
34 
35 #ifdef __MINGW32__
36 #define atanh(x) (0.5 * log((1.0 + (x)) / (1.0 - (x))))
37 #define asinh(x) log((x) + sqrt((x) * (x) + 1.0))
38 #define acosh(x) log((x) + sqrt((x) * (x) - 1.0))
39 #endif
40 
41 struct tFilter {
42  int Type;
43  int Class;
44  int Order;
45  double Ripple; // in dB
46  double Impedance;
47  double Frequency;
48  double Frequency2;
49  double Attenuation;
50  double Frequency3;
51 };
52 
53 
54 class QString;
55 
56 class LC_Filter {
57 public:
58  LC_Filter();
59  ~LC_Filter();
60 
61  static QString* createSchematic(tFilter*);
62 
63 private:
64  static QString num2str(double);
65  static double BesselValue(int, int);
66  static double ButterworthValue(int, int);
67  static double ChebyshevValue(int, int, double);
68 };
69 
70 #endif