Analog.Semiconductors.Tests.DiodeForward ​
Operating-point check for Diode, one case per branch of the defining equation.
The diode hangs directly across an ideal source, so the junction sees exactly Vbias:
i = Ids*(exlin(V/Vt, Maxexp) - 1) + V/R
exlin(x, M) = if x > M then exp(M)*(1 + x - M) else exp(x)at the default MSL card (Ids = 1e-6, Vt = 0.04, Maxexp = 15, R = 1e8, temperature dependency off):
Vbias = 0.65(case1):V/Vt = 16.25, aboveMaxexp, so the linear continuation.i = 7.35529A.Vbias = -5(case2): reverse,i = -Ids + V/R = -1.05e-6A.Vbias = 0.4(case3):V/Vt = 10, so the exponential.i = 0.0220255A.
This card is leaky — Ids = 1 µA is MSL's default and Vt = 0.04 is not kT/q — so 0.65 V is past the knee at 7.4 A. Case3 exercises the Shockley exponential.
The dummy RC branch supplies the one differential state a transient test needs.
Usage ​
ElectricalComponents.Analog.Semiconductors.Tests.DiodeForward(Vbias=0.65)
Parameters: ​
| Name | Description | Units | Default value |
|---|---|---|---|
Vbias | Bias voltage applied across the diode | V | 0.65 |
Behavior ​
Source ​
"""
Operating-point check for Diode, one case per branch of the defining equation.
The diode hangs directly across an ideal source, so the junction sees exactly `Vbias`:
```
i = Ids*(exlin(V/Vt, Maxexp) - 1) + V/R
exlin(x, M) = if x > M then exp(M)*(1 + x - M) else exp(x)
```
at the default MSL card (`Ids = 1e-6`, `Vt = 0.04`, `Maxexp = 15`, `R = 1e8`,
temperature dependency off):
* `Vbias = 0.65` (case1): `V/Vt = 16.25`, above `Maxexp`, so the **linear
continuation**. `i = 7.35529` A.
* `Vbias = -5` (case2): reverse, `i = -Ids + V/R = -1.05e-6` A.
* `Vbias = 0.4` (case3): `V/Vt = 10`, so the **exponential**. `i = 0.0220255` A.
This card is leaky — `Ids = 1 µA` is MSL's default and `Vt = 0.04` is not `kT/q` — so
0.65 V is past the knee at 7.4 A. Case3 exercises the Shockley exponential.
The dummy RC branch supplies the one differential state a transient test needs.
"""
test component DiodeForward
"Bias level"
sig = BlockComponents.Sources.Constant(k = Vbias) {
"Dyad": {"placement": {"diagram": {"x1": 290, "x2": 390, "y1": 220, "y2": 320}}}
}
"Bias source"
vs = ElectricalComponents.Analog.Sources.VoltageSource() {
"Dyad": {"placement": {"diagram": {"x1": 425, "x2": 525, "y1": 325, "y2": 425}}}
}
"Diode under test, default card"
d = ElectricalComponents.Analog.Semiconductors.Diode() {
"Dyad": {"placement": {"diagram": {"x1": 35, "x2": 135, "y1": 120, "y2": 220}}}
}
"Dummy branch resistor; provides a differential state without loading the diode"
r_dummy = ElectricalComponents.Analog.Basic.Resistor(R = 1000) {
"Dyad": {"placement": {"diagram": {"x1": 165, "x2": 265, "y1": 20, "y2": 120}}}
}
"Dummy branch capacitor"
c_dummy = ElectricalComponents.Analog.Basic.Capacitor(C = 1u) {
"Dyad": {"placement": {"diagram": {"x1": 295, "x2": 395, "y1": 20, "y2": 120}}}
}
"Ground reference"
ground = ElectricalComponents.Analog.Basic.Ground() {
"Dyad": {"placement": {"diagram": {"x1": 550, "x2": 650, "y1": 430, "y2": 530}}}
}
"Bias voltage applied across the diode"
parameter Vbias::Voltage = 0.65
relations
initial c_dummy.v = 0
connect(sig.y, vs.V) {"Dyad": {"edges": [{"S": 1, "M": [{"x": 475, "y": 270}], "E": 2}], "path": {}}}
connect(vs.p, d.p, r_dummy.p) {
"Dyad": {
"edges": [
{"S": 1, "M": [{"x": 20, "y": 375}], "E": -1},
{"S": -1, "M": [], "E": 2},
{"S": -1, "M": [{"x": 20, "y": 70}], "E": 3}
],
"junctions": [{"x": 20, "y": 170}],
"path": {}
}
}
connect(r_dummy.n, c_dummy.p) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "path": {}}}
connect(d.n, c_dummy.n, vs.n, ground.g) {
"Dyad": {
"edges": [
{"S": 1, "M": [{"x": 410, "y": 170}], "E": -1},
{"S": -1, "M": [], "E": 2},
{"S": -1, "M": [{"x": 540, "y": 70}], "E": -2},
{"S": -2, "M": [], "E": 3},
{"S": -2, "M": [{"x": 600, "y": 375}], "E": 4}
],
"junctions": [{"x": 410, "y": 70}, {"x": 540, "y": 375}],
"path": {}
}
}
metadata {
"Dyad": {
"tests": {
"case1": {
"stop": 0.01,
"atol": {"d.i": 0.00001},
"expect": {"final": {"d.i": 7.3552880946}}
},
"case2": {
"stop": 0.01,
"params": {"Vbias": -5},
"atol": {"d.i": 1e-12},
"expect": {"final": {"d.i": -0.00000105}}
},
"case3": {
"stop": 0.01,
"params": {"Vbias": 0.4},
"atol": {"d.i": 1e-9},
"expect": {"final": {"d.i": 0.0220254698}}
}
}
}
}
endFlattened Source
"""
Operating-point check for Diode, one case per branch of the defining equation.
The diode hangs directly across an ideal source, so the junction sees exactly `Vbias`:
```
i = Ids*(exlin(V/Vt, Maxexp) - 1) + V/R
exlin(x, M) = if x > M then exp(M)*(1 + x - M) else exp(x)
```
at the default MSL card (`Ids = 1e-6`, `Vt = 0.04`, `Maxexp = 15`, `R = 1e8`,
temperature dependency off):
* `Vbias = 0.65` (case1): `V/Vt = 16.25`, above `Maxexp`, so the **linear
continuation**. `i = 7.35529` A.
* `Vbias = -5` (case2): reverse, `i = -Ids + V/R = -1.05e-6` A.
* `Vbias = 0.4` (case3): `V/Vt = 10`, so the **exponential**. `i = 0.0220255` A.
This card is leaky — `Ids = 1 µA` is MSL's default and `Vt = 0.04` is not `kT/q` — so
0.65 V is past the knee at 7.4 A. Case3 exercises the Shockley exponential.
The dummy RC branch supplies the one differential state a transient test needs.
"""
test component DiodeForward
"Bias level"
sig = BlockComponents.Sources.Constant(k = Vbias) {
"Dyad": {"placement": {"diagram": {"x1": 290, "x2": 390, "y1": 220, "y2": 320}}}
}
"Bias source"
vs = ElectricalComponents.Analog.Sources.VoltageSource() {
"Dyad": {"placement": {"diagram": {"x1": 425, "x2": 525, "y1": 325, "y2": 425}}}
}
"Diode under test, default card"
d = ElectricalComponents.Analog.Semiconductors.Diode() {
"Dyad": {"placement": {"diagram": {"x1": 35, "x2": 135, "y1": 120, "y2": 220}}}
}
"Dummy branch resistor; provides a differential state without loading the diode"
r_dummy = ElectricalComponents.Analog.Basic.Resistor(R = 1000) {
"Dyad": {"placement": {"diagram": {"x1": 165, "x2": 265, "y1": 20, "y2": 120}}}
}
"Dummy branch capacitor"
c_dummy = ElectricalComponents.Analog.Basic.Capacitor(C = 1u) {
"Dyad": {"placement": {"diagram": {"x1": 295, "x2": 395, "y1": 20, "y2": 120}}}
}
"Ground reference"
ground = ElectricalComponents.Analog.Basic.Ground() {
"Dyad": {"placement": {"diagram": {"x1": 550, "x2": 650, "y1": 430, "y2": 530}}}
}
"Bias voltage applied across the diode"
parameter Vbias::Voltage = 0.65
relations
initial c_dummy.v = 0
connect(sig.y, vs.V) {"Dyad": {"edges": [{"S": 1, "M": [{"x": 475, "y": 270}], "E": 2}], "path": {}}}
connect(vs.p, d.p, r_dummy.p) {
"Dyad": {
"edges": [
{"S": 1, "M": [{"x": 20, "y": 375}], "E": -1},
{"S": -1, "M": [], "E": 2},
{"S": -1, "M": [{"x": 20, "y": 70}], "E": 3}
],
"junctions": [{"x": 20, "y": 170}],
"path": {}
}
}
connect(r_dummy.n, c_dummy.p) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "path": {}}}
connect(d.n, c_dummy.n, vs.n, ground.g) {
"Dyad": {
"edges": [
{"S": 1, "M": [{"x": 410, "y": 170}], "E": -1},
{"S": -1, "M": [], "E": 2},
{"S": -1, "M": [{"x": 540, "y": 70}], "E": -2},
{"S": -2, "M": [], "E": 3},
{"S": -2, "M": [{"x": 600, "y": 375}], "E": 4}
],
"junctions": [{"x": 410, "y": 70}, {"x": 540, "y": 375}],
"path": {}
}
}
metadata {
"Dyad": {
"tests": {
"case1": {
"stop": 0.01,
"atol": {"d.i": 0.00001},
"expect": {"final": {"d.i": 7.3552880946}}
},
"case2": {
"stop": 0.01,
"params": {"Vbias": -5},
"atol": {"d.i": 1e-12},
"expect": {"final": {"d.i": -0.00000105}}
},
"case3": {
"stop": 0.01,
"params": {"Vbias": 0.4},
"atol": {"d.i": 1e-9},
"expect": {"final": {"d.i": 0.0220254698}}
}
}
}
}
end