1. Graphische Lösung mit Octave:
octave:1> x=0:10:800
octave:2> y1=(5000-x)/1000
octave:3> y2=1e-12*(exp(x/26)-1)
octave:4> plot(x,y1)
octave:5> hold on
octave:6> plot(x,y2)
octave:7> hold off
octave:8> x=650:1:770
octave:9> y1=(5000-x)/1000
octave:10> y2=1e-12*(exp(x/26)-1)
octave:11> plot(x,y1)
octave:12> hold on
octave:13> plot(x,y2)
2. Numerische Lösung in Tabellenkalkulation:
3. Fazit
Wir operieren hier in einem exorbitant grossen Zahlenbereich, der jede 32-Bit-CPU überlaufen lässt. Ausser, wir arbeiten mit Fliesskomma-Zahlen. Diese ermöglichen, kleine Zahlen mit kleinen Zahlen und grosse Zahlen mit grossen Zahlen zu verrechnen. Dadurch wird der Fehler auch kleiner.
4. Test
Hier ein erster, noch unvollendeter Versuch, sowas in Verilog zu implementieren:
module diodengl (
clk, // clock
ufd // Dioden-Spannung (gesucht)
);
input clk;
output [31:0] ufd;
reg [31:0] u1; // Spannungsquelle mV
reg [31:0] r1; // Innenwiderstand Ohm
reg [31:0] is; // Dioden-Sperrstrom pA
reg [31:0] ut; // Temperaturspannung mV
reg [31:0] smin; // Abbruchbedingung mV
reg [31:0] s; // "Schrittweite"
reg [31:0] sa; // "Schrittweite", absolutwert
reg [31:0] y1; // Zwischenresultat 1
reg [31:0] y2; // Zwischenresultat 2
reg [31:0] y2a; // Zwischenresultat 2a (Ufd/Ut)
reg [31:0] y2b; // Zwischenresultat 2b (e^y1)
reg [31:0] ufd; // Resultat
reg [31:0] i; // Zähler
initial begin
u1=5000;
r1=1000;
is=1;
ut=26;
smin=1;
s=1;
sa=1;
ufd=1;
end
always @ (posedge clk)
begin
// Error (10119): Verilog HDL Loop Statement error at
// diodengl.v(35): loop with non-constant loop condition must
// terminate within 250 iterations
// while(sa>tol) begin
ufd = ufd + s;
y1=u1-ufd/r1;
y2a=ufd/ut;
// Error (10256): Verilog HDL error at diodengl.v(42):
// exponentiation is not supported for specified operands,
// exponent base must be a positive power of 2 with
// non-constant exponent.
// y2b=2718**y2a;
y2b=2048**y2a;
y2=is*(y2b-1000);
s=(y1-y2)/100;
// Absolutwert von Schrittweite berechnen für
// Abbruchbedingung
// if (s[31]==1'b1) sa[31:0]={1'b1,s[30:0]};
// else sa [31:0]=s [31:0];
// end
end
endmodule


