Dr.Godfried-Willem RAES
Kursus Experimentele Muziek:
Boekdeel 2: Live Electronics
Hogeschool Gent : Departement
Muziek & Drama
2032
Passieve Filters
1.- Utility for the design of Butterworth 2nd
to 8th order LPF and HPF filters in T and Pi configurations using inductors
FILTERS.BAS (now translated to PowerBasic CC)
<Source code>
<Compiled Executable>
2.- Library functions for filter calculation
starting from given components
FILTMATH.BAS
To ease the calculation of networks
in the frequency domain, we wrote a library of Basic functions for the most
common networks composed of resistors, capacitors and coils (inductances).
The parameters to each function
are the circuit values for the components in the order as encountered when reading
the network left to right.
As is, the functions return a single
value for the output voltage only. It would be easy to adapt them such as to
return a phase value as well. However, Basic does not allow us the design of
functions returning typed variables. Hence, we would have to pass the phase
angle as an empty variable (called by reference).
All internal math makes use of
complex numbers and calls the COMPMATH library we designed for this purpose.
A separate module 'Filters.bas'
contains easy to use DOS-based design software for Butterworth Low- and Highpass
filters with 2 to 8 poles. Active filter design, using opamps is covered in
chapter 2033.html
FILTMATH.BI (Include file):
- ' procedures and functions in module FILTMATH
- ' complex math functions for filters:
(Ui/Uo relation)
- DECLARE FUNCTION LPFioT2# (Ui#, Ri#, Rl#,
L#, C#, Rb#, frq#)
- DECLARE FUNCTION LPFioT3# (Ui#, Ri#, Rl1#,
L1#, C#, Rl2#, L2#, Rb#, frq#)
- DECLARE FUNCTION HPFioT2# (Ui#, Ri#, C#,
Rl#, L#, Rb#, frq#)
- DECLARE FUNCTION HPFioT3# (Ui#, Ri#, C1#,
Rl#, L#, C2#, Rb#, frq#)
- DECLARE FUNCTION RLCpario# (Ui#, Ri#,
Rl#, L#, C#, Rb#, frq#)
- DECLARE FUNCTION RLCserio# (Ui#, Ri#,
Rl#, L#, C#, Rb#, frq#)
- DECLARE FUNCTION HPFioPi# (Ui#, Ri#, Rl#,
L#, C#, Rb#, frq#)
- DECLARE FUNCTION LPFioPi# (Ui#, Ri#, C#,
Rl#, L#, Rb#, frq#)
- ' to be done:
-
- DECLARE FUNCTION LPFioT4# (Ui#, Ri#, Rl#,
L#, C#, Rb#, frq#)
- DECLARE FUNCTION HPFioT4# (Ui#, Ri#, C#,
Rl#, L#, Rb#, frq#)
- DECLARE FUNCTION LPFioT5# (Ui#, Ri#, Rl#,
L#, C#, Rb#, frq#)
- DECLARE FUNCTION HPFioT5# (Ui#, Ri#, C#,
Rl#, L#, Rb#, frq#)
- DECLARE FUNCTION HPFioPi3# (Ui#, Ri#,
Rl#, L#, C#, Rb#, frq#)
- DECLARE FUNCTION LPFioPi3# (Ui#, Ri#,
C#, Rl#, L#, Rb#, frq#)
- DECLARE FUNCTION HPFioPi4# (Ui#, Ri#,
Rl#, L#, C#, Rb#, frq#)
- DECLARE FUNCTION LPFioPi4# (Ui#, Ri#,
C#, Rl#, L#, Rb#, frq#)
- DECLARE FUNCTION HPFioPi5# (Ui#, Ri#,
Rl#, L#, C#, Rb#, frq#)
- DECLARE FUNCTION LPFioPi5# (Ui#, Ri#,
C#, Rl#, L#, Rb#, frq#)
FILTMATH.BAS (Source-code file)
- ' Procedures & functions for electronic
filter circuit analysis in the
- ' frequency-domain. This modules requires
COMPMATH
- ' All these functions work in the frequency
domain and include C-R-L components
- ' Pure RC-filters are not implemented
yet.
- ' Component values are passed as double
precision numbers.
- REM $INCLUDE: 'COMPMATH.BI'
- REM $INCLUDE: 'FILTMATH.BI'
-
- FUNCTION HPFioPi# (Ui#, Ri#, Rl#, L#,
C#, Rb#, frq#)
- ' deze funktie retourneert Uo# in volgend
netwerk: (2-pole Pi-config)
- DIM R1 AS Polar, R2 AS Polar, L1 AS Polar,
C1 AS Polar, R3 AS Polar
- XcPol C#, frq#, C1
- XlPol L#, frq#, L1
- R1.mag = Ri#: R1.ang = 0
- R2.mag = Rl#: R2.ang = 0
- R3.mag = Rb#: R3.ang = 0
- AddPol R2, L1, L1: ' Rl# + Zl#
- DIM Zrc AS Polar
- AddPol C1, R3, Zrc
- DIM Zlrc AS Polar
- ParPol Zrc, L1, Zlrc
- DIM Teller AS Polar
- MulPol R3, Zlrc, Teller
- DIM Noem1 AS Polar
- AddPol R1, Zlrc, Noem1
- DIM Noemer AS Polar
- MulPol Noem1, Zrc, Noemer
-
- DIM Zrel AS Polar
- DivPol Teller, Noemer, Zrel
- HPFioPi# = Ui# * Zrel.mag
- END FUNCTION
-
- FUNCTION HPFioT2# (Ui#, Ri#, C#, Rl#,
L#, Rb#, frq#)
- ' returns Uo# for following network: (HPF-
2 pole T)
- DIM R1 AS Polar, C1 AS Polar, R2 AS Polar,
L1 AS Polar, R3 AS Polar
- XcPol C#, frq#, C1
- XlPol L#, frq#, L1
- R1.mag = Ri#: R1.ang = 0
- R2.mag = Rl#: R2.ang = 0
- R3.mag = Rb#: R3.ang = 0
- AddPol L1, R2, L1
- DIM Zrc AS Polar
- AddPol R1, C1, Zrc
- DIM Zrl AS Polar
- ParPol R3, L1, Zrl
- DIM Ztot AS Polar
- AddPol Zrc, Zrl, Ztot
- DIM Zrel AS Polar
- DivPol Zrl, Ztot, Zrel
- HPFioT2# = Ui# * Zrel.mag
- END FUNCTION
-
- FUNCTION HPFioT3# (Ui#, Ri#, Ct1#, Rl#,
L#, Ct2#, Rb#, frq#)
- ' returns Uo# for following network: (HPF-
3 pole T)
- DIM R1 AS Polar
- DIM C1 AS Polar: DIM C2 AS Polar
- DIM R2 AS Polar
- DIM L1 AS Polar
- DIM R3 AS Polar
- XcPol Ct1#, frq#, C1
- XcPol Ct2#, frq#, C2
- XlPol L#, frq#, L1
- R1.mag = Ri#: R1.ang = 0
- R2.mag = Rl#: R2.ang = 0
- R3.mag = Rb#: R3.ang = 0
- AddPol L1, R2, L1
- DIM Zrc AS Polar
- AddPol C1, R3, Zrc
- DIM Zlrc AS Polar
- ParPol L1, Zrc, Zlrc
- DIM Teller AS Polar
- MulPol R3, Zlrc, Teller
- DIM Noem1 AS Polar
- AddPol C2, R3, Noem1
- DIM Noem2 AS Polar
- AddPol R1, C1, Noem2
- DIM Noem3 AS Polar
- AddPol Noem2, Zlrc, Noem3
- DIM Noemer AS Polar
- MulPol Noem1, Noem3, Noemer
- DIM Zrel AS Polar
- DivPol Teller, Noemer, Zrel
- HPFioT3# = Ui# * Zrel.mag
-
- END FUNCTION
-
- FUNCTION LPFioPi# (Ui#, Ri#, C#, Rl#,
L#, Rb#, frq#)
- ' deze funktie retourneert Uo# in volgend
netwerk: (2-pole Pi-config)
- DIM R1 AS Polar,R2 AS Polar,L1 AS Polar,C1
AS Polar,R3 AS Polar
- DIM Zlr3 AS Polar,Zclr3 AS Polar,Teller
AS Polar,Noem1 AS Polar
- DIM Noemer AS Polar,Zrel AS Polar
- XcPol C#, frq#, C1
- XlPol L#, frq#, L1
- R1.mag = Ri#: R1.ang = 0
- R2.mag = Rl#: R2.ang = 0
- R3.mag = Rb#: R3.ang = 0
- AddPol R2, L1, L1: ' Rl# + Zl#
- AddPol L1, R3, Zlr3 ' Rl# + Zl# + Rb#
- ParPol C1, Zlr3, Zclr3 ' C par Rl# + Zl#
+ Rb#
- MulPol R3, Zclr3, Teller
- AddPol R1, Zclr3, Noem1
- MulPol Noem1, Zlr3, Noemer
- DivPol Teller, Noemer, Zrel
- LPFioPi# = Ui# * Zrel.mag
- END FUNCTION
-
- FUNCTION LPFioT2# (Ui#, Ri#, Rl#, L#,
C#, Rb#, frq#)
- ' deze funktie retourneert Uo# in volgend
netwerk: (2-pole T-config)
- DIM R1 AS Polar,R2 AS Polar,L1 AS Polar,C1
AS Polar,R3 AS Polar
- DIM Zrc AS Polar,Zr12l AS Polar,Ztot AS
Polar,Zrel AS Polar
- XcPol C#, frq#, C1
- XlPol L#, frq#, L1
- R1.mag = Ri#: R1.ang = 0
- R2.mag = Rl#: R2.ang = 0
- R3.mag = Rb#: R3.ang = 0
- AddPol R2, L1, L1: ' Rl# + Zl#
- AddPol R1, L1, Zr12l ' Ri# + Rl# + Zl#
- ParPol C1, R3, Zrc
- AddPol Zrc, Zr12l, Ztot
- DivPol Zrc, Ztot, Zrel
- LPFioT2# = Ui# * Zrel.mag
- END FUNCTION
-
- FUNCTION LPFioT3# (Ui#, Ri#, Rl1#, Ll1#,
C#, Rl2#, Ll2#, Rb#, frq#)
- algebraische afleiding:
- alle simbolen staan voor de
impedantie van
bij frq#.
- stel Zlr = (L2+Rl2)+ Rb
- stel Zclr = Par(C, Zlr) : parallel
geschakelde impedantie
- dan hebben we:
-
- Ui Ri + (L1+Rl1) + Zclr
- -- = --------------------
- Ui Zclr
- En:
-
- Ui Zlr Uo.Zlr
- --- = --- waaruit volgt: Ui= ------
- Uo Rb Rb
- En dus:
-
- Ui.R4 Ri +(Rl1+L1) + Zclr
- ----- = -------------------
- Uo.Zlr Zclr
-
- Uo.Zlr (Ri + (Rl1+L1)+ Zclr) = Ui.Rb .
Zclr
-
- Waaruit volgt:
- Rb . Zclr
- Uo = Ui ------------------------
- Zlr.(Ri+ (Rl1+L1)+Zclr)
-
-
- DIM R1 AS Polar: R1.mag = Ri#: R1.ang
= 0
- DIM L1 AS Polar: XlPol Ll1#, frq#, L1
- DIM C1 AS Polar: XcPol C#, frq#, C1
- DIM L2 AS Polar: XlPol Ll2#, frq#, L2
- DIM R3 AS Polar: R3.mag = Rb#: R3.ang
= 0
- DIM Rtmp AS Polar
- Rtmp.mag = Rl1#: Rtmp.ang = 0
- AddPol L1, Rtmp, L1
- Rtmp.mag = Rl2#
- AddPol L2, Rtmp, L2
- DIM Zlr AS Polar
- AddPol L2, R3, Zlr
- DIM Zclr AS Polar
- ParPol Zlr, C1, Zclr
- DIM Teller AS Polar
- AddPol R3, Zclr, Teller
- DIM Noem1 AS Polar
- AddPol R1, L2, Noem1
- AddPol Noem1, Zclr, Noem1
- DIM Noemer AS Polar
- MulPol Zlr, Noem1, Noemer
- DIM Zrel AS Polar
- DivPol Teller, Noemer, Zrel
- LPFioT3# = Ui# * Zrel.mag
- 'ang= Zrel.ang
- END FUNCTION
-
- FUNCTION RLCpario# (Ui#, Ri#, Rl#, L#,
C#, Rb#, frq#)
- ' returns Uo# for following network:
- DIM R1 AS Polar, C1 AS Polar, R2 AS Polar,
L1 AS Polar, R3 AS Polar
- XcPol C#, frq#, C1
- XlPol L#, frq#, L1
- R1.mag = Ri#: R1.ang = 0
- R2.mag = Rl#: R2.ang = 0
- R3.mag = Rb#: R3.ang = 0
- AddPol L1, R2, L1
- DIM Par AS Polar
- ParPol L1, C1, Par
- ParPol Par, R3, Par
- DIM Ztot AS Polar
- AddPol Par, R1, Ztot
- DIM Zrel AS Polar
- DivPol R1, Par, Zrel
- RLCpario# = Ui# * Zrel.mag
- END FUNCTION
-
- FUNCTION RLCserio# (Ui#, Ri#, Rl#, L#,
C#, Rb#, frq#)
- ' returns Uo# for following network:
- ' insert picture
- DIM R1 AS Polar, C1 AS Polar, R2 AS Polar,
L1 AS Polar, R3 AS Polar
- XcPol C#, frq#, C1
- XlPol L#, frq#, L1
- R1.mag = Ri#: R1.ang = 0
- R2.mag = Rl#: R2.ang = 0
- R3.mag = Rb#: R3.ang = 0
- AddPol L1, R2, L1
- DIM Ser AS Polar
- AddPol L1, C1, Ser
- DIM Par AS Polar
- ParPol Ser, R3, Par
- DIM Ztot AS Polar
- AddPol Par, R1, Ztot
- DIM Zrel AS Polar
- DivPol R1, Par, Zrel
- RLCserio# = Ui# * Zrel.mag
- END FUNCTION
Filedate: 970816 / Last update
2003-02-18