-
Notifications
You must be signed in to change notification settings - Fork 164
/
Spice3.mo
10552 lines (9576 loc) · 441 KB
/
Spice3.mo
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
within Modelica.Electrical;
package Spice3 "Library for components of the Berkeley SPICE3 simulator"
extends Modelica.Icons.Package;
package UsersGuide "User's Guide"
extends Modelica.Icons.Information;
class Overview "Overview"
extends Modelica.Icons.Information;
annotation (Documentation(info="<html>
<h4>Overview of Spice3 library</h4>
<p>The Spice3 library is a Modelica library that contains some models of the Berkeley SPICE3 analog simulator.</p>
<p><u>General information about the analog simulator SPICE3 </u></p>
<p>SPICE (Simulation Program with Integrated Circuit Emphasis) is a simulator for analog electrical circuits. It was developed as one of the first analog simulators in the university of Berkeley. SPICE netlists, which contain the circuit that shall be simulated, are a de-facto-standard up to now. For nearly every electrical circuit a SPICE netlist exists. Today the current version of SPICE is SPICE3e/SPICE3f. SPICE contains basic elements (resistor, inductor, capacitor), sources and semiconductor devices (diode, bipolar transistors, junction field effect transistors, MOS-field effect transistors) as well as models of lines. Out of this offered pool of elements, the circuits that shall be simulated are build as SPICE netlists.</p>
<p><u>The Spice3-library for Modelica</u></p>
<p>The Spice3 library was extracted from original SPICE3 C++ code. To be sure the Modelica models are correct the simulation results were compared to SPICE3. This way was chosen since SPICE3 is the only open source Spice simulator.</p>
<p>The Spice3-library was built in accordance to the model structure in SPICE. It contains the following packages:</p>
<ul>
<li>Examples</li>
<li>Basic (R, C, L, controlled sources)</li>
<li>Semiconductors (MOS (P, N), BJT(NPN PNP), Diode, semiconductor resistor)</li>
<li>Sources (constant, sinusoidal, exponential, pulse, piece wise linear, single-frequency FM, respectively for V and I)</li>
<li>Additionals (useful features from SPICE2)</li>
<li>Interfaces</li>
<li>Internal (functions and data needed to model the semiconductor devices)<br></li>
</ul>
<p>Since the semiconductor models, especially MOS and BJT, are very complex models, many functions, data and parameters were needed for their description. Therefore a special Package called Internal was created that contains all the functions and records with data and parameters that are needed for the semiconductor models. It is not necessary that a user of the library works inside this package, so it is not for user access. The package Additionals is also a special one. It is not part of the original SPICE3. Nevertheless it contains useful models or features like the polynomial sources of SPICE2 that are often asked for.</p>
<p>There are many commercial SPICE simulators (PSPICE, NgSPICE, HSPICE, ...) which are derived from the Berkeley SPICE or are in some relation to it. Netlists of such SPICE derivatives can differ from Berkeley SPICE3 netlists. This has to be taken into account if netlists (their parameter names) are used with this package.</p>
</html>"));
end Overview;
class Useofsemiconductors "Use of Semiconductors"
extends Modelica.Icons.Information;
annotation (Documentation(info="<html>
<p>Within the semiconductor devices SPICE3 differentiates between technology parameters and device parameters. Device parameters can be chosen for every single model instance, e.g., the channel length of a transistor. Technology parameters which are specified in a model card (.model) are adjustable for more than one element simultaneously, e.g. the type of transistors. As usually done in Modelica the parameters of the modelcard can be set in a parameter list.</p>
<p>To parametrize more than one model two ways are possible:</p>
<ol>
<li>Apart record:<br>For each transistor in the circuit a record with the technology parameters is made available as an instance of the record modelcardMOS. In the example<br>"inverterApartRecord" this way is explained more in detail.</li>
<li>Extended model:<br>For each set of technology parameters a apart model has to be defined. In the example "inverterExtendedModel" this way is explained more in detail.</li>
</ol>
</html>"));
end Useofsemiconductors;
class Spicenetlist "SPICE3 netlists"
extends Modelica.Icons.Information;
annotation (Documentation(info="<html>
<h4>Translation of SPICE3 netlists to Modelica </h4>
<p>Since SPICE3 netlists are available for nearly every electrical circuit a desirable feature would be to translate SPICE3 netlists to Modelica. With the help of the example of an inverter circuits a possible way of the translation will be explained.</p>
<table cellspacing=\"0\" cellpadding=\"0\" border=\"1\">
<caption>Table 1: Translation of the SPICE3 netlist (left side) to Modelica (right side)</caption>
<tr>
<td><blockquote><pre>
inverter
Mp1 11 1 13 11 MPmos
Mp2 11 13 2 11 MPmos
Mn1 13 1 0 0 MNmos
Mn2 2 13 0 0 MNmos
Vgate 1 0 PULSE(0 5 2s 1s)
Vdrain 11 0 PULSE(0 5 0s 1s)
.model MPmos PMOS (gamma=0.37)
.model MNmos NMOS (gamma=0.37 lambda=0.02)
.tran 0.01 5
.end
</pre></blockquote></td>
<td><blockquote><pre>
model inverter
Spice3.Basic.Ground g;
Spice3…M Mp1(mtype=true, M(GAMMA=0.37));
Spice3…M Mp2(mtype=true, M(GAMMA=0.37));
Spice3…M Mn1(M(LAMBDA=0.02, GAMMA=0.37));
Spice3…M Mn2(p(LAMBDA=0.02, GAMMA=0.37));
Spice3…V_pulse vdrain(V1=0, V2=5, TD=0, TR=1);
Spice3…V_pulse vdrain(V1=0, V2=5, TD=0, TR=1);
Spice3.Interfaces.Pin p_in, p_out;
protected
Spice3.Interfaces.Pin n0, n1, n2, n11, n13;
equation
connect(p_in, n1); connect(p_out, n2);
connect(g.p, n0);
connect(vdrain.n,n0); connect(vdrain.p,n11);
connect(Mp1.B,n11); connect(Mp1.D, n11);
connect(Mp1.G, n1); connect(Mp1.S, n13);
connect(Mp2.B,n11); connect(Mp2.D, n11);
connect(Mp2.G, n13); connect(Mp2.S, n2);
connect(Mn1.B,n0); connect(Mn1.D, n13);
connect(Mn1.G, n1); connect(Mn1.S, n0);
connect(Mn2.B,n0); connect(Mn2.D, n2);
connect(Mn2.G, n13); connect(Mn2.S, n0);
end inverter;
</pre></blockquote></td>
</tr>
</table>
<p>Given is a SPICE3 netlist that contains two inverter circuits. This netlist should be translated to Modelica in which the input voltage of the first inverter (node number 1) and the output voltage of the second inverter (node number 2) will later be connected with the surrounding circuit.</p>
<p>The following steps are necessary:</p>
<ol>
<li>A name for the Modelica model has to be chosen. It could be taken from the first line of the SPICE3 netlist.</li>
<li>The ground node has to be instantiated (i.e., <code>Spice3.Basic.Ground</code>).</li>
<li>For each component of the netlist an instant has to be created. According to the first letter of the SPICE3 model identifier in the netlist, the needed component has to be chosen, instantiated and according to the given parameters parametrized, e.g., the SPICE lineVdrain 11 0 PULSE(0 5 0 1)becomes the following Modelica line: <code>Spice3…V_pulse vdrain(V1=0, V2=5, TD=0, TR=1);</code></li>
<li>For all node numbers an internal pin has to be created. For example the node number 2 from the SPICE3 netlist becomes
<blockquote><pre>
protected Spice3.Interfaces.Pin n2;
</pre></blockquote>
in Modelica. The code letter (here <code>n</code>) is needed because a single number is no name in Modelica.</li>
<li>According to the netlist the internal pins have to be connected with the components, e.g., <code>connect(Mp1.D, n11)</code>.</li>
<li>In the last step the external pins have to be allocated ant connected to the according internal pin. In Table 1 this is done as follows:
<blockquote><pre>
Spice3.Interfaces.Pin p_in, p_out;
connect(p_in, n1);
connect(p_out, n2);
</pre></blockquote>
</li>
</ol>
</html>"));
end Spicenetlist;
class NamingPrinciple "Naming principle"
extends Modelica.Icons.Information;
annotation (Documentation(info="<html>
<p>In SPICE3 we have a predefined model pool. Each model device has got a code letter (e.g., resistor - R). In analogy to the SPICE3 models the models of the Spice3 library also got the according code letter in their names. The following examples shows the relationship:</p>
<p>A typical SPICE3 line could be:</p>
<p><strong>C</strong>1 3 2 1pF</p>
<p>The first letter is the code letter (here <strong>C</strong>). It specifies the type of the model component (here capacitance). To see the analogy to the SPICE3 models in the Spice3 library the transformed capacitance has got the name <strong>C</strong>_Capacitance. According to that naming rule the components of the Spice3 library have the following names (the first letter is the code letter that has to be used in SPICE3):</p>
<ul>
<li>R_Resistor</li>
<li>C_Capacitance</li>
<li>L_Inductor</li>
<li>E_VCV, E_VCV_POLY</li>
<li>G_VCC, G_VCC_POLY</li>
<li>H_CCV, H_CCV_POLY</li>
<li>F_CCC, F_CCC_POLY</li>
<li>M_PMOS</li>
<li>M_NMOS</li>
<li>Q_NPNBJT</li>
<li>Q_PNPBJT</li>
<li>D_Diode</li>
<li>V_constant, I_constant</li>
<li>V_sin, I_sin</li>
<li>V_exp, I_exp</li>
<li>V_pulse, I_pulse</li>
<li>V_pwl, I_pwl</li>
<li>V_sffm, I_sffm<br><strong><br></strong></li>
</ul>
</html>"));
end NamingPrinciple;
class ParameterHandling "Parameter handling"
extends Modelica.Icons.Information;
annotation (Documentation(info="<html>
<p>In SPICE3 it is important to know whether a parameter was set by the user or not because the calculation of some values depends on that information and can be different. Since in Modelica there is no possibility to check that, a circumvention was chosen. The relevant parameters get an unrealistic value (-1e40) as their default value. Within a function it is checked if the parameter has still got this value (the parameter was not set by the user) of if it has a new value (parameter was set by the user).</p>
</html>"));
end ParameterHandling;
class Literature "Literature"
extends Modelica.Icons.References;
annotation (Documentation(info="<html>
<table cellspacing=\"0\" cellpadding=\"2\" border=\"0\"><tr>
<td><p>[Böhme2009]</p></td>
<td><p>S. Böhme, K. Majetta, C. Clauss, P. Schneider, "Spice3 Modelica Library," <em>7th Modelica Conference</em>, Como, Italy (2009)</p></td>
<td></td>
</tr>
<tr>
<td><p>[Antognetti1988]</p></td>
<td><p>P. Antognetti, G. Massobrio, <em>Semiconductor Device Modeling with SPICE.</em>, McGraw-Hill Book Company, USA, 1988</p></td>
<td></td>
</tr>
<tr>
<td><p>[Connelly1992]</p></td>
<td><p>A. Connelly, A, P. Choi, <em>Macromodeling with SPICE.</em>, Prentice-Hall, New Jersey, USA (1992)</p></td>
<td></td>
</tr>
<tr>
<td><p>[Johnson1991]</p></td>
<td><p>B. Johnson, T. Quarles, A.R. Newton, D. O. Pederson, A. Sangiovanni-Vincentelli, <em>SPICE3 Version 3f User's Manual.</em>, University of Berkeley, Department of Electrical Engineering and Computer Sciences, USA (1991): <a href=\"modelica://Modelica/Resources/Documentation/Electrical/Spice3/Spice_3f3_Users_Manual.pdf\">SPICE3 user's manual</a> (© Regents of the University of California)</p></td>
<td></td>
</tr>
<tr>
<td><p>[Kielkowski1994]</p></td>
<td><p>R. Kielkowski, <em>Inside SPICE - Overcoming the obstacles of circuit simulation.</em>, McGraw-Hill, USA (1994)</p></td>
</tr>
</table>
</html>"));
end Literature;
class ReleaseNotes "Release notes"
extends Modelica.Icons.ReleaseNotes;
annotation (Documentation(info="<html>
<p>This section summarizes the changes that have been performed on the Spice3 library.</p>
<ul>
<li>Version 1.0 (2010-02-18): first version of the library was released</li>
</ul>
</html>", revisions="<html>
<ul>
<li><em>15th March 2012 by Kristin Majetta</em><br>SPICE3 benchmark RTL Inverter</li>
<li><em>14th March 2012 by Kristin Majetta</em><br>SPICE3 benchmark Mosfet characterisation</li>
<li><em>14th March 2012 by Kristin Majetta</em><br>SPICE3 benchmark Differential Pair added</li>
<li><em>12th March 2012 by Kristin Majetta</em><br>BJT model improved</li>
<li><em>09th March 2012 by Kristin Majetta</em><br>MOS Level 2 model added</li>
<li><em>24th February 2012 by Kristin Majetta</em><br>JFET model added</li>
<li><em>23rd February 2012 by Kristin Majetta</em><br>Semiconductor Capacitor added</li>
<li><em>21st February 2012</em> by Kristin Majetta<br>CoupledInductors (K) added</li>
<li><em>March 2010</em> by Kristin Majetta<br>Guidelines applied, User's Guide added</li>
<li><em>February 2010</em> by Kristin Majetta<br>Spice3 library added to MSL and examples revised</li>
<li><em>September 2009</em> by Kristin Majetta <br>Bipolar transistor implemented</li>
<li><em>August 2009</em> by Jonathan Kress <br>default values in sources improved</li>
<li><em>August 2009</em> by Kristin Majetta <br>Bipolar transistor started</li>
<li><em>April 2009</em> by Kristin Majetta <br>Semiconductor Resistor implemented</li>
<li><em>March 2009</em> by Kristin Majetta <br>DIODE implemented</li>
<li><em>25th February 2009</em> by Kristin Majetta <br>MOS Level 2 implemented</li>
<li><em>15th October 2008</em> by Kristin Majetta <br>minor errors fixed in L_Inductor, I_Pulse and SpiceRoot</li>
<li><em>April, 2008</em> by Sandra Boehme <br>initially implemented<br></li>
</ul>
</html>"));
end ReleaseNotes;
class Contact "Contact"
extends Modelica.Icons.Contact;
annotation (Documentation(info="<html>
<h4>Main Authors</h4>
<dl>
<dt><strong>Kristin Majetta</strong></dt>
<dd>email: <a href=\"mailto:Kristin.Majetta@eas.iis.fraunhofer.de\">Kristin Majetta@eas.iis.fraunhofer.de</a></dd>
<dt><strong>Christoph Clauss</strong></dt>
<dd>email: <a href=\"mailto:christoph@clauss-it.com\">christoph@clauss-it.com</a></dd>
<dt><strong>Sandra Boehme</strong></dt>
<dd>email: <a href=\"mailto:Sandra.Boehme@eas.iis.fraunhofer.de\">Sandra.Boehme@eas.iis.fraunhofer.de</a></dd>
</dl>
<dl>
<dt>Address</dt>
<dd>Fraunhofer Institute Integrated Circuits<br />
Design Automation Division<br />
Zeunerstraße 38<br />
01069 Dresden, Germany</dd>
</dl>
<h4>Acknowledgements</h4>
<ul>
<li>The development of this library was done within the European ITEA2 projects EUROSYSLIB and MODELISAR.</li>
<li>For his contribution we thank Mr. Jonathan Gerbet.</li>
</ul>
</html>"));
end Contact;
annotation (DocumentationClass=true, Documentation(info="<html>
<p>Package Spice3 is a <strong>free</strong> Modelica package</p>
<p>This is a short <strong>User's Guide</strong> for the overall library.</p>
</html>", revisions="<html>
<ul>
<li><em>Feb 2010</em> by Kristin Majetta initially written</li>
</ul>
</html>"));
end UsersGuide;
package Examples "Example circuits"
extends Modelica.Icons.ExamplesPackage;
model Inverter "Simple inverter circuit"
//--------------------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------------------
extends Modelica.Icons.Example;
Semiconductors.M_PMOS mp(modelcard(
RD=0,
RS=0,
CBD=0,
CBS=0), Sinternal(start=0),IC=-1e40)
annotation (Placement(transformation(extent={{-14,8},{6,28}})));
Semiconductors.M_NMOS mn(modelcard(
RD=0,
RS=0,
CBD=0,
CBS=0), IC=-1e40)
annotation (Placement(transformation(extent={{-14,-34},{6,-14}})));
Basic.Ground ground
annotation (Placement(transformation(extent={{-14,-60},{6,-40}})));
Sources.V_pulse vin(
V2=5,
TD=4e-12,
TR=0.1e-12,
TF=0.1e-12,
PW=1e-12,
PER=2e-12) annotation (Placement(transformation(
extent={{-10,-10},{10,10}},
rotation=270,
origin={-40,-16})));
Sources.V_pulse v(V2=5, TR=0.1e-12) annotation (Placement(
transformation(
extent={{-10,-10},{10,10}},
rotation=270,
origin={40,-4})));
equation
connect(mn.D, mp.S) annotation (Line(
points={{-4,-14},{-4,8}}, color={0,0,255}));
connect(mp.G, mn.G) annotation (Line(
points={{-14,17.9},{-14,-24.1}}, color={0,0,255}));
connect(mn.S, mn.B) annotation (Line(
points={{-4,-34},{6,-34},{6,-24}}));
connect(mp.B, mp.D) annotation (Line(
points={{6,18},{6,28},{-4,28}}, color={0,0,255}));
connect(mn.S, ground.p) annotation (Line(
points={{-4,-34},{-4,-40}}));
connect(v.p, mp.D) annotation (Line(
points={{40,6},{40,28},{-4,28}}, color={0,0,255}));
connect(v.n, ground.p) annotation (Line(points={{40,-14},{40,-40},{-4,-40}},
color={0,0,255}));
connect(vin.p, mp.G) annotation (Line(
points={{-40,-6},{-40,17.9},{-14,17.9}}, color={0,0,255}));
connect(vin.n, ground.p) annotation (Line(points={{-40,-26},{-40,-40},{-4,
-40}}, color={0,0,255}));
annotation (experiment(
StopTime=1e-11,
Interval=5e-15,
Tolerance=1e-7),
Documentation(info="<html>
<p>An inverter is an electrical circuit that consists of a PMOS and a NMOS transistor. Its task is to turn the input voltage from high potential to low potential or the other way round.</p>
<p>Simulate until 1e-11 s. Display the input voltage vin.p.v as well as the output voltage mp.S.v. It shows that the input voltage is inverted.</p>
</html>", revisions="<html>
<ul>
<li><em>March 2009</em> by Kristin Majetta initially implemented</li>
</ul>
</html>"));
end Inverter;
model InvertersApartRecord
"Two inverters where transistor models use different modelcard instances"
extends Modelica.Icons.Example;
Basic.Ground ground annotation (Placement(transformation(extent={{-38,-80},
{-18,-60}})));
//--------------------------------------------------------------------------------------------------------------
/*apart record: For each transistor in the circuit a record with the technology parameters is made available
as an instance of the record modelcardMOS */
parameter Semiconductors.ModelcardMOS MPmos(GAMMA=0.37, CBD=0, CBS=0)
"Specified modelcardMOS for MPmos"; //instance of record modelcardMOS
parameter Semiconductors.ModelcardMOS MNmos(GAMMA=0.37, LAMBDA=0.02, CBD=0, CBS=0)
"Specified modelcardMOS for MNmos";
//instance of record modelcardMOS
Semiconductors.M_PMOS mp1(modelcard=MPmos, IC=-1e40)
annotation (Placement(transformation(extent={{-38,20},{-18,40}})));
Semiconductors.M_NMOS mn1(modelcard=MNmos, IC=-1e40)
annotation (Placement(transformation(extent={{-38,-30},{-18,-10}})));
Semiconductors.M_PMOS mp2(modelcard=MPmos, IC=-1e40)
annotation (Placement(transformation(extent={{2,20},{22,40}})));
Semiconductors.M_NMOS mn2(modelcard=MNmos, IC=-1e40)
annotation (Placement(transformation(extent={{2,-30},{22,-10}})));
//--------------------------------------------------------------------------------------------------------------
Basic.C_Capacitor c1(C=1e-5,
IC=0,
UIC=true)
annotation (Placement(transformation(
origin={-8,-30},
extent={{-10,-10},{10,10}},
rotation=270)));
Basic.C_Capacitor c2(C=1e-5,
IC=0,
UIC=true)
annotation (Placement(transformation(
origin={34,-30},
extent={{-10,-10},{10,10}},
rotation=270)));
Sources.V_pulse vin(
V2=5,
TD=2,
TR=1) annotation (Placement(transformation(
extent={{-10,-10},{10,10}},
rotation=270,
origin={-60,-32})));
Sources.V_pulse v(V2=5, TR=1) annotation (Placement(transformation(
extent={{-10,-10},{10,10}},
rotation=270,
origin={60,-32})));
equation
connect(mp1.B, mp1.D) annotation (Line(points={{-18,30},{-18,40},{-28,
40}}, color={0,0,255}));
connect(mn1.S, ground.p)
annotation (Line(points={{-28,-30},{-28,-60}}, color={0,0,255}));
connect(mp1.S, mn1.D)
annotation (Line(points={{-28,20},{-28,-10}}, color={0,0,255}));
connect(mn1.G, mp1.G) annotation (Line(points={{-38,-20.1},{-38,29.9}}, color={0,0,255}));
connect(mn1.B, mn1.S) annotation (Line(points={{-18,-20},{-18,-30},{-28,
-30}}, color={0,0,255}));
connect(mp2.B, mp2.D) annotation (Line(points={{22,30},{22,40},{12,40}}, color={0,0,255}));
connect(mn2.S, ground.p) annotation (Line(points={{12,-30},{12,-60},{-28,
-60}}, color={0,0,255}));
connect(mp2.S, mn2.D)
annotation (Line(points={{12,20},{12,-10}}, color={0,0,255}));
connect(mn2.G, mp2.G) annotation (Line(points={{2,-20.1},{2,29.9}}, color={0,0,255}));
connect(mn2.B, mn2.S) annotation (Line(points={{22,-20},{22,-30},{12,
-30}}, color={0,0,255}));
connect(mp2.G, mn1.D) annotation (Line(points={{2,29.9},{2,0},{-28,0},{
-28,-10}}, color={0,0,255}));
connect(c1.p, mn1.D) annotation (Line(points={{-8,-20},{-8,0},{-28,0},{
-28,-10}}, color={0,0,255}));
connect(mn2.D, c2.p) annotation (Line(points={{12,-10},{12,0},{34,0},{34,
-20}}, color={0,0,255}));
connect(c2.n, ground.p) annotation (Line(points={{34,-40},{34,-60},{-28,
-60}}, color={0,0,255}));
connect(c1.n, ground.p) annotation (Line(points={{-8,-40},{-8,-60},{-28,
-60}}, color={0,0,255}));
connect(mp1.G, vin.p) annotation (Line(
points={{-38,29.9},{-60,29.9},{-60,-22}}, color={0,0,255}));
connect(vin.n, ground.p) annotation (Line(points={{-60,-42},{-60,-60},{-28,
-60}}, color={0,0,255}));
connect(v.p, mp2.D) annotation (Line(
points={{60,-22},{60,40},{12,40}}, color={0,0,255}));
connect(mp1.D, mp2.D) annotation (Line(
points={{-28,40},{12,40}}, color={0,0,255}));
connect(v.n, ground.p) annotation (Line(points={{60,-42},{60,-60},{-28,-60}},
color={0,0,255}));
annotation (experiment(StopTime=5),
Documentation(info="<html>
<p>An inverter is an electrical circuit that consists of a PMOS and a NMOS. Its task is to turn the input voltage from high potential to low potential or the other way round. This circuit <em>InverterApartModel</em> contains two inverters. The input voltage of the first inverter is nearly equal to the output voltage of the second inverter. Capacities cause some differences.</p>
<p>To see the typical behavior of the circuit the input voltages and the output voltages should be plotted. Besides that it can be interesting to watch the output voltage of the first inverter. Simulated until t=5s.</p>
<p>Input voltages: vin.p.v and v.p.v</p>
<p>Output voltage of the first inverter: mn1.D.v</p>
<p>Output voltage of the second Inverter: mn2.D.v</p>
<p>This example shows one possibility to make the record of the technology parameters available for more than one transistor. For each transistor in the circuit a record with the technology parameters is made available as an instance of the record modelcardMOS. In this circuit we need two different records for technology parameters, one for PMOS (MPmos) and one for NMOS (MNmos). This instances of the record for the technology parameters were made available for every transistor as one of theirs parameters (Spice3.Repository.MOS mn1(mtype=0, modelcard=MNmos).</p>
</html>", revisions="<html>
<ul>
<li><em>April 2009</em> by Kristin Majetta initially implemented</li>
</ul>
</html>"));
end InvertersApartRecord;
model InvertersExtendedModel
"Two inverters with MOS models defined by inheritance"
extends Modelica.Icons.Example;
Basic.Ground ground annotation (Placement(transformation(extent={{-40,-80},
{-20,-60}})));
//--------------------------------------------------------------------------------------------------------------
/*extended model: For each set of technology parameters an apart model has to be defined. Every transistor extends
this model. In this process the required technology parameters are specified. */
model MPmos "PMOS transistor with specified modelcard"
parameter Semiconductors.ModelcardMOS M(GAMMA=0.37, CBD=0, CBS=0);
extends Semiconductors.M_PMOS(modelcard=M);
annotation (Documentation(info="<html>
<p>This model MPmos is inherited by the model <em>InverterExtendedModel</em> to build an inverter circuit. For detailed information please see <em>InverterExtendedModel</em>.</p>
</html>"));
end MPmos;
model MNmos "NMOS transistor with specified modelcard"
parameter Semiconductors.ModelcardMOS M(GAMMA=0.37, LAMBDA=0.02, CBD=0, CBS=0);
extends Semiconductors.M_NMOS(modelcard=M);
annotation (Documentation(info="<html>
<p>This model MNmos is inherited by the model <em>InverterExtendedModel</em> to build an inverter circuit. For detailed information please see <em>InverterExtendedModel</em>.</p>
</html>"));
end MNmos;
MPmos mp1(IC=-1e40) annotation (Placement(transformation(extent={{-40,20},{-20,40}})));
MNmos mn1(IC=-1e40) annotation (Placement(transformation(extent={{-40,-30},{-20,-10}})));
MPmos mp2(IC=-1e40) annotation (Placement(transformation(extent={{0,20},{20,40}})));
MNmos mn2(IC=-1e40) annotation (Placement(transformation(extent={{0,-30},{20,-10}})));
//--------------------------------------------------------------------------------------------------------------
Basic.C_Capacitor c1(C=1e-5,
IC=0,
UIC=true)
annotation (Placement(transformation(
origin={-10,-30},
extent={{-10,-10},{10,10}},
rotation=270)));
Basic.C_Capacitor c2(C=1e-5,
IC=0,
UIC=true)
annotation (Placement(transformation(
origin={32,-30},
extent={{-10,-10},{10,10}},
rotation=270)));
Sources.V_pulse vin(
V2=5,
TD=2,
TR=1) annotation (Placement(transformation(
extent={{-10,-10},{10,10}},
rotation=270,
origin={-60,-22})));
Sources.V_pulse v(V2=5, TR=1) annotation (Placement(transformation(
extent={{-10,-10},{10,10}},
rotation=270,
origin={56,-22})));
equation
connect(mp1.B, mp1.D) annotation (Line(points={{-20,30},{-20,40},{-30,40}}, color={0,0,255}));
connect(mn1.S, ground.p)
annotation (Line(points={{-30,-30},{-30,-60}}, color={0,0,255}));
connect(mp1.S, mn1.D)
annotation (Line(points={{-30,20},{-30,-10}}, color={0,0,255}));
connect(mn1.G, mp1.G) annotation (Line(points={{-40,-20.1},{-40,29.9}}, color={0,0,255}));
connect(mn1.B, mn1.S) annotation (Line(points={{-20,-20},{-20,-30},{-30,-30}}, color={0,0,255}));
connect(mp2.B, mp2.D) annotation (Line(points={{20,30},{20,40},{10,40}}, color={0,0,255}));
connect(mn2.S, ground.p) annotation (Line(points={{10,-30},{10,-60},{-30,-60}}, color={0,0,255}));
connect(mp2.S, mn2.D)
annotation (Line(points={{10,20},{10,-10}}, color={0,0,255}));
connect(mn2.G, mp2.G) annotation (Line(points={{0,-20.1},{0,29.9}}, color={0,0,255}));
connect(mn2.B, mn2.S) annotation (Line(points={{20,-20},{20,-30},{10,-30}}, color={0,0,255}));
connect(mp2.G, mn1.D) annotation (Line(points={{0,29.9},{0,0},{-30,0},{-30,-10}}, color={0,0,255}));
connect(c1.p, mn1.D) annotation (Line(points={{-10,-20},{-10,0},{-30,0},{
-30,-10}}, color={0,0,255}));
connect(mn2.D, c2.p) annotation (Line(points={{10,-10},{10,0},{32,0},{32,-20}}, color={0,0,255}));
connect(c2.n, ground.p) annotation (Line(points={{32,-40},{32,-60},{-30,
-60}}, color={0,0,255}));
connect(c1.n, ground.p) annotation (Line(points={{-10,-40},{-10,-60},{-30,
-60}}, color={0,0,255}));
connect(vin.p, mp1.G) annotation (Line(
points={{-60,-12},{-60,26},{-40,26},{-40,29.9}}, color={0,0,255}));
connect(vin.n, ground.p) annotation (Line(points={{-60,-32},{-60,-60},{-30,
-60}}, color={0,0,255}));
connect(v.p, mp2.D) annotation (Line(
points={{56,-12},{56,40},{10,40}}, color={0,0,255}));
connect(mp2.D, mp1.D) annotation (Line(
points={{10,40},{-30,40}}, color={0,0,255}));
connect(v.n, ground.p) annotation (Line(points={{56,-32},{56,-60},{-30,-60}},
color={0,0,255}));
annotation (experiment(StopTime=5),
Documentation(info="<html>
<p>An inverter is an electrical circuit that consists of a PMOS and a NMOS. Its task is to turn the input voltage from high potential to low potential or the other way round. This circuit <em>InverterExtendedModel</em> contains two inverters. The input voltage of the first inverter is nearly equal to the output voltage of the second inverter. Capacities cause some differences.</p>
<p>To see the typical behavior of the circuit the input voltages and the output voltages should be plotted. Besides that it can be interesting to watch the output voltage of the first inverter. Simulated until t=5s.</p>
<p>Input voltages: vin.p.v and v.p.v</p>
<p>Output voltage of the first inverter: mn1.D.v</p>
<p>Output voltage of the second Inverter: mn2.D.v</p>
<p>This example shows one possibility to make the record of the technology parameters available for more than one transistor. For each set of technology parameters an apart model has to be defined (in this example: MPmos and MNmos). Inside the model definition the technology parameters are appointed (Spice3.Semiconductors.modelcardMOS M(GAMMA=0.37, LAMBDA=0.02)). Every model extends a transistor. In this process the required technology parameters are specified (extends Spice3.Repository.MOS(final mtype=1, modelcard=M). To make transistors available in the circuit instances of the defined models are applied (MPmos mp1; MNmos mn1; MPmos mp2; MNmos mn2;).</p>
</html>", revisions="<html>
<ul>
<li><em>April 2009</em> by Kristin Majetta initially implemented</li>
</ul>
</html>"));
end InvertersExtendedModel;
model FourInverters
"Four inverters with MOSFET level 1, using private record as model card"
extends Modelica.Icons.Example;
Basic.Ground ground annotation (Placement(transformation(extent={{-74,-80},
{-54,-60}})));
parameter Semiconductors.ModelcardMOS modp(CBD=0, CBS=0)
"Private PMOS modelcard";
parameter Semiconductors.ModelcardMOS modn(CBD=0, CBS=0)
"Private NMOS modelcard";
Semiconductors.M_PMOS mp1(modelcard=modp, IC=-1e40)
annotation (Placement(transformation(extent={{-74,20},{-54,40}})));
Semiconductors.M_NMOS mn1(modelcard=modn, IC=-1e40)
annotation (Placement(transformation(extent={{-74,-30},{-54,-10}})));
Semiconductors.M_PMOS mp2(modelcard=modp, IC=-1e40)
annotation (Placement(transformation(extent={{-34,20},{-14,40}})));
Semiconductors.M_NMOS mn2(modelcard=modn, IC=-1e40)
annotation (Placement(transformation(extent={{-34,-30},{-14,-10}})));
Semiconductors.M_PMOS mp3(modelcard=modp, IC=-1e40)
annotation (Placement(transformation(extent={{6,20},{26,40}})));
Semiconductors.M_NMOS mn3(modelcard=modp, IC=-1e40)
annotation (Placement(transformation(extent={{6,-30},{26,-10}})));
Semiconductors.M_PMOS mp4(modelcard=modn, IC=-1e40)
annotation (Placement(transformation(extent={{46,20},{66,40}})));
Semiconductors.M_NMOS mn4(modelcard=modn, IC=-1e40)
annotation (Placement(transformation(extent={{46,-30},{66,-10}})));
Basic.C_Capacitor c1(C=10e-6,
IC=0,
UIC=true)
annotation (Placement(transformation(
origin={-44,-30},
extent={{-10,-10},{10,10}},
rotation=270)));
Basic.C_Capacitor c2(C=10e-6,
IC=0,
UIC=true)
annotation (Placement(transformation(
origin={-2,-30},
extent={{-10,-10},{10,10}},
rotation=270)));
Basic.C_Capacitor c3(C=10e-6,
IC=0,
UIC=true)
annotation (Placement(transformation(
origin={36,-30},
extent={{-10,-10},{10,10}},
rotation=270)));
Basic.C_Capacitor c4(C=10e-6,
IC=0,
UIC=true)
annotation (Placement(transformation(
origin={76,-30},
extent={{-10,-10},{10,10}},
rotation=270)));
Sources.V_pulse vin(
V2=5,
TD=2,
TR=1) annotation (Placement(transformation(
extent={{-10,-10},{10,10}},
rotation=270,
origin={-86,-42})));
Sources.V_pulse v(V2=5, TR=1) annotation (
Placement(transformation(
extent={{-10,-10},{10,10}},
rotation=270,
origin={92,-48})));
equation
connect(mp1.B, mp1.D) annotation (Line(points={{-54,30},{-54,40},{-64,
40}}, color={0,0,255}));
connect(mn1.S, ground.p)
annotation (Line(points={{-64,-30},{-64,-60}}, color={0,0,255}));
connect(mp1.S, mn1.D)
annotation (Line(points={{-64,20},{-64,-10}}, color={0,0,255}));
connect(mn1.G, mp1.G) annotation (Line(points={{-74,-20.1},{-74,29.9}}, color={0,0,255}));
connect(mn1.B, mn1.S) annotation (Line(points={{-54,-20},{-54,-30},{-64,
-30}}, color={0,0,255}));
connect(mp2.B, mp2.D) annotation (Line(points={{-14,30},{-14,40},{-24,
40}}, color={0,0,255}));
connect(mn2.S, ground.p) annotation (Line(points={{-24,-30},{-24,-60},{
-64,-60}}, color={0,0,255}));
connect(mp2.S, mn2.D)
annotation (Line(points={{-24,20},{-24,-10}}, color={0,0,255}));
connect(mn2.G, mp2.G) annotation (Line(points={{-34,-20.1},{-34,29.9}}, color={0,0,255}));
connect(mn2.B, mn2.S) annotation (Line(points={{-14,-20},{-14,-30},{-24,
-30}}, color={0,0,255}));
connect(c1.p, mn1.D) annotation (Line(points={{-44,-20},{-44,0},{-64,0},
{-64,-10}}, color={0,0,255}));
connect(mn2.D, c2.p) annotation (Line(points={{-24,-10},{-24,0},{-2,0},{
-2,-20}}, color={0,0,255}));
connect(c2.n, ground.p) annotation (Line(points={{-2,-40},{-2,-60},{-64,
-60}}, color={0,0,255}));
connect(c1.n, ground.p) annotation (Line(points={{-44,-40},{-44,-60},{-64,
-60}}, color={0,0,255}));
connect(c3.n, ground.p) annotation (Line(points={{36,-40},{36,-60},{-64,
-60}}, color={0,0,255}));
connect(c4.n, ground.p) annotation (Line(points={{76,-40},{76,-60},{-64,
-60}}, color={0,0,255}));
connect(mn4.B, mn4.S) annotation (Line(points={{66,-20},{66,-30},{56,
-30}}, color={0,0,255}));
connect(mn3.B, mn3.S) annotation (Line(points={{26,-20},{26,-30},{16,
-30}}, color={0,0,255}));
connect(mp3.B, mp3.D) annotation (Line(points={{26,30},{26,40},{16,40}}, color={0,0,255}));
connect(mp4.B, mp4.D) annotation (Line(points={{66,30},{66,40},{56,40}}, color={0,0,255}));
connect(mp3.S, mn3.D)
annotation (Line(points={{16,20},{16,-10}}, color={0,0,255}));
connect(mp4.S, mn4.D)
annotation (Line(points={{56,20},{56,-10}}, color={0,0,255}));
connect(mn3.S, ground.p) annotation (Line(points={{16,-30},{16,-60},{-64,
-60}}, color={0,0,255}));
connect(mn4.S, ground.p) annotation (Line(points={{56,-30},{56,-60},{-64,
-60}}, color={0,0,255}));
connect(c3.p, mn3.D) annotation (Line(points={{36,-20},{36,0},{16,0},{16,
-10}}, color={0,0,255}));
connect(c4.p, mn4.D) annotation (Line(points={{76,-20},{76,0},{56,0},{56,
-10}}, color={0,0,255}));
connect(c2.p, mn3.G) annotation (Line(points={{-2,-20},{2,-20},{2,-20.1},
{6,-20.1}}, color={0,0,255}));
connect(mn3.G, mp3.G) annotation (Line(points={{6,-20.1},{6,29.9}}, color={0,0,255}));
connect(c3.p, mn4.G) annotation (Line(points={{36,-20},{41,-20},{41,
-20.1},{46,-20.1}}, color={0,0,255}));
connect(mn4.G, mp4.G) annotation (Line(points={{46,-20.1},{46,29.9}}, color={0,0,255}));
connect(c1.p, mn2.G) annotation (Line(points={{-44,-20},{-39,-20},{-39,
-20.1},{-34,-20.1}}, color={0,0,255}));
connect(vin.p, mn1.G) annotation (Line(
points={{-86,-32},{-86,0},{-74,0},{-74,-20.1}}, color={0,0,255}));
connect(vin.n, ground.p) annotation (Line(points={{-86,-52},{-86,-60},{-64,
-60}}, color={0,0,255}));
connect(v.p, mp4.D) annotation (Line(
points={{92,-38},{92,40},{56,40}}, color={0,0,255}));
connect(v.n, ground.p) annotation (Line(points={{92,-58},{92,-60},{-64,-60}},
color={0,0,255}));
connect(mp3.D, mp4.D) annotation (Line(
points={{16,40},{56,40}}, color={0,0,255}));
connect(mp2.D, mp3.D) annotation (Line(
points={{-24,40},{16,40}}, color={0,0,255}));
connect(mp1.D, mp2.D) annotation (Line(
points={{-64,40},{-24,40}}, color={0,0,255}));
annotation (experiment(StopTime=5),
Documentation(info="<html>
<p>This circuit that contains four inverter was designed to show the functionality of the MOS transistor models. To see the behavior of the circuit the output voltages of each inverter should be displayed (mp1.S.v, mp2.S.v, mp3.S.v, mp4.S.v). The output voltages of the second an fourth inverter and the input voltage of the first inverter have the same potential. The output voltages of the first and third inverter have the opposite potential compared with inverter 2 and 4.</p>
<p>Simulate until t=5s. The output values should be: mp1.S.v, mp2.S.v, mp3.S.v and mp4.S.v</p>
</html>", revisions="<html>
<ul>
<li><em>April 2009</em> by Kristin Majetta initially implemented</li>
</ul>
</html>"));
end FourInverters;
model Nand "MOS Nand gate circuit"
extends Modelica.Icons.Example;
Semiconductors.M_PMOS mp1(
L=2e-5,
W=1e-5,
modelcard(PHI=0.7, CBD=0, CBS=0), Sinternal(start=0), IC=-1e40) annotation (Placement(transformation(
extent={{-22,24},{-2,44}})));
Semiconductors.M_PMOS mp2(modelcard(PHI=0.7,CBD=0, CBS=0), IC=-1e40)
annotation (Placement(transformation(
extent={{24,24},{44,44}})));
Semiconductors.M_NMOS mn2(Dinternal(start=0), modelcard(CBD=0, CBS=0), IC=-1e40) annotation (Placement(transformation(
extent={{-24,-44},{-4,-24}})));
Semiconductors.M_NMOS mn1(modelcard(CBD=0, CBS=0), IC=-1e40) annotation (Placement(transformation(
extent={{-24,-10},{-4,10}})));
Sources.V_constant vconstant(V=5) annotation (Placement(
transformation(extent={{-10,-10},{10,10}},
rotation=270,
origin={62,34})));
Basic.Ground ground annotation (Placement(transformation(extent={{20,-100},
{40,-80}})));
Sources.V_pulse vin1(
TR=1e-9,
TF=1e-9,
V2=5,
TD=2e-8,
PW=4e-8,
PER=8e-8) annotation (Placement(transformation(
origin={-50,24},
extent={{-10,-10},{10,10}},
rotation=270)));
Sources.V_pulse vin2(
V2=5,
TR=1e-9,
TF=1e-9,
TD=1e-8,
PW=4e-8,
PER=8e-8) annotation (Placement(transformation(
origin={-52,-44},
extent={{-10,-10},{10,10}},
rotation=270)));
equation
connect(mp1.B, mp1.D) annotation (Line(points={{-2,34},{-2,44},{
-12,44}}, color={0,0,255}));
connect(mp2.B, mp2.D) annotation (Line(points={{44,34},{44,44},
{34,44}}, color={0,0,255}));
connect(vconstant.p, mp2.D) annotation (Line(points={{62,44},{62,44},
{34,44}}, color={0,0,255}));
connect(mp2.D, mp1.D)
annotation (Line(points={{34,44},{-12,44}}, color={0,0,255}));
connect(mp1.G, mn1.G) annotation (Line(points={{-22,33.9},{-22,
16},{-24,16},{-24,-0.1}}, color={0,0,255}));
connect(mp1.G, vin1.p) annotation (Line(points={{-22,33.9},{-38,33.9},
{-38,34},{-50,34}}, color={0,0,255}));
connect(vin1.n, ground.p) annotation (Line(points={{-50,14},{-62,14},{
-62,-80},{30,-80}}, color={0,0,255}));
connect(mp2.G, mn2.G) annotation (Line(points={{24,33.9},{24,14},
{-32,14},{-32,-34.1},{-24,-34.1}}, color={0,0,255}));
connect(mn2.G, vin2.p) annotation (Line(points={{-24,-34.1},{-38,
-34.1},{-38,-34},{-52,-34}}, color={0,0,255}));
connect(vin2.n, ground.p) annotation (Line(points={{-52,-54},{-52,-80},{
30,-80}}, color={0,0,255}));
connect(mn2.S, ground.p) annotation (Line(points={{-14,-44},{-14,-80},
{30,-80}}, color={0,0,255}));
connect(mn1.B, mn2.B)
annotation (Line(points={{-4,0},{-4,-34}}, color={0,0,255}));
connect(mn2.B, mn2.S) annotation (Line(points={{-4,-34},{-4,-44},
{-14,-44}}, color={0,0,255}));
connect(mn1.S, mn2.D)
annotation (Line(points={{-14,-10},{-14,-24}}, color={0,0,255}));
connect(mp1.S, mn1.D)
annotation (Line(points={{-12,24},{-12,18},{-14,18},{-14,10}}, color={0,0,255}));
connect(mp2.S, mn1.D) annotation (Line(points={{34,24},{34,10},
{-14,10}}, color={0,0,255}));
connect(vconstant.n, ground.p) annotation (Line(points={{62,24},{62,-80},
{30,-80}}, color={0,0,255}));
annotation (Documentation(info="<html>
<p>In nearly every electronic the basic circuit "nand" are used. A nand contains two PMOS and two NMOS. The faulty wiring can be seen in the graphical mode. If and only if the two input voltages have high potential, the output voltage has low potential, otherwise the output voltage has high potential.</p>
<p>Nand truth table (1 means true, it is represented by the 5V voltage):</p>
<table cellspacing=\"2\" cellpadding=\"0\" border=\"1\"><tr>
<td><p>input voltage vin1</p></td>
<td><p>input voltage vin2</p></td>
<td><p>output voltage mn1.D</p></td>
</tr>
<tr>
<td><p>0</p></td>
<td><p>0</p></td>
<td><p>1</p></td>
</tr>
<tr>
<td><p>0</p></td>
<td><p>1</p></td>
<td><p>1</p></td>
</tr>
<tr>
<td><p>1</p></td>
<td><p>0</p></td>
<td><p>1</p></td>
</tr>
<tr>
<td><p>1</p></td>
<td><p>1</p></td>
<td><p>0</p></td>
</tr>
</table>
<p>Simulate until t=2e-7s. Display the two input voltages vin1.p.v and vin2.p.v and the output voltage mn1.D.v, which becomes zero only if both input values are high.</p>
</html>", revisions="<html>
<ul>
<li><em>May 2009</em> by Kristin Majetta initially implemented</li>
</ul>
</html>"),
experiment(StopTime=2e-007));
end Nand;
model Nor "MOS NOR gate circuit"
extends Modelica.Icons.Example;
Semiconductors.M_PMOS mp1(modelcard(
RD=1e-4,
RS=1e-4,
CBD=1e-5,
CBS=1e-5,
CGSO=1e-5,
CGDO=1e-5,
CGBO=1e-5), Dinternal(start=0,fixed=true), Sinternal(start=0,fixed=true), IC=-1e40) annotation (Placement(transformation(
extent={{-16,24},{4,44}})));
Semiconductors.M_PMOS mp2(modelcard(
RD=1e-4,
RS=1e-4,
CBD=1e-5,
CBS=1e-5,
CGSO=1e-5,
CGDO=1e-5,
CGBO=1e-5), Dinternal(start=0,fixed=true), Sinternal(start=0,fixed=true), IC=-1e40) annotation (Placement(transformation(
extent={{-16,-6},{4,14}})));
Semiconductors.M_NMOS mn1(modelcard(
RD=1e-4,
RS=1e-4,
CBD=1e-5,
CBS=1e-5,
CGSO=1e-5,
CGDO=1e-5,
CGBO=1e-5), Dinternal(start=0,fixed=true), Sinternal(start=0,fixed=true), IC=-1e40) annotation (Placement(transformation(
extent={{-16,-44},{4,-24}})));
Semiconductors.M_NMOS mn2(modelcard(
RD=1e-4,
RS=1e-4,
CBD=1e-5,
CBS=1e-5,
CGSO=1e-5,
CGDO=1e-5,
CGBO=1e-5), Dinternal(start=0,fixed=true), Sinternal(start=0,fixed=true), IC=-1e40) annotation (Placement(transformation(
extent={{32,-44},{52,-24}})));
Basic.Ground ground annotation (Placement(transformation(extent={{28,-100},
{48,-80}})));
Sources.V_pulse vin1(
V2=5,
TR=0.001,
TF=0.001,
PW=2,
PER=10,
TD=2) annotation (Placement(transformation(
origin={-42,24},
extent={{-10,-10},{10,10}},
rotation=270)));
Sources.V_pulse vin2(
V2=5,
TR=0.001,
TF=0.001,
PW=2,
PER=10,
TD=1) annotation (Placement(transformation(
origin={-44,-44},
extent={{-10,-10},{10,10}},
rotation=270)));
Sources.V_pulse v(
TD=0.5,
TR=0.1,
V2=5) annotation (Placement(transformation(
extent={{-10,-10},{10,10}},
rotation=270,
origin={62,34})));
equation
connect(mn1.B, mn1.S) annotation (Line(points={{4,-34},{4,-44},{
-6,-44}}, color={0,0,255}));
connect(mn2.B, mn2.S) annotation (Line(points={{52,-34},{52,-44},
{42,-44}}, color={0,0,255}));
connect(mn2.S, ground.p) annotation (Line(points={{42,-44},{38,-44},
{38,-80}}, color={0,0,255}));
connect(mn1.S, ground.p) annotation (Line(points={{-6,-44},{-6,-80},{
38,-80}}, color={0,0,255}));
connect(vin2.p, mn1.G) annotation (Line(points={{-44,-34},{-29,
-34},{-29,-34.1},{-16,-34.1}}, color={0,0,255}));
connect(vin2.n, ground.p) annotation (Line(points={{-44,-54},{-44,-80},
{38,-80}}, color={0,0,255}));
connect(vin1.p, mp1.G) annotation (Line(points={{-42,34},{-29,34},
{-29,33.9},{-16,33.9}}, color={0,0,255}));
connect(vin1.n, ground.p) annotation (Line(points={{-42,14},{-64,14},{
-64,-80},{38,-80}}, color={0,0,255}));
connect(mp1.S, mp2.D)
annotation (Line(points={{-6,24},{-6,14}}, color={0,0,255}));
connect(mp2.S, mn1.D) annotation (Line(points={{-6,-6},{-6,-24}}, color={0,0,255}));
connect(mn2.D, mn1.D) annotation (Line(points={{42,-24},{-6,-24}}, color={0,0,255}));
connect(vin2.p, mp2.G) annotation (Line(points={{-44,-34},{-44,4},
{-16,4},{-16,3.9}}, color={0,0,255}));
connect(vin1.p, mn2.G) annotation (Line(points={{-42,34},{-28,34},
{-28,-18},{32,-18},{32,-34.1}}, color={0,0,255}));
connect(mp1.B, mp1.D) annotation (Line(
points={{4,34},{4,44},{-6,44}}, color={0,0,255}));
connect(mp2.B, mp1.B) annotation (Line(
points={{4,4},{4,34}}, color={0,0,255}));
connect(v.p, mp1.D) annotation (Line(
points={{62,44},{-6,44}}, color={0,0,255}));
connect(v.n, ground.p) annotation (Line(points={{62,24},{62,-80},{38,-80}},
color={0,0,255}));
annotation (Documentation(info="<html>
<p>In nearly every electronic the basic circuit "nor" is used. A nor contains two PMOS and two NMOS. The faulty wiring can be seen in the graphical mode. If and only if the two input voltages have low potential, the output voltage has high potential, otherwise the output voltage has low potential.</p>
<p>Nor truth table (1 means true, it is represented by the 5V voltage):</p>
<table cellspacing=\"2\" cellpadding=\"0\" border=\"1\"><tr>
<td><p>input voltage vin1</p></td>
<td><p>input voltage vin2</p></td>
<td><p>output voltage mp1.S</p></td>
</tr>
<tr>
<td><p>0</p></td>
<td><p>0</p></td>
<td><p>1</p></td>
</tr>
<tr>
<td><p>0</p></td>
<td><p>1</p></td>
<td><p>0</p></td>
</tr>
<tr>
<td><p>1</p></td>
<td><p>0</p></td>
<td><p>0</p></td>
</tr>
<tr>
<td><p>1</p></td>
<td><p>1</p></td>
<td><p>0</p></td>
</tr>
</table>
<p>Simulate until t=5s. Display the two input voltages vin1.p.v and vin2.p.v and the output voltage mp1.S.v.</p>
<p>The output value in the example shows a behaviour "near" the one of the truth table, since the capacitances are huge. Therefore loading is not finished before the next input changes.</p>
</html>", revisions="<html>
<ul>
<li><em>March 2009</em> by Kristin Majetta initially implemented</li>
</ul>
</html>"),
experiment(StopTime=5));
end Nor;
model Graetz "Graetz rectifier circuit"
extends Modelica.Icons.Example;
Semiconductors.D_DIODE D1(IC=-1e40, SENS_AREA=false,modelcarddiode(CJO=1e-7),pin(start=0, fixed=true))
annotation (Placement(transformation(
extent={{-10,-10},{10,10}},
origin={0,14})));
Semiconductors.D_DIODE D3(IC=-1e40, SENS_AREA=false,modelcarddiode(CJO=1e-7), n(v(start=0, fixed=true)))
annotation (Placement(transformation(extent={{-10,-10},{10,10}},
rotation=270,
origin={20,-8})));
Semiconductors.D_DIODE D4(IC=-1e40, SENS_AREA=false,modelcarddiode(CJO=1e-7))
annotation (Placement(transformation(
extent={{-10,-10},{10,10}},
origin={1,-30})));
Semiconductors.D_DIODE D2(IC=-1e40, SENS_AREA=false,modelcarddiode(CJO=1e-7))
annotation (Placement(transformation(extent={{-10,-10},{10,10}},
rotation=270,
origin={-20,-8})));
Semiconductors.R_Resistor rout(R=10)
annotation (Placement(transformation(
extent={{-10,-10},{10,10}},
rotation=90,
origin={42,-7})));
Sources.V_sin vsin(VA=10, FREQ=200)
annotation (Placement(transformation(
extent={{-10,-10},{10,10}},
rotation=270,
origin={-44,-8})));
Basic.Ground ground
annotation (Placement(transformation(extent={{-30,-60},{-10,-40}})));
equation
connect(D1.n, D3.p) annotation (Line(points={{10,14},{20,14},{20,2}},
color={0,0,255}));
connect(D2.p, D1.p) annotation (Line(
points={{-20,2},{-20,14},{-10,14}}, color={0,0,255}));
connect(D4.n, D3.n) annotation (Line(points={{11,-30},{20,-30},{20,-18}},
color={0,0,255}));
connect(D4.p, D2.n) annotation (Line(
points={{-9,-30},{-20,-30},{-20,-18}}, color={0,0,255}));
connect(D4.p, ground.p) annotation (Line(
points={{-9,-30},{-20,-30},{-20,-40}}, color={0,0,255}));
connect(vsin.n, ground.p) annotation (Line(points={{-44,-18},{-44,-40},{-20,
-40}}, color={0,0,255}));
connect(D4.n, rout.p) annotation (Line(points={{11,-30},{42,-30},{42,-17}},
color={0,0,255}));
connect(rout.n, D1.p) annotation (Line(
points={{42,3},{42,26},{-20,26},{-20,14},{-10,14}}, color={0,0,255}));
connect(D3.p, vsin.p) annotation (Line(