Warum lierfert Spice falsche Ergebnisse?

Hallo zusammen!

Ich beschäftige mich noch nicht lange mit Spice (ngspice unter linux), und bin jetzt auf folgendes Problem bei einer ganz einfachen Kleinsignalanalyse gestoßen:

Iin 1 0 AC 1 0 R1 1 2 100 L1 2 0 1 .AC LIN 10 10K

Eigentlich müsste die Spannung v(2) an L1 linear ansteigen. Sie wird aber als 0 über den ganzen Frequenzbereich geplottet.

Wenn man einen hohen Widerstand (1Meg) parallel zur Stromquelle schaltet, steigt die Spannung v(2) im plot tatsächlich an, allerdings nicht linear, sondern als kurve.

Wo liegen der/die Fehler? Habe gelesen, das spice komponenten für die ac analyse linearisiert. Kann das damit zusammenhängen? Was genau ist damit eigentlich gemeint?

MfG Tobias

Reply to
Tobias Deiminger
Loading thread data ...

"Tobias Deiminger" schrieb im Newsbeitrag news: snipped-for-privacy@t-online.de...

Hallo Tobias,

Das .AC Kommando verlangt 3 Parameter siehe Anhang.

.AC LIN 101 1 10K

Das wäre jetzt ein Sweep von 1Hz bis 10KHz mit 101 Punkten im Abstand von (10000-1)/100Hz.

Eigentlich hättest du eine Fehlermeldung wegen deinem .AC Befehl bekommen müssen.

Ich habe leider kein Linux und kann deshalb NGSpice nicht testen. Mit LTspice oder PSPICE A/D(Demo-Version) funktioniert deine Schaltung. Das Ergebnis ist exakt wie erwartet ein linearer Anstieg über der Frequenz. Probier mal deine Schaltung mit dem richtigen .AC-Kommando.

Linearisiert heißt, daß bei einem nichtlinearen Bauteil die Steigung im Arbeitspunkt als Wert genommen wird. Dazu wird zuerst Der Arbeitspunkt wie in der .OP Analyse bestimmt.

Beispiel für eine ideale Diode die von einem Gleichstrom durchflossen wird. Die Steigung dU/dI ist dann Vt/I mit Vt ungefähr 25mV. Rd = 25m/1mA = 40 Ohm bei Id=1mA. In der .AC Analyse wird die Diode somit durch einen Widerstand mit

40 Ohm ersetzt. Bei einem realen Diodenmodell wird dann noch eine Kapazität parallel zum Widerstand berechnet. Die Ersatzschaltung für die Diode bei .AC ist somit ein Widerstand und ein parallel geschalteter Kondensator. In der Schaltungsmatrix für die .AC-Analyse gibt es somit nur noch R, L, C, ideale Strom- und Spannungs-Verstärker und konstante Wechselspannungsquellen. Konstante Wechselspannungs- quellen sind die Quellen mit AC, z.B dein Iin.

Probier doch mal LTspice. Du wirst begeistert sein. LTspice ist kostenloses SPICE für Windows mit graphischem User Interface. Es kann aber auch mit Netzlisten(.cir) umgehen. Die Schaltung darf beliebig viele Bauteile enthalten. Linux-Anwender können LTspice mit WINE benutzen. Siehe unten.

formatting link

Die Help-Seiten des Programms als PDF.

formatting link

Die Yahoo user group für LTspice

formatting link

Gruß Helmut

NGSPICE Helpseiten

------------------

formatting link

4.3.1 .AC: Small-Signal AC Analysis General form:

.AC DEC ND FSTART FSTOP .AC OCT NO FSTART FSTOP .AC LIN NP FSTART FSTOP

Examples:

.AC DEC 10 1 10K .AC DEC 10 1K 100MEG .AC LIN 100 1 100HZ

DEC stands for decade variation, and ND is the number of points per decade. OCT stands for octave variation, and NO is the number of points per octave. LIN stands for linear variation, and NP is the number of points. FSTART is the starting frequency, and FSTOP is the final frequency. If this line is included in the input file, SPICE performs an AC analysis of the circuit over the specified frequency range. Note that in order for this analysis to be meaningful, at least one independent source must have been specified with an ac value.

LTspice

-------

Hier die Anleitung für Linux aus der FAQ von dem oben erwähntem PDF-Manual. Ich habe gestern auf der Hobby Elektronik einen Linux-Profi gebeten doch mal LTspice herunterzuladen und zu installieren. Es lief mit der aktuellen(..05) Wine-Version.

--
Running LTspice Under Linux

Do you have a Linux version of this program?

Not a separate edition, but it does run under WINE.  The program has been 
tested on Linux RedHat 8.0 with WINE version 20030219, RedHat 9.0 with WINE 
20040716, and SuSE 9.1 with 20040716.

OK, I've never used WINE, how do I install this?

Check with http://www.winehq.com to find the current version of WINE for 
your system.  At the time of this writing, for RedHat 8.0, this pointed to 
http://mecano.gme.usherb.ca/~vberon/wine

Copy the appropriate .rpm file to your machine and open it from nautilus.
Get the file swcadiii.exe from http://www.linear.com/software.  In an xterm, 
execute "wine swcadiii.exe" to install LTspice.
There will now be a Linear Technology Logo on your gnome desktop.  Double 
click it to start or type "wine scad3.exe" from an xterm to start the 
program.

The schematic fonts don't scale as smoothly under WINE as Windows.  Why is 
that?

WINE is doing the best it can with the fonts it finds.  It will do better if 
you tell it how to find the files arial.ttf and cour.ttf from your Windows 
system.

The PWL additional point editor doesn't look right under WINE?

Try using the native Windows .dll from your Windows system.  The command 
line to then invoke LTspice from WINE is wine -dll commctrl,comctl32=n 
scad3.exe.

It seems LTspice is running slightly differently under WINE/Linux than 
windows.  Why is that?

LTspice detects whether or not it's running under WINE.  If so, it works 
around a few WINE issues.  You can force LTspice to think it's running under 
WINE with the command line switch -wine.  You can force it to think it's not 
with the command line switch -nowine in case you're interesting in working 
on WINE issues.
Reply to
Helmut Sennewald

Danke für die links und Infos!

Stimmt, habe ich nur hier im Post vergessen, aber in der spice-datei wars schon richtig...

Habe ich soeben probiert, läuft problemlos mit wine. Damit funktioniert meine Schaltung auch so wie sie soll. Habe dann die Netzliste von ltspice genommen und mit ng-spice laufen lassen, und da waren sie wieder, die 0 Volt. Sehr seltsam...???

Vielleicht kann das jemand mal mit ng-spice nachvollziehen?

Reply to
Tobias Deiminger

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.