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

In[21]:= darlWithoutModels =<br />

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

];<br />

In[22]:= ExpandSubcircuits[darlWithoutModels] // DisplayForm<br />

Out[22]//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 />

Redefining and Removing Global Subcircuits<br />

If ExpandSubcircuits or CircuitEquations is called on a Circuit object containing a global model<br />

definition, any previously stored model in the global database with the same Name and Selector<br />

arguments is replaced by the new one. To remove a particular subcircuit from the global database<br />

we can use the command RemoveSubcircuit (Section 3.3.8). Its arguments must be the name and<br />

the selector of the subcircuit definition to be deleted. The return value is a list of the names and<br />

selectors of the remaining subcircuit definitions. For example, let’s remove the transistor model<br />

NPNTransistor/ACdynamic. The only remaining model is then NPNTransistor/ACsimple:<br />

In[23]:= RemoveSubcircuit[NPNTransistor, ACdynamic]<br />

Out[23]= NPNTransistor, ACsimple<br />

Locally Overriding Global Subcircuit Definitions<br />

One further application of the Scope argument is that we can locally override a global subcircuit<br />

definition. Local subcircuits always take precedence over global definitions with the same name and<br />

selector without overwriting the global definition. To illustrate this, let’s temporarily replace the<br />

NPNTransistor/ACsimple model with the subcircuit shown in Figure 3.4. The difference between<br />

the original implementation of NPNTransistor/ACsimple and this model is that the latter contains a<br />

voltage-controlled current source VCCS (Section 4.2.13) instead of a current-controlled current source<br />

CCCS (Section 4.2.11).

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

Saved successfully!

Ooh no, something went wrong!