Analog.Semiconductors.Tests.DiodeTest ​
Test circuit for Diode: a half-wave rectifier with a capacitor-input filter.
A 5 V, 10 Hz sine drives the diode through a 10 Ω source resistance into a 1 kΩ load bypassed by 100 µF. The diode commutates once per cycle, so each run sweeps the junction from forward conduction to full blocking, where the exponential has saturated at -Ids and the only remaining path is the parallel R.
The load time constant (0.1 s) matches the period, so the ripple between the charging bursts is visible.
Diode has no series resistance and no charge storage, so there is no reverse recovery and no junction node to record — the terminal voltage is the junction voltage. d.i and cload.v pin the circuit. Note that the default MSL card is leaky: Ids = 1 µA and Vt = 0.04, so the forward drop under this load is well below a silicon diode's 0.7 V.
Usage ​
ElectricalComponents.Analog.Semiconductors.Tests.DiodeTest()
Behavior ​
Source ​
"""
Test circuit for Diode: a half-wave rectifier with a capacitor-input filter.
A 5 V, 10 Hz sine drives the diode through a 10 Ω source resistance into a
1 kΩ load bypassed by 100 µF. The diode commutates once per cycle, so each run
sweeps the junction from forward conduction to full blocking, where the
exponential has saturated at `-Ids` and the only remaining path is the parallel
`R`.
The load time constant (0.1 s) matches the period, so the ripple between the
charging bursts is visible.
`Diode` has no series resistance and no charge storage, so there is no reverse
recovery and no junction node to record — the terminal voltage *is* the junction
voltage. `d.i` and `cload.v` pin the circuit. Note that the default MSL card is
leaky: `Ids = 1 µA` and `Vt = 0.04`, so the forward drop under this load is well
below a silicon diode's 0.7 V.
"""
test component DiodeTest
"Sine signal source: 5 V amplitude, 10 Hz"
sine = BlockComponents.Sources.Sine(amplitude = 5, frequency = 10) {
"Dyad": {"placement": {"diagram": {"x1": 160, "y1": 20, "x2": 260, "y2": 120}}}
}
"Voltage source driven by the sine signal"
vs = ElectricalComponents.Analog.Sources.VoltageSource() {
"Dyad": {"placement": {"diagram": {"x1": 295, "y1": 135, "x2": 395, "y2": 235}}}
}
"Source series resistance (10 Ω), limiting the charging peaks"
rs = ElectricalComponents.Analog.Basic.Resistor(R = 10) {
"Dyad": {"placement": {"diagram": {"x1": 425, "y1": 30, "x2": 525, "y2": 130}}}
}
"Diode under test"
d = ElectricalComponents.Analog.Semiconductors.Diode() {
"Dyad": {"placement": {"diagram": {"x1": 555, "y1": 30, "x2": 655, "y2": 130}}}
}
"Reservoir capacitor (100 µF)"
cload = ElectricalComponents.Analog.Basic.Capacitor(C = 100u) {
"Dyad": {"placement": {"diagram": {"x1": 35, "y1": 335, "x2": 135, "y2": 435}}}
}
"Load resistor (1 kΩ)"
rload = ElectricalComponents.Analog.Basic.Resistor(R = 1000) {
"Dyad": {"placement": {"diagram": {"x1": 165, "y1": 235, "x2": 265, "y2": 335}}}
}
"Ground reference"
ground = ElectricalComponents.Analog.Basic.Ground() {
"Dyad": {"placement": {"diagram": {"x1": 425, "y1": 240, "x2": 525, "y2": 340}}}
}
relations
initial cload.v = 0
connect(sine.y, vs.V) {"Dyad": {"edges": [{"S": 1, "M": [{"x": 345, "y": 70}], "E": 2}], "path": {}}}
connect(vs.p, rs.p) {
"Dyad": {
"edges": [{"S": 1, "M": [{"x": 280, "y": 185}, {"x": 280, "y": 80}], "E": 2}],
"path": {}
}
}
connect(rs.n, d.p) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "path": {}}}
connect(d.n, cload.p, rload.p) {
"Dyad": {
"edges": [
{
"S": 1,
"M": [{"x": 670, "y": 80}, {"x": 670, "y": 485}, {"x": 20, "y": 485}],
"E": -1
},
{"S": -1, "M": [], "E": 2},
{"S": -1, "M": [{"x": 20, "y": 285}], "E": 3}
],
"junctions": [{"x": 20, "y": 385}],
"path": {}
}
}
connect(cload.n, rload.n, vs.n, ground.g) {
"Dyad": {
"edges": [
{"S": 1, "M": [{"x": 280, "y": 385}], "E": -1},
{"S": -1, "M": [], "E": 2},
{"S": -1, "M": [{"x": 410, "y": 285}], "E": -2},
{"S": -2, "M": [], "E": 3},
{"S": -2, "M": [{"x": 475, "y": 185}], "E": 4}
],
"junctions": [{"x": 280, "y": 285}, {"x": 410, "y": 185}],
"path": {}
}
}
metadata {
"Dyad": {"tests": {"case1": {"stop": 1, "expect": {"signals": ["d.i", "cload.v"]}}}}
}
endFlattened Source
"""
Test circuit for Diode: a half-wave rectifier with a capacitor-input filter.
A 5 V, 10 Hz sine drives the diode through a 10 Ω source resistance into a
1 kΩ load bypassed by 100 µF. The diode commutates once per cycle, so each run
sweeps the junction from forward conduction to full blocking, where the
exponential has saturated at `-Ids` and the only remaining path is the parallel
`R`.
The load time constant (0.1 s) matches the period, so the ripple between the
charging bursts is visible.
`Diode` has no series resistance and no charge storage, so there is no reverse
recovery and no junction node to record — the terminal voltage *is* the junction
voltage. `d.i` and `cload.v` pin the circuit. Note that the default MSL card is
leaky: `Ids = 1 µA` and `Vt = 0.04`, so the forward drop under this load is well
below a silicon diode's 0.7 V.
"""
test component DiodeTest
"Sine signal source: 5 V amplitude, 10 Hz"
sine = BlockComponents.Sources.Sine(amplitude = 5, frequency = 10) {
"Dyad": {"placement": {"diagram": {"x1": 160, "y1": 20, "x2": 260, "y2": 120}}}
}
"Voltage source driven by the sine signal"
vs = ElectricalComponents.Analog.Sources.VoltageSource() {
"Dyad": {"placement": {"diagram": {"x1": 295, "y1": 135, "x2": 395, "y2": 235}}}
}
"Source series resistance (10 Ω), limiting the charging peaks"
rs = ElectricalComponents.Analog.Basic.Resistor(R = 10) {
"Dyad": {"placement": {"diagram": {"x1": 425, "y1": 30, "x2": 525, "y2": 130}}}
}
"Diode under test"
d = ElectricalComponents.Analog.Semiconductors.Diode() {
"Dyad": {"placement": {"diagram": {"x1": 555, "y1": 30, "x2": 655, "y2": 130}}}
}
"Reservoir capacitor (100 µF)"
cload = ElectricalComponents.Analog.Basic.Capacitor(C = 100u) {
"Dyad": {"placement": {"diagram": {"x1": 35, "y1": 335, "x2": 135, "y2": 435}}}
}
"Load resistor (1 kΩ)"
rload = ElectricalComponents.Analog.Basic.Resistor(R = 1000) {
"Dyad": {"placement": {"diagram": {"x1": 165, "y1": 235, "x2": 265, "y2": 335}}}
}
"Ground reference"
ground = ElectricalComponents.Analog.Basic.Ground() {
"Dyad": {"placement": {"diagram": {"x1": 425, "y1": 240, "x2": 525, "y2": 340}}}
}
relations
initial cload.v = 0
connect(sine.y, vs.V) {"Dyad": {"edges": [{"S": 1, "M": [{"x": 345, "y": 70}], "E": 2}], "path": {}}}
connect(vs.p, rs.p) {
"Dyad": {
"edges": [{"S": 1, "M": [{"x": 280, "y": 185}, {"x": 280, "y": 80}], "E": 2}],
"path": {}
}
}
connect(rs.n, d.p) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "path": {}}}
connect(d.n, cload.p, rload.p) {
"Dyad": {
"edges": [
{
"S": 1,
"M": [{"x": 670, "y": 80}, {"x": 670, "y": 485}, {"x": 20, "y": 485}],
"E": -1
},
{"S": -1, "M": [], "E": 2},
{"S": -1, "M": [{"x": 20, "y": 285}], "E": 3}
],
"junctions": [{"x": 20, "y": 385}],
"path": {}
}
}
connect(cload.n, rload.n, vs.n, ground.g) {
"Dyad": {
"edges": [
{"S": 1, "M": [{"x": 280, "y": 385}], "E": -1},
{"S": -1, "M": [], "E": 2},
{"S": -1, "M": [{"x": 410, "y": 285}], "E": -2},
{"S": -2, "M": [], "E": 3},
{"S": -2, "M": [{"x": 475, "y": 185}], "E": 4}
],
"junctions": [{"x": 280, "y": 285}, {"x": 410, "y": 185}],
"path": {}
}
}
metadata {
"Dyad": {"tests": {"case1": {"stop": 1, "expect": {"signals": ["d.i", "cload.v"]}}}}
}
endTest Cases ​
Test Case case1 ​
pltplt