LIBRARY
Analog.Semiconductors.Tests.PNPTest ​
Test circuit for PNP: the polarity mirror of the NPN common-emitter test.
The emitter sits on the 5 V rail and the collector is loaded by 1 kΩ to ground, so collector current pulls the output node up. The base is ramped from the rail down to 4 V over 1 s through 10 kΩ: the emitter-base junction voltage V_EB rises 0 to 1 V, carrying the device from cut-off through forward active into saturation, and rc.v tracks the collector current.
The base resistor keeps the drive off an ideal source across C_jE (a structurally singular configuration), and the substrate pin is grounded, reproducing the upstream use_substrate = false behavior.
Usage ​
ElectricalComponents.Analog.Semiconductors.Tests.PNPTest()
Behavior ​
Source ​
dyad
"""
Test circuit for PNP: the polarity mirror of the NPN common-emitter test.
The emitter sits on the 5 V rail and the collector is loaded by 1 kΩ to
ground, so collector current pulls the output node up. The base is ramped
from the rail down to 4 V over 1 s through 10 kΩ: the emitter-base junction
voltage `V_EB` rises 0 to 1 V, carrying the device from cut-off through
forward active into saturation, and `rc.v` tracks the collector current.
The base resistor keeps the drive off an ideal source across `C_jE` (a
structurally singular configuration), and the substrate pin is grounded,
reproducing the upstream `use_substrate = false` behavior.
"""
test component PNPTest
"Supply rail level (5 V)"
supply_lvl = BlockComponents.Sources.Constant(k = 5) {
"Dyad": {"placement": {"diagram": {"x1": 20, "y1": 120, "x2": 120, "y2": 220}}}
}
"Emitter supply"
supply = ElectricalComponents.Analog.Sources.VoltageSource() {
"Dyad": {"placement": {"diagram": {"x1": 155, "y1": 225, "x2": 255, "y2": 325}}}
}
"Base ramp: 5 V down to 4 V over 1 s"
bias_sig = BlockComponents.Sources.Ramp(offset = 5, height = -1, duration = 1) {
"Dyad": {"placement": {"diagram": {"x1": 150, "y1": 20, "x2": 250, "y2": 120}}}
}
"Base drive"
bias = ElectricalComponents.Analog.Sources.VoltageSource() {
"Dyad": {"placement": {"diagram": {"x1": 295, "y1": 125, "x2": 395, "y2": 225}}}
}
"Base series resistance (10 kΩ)"
rb = ElectricalComponents.Analog.Basic.Resistor(R = 10000) {
"Dyad": {"placement": {"diagram": {"x1": 425, "y1": 350, "x2": 525, "y2": 450}}}
}
"Collector load resistor (1 kΩ)"
rc = ElectricalComponents.Analog.Basic.Resistor(R = 1000) {
"Dyad": {"placement": {"diagram": {"x1": 685, "y1": 275, "x2": 785, "y2": 375}}}
}
"Transistor under test"
q = ElectricalComponents.Analog.Semiconductors.PNP() {
"Dyad": {"placement": {"diagram": {"x1": 555, "y1": 350, "x2": 655, "y2": 450}}}
}
"Ground reference"
ground = ElectricalComponents.Analog.Basic.Ground() {
"Dyad": {"placement": {"diagram": {"x1": 425, "y1": 230, "x2": 525, "y2": 330}}}
}
relations
"Base starts at the rail: junctions discharged, collector at ground"
initial q.V_EB = 0
initial q.V_CS = 0
connect(supply_lvl.y, supply.V) {"Dyad": {"edges": [{"S": 1, "M": [{"x": 205, "y": 170}], "E": 2}], "path": {}}}
connect(bias_sig.y, bias.V) {"Dyad": {"edges": [{"S": 1, "M": [{"x": 345, "y": 70}], "E": 2}], "path": {}}}
connect(supply.p, q.e) {
"Dyad": {
"edges": [
{
"S": 1,
"M": [{"x": 140, "y": 275}, {"x": 140, "y": 505}, {"x": 605, "y": 505}],
"E": 2
}
],
"path": {}
}
}
connect(q.c, rc.p) {"Dyad": {"edges": [{"S": 1, "M": [{"x": 605, "y": 325}], "E": 2}], "path": {}}}
connect(bias.p, rb.p) {
"Dyad": {
"edges": [{"S": 1, "M": [{"x": 280, "y": 175}, {"x": 280, "y": 400}], "E": 2}],
"path": {}
}
}
connect(rb.n, q.b) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "path": {}}}
connect(q.s, rc.n, supply.n, bias.n, ground.g) {
"Dyad": {
"edges": [
{"S": 1, "M": [], "E": -1},
{"S": -1, "M": [{"x": 800, "y": 325}], "E": 2},
{"S": -1, "M": [{"x": 800, "y": 516}, {"x": 270, "y": 516}], "E": -2},
{"S": -2, "M": [], "E": 3},
{"S": -2, "M": [{"x": 410, "y": 275}], "E": -3},
{"S": -3, "M": [], "E": 4},
{"S": -3, "M": [{"x": 475, "y": 175}], "E": 5}
],
"junctions": [{"x": 800, "y": 400}, {"x": 270, "y": 275}, {"x": 410, "y": 175}],
"path": {}
}
}
metadata {
"Dyad": {"tests": {"case1": {"stop": 1, "expect": {"signals": ["q.V_EB", "rc.v"]}}}}
}
endFlattened Source
dyad
"""
Test circuit for PNP: the polarity mirror of the NPN common-emitter test.
The emitter sits on the 5 V rail and the collector is loaded by 1 kΩ to
ground, so collector current pulls the output node up. The base is ramped
from the rail down to 4 V over 1 s through 10 kΩ: the emitter-base junction
voltage `V_EB` rises 0 to 1 V, carrying the device from cut-off through
forward active into saturation, and `rc.v` tracks the collector current.
The base resistor keeps the drive off an ideal source across `C_jE` (a
structurally singular configuration), and the substrate pin is grounded,
reproducing the upstream `use_substrate = false` behavior.
"""
test component PNPTest
"Supply rail level (5 V)"
supply_lvl = BlockComponents.Sources.Constant(k = 5) {
"Dyad": {"placement": {"diagram": {"x1": 20, "y1": 120, "x2": 120, "y2": 220}}}
}
"Emitter supply"
supply = ElectricalComponents.Analog.Sources.VoltageSource() {
"Dyad": {"placement": {"diagram": {"x1": 155, "y1": 225, "x2": 255, "y2": 325}}}
}
"Base ramp: 5 V down to 4 V over 1 s"
bias_sig = BlockComponents.Sources.Ramp(offset = 5, height = -1, duration = 1) {
"Dyad": {"placement": {"diagram": {"x1": 150, "y1": 20, "x2": 250, "y2": 120}}}
}
"Base drive"
bias = ElectricalComponents.Analog.Sources.VoltageSource() {
"Dyad": {"placement": {"diagram": {"x1": 295, "y1": 125, "x2": 395, "y2": 225}}}
}
"Base series resistance (10 kΩ)"
rb = ElectricalComponents.Analog.Basic.Resistor(R = 10000) {
"Dyad": {"placement": {"diagram": {"x1": 425, "y1": 350, "x2": 525, "y2": 450}}}
}
"Collector load resistor (1 kΩ)"
rc = ElectricalComponents.Analog.Basic.Resistor(R = 1000) {
"Dyad": {"placement": {"diagram": {"x1": 685, "y1": 275, "x2": 785, "y2": 375}}}
}
"Transistor under test"
q = ElectricalComponents.Analog.Semiconductors.PNP() {
"Dyad": {"placement": {"diagram": {"x1": 555, "y1": 350, "x2": 655, "y2": 450}}}
}
"Ground reference"
ground = ElectricalComponents.Analog.Basic.Ground() {
"Dyad": {"placement": {"diagram": {"x1": 425, "y1": 230, "x2": 525, "y2": 330}}}
}
relations
"Base starts at the rail: junctions discharged, collector at ground"
initial q.V_EB = 0
initial q.V_CS = 0
connect(supply_lvl.y, supply.V) {"Dyad": {"edges": [{"S": 1, "M": [{"x": 205, "y": 170}], "E": 2}], "path": {}}}
connect(bias_sig.y, bias.V) {"Dyad": {"edges": [{"S": 1, "M": [{"x": 345, "y": 70}], "E": 2}], "path": {}}}
connect(supply.p, q.e) {
"Dyad": {
"edges": [
{
"S": 1,
"M": [{"x": 140, "y": 275}, {"x": 140, "y": 505}, {"x": 605, "y": 505}],
"E": 2
}
],
"path": {}
}
}
connect(q.c, rc.p) {"Dyad": {"edges": [{"S": 1, "M": [{"x": 605, "y": 325}], "E": 2}], "path": {}}}
connect(bias.p, rb.p) {
"Dyad": {
"edges": [{"S": 1, "M": [{"x": 280, "y": 175}, {"x": 280, "y": 400}], "E": 2}],
"path": {}
}
}
connect(rb.n, q.b) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "path": {}}}
connect(q.s, rc.n, supply.n, bias.n, ground.g) {
"Dyad": {
"edges": [
{"S": 1, "M": [], "E": -1},
{"S": -1, "M": [{"x": 800, "y": 325}], "E": 2},
{"S": -1, "M": [{"x": 800, "y": 516}, {"x": 270, "y": 516}], "E": -2},
{"S": -2, "M": [], "E": 3},
{"S": -2, "M": [{"x": 410, "y": 275}], "E": -3},
{"S": -3, "M": [], "E": 4},
{"S": -3, "M": [{"x": 475, "y": 175}], "E": 5}
],
"junctions": [{"x": 800, "y": 400}, {"x": 270, "y": 275}, {"x": 410, "y": 175}],
"path": {}
}
}
metadata {
"Dyad": {"tests": {"case1": {"stop": 1, "expect": {"signals": ["q.V_EB", "rc.v"]}}}}
}
endTest Cases ​
Test Case case1 ​
julia
pltjulia
plt