LIBRARY
Analog.Basic.Tests.VariableConductor
Test circuit for VariableConductor.
Same topology as ShowVariableResistor: a sine voltage source drives two parallel branches — a fixed 3-resistor chain (R1-R2-R3, each 1 Ohm) and a chain with two 1 Ohm resistors flanking a VariableConductor. The conductance ramps from 0.5 S (≡ 2 Ω) down to ~0.143 S (≡ 7 Ω) over 2 s, mirroring the resistance ramp in ShowVariableResistor.
Usage
ElectricalComponents.Analog.Basic.Tests.VariableConductor()
Behavior
Source
dyad
"""
Test circuit for VariableConductor.
Same topology as ShowVariableResistor: a sine voltage source drives
two parallel branches — a fixed 3-resistor chain (R1-R2-R3, each
1 Ohm) and a chain with two 1 Ohm resistors flanking a
VariableConductor. The conductance ramps from 0.5 S (≡ 2 Ω) down
to ~0.143 S (≡ 7 Ω) over 2 s, mirroring the resistance ramp in
ShowVariableResistor.
"""
test component VariableConductor
"Sine voltage source: V=1 V, f=1 Hz"
sine = BlockComponents.Sources.Sine(amplitude = 1, frequency = 1) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 20, "y1": 20, "x2": 120, "y2": 120, "rot": 0}
},
"tags": []
}
}
"Voltage source driven by the sine signal"
voltage_source = ElectricalComponents.Analog.Sources.VoltageSource() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 100, "y1": 230, "x2": 200, "y2": 330, "rot": 0}
},
"tags": []
}
}
"Ground at source positive terminal"
ground1 = ElectricalComponents.Analog.Basic.Ground() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 10, "y1": 660, "x2": 110, "y2": 760, "rot": 0}
},
"tags": []
}
}
"Ground at return path (right side)"
ground2 = ElectricalComponents.Analog.Basic.Ground() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 900, "y1": 690, "x2": 1000, "y2": 790, "rot": 0}
},
"tags": []
}
}
"Fixed resistor chain (top branch)"
R1 = ElectricalComponents.Analog.Basic.Resistor(R = 1) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 300, "y1": 230, "x2": 400, "y2": 330, "rot": 0}
},
"tags": []
}
}
R2 = ElectricalComponents.Analog.Basic.Resistor(R = 1) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 500, "y1": 230, "x2": 600, "y2": 330, "rot": 0}
},
"tags": []
}
}
R3 = ElectricalComponents.Analog.Basic.Resistor(R = 1) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 700, "y1": 230, "x2": 800, "y2": 330, "rot": 0}
},
"tags": []
}
}
"Variable conductor chain (bottom branch)"
R4 = ElectricalComponents.Analog.Basic.Resistor(R = 1) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 290, "y1": 530, "x2": 390, "y2": 630, "rot": 0}
},
"tags": []
}
}
variable_conductor = ElectricalComponents.Analog.Basic.VariableConductor() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 500, "y1": 530, "x2": 600, "y2": 630, "rot": 0}
},
"tags": []
}
}
R5 = ElectricalComponents.Analog.Basic.Resistor(R = 1) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 700, "y1": 530, "x2": 800, "y2": 630, "rot": 0}
},
"tags": []
}
}
"Ramp signal for variable conductance: 0.5 S down to ~0.143 S over 2 s"
ramp = BlockComponents.Sources.Ramp(height = -0.357, offset = 0.5, duration = 2) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 380, "y1": 370, "x2": 480, "y2": 470, "rot": 0}
},
"tags": []
}
}
"Fixed temperature to ground the thermal port (alpha=0, so T is irrelevant)"
fixed_temp = ThermalComponents.Sources.FixedTemperature(T = 300.15) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 320, "y1": 740, "x2": 420, "y2": 840, "rot": 0}
},
"tags": []
}
}
relations
guess variable_conductor.i = 0
"Signal to voltage source"
connect(sine.y, voltage_source.V) {
"Dyad": {
"edges": [{"S": 1, "M": [{"x": 150, "y": 70}], "E": 2}],
"renderStyle": "standard"
}
}
"Source positive to ground1"
connect(voltage_source.p, ground1.g) {
"Dyad": {
"edges": [{"S": 1, "M": [{"x": 60, "y": 280}], "E": 2}],
"renderStyle": "standard"
}
}
"Source negative to both branches"
connect(voltage_source.n, R1.p) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
connect(voltage_source.n, R4.p) {
"Dyad": {
"edges": [{"S": 1, "M": [{"x": 270, "y": 280}, {"x": 270, "y": 580}], "E": 2}],
"renderStyle": "standard"
}
}
"Top branch: R1 -> R2 -> R3 -> ground2"
connect(R1.n, R2.p) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
connect(R2.n, R3.p) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
connect(R3.n, ground2.g) {
"Dyad": {
"edges": [{"S": 1, "M": [{"x": 950, "y": 280}], "E": 2}],
"renderStyle": "standard"
}
}
"Bottom branch: R4 -> VC -> R5 -> ground2"
connect(R4.n, variable_conductor.p) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
connect(R5.n, ground2.g) {
"Dyad": {
"edges": [{"S": 1, "M": [{"x": 950, "y": 580}], "E": 2}],
"renderStyle": "standard"
}
}
connect(variable_conductor.n, R5.p) {"Dyad": {"renderStyle": "standard", "edges": [{"S": 1, "E": 2, "M": []}]}}
connect(ramp.y, variable_conductor.G) {
"Dyad": {
"renderStyle": "standard",
"edges": [{"S": 1, "M": [{"x": 550, "y": 420}], "E": 2}]
}
}
connect(fixed_temp.port, variable_conductor.heat_port) {
"Dyad": {
"renderStyle": "standard",
"edges": [{"S": 1, "M": [{"x": 551, "y": 790}], "E": 2}]
}
}
metadata {
"Dyad": {
"tests": {
"case1": {
"stop": 1,
"expect": {"signals": ["variable_conductor.i", "R2.i", "variable_conductor.LossPower"]}
}
}
}
}
endFlattened Source
dyad
"""
Test circuit for VariableConductor.
Same topology as ShowVariableResistor: a sine voltage source drives
two parallel branches — a fixed 3-resistor chain (R1-R2-R3, each
1 Ohm) and a chain with two 1 Ohm resistors flanking a
VariableConductor. The conductance ramps from 0.5 S (≡ 2 Ω) down
to ~0.143 S (≡ 7 Ω) over 2 s, mirroring the resistance ramp in
ShowVariableResistor.
"""
test component VariableConductor
"Sine voltage source: V=1 V, f=1 Hz"
sine = BlockComponents.Sources.Sine(amplitude = 1, frequency = 1) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 20, "y1": 20, "x2": 120, "y2": 120, "rot": 0}
},
"tags": []
}
}
"Voltage source driven by the sine signal"
voltage_source = ElectricalComponents.Analog.Sources.VoltageSource() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 100, "y1": 230, "x2": 200, "y2": 330, "rot": 0}
},
"tags": []
}
}
"Ground at source positive terminal"
ground1 = ElectricalComponents.Analog.Basic.Ground() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 10, "y1": 660, "x2": 110, "y2": 760, "rot": 0}
},
"tags": []
}
}
"Ground at return path (right side)"
ground2 = ElectricalComponents.Analog.Basic.Ground() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 900, "y1": 690, "x2": 1000, "y2": 790, "rot": 0}
},
"tags": []
}
}
"Fixed resistor chain (top branch)"
R1 = ElectricalComponents.Analog.Basic.Resistor(R = 1) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 300, "y1": 230, "x2": 400, "y2": 330, "rot": 0}
},
"tags": []
}
}
R2 = ElectricalComponents.Analog.Basic.Resistor(R = 1) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 500, "y1": 230, "x2": 600, "y2": 330, "rot": 0}
},
"tags": []
}
}
R3 = ElectricalComponents.Analog.Basic.Resistor(R = 1) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 700, "y1": 230, "x2": 800, "y2": 330, "rot": 0}
},
"tags": []
}
}
"Variable conductor chain (bottom branch)"
R4 = ElectricalComponents.Analog.Basic.Resistor(R = 1) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 290, "y1": 530, "x2": 390, "y2": 630, "rot": 0}
},
"tags": []
}
}
variable_conductor = ElectricalComponents.Analog.Basic.VariableConductor() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 500, "y1": 530, "x2": 600, "y2": 630, "rot": 0}
},
"tags": []
}
}
R5 = ElectricalComponents.Analog.Basic.Resistor(R = 1) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 700, "y1": 530, "x2": 800, "y2": 630, "rot": 0}
},
"tags": []
}
}
"Ramp signal for variable conductance: 0.5 S down to ~0.143 S over 2 s"
ramp = BlockComponents.Sources.Ramp(height = -0.357, offset = 0.5, duration = 2) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 380, "y1": 370, "x2": 480, "y2": 470, "rot": 0}
},
"tags": []
}
}
"Fixed temperature to ground the thermal port (alpha=0, so T is irrelevant)"
fixed_temp = ThermalComponents.Sources.FixedTemperature(T = 300.15) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 320, "y1": 740, "x2": 420, "y2": 840, "rot": 0}
},
"tags": []
}
}
relations
guess variable_conductor.i = 0
"Signal to voltage source"
connect(sine.y, voltage_source.V) {
"Dyad": {
"edges": [{"S": 1, "M": [{"x": 150, "y": 70}], "E": 2}],
"renderStyle": "standard"
}
}
"Source positive to ground1"
connect(voltage_source.p, ground1.g) {
"Dyad": {
"edges": [{"S": 1, "M": [{"x": 60, "y": 280}], "E": 2}],
"renderStyle": "standard"
}
}
"Source negative to both branches"
connect(voltage_source.n, R1.p) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
connect(voltage_source.n, R4.p) {
"Dyad": {
"edges": [{"S": 1, "M": [{"x": 270, "y": 280}, {"x": 270, "y": 580}], "E": 2}],
"renderStyle": "standard"
}
}
"Top branch: R1 -> R2 -> R3 -> ground2"
connect(R1.n, R2.p) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
connect(R2.n, R3.p) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
connect(R3.n, ground2.g) {
"Dyad": {
"edges": [{"S": 1, "M": [{"x": 950, "y": 280}], "E": 2}],
"renderStyle": "standard"
}
}
"Bottom branch: R4 -> VC -> R5 -> ground2"
connect(R4.n, variable_conductor.p) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
connect(R5.n, ground2.g) {
"Dyad": {
"edges": [{"S": 1, "M": [{"x": 950, "y": 580}], "E": 2}],
"renderStyle": "standard"
}
}
connect(variable_conductor.n, R5.p) {"Dyad": {"renderStyle": "standard", "edges": [{"S": 1, "E": 2, "M": []}]}}
connect(ramp.y, variable_conductor.G) {
"Dyad": {
"renderStyle": "standard",
"edges": [{"S": 1, "M": [{"x": 550, "y": 420}], "E": 2}]
}
}
connect(fixed_temp.port, variable_conductor.heat_port) {
"Dyad": {
"renderStyle": "standard",
"edges": [{"S": 1, "M": [{"x": 551, "y": 790}], "E": 2}]
}
}
metadata {
"Dyad": {
"tests": {
"case1": {
"stop": 1,
"expect": {"signals": ["variable_conductor.i", "R2.i", "variable_conductor.LossPower"]}
}
}
}
}
endTest Cases
Test Case case1
julia
pltjulia
pltjulia
pltRelated
Examples
Experiments
Analyses
Tests