Getting Started with PyOPUS

Now we can run a python program from the Demo subfolder of PyOPUS sources. You find the file attached to this page. Download it, unpack it, for example in C: and go to C:/PyOPUS-0.6/demo/circuit-evaluation/06-iteration-plotter



demos


the cmos180n.lib file is a CMOS 0.18u library for SPICE OPUS, mosmm.inc models the NMOS and CMOS subcircuits depending by channel dimensions parameters W and L, the device multiplier m, the threshold voltage vtmm and the mobility variation of the transistor u0mm. For these last parameters 0 means that both have a nominal value, 1 corresponds to 1-sigma positive deviation, and -1 corresponds to 1-sigma negative deviation.

the opamp.inc file describes the following operational amplifier



opampschematic


the topdc.inc describes this circuit



circuitschematic

runme.py is the python program. The code is quite long. Basically it runs a PerfomanceEvaluator() function to extract values as the gain, the bandwith, etc. The CostEvaluator() constructs a cost function evaluator using the perfomance evaluator results. The cost function value will be printed for every iteration and the details will be printed every time a better circuit is found (the best-yet cost function value decreses) and the circuit’s performance is plotted in two windows.

When the optimization is finished the best circuit is re-evaluated and its performance is printed in the terminal window. The performance of the final circuit is plotted in the same windows as the performance of the best-yet circuit was plotted during optimization.

in the terminal window (cmd.exe) we can run the example by typing

python runme.py

The performance of the best circuit:



bestcircuit


The dc plot window of the final result. below is the differential input voltage sweep





and this is the common mode input voltage sweep





To exit, close GUI control window





[attachments title=”PyOPUSSoftware” logged_users=2 include=”728″]

Posted in SPICE OPUS and tagged , , , .