root/trunk/Modelica/Electrical/Analog/Examples/CauerLowPassSC.mo

Revision 1035, 25.2 kB (checked in by hubertus, 10 months ago)

removed all wrong occurrences of "uses" from the library (ticket:45)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1within Modelica.Electrical.Analog.Examples;
2model CauerLowPassSC
3  "Cauer low-pass filter with operational amplifiers and switched capacitors"
4model Rn "negative resistance"
5  parameter Modelica.SIunits.Time clock=1 "clock";
6  parameter Modelica.SIunits.Resistance R(min=Modelica.Constants.eps)=1
7      "Resistance";
8  Modelica.Blocks.Sources.BooleanPulse BooleanPulse1(period=clock) 
9    annotation (Placement(transformation(extent={{-10,50},{10,70}}, rotation=0)));
10  annotation (Diagram(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{
11              100,100}}),
12            graphics),
13    Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{100,
14              100}}), graphics={
15          Bitmap(extent={{-62,6},{-62,14}}, fileName=""),
16          Rectangle(
17            extent={{-80,32},{80,-30}},
18            pattern=LinePattern.None,
19            lineColor={0,0,255}),
20          Text(
21            extent={{-30,-40},{30,-72}},
22            lineColor={0,0,0},
23            textString="R=%R"),
24          Line(points={{-74,0},{-80,0},{-60,0}}, color={85,255,85}),
25          Line(points={{-80,-20},{-60,-20},{-60,-16},{-40,-8},{-4,-8}}, color={
26                85,255,85}),
27          Line(points={{80,0},{60,0}}, color={85,255,85}),
28          Line(points={{-60,2},{-60,-4}}, color={170,255,170}),
29          Line(points={{-4,2},{-4,-18}}, color={85,255,85}),
30          Line(points={{4,2},{4,-18}}, color={85,255,85}),
31          Text(
32            extent={{-60,80},{60,40}},
33            lineColor={0,0,255},
34            textString="%name"),
35          Line(points={{-92,0},{-80,0}}, color={85,85,255}),
36          Line(points={{90,0},{80,0},{80,0}}, color={85,85,255}),
37          Line(points={{4,-8},{40,-8},{60,-4}}, color={85,255,85}),
38          Line(points={{60,0},{60,-4}}, color={85,255,85}),
39          Line(points={{60,-16},{60,-20},{80,-20}}, color={85,255,85})}));
40
41  Modelica.Electrical.Analog.Basic.Capacitor Capacitor1(C=clock/R) 
42    annotation (Placement(transformation(extent={{-20,-20},{20,20}}, rotation=0)));
43  Modelica.Electrical.Analog.Ideal.IdealCommutingSwitch IdealCommutingSwitch1
44    annotation (Placement(transformation(
45          origin={-50,0},
46          extent={{-10,-10},{10,10}},
47          rotation=180)));
48  Modelica.Electrical.Analog.Ideal.IdealCommutingSwitch IdealCommutingSwitch2
49    annotation (Placement(transformation(extent={{40,-10},{60,10}}, rotation=0)));
50  Modelica.Electrical.Analog.Basic.Ground Ground1
51    annotation (Placement(transformation(extent={{-66,-32},{-54,-20}}, rotation=
52             0)));
53  Modelica.Electrical.Analog.Basic.Ground Ground2
54    annotation (Placement(transformation(extent={{54,-32},{66,-20}}, rotation=0)));
55  Modelica.Electrical.Analog.Interfaces.NegativePin n1
56    annotation (Placement(transformation(extent={{-112,-10},{-92,10}}, rotation=
57             0)));
58  Modelica.Electrical.Analog.Interfaces.NegativePin n2
59    annotation (Placement(transformation(extent={{90,-8},{110,12}}, rotation=0)));
60equation
61  connect(IdealCommutingSwitch1.p,Capacitor1. p) annotation (Line(points={{-40,
62            -1.22465e-015},{-42,-1.22465e-015},{-44,0},{-20,0}}, color={0,0,255}));
63  connect(Capacitor1.n,IdealCommutingSwitch2. p) 
64    annotation (Line(points={{20,0},{40,0}}, color={0,0,255}));
65  connect(IdealCommutingSwitch2.control,BooleanPulse1. y) annotation (Line(
66          points={{50,8},{50,30},{20,30},{20,60},{11,60}}, color={255,0,255}));
67  connect(IdealCommutingSwitch1.control,BooleanPulse1. y) annotation (Line(
68          points={{-50,-8},{-50,30},{20,30},{20,60},{11,60}}, color={255,0,255}));
69  connect(Ground2.p,IdealCommutingSwitch2. n2) annotation (Line(points={{60,-20},
70            {60,0}}, color={0,0,255}));
71  connect(IdealCommutingSwitch2.n1,n2)  annotation (Line(
72        points={{60,5},{80,5},{80,2},{100,2}},
73        color={0,0,255}));
74  connect(n1, IdealCommutingSwitch1.n2) annotation (Line(
75        points={{-102,0},{-81,0},{-81,1.22465e-015},{-60,1.22465e-015}},
76        color={0,0,255}));
77  connect(Ground1.p, IdealCommutingSwitch1.n1) annotation (Line(
78        points={{-60,-20},{-60,-5}},
79        color={0,0,255}));
80end Rn;
81
82model Rp "positive resistance"
83
84  annotation (Diagram(coordinateSystem(
85            preserveAspectRatio=true, extent={{-100,-100},{100,100}}),
86                                                     graphics),
87    Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{100,
88              100}}), graphics={
89          Bitmap(extent={{-62,4},{-62,12}}, fileName=""),
90          Rectangle(
91            extent={{-80,30},{80,-32}},
92            pattern=LinePattern.None,
93            lineColor={0,0,255}),
94          Line(points={{-92,0},{-80,0}}, color={85,85,255}),
95          Line(points={{80,0},{92,0}}, color={85,85,255}),
96          Text(
97            extent={{-40,-40},{32,-72}},
98            lineColor={0,0,0},
99            textString="R=%R"),
100          Line(points={{-74,0},{-80,0},{-60,0}}, color={85,255,85}),
101          Line(points={{-80,-20},{-60,-20},{-60,-16},{-40,-10},{-4,-10}}, color=
102               {85,255,85}),
103          Line(points={{4,-10},{40,-10},{60,-16},{60,-20},{80,-20}}, color={85,
104                255,85}),
105          Line(points={{80,0},{60,0}}, color={85,255,85}),
106          Line(points={{60,0},{60,-4}}, color={85,255,85}),
107          Line(points={{-60,0},{-60,-6}}, color={170,255,170}),
108          Line(points={{-4,0},{-4,-20}}, color={85,255,85}),
109          Line(points={{4,0},{4,-20}}, color={85,255,85}),
110          Text(
111            extent={{-60,80},{60,40}},
112            lineColor={0,0,255},
113            textString="%name")}));
114  parameter Modelica.SIunits.Time clock=1 "clock";
115  parameter Modelica.SIunits.Resistance R(min=Modelica.Constants.eps)=1
116      "Resistance";
117  Modelica.Blocks.Sources.BooleanPulse BooleanPulse1(period=clock) 
118    annotation (Placement(transformation(extent={{-10,50},{10,70}}, rotation=0)));
119  Modelica.Electrical.Analog.Basic.Capacitor Capacitor1(C=clock/R) 
120    annotation (Placement(transformation(extent={{-20,-20},{20,20}}, rotation=0)));
121  Modelica.Electrical.Analog.Ideal.IdealCommutingSwitch IdealCommutingSwitch1
122    annotation (Placement(transformation(
123          origin={-50,0},
124          extent={{-10,-10},{10,10}},
125          rotation=180)));
126  Modelica.Electrical.Analog.Ideal.IdealCommutingSwitch IdealCommutingSwitch2
127    annotation (Placement(transformation(extent={{40,-10},{60,10}}, rotation=0)));
128  Modelica.Electrical.Analog.Basic.Ground Ground1
129    annotation (Placement(transformation(
130          origin={-59,46},
131          extent={{-5,-6},{5,6}},
132          rotation=180)));
133  Modelica.Electrical.Analog.Basic.Ground Ground2
134    annotation (Placement(transformation(extent={{56,-44},{66,-32}}, rotation=0)));
135  Modelica.Electrical.Analog.Interfaces.NegativePin n1
136    annotation (Placement(transformation(extent={{-112,-10},{-92,10}}, rotation=
137             0)));
138  Modelica.Electrical.Analog.Interfaces.NegativePin n2
139    annotation (Placement(transformation(extent={{90,-8},{110,12}}, rotation=0)));
140equation
141  connect(IdealCommutingSwitch1.p, Capacitor1.p) annotation (Line(points={{-40,
142            -1.22465e-015},{-42,-1.22465e-015},{-44,0},{-20,0}}, color={0,0,255}));
143  connect(Capacitor1.n, IdealCommutingSwitch2.p) 
144    annotation (Line(points={{20,0},{40,0}}, color={0,0,255}));
145  connect(IdealCommutingSwitch2.control, BooleanPulse1.y) annotation (Line(
146          points={{50,8},{50,30},{20,30},{20,60},{11,60}}, color={255,0,255}));
147  connect(IdealCommutingSwitch1.control, BooleanPulse1.y) annotation (Line(
148          points={{-50,-8},{-50,30},{20,30},{20,60},{11,60}}, color={255,0,255}));
149  connect(Ground1.p, IdealCommutingSwitch1.n2) annotation (Line(points={{-59,40},
150            {-60,40},{-60,1.22465e-015}}, color={0,0,255}));
151  connect(Ground2.p, IdealCommutingSwitch2.n2) annotation (Line(points={{61,-32},
152            {60,-32},{60,0}}, color={0,0,255}));
153  connect(IdealCommutingSwitch1.n1, n1) annotation (Line(points={{-60,-5},{-99,
154            -5},{-99,0},{-102,0}}, color={0,0,255}));
155  connect(IdealCommutingSwitch2.n1, n2) annotation (Line(
156        points={{60,5},{80,5},{80,2},{100,2}},
157        color={0,0,255}));
158end Rp;
159  annotation (Diagram(coordinateSystem(preserveAspectRatio=true, extent={{-250,-200},{
160            250,200}}), graphics={Text(
161          extent={{-100,180},{94,140}},
162          textString="CauerLowPassSC",
163          lineColor={0,0,255})}),
164    experiment(StopTime=60, NumberOfIntervals=1500),
165    Documentation(revisions="<html>
166<ul>
167<li><i>January 13, 2006</i> 
168       by Christoph Clauss<br>
169       included into Modelica Standard Library</li>
170<li><i>September 15, 2005</i>
171       by by Peter Trappe designed and by Teresa Schlegel<br>
172       initially modelled.</li>
173</ul>
174</html>", info="<html>
175The example CauerLowPassSC is a low-pass-filter of the fifth order. It is realized
176using an switched-capacitor network with operational amplifiers. The voltage source V is the input voltage (step),
177and the OP5.out.v is the filter output voltage. The pulse response is calculated.
178<p>
179This model is identical to the CauerLowPassAnalog example, but inverting. To get the same response
180as that of the CauerLowPassAnalog example, a negative voltage step is used as input.
181<p>
182This model is identical to the CauerLowPassOPV example. But the resistors are realized by
183switched capacitors. There are two such resistors Rp (of value +1), and Rn (of value -1).
184In this models the switching clock source is included. In a typical switched capacitor circuit
185there would be a central clock source.
186<p>
187The simulation end time should be 60. Please plot both V.v (which is the inverted input voltage) and OP5.p.v (output voltage). Compare this result with the CauerLowPassAnalog result.
188<p>
189Due to the recharging of the capacitances after switching the performance of simulation is not as good as in the CauerLowPassOPV example.
190<p>
191</html>"),
192    Icon(coordinateSystem(preserveAspectRatio=true, extent={{-250,-200},{250,
193            200}}), graphics={
194        Rectangle(
195          extent={{-100,-100},{80,50}},
196          fillColor={255,255,255},
197          fillPattern=FillPattern.Solid,
198          lineColor={0,0,255}),
199        Polygon(
200          points={{-100,50},{-80,70},{100,70},{80,50},{-100,50}},
201          fillColor={255,255,255},
202          fillPattern=FillPattern.Solid,
203          lineColor={0,0,255}),
204        Polygon(
205          points={{100,70},{100,-80},{80,-100},{80,50},{100,70}},
206          fillColor={255,255,255},
207          fillPattern=FillPattern.Solid,
208          lineColor={0,0,255}),
209        Text(
210          extent={{-96,3},{77,-49}},
211          lineColor={0,0,255},
212          textString="Example"),
213        Text(
214          extent={{-120,132},{120,73}},
215          lineColor={255,0,0},
216          textString="%name")}));
217
218  parameter Modelica.SIunits.Capacitance l1=1.304 "filter coefficient i1";
219  parameter Modelica.SIunits.Capacitance l2=0.8586 "filter coefficient i2";
220  parameter Modelica.SIunits.Capacitance c1=1.072 "filter coefficient c1";
221  parameter Modelica.SIunits.Capacitance c2=1/(1.704992^2*l1)
222    "filter coefficient c2";
223  parameter Modelica.SIunits.Capacitance c3=1.682 "filter coefficient c3";
224  parameter Modelica.SIunits.Capacitance c4=1/(1.179945^2*l2)
225    "filter coefficient c4";
226  parameter Modelica.SIunits.Capacitance c5=0.7262 "filter coefficient c5";
227  Modelica.Electrical.Analog.Basic.Capacitor C1(C=c1 + c2) 
228    annotation (Placement(transformation(extent={{-193,30},{-173,50}}, rotation=
229           0)));
230  Modelica.Electrical.Analog.Basic.Capacitor C2(C=c2) 
231    annotation (Placement(transformation(extent={{-241,-70},{-221,-50}},
232          rotation=0)));
233  Modelica.Electrical.Analog.Basic.Capacitor C3(C=l1) 
234    annotation (Placement(transformation(extent={{-91,30},{-71,50}}, rotation=0)));
235  Modelica.Electrical.Analog.Basic.Capacitor C4(C=c4) 
236    annotation (Placement(transformation(extent={{-31,50},{-11,70}}, rotation=0)));
237  Modelica.Electrical.Analog.Basic.Capacitor C5(C=c2) 
238    annotation (Placement(transformation(extent={{-31,-100},{-11,-80}},
239          rotation=0)));
240  Modelica.Electrical.Analog.Ideal.IdealOpAmp3Pin Op1
241    annotation (Placement(transformation(extent={{-201,-50},{-161,-10}},
242          rotation=0)));
243  Modelica.Electrical.Analog.Basic.Ground G
244    annotation (Placement(transformation(extent={{-189,-76},{-175,-60}},
245          rotation=0)));
246  Modelica.Electrical.Analog.Ideal.IdealOpAmp3Pin Op2
247    annotation (Placement(transformation(extent={{-101,-50},{-61,-10}},
248          rotation=0)));
249  Modelica.Electrical.Analog.Ideal.IdealOpAmp3Pin Op3
250    annotation (Placement(transformation(extent={{5,-50},{45,-10}}, rotation=0)));
251  Modelica.Electrical.Analog.Basic.Ground G1
252    annotation (Placement(transformation(extent={{-88,-76},{-74,-60}}, rotation=
253           0)));
254  Modelica.Electrical.Analog.Basic.Capacitor C6(C=c2 + c3 + c4) 
255    annotation (Placement(transformation(extent={{8,30},{28,50}}, rotation=0)));
256  Modelica.Electrical.Analog.Ideal.IdealOpAmp3Pin Op4
257    annotation (Placement(transformation(extent={{99,-50},{139,-10}}, rotation=
258            0)));
259  Modelica.Electrical.Analog.Ideal.IdealOpAmp3Pin Op5
260    annotation (Placement(transformation(extent={{199,-50},{239,-10}}, rotation=
261           0)));
262  Modelica.Electrical.Analog.Basic.Capacitor C7(C=l2) 
263    annotation (Placement(transformation(extent={{109,30},{129,50}}, rotation=0)));
264  Modelica.Electrical.Analog.Basic.Capacitor C8(C=c4) 
265    annotation (Placement(transformation(extent={{159,-130},{179,-110}},
266          rotation=0)));
267  Modelica.Electrical.Analog.Basic.Capacitor C9(C=c4 + c5) 
268    annotation (Placement(transformation(extent={{207,10},{227,30}}, rotation=0)));
269protected
270  Modelica.Electrical.Analog.Interfaces.NegativePin n1
271    annotation (Placement(transformation(extent={{-215,-22},{-211,-18}},
272          rotation=0)));
273protected
274  Modelica.Electrical.Analog.Interfaces.NegativePin n2
275    annotation (Placement(transformation(extent={{-215,18},{-211,22}}, rotation=
276           0)));
277protected
278  Modelica.Electrical.Analog.Interfaces.NegativePin n3
279    annotation (Placement(transformation(extent={{-215,38},{-211,42}}, rotation=
280           0)));
281protected
282  Modelica.Electrical.Analog.Interfaces.NegativePin n4
283    annotation (Placement(transformation(
284        origin={-161,40},
285        extent={{2,2},{-2,-2}},
286        rotation=180)));
287protected
288  Modelica.Electrical.Analog.Interfaces.NegativePin n5
289    annotation (Placement(transformation(extent={{-115,-32},{-111,-28}},
290          rotation=0)));
291protected
292  Modelica.Electrical.Analog.Interfaces.PositivePin p1
293    annotation (Placement(transformation(extent={{-155,-122},{-149,-118}},
294          rotation=0)));
295protected
296  Modelica.Electrical.Analog.Interfaces.NegativePin n6
297    annotation (Placement(transformation(extent={{-63,38},{-59,42}}, rotation=0)));
298protected
299  Modelica.Electrical.Analog.Interfaces.NegativePin n7
300    annotation (Placement(transformation(extent={{-7,-32},{-3,-28}}, rotation=0)));
301protected
302  Modelica.Electrical.Analog.Interfaces.NegativePin n8
303    annotation (Placement(transformation(extent={{-7,18},{-3,22}}, rotation=0)));
304protected
305  Modelica.Electrical.Analog.Interfaces.PositivePin p2
306    annotation (Placement(transformation(extent={{-7,38},{-3,42}}, rotation=0)));
307protected
308  Modelica.Electrical.Analog.Interfaces.PositivePin out1
309    annotation (Placement(transformation(extent={{43,-122},{47,-118}}, rotation=
310           0)));
311protected
312  Modelica.Electrical.Analog.Interfaces.PositivePin p3
313    annotation (Placement(transformation(extent={{57,78},{61,82}}, rotation=0)));
314protected
315  Modelica.Electrical.Analog.Interfaces.NegativePin n9
316    annotation (Placement(transformation(extent={{85,18},{89,22}}, rotation=0)));
317protected
318  Modelica.Electrical.Analog.Interfaces.NegativePin n10
319    annotation (Placement(transformation(extent={{85,-32},{89,-28}}, rotation=0)));
320protected
321  Modelica.Electrical.Analog.Interfaces.NegativePin n11
322    annotation (Placement(transformation(extent={{137,38},{141,42}}, rotation=0)));
323public
324  Modelica.Electrical.Analog.Basic.Ground G2
325    annotation (Placement(transformation(extent={{11,-76},{25,-60}}, rotation=0)));
326protected
327  Modelica.Electrical.Analog.Interfaces.NegativePin n12
328    annotation (Placement(transformation(extent={{237,58},{241,62}}, rotation=0)));
329protected
330  Modelica.Electrical.Analog.Interfaces.NegativePin n13
331    annotation (Placement(transformation(extent={{237,18},{241,22}}, rotation=0)));
332protected
333  Modelica.Electrical.Analog.Interfaces.PositivePin p4
334    annotation (Placement(transformation(extent={{187,18},{193,22}}, rotation=0)));
335protected
336  Modelica.Electrical.Analog.Interfaces.NegativePin n14
337    annotation (Placement(transformation(extent={{187,-32},{193,-28}}, rotation=
338           0)));
339public
340  Modelica.Electrical.Analog.Basic.Ground G3
341    annotation (Placement(transformation(extent={{112,-76},{126,-60}}, rotation=
342           0)));
343  Modelica.Electrical.Analog.Basic.Ground G4
344    annotation (Placement(transformation(extent={{212,-76},{226,-60}}, rotation=
345           0)));
346  Modelica.Electrical.Analog.Sources.StepVoltage V(startTime=1) 
347    annotation (Placement(transformation(
348        origin={-241,-150},
349        extent={{-10,-10},{10,10}},
350        rotation=90)));
351  Modelica.Electrical.Analog.Basic.Ground Ground1
352    annotation (Placement(transformation(extent={{-247,-182},{-235,-170}},
353          rotation=0)));
354  Rn R4(clock=0.1) annotation (Placement(transformation(extent={{-140,-40},{
355            -120,-20}}, rotation=0)));
356  Rn R5(clock=0.1) annotation (Placement(transformation(extent={{-140,-80},{
357            -120,-60}}, rotation=0)));
358  Rn R8(clock=0.1) annotation (Placement(transformation(extent={{60,10},{80,30}},
359          rotation=0)));
360  Rn R9(clock=0.1) annotation (Placement(transformation(extent={{60,-40},{80,
361            -20}}, rotation=0)));
362  Rp R1(clock=0.1) annotation (Placement(transformation(extent={{-240,-30},{
363            -220,-10}}, rotation=0)));
364  Rp R2(clock=0.1) annotation (Placement(transformation(extent={{-240,10},{-220,
365            30}}, rotation=0)));
366  Rp R3(clock=0.1) annotation (Placement(transformation(extent={{-200,70},{-180,
367            90}}, rotation=0)));
368  Rp Rp1(clock=0.1) annotation (Placement(transformation(extent={{-32,10},{-12,
369            30}}, rotation=0)));
370  Rp R7(clock=0.1) annotation (Placement(transformation(extent={{-32,-40},{-12,
371            -20}}, rotation=0)));
372  Rp R10(clock=0.1) annotation (Placement(transformation(extent={{160,-40},{180,
373            -20}}, rotation=0)));
374  Rp R11(clock=0.1) annotation (Placement(transformation(extent={{208,50},{228,
375            70}}, rotation=0)));
376equation
377  connect(Op1.in_p,G. p) annotation (Line(points={{-201,-40},{-201,-50},{-181,
378          -50},{-181,-60},{-182,-60}}, color={0,0,255}));
379  connect(G1.p,Op2. in_p) annotation (Line(points={{-81,-60},{-81,-50},{-101,
380          -50},{-101,-40}}, color={0,0,255}));
381  connect(n1,Op1. in_n) annotation (Line(points={{-213,-20},{-201,-20}}, color=
382          {0,0,255}));
383  connect(C2.n,n1)  annotation (Line(points={{-221,-60},{-213,-60},{-213,-20}},
384        color={0,0,255}));
385  connect(n1,n2) 
386    annotation (Line(points={{-213,-20},{-213,20}}, color={0,0,255}));
387  connect(n2,n3) 
388    annotation (Line(points=