Kérkel segíts, hogy ne maradjon hibás információ az oldalon!
Ha szerinted valami nem fedi a valóságot, kérlek írd meg, hogy javítani tudjam. Ha kérdésed van, fordulj hozzám bizalommal!

2009. október 29., csütörtök

Improved Eagle Spice ULP

The Advanced Spice features:
Netlist names are the same as in Eagle (better readability)
Can include subckt and models (from files)
On page define own models
Improved processing of schematic
Added Spice Eagle library (with power supply schematic simbol)

Download it from here: aspice.ulp
And here: mspice.lbr

Installation:
Download the files and put them to the corresponding Eagle library. Open the Libraries on the Eagle Control panel, look for the newly copied library. Right click on it and click on Use.

Running the ULP:
Simply type:
RUN aspice.ulp

This will generate the netlist file in the project directory.

Usage:

Spice variables from the base script. You can use this in the value field on the schematic or edit the library you are using, open the simbol you want to use and put these on a new layer.
  • spicename: what you write after this word will be put in front of the device name in the netlist.
  • spiceorder: you can change the pin orders according for eg. to your subckt if it is not the same as in the eagle simbol.
  • spicepostf: more complex value text.
  • spicepref: what you write after this will be between the name and the node in the netlist.


Using Subckts:
First of all: don't forget to put a letter 'X' in front of the device name on the schematic. It is the same if you use spicename X.
Add a SPICEINCLUDE item from the mspice library (using the ADD command).
Name it after the model name (editing eagle NAME tag).
Edit the VALUE tag and add the filename (with complete path).

The script will write a warning into the netlist file if it cannot find the file or the file does not contain the named model.

Include a model from file:
It is just like including a subckt. The only difference is that the script will look for a model definition and not for a subckt.

Define own model on page:
Add a SPICEMODEL item to the page. Name it as the model name and use the VALUE tag to define the model paramters.

Example: diode with 1V forward voltage:
Give VALUE= D_ONEV
Give NAME= D (vj=1V)

The script will generate the following line:
".model D_ONE D (vj=1V)

Please note that the script does not choose the device type, that must be specified by the user (eg. pnp, npn, d etc.)

Supplies:
The script will find the Eagle supply arrows and will generate them as common (ground) referenced voltage supplies. But it is not recommended as it can cause problems in the netlist naming (+5, -40 is not preferred by the spice simulator).

Use the supply given in the mspice.lib instead!
Add a VDC simbol to your schematic. Use values like: DC 34V or DC +5V. (Please note that these simbol will be two pins on the pcb.)

Constant current source:
Add an IDC item to your schematic from the mspice.lib.

Variable voltage sources:
You can use variable sources by giving the VALUE parameters as a Spice variable source parameter.
Example: pulse generator:
VALUE= pulse 0 2 10u 100u 100u 3m 4u

Current measurement:
Just as in command line spice: add a VDC source to your schematic and assign a DC 0V value to it. You can plot its current in spice by:
plot i(VNameOfSource)


I did really like writing this script and really hope this will yield some of you a better time when using Spice with Eagle.

For those who does not know how to Spice:
Spice tutorial:
http://littletux.homelinux.org/knowhow/ngspice.pdf

Ngspice manual:
http://www-ti.informatik.uni-tuebingen.de/~bernauer/lehre/ti-1-0506/spice/ngspice.pdf

Nincsenek megjegyzések: