23.01.2015 Views

Download - Wolfram Research

Download - Wolfram Research

Download - Wolfram Research

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

68 2. Tutorial<br />

In[27]:= Circuit[<br />

Model[<br />

Name −> NPNTransistor,<br />

Selector −> ACgm,<br />

Scope −> Global,<br />

Ports −> {"B", "C", "E"},<br />

Parameters −> {RB, beta},<br />

Translation −> {gm −> beta / RB},<br />

Definition −><br />

Netlist[<br />

{RB, {"B", "E"}, RB},<br />

{VC, {"B", "E", "C", "E"}, gm}<br />

]<br />

]<br />

] // ExpandSubcircuits;<br />

In[28]:= darlNumParams =<br />

Circuit[<br />

Netlist[<br />

{I1, {0, 1}, 1},<br />

{Q1, {1 −> "B", 2 −> "C", 3 −> "E"},<br />

Model −> NPNTransistor, Selector −> ACgm,<br />

RB −> 400.0, beta −> 150.0},<br />

{Q2, {3 −> "B", 2 −> "C", 0 −> "E"},<br />

Model −> NPNTransistor, Selector −> ACgm,<br />

RB −> 100.0, beta −> 50.0},<br />

{Load, {0, 2}, Type −> Resistor, Value −> RL,<br />

Pattern −> Impedance}<br />

]<br />

];<br />

Just before subcircuit expansion the right-hand sides of the translation rules are evaluated with<br />

the parameter values specified in the value fields of the subcircuit references. The evaluated<br />

parameter translation rules are then applied to all value fields in the subcircuit netlist, resulting<br />

in the replacement of all symbols appearing on the left-hand side of the translations. Thus, gm is<br />

automatically calculated from RB and beta.<br />

In[29]:= ExpandSubcircuits[darlNumParams] // DisplayForm<br />

Out[29]//DisplayForm=<br />

Netlist Flat, 6 Entries:<br />

I1, 0, 1, 1<br />

RB$Q1, 1, 3, 400.<br />

VC$Q1, 1, 3, 2, 3, 0.375<br />

RB$Q2, 3, 0, 100.<br />

VC$Q2, 3, 0, 2, 0, 0.5<br />

Load, 0, 2, Type Resistor, Value RL, Pattern Impedance<br />

Delayed Translation Rules<br />

In this simple example, using the Translation argument is not absolutely necessary. We could have<br />

achieved the same effect without a translation rule by writing the netlist entry for the VCCS like<br />

this:

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!