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 59<br />

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

Netlist[<br />

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

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

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

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

Model −> NPNTransistor, Selector −> ACsimple},<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 />

Definition −><br />

Netlist[<br />

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

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

]<br />

]<br />

] // ExpandSubcircuits // DisplayForm<br />

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

Netlist Flat, 6 Entries:<br />

I1, 0, 1, 1<br />

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

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

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

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

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

While ExpandSubcircuits (Section 3.4.1) has generated unique identifiers for the base resistor RB<br />

and the current-controlled current source CC for each instance of the transistor model, it has not<br />

made any changes to the associated symbolic element values RB and beta. Obviously, these have<br />

been regarded as global symbols, resulting in identical base resistances and current gains of both<br />

transistors. This is certainly not the result we wanted because the individual current gains of<br />

the transistors in a Darlington stage may be quite different. Instead, ExpandSubcircuits should<br />

instantiate the element values as well, and thus generate the symbols RB$Q1, RB$Q2, beta$Q1, and<br />

beta$Q2 for the two resistors and the two current gains respectively.<br />

The reason behind the unwanted behavior exhibited here is that ExpandSubcircuits has not been<br />

explicitly instructed to treat RB and beta as what they really are, namely as parameters of the model.<br />

We can solve this problem by adding the parameter declaration<br />

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

to our Model definition, which instructs ExpandSubcircuits to replace all occurrences of these<br />

symbols in the value fields of the subcircuit netlist by different identifiers for each subcircuit<br />

instance.

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

Saved successfully!

Ooh no, something went wrong!