23.01.2015 Views

Download - Wolfram Research

Download - Wolfram Research

Download - Wolfram Research

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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

2.3 Circuits and Subcircuits 63<br />

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

Netlist[<br />

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

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

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

RB −> RB1, beta −> 150},<br />

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

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

beta −> beta2},<br />

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

Pattern −> Impedance}<br />

],<br />

Model[<br />

Name −> NPNTransistor,<br />

Selector −> ACsimple,<br />

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

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

Definition −><br />

Netlist[<br />

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

{CC, {"B", "X", "C", "E"}, beta}<br />

]<br />

]<br />

] // ExpandSubcircuits // DisplayForm<br />

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

Netlist Flat, 6 Entries:<br />

I1, 0, 1, 1<br />

RB$Q1, X$Q1, 3, RB1<br />

CC$Q1, 1, X$Q1, 2, 3, 150<br />

RB$Q2, X$Q2, 0, RB$Q2<br />

CC$Q2, 3, X$Q2, 2, 0, beta2<br />

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

During subcircuit expansion, the model parameters have now been replaced by the values from the<br />

top-level netlist. As we did not assign a value to the base resistor of Q2, the automatic instantiation<br />

mechanism has created the symbol RB$Q2 in order to provide a default value for RB.<br />

2.3.6 The Scope Argument<br />

Local and Global Subcircuit Definitions<br />

In all the preceding examples, the top-level netlist is immediately followed by the definitions of<br />

the subcircuits referenced from within the netlist. These subcircuit definitions are local and volatile<br />

because they are neither visible outside the scope of the enclosing Circuit statement nor do they<br />

"survive" subcircuit expansion. When doing multiple circuit analyses with a number of frequently<br />

used device models it would be rather tedious if we always had to include all potentially selected<br />

models in the circuit description together with the top-level netlist. Therefore, we have the option to<br />

make any subcircuit definition permanent and accessible from within other netlists by providing an

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

Saved successfully!

Ooh no, something went wrong!