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.

64 2. Tutorial<br />

appropriate Scope argument (see Section 3.2.1). Scope has two possible values, Local and Global.<br />

To make a subcircuit available globally, we need to set the scope as follows:<br />

Scope −> Global<br />

By expanding a circuit which contains only model definitions with global scope we can implement a<br />

globally accessible model library in our current Mathematica environment. For example, let’s set up<br />

a model library from the two NPN transistor models NPNTransistor/ACsimple and<br />

NPNTransistor/ACdynamic from Section 2.3.2 (see Figure 3.2).<br />

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

Model[<br />

Name −> NPNTransistor,<br />

Selector −> ACsimple,<br />

Scope −> Global,<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 />

Model[<br />

Name −> NPNTransistor,<br />

Selector −> ACdynamic,<br />

Scope −> Global,<br />

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

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

Definition −><br />

Netlist[<br />

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

{CM, {"B", "C"}, CM},<br />

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

{RO, {"C", "E"}, RO}<br />

]<br />

]<br />

] // ExpandSubcircuits;<br />

Both models are now stored in the global subcircuit database and can thus be referenced by any other<br />

netlist. Note that simply defining the models is not sufficient for storing them in the global database –<br />

we have to call ExpandSubcircuits in order to store them into the global database. If the Circuit<br />

object contains a top-level Netlist, a call to CircuitEquations stores the models in the global<br />

database, too. We can check the contents of the database using the command GlobalSubcircuits<br />

(Section 3.3.4), which will return a list of the names and selectors of the global subcircuits.<br />

In[20]:= GlobalSubcircuits[]<br />

Out[20]=<br />

NPNTransistor, ACdynamic, NPNTransistor, ACsimple<br />

The global definition of the transistor models allows us to write the circuit description of the<br />

Darlington amplifier from Section 2.3.5 (see Figure 3.3) without the Model commands. Then, during<br />

subcircuit expansion, the global database will be searched for models which are not defined locally.

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

Saved successfully!

Ooh no, something went wrong!