AmplifierWithOpAmpDetailed
Inverting operational amplifier circuit built using a detailed op-amp model.
This circuit implements an inverting amplifier configuration utilizing an OpAmpDetailed
component. An input signal, generated by input_signal1
(a sine wave with 12V amplitude, 1kHz frequency) and conditioned by voltage_source_1
, is applied to the inverting input terminal of the operational amplifier via the input resistor
(R_in = 10kΩ). The non-inverting input of the op-amp is connected to the circuit ground. The operational amplifier is powered by voltage_source_2
(+15V) andvoltage_source_3
(-15V), which are driven byinput_signal2
andinput_signal3
respectively. The output of the amplifier is connected to a loadresistor2
(10kΩ). The voltage gain of this inverting amplifier is primarily determined by the ratio of the feedback resistorresistor1
(R_f = 20kΩ) to the input resistor
. Given the component values R
of resistor
) and R
of resistor1
), the ideal gain is -2. The behavior of OpAmpDetailed
will introduce non-ideal characteristics.
Usage
AmplifierWithOpAmpDetailed()
Behavior
Source
# Inverting operational amplifier circuit built using a detailed op-amp model.
#
# This circuit implements an inverting amplifier configuration utilizing an `OpAmpDetailed` component.
# An input signal, generated by `input_signal1` (a sine wave with 12V amplitude, 1kHz frequency)
# and conditioned by `voltage_source_1`, is applied to the inverting input terminal of the operational
# amplifier via the input `resistor` (R_in = 10kΩ). The non-inverting input of the op-amp is
# connected to the circuit ground. The operational amplifier is powered by `voltage_source_2` (+15V)
# and `voltage_source_3` (-15V), which are driven by `input_signal2` and `input_signal3` respectively.
# The output of the amplifier is connected to a load `resistor2` (10kΩ).
# The voltage gain of this inverting amplifier is primarily determined by the ratio of the feedback
# resistor `resistor1` (R_f = 20kΩ) to the input `resistor`.
# Given the component values $R_{in} = 10k\Omega$ (parameter `R` of `resistor`) and
# $R_f = 20k\Omega$ (parameter `R` of `resistor1`), the ideal gain is -2.
# The behavior of `OpAmpDetailed` will introduce non-ideal characteristics.
test component AmplifierWithOpAmpDetailed
# Detailed operational amplifier model instance, forming the core of the amplifier.
op_amp = OpAmpDetailed() [{
"Dyad": {"placement": {"icon": {"x1": 400, "y1": 550, "x2": 600, "y2": 750, "rot": 0}}}
}]
# Input resistor (R_in), value 10kOhm, connecting the input signal to the op-amp's inverting input.
resistor = Resistor(R=10000) [{
"Dyad": {"placement": {"icon": {"x1": 100, "y1": 510, "x2": 300, "y2": 710, "rot": 0}}}
}]
# Feedback resistor (R_f), value 20kOhm, from op-amp output to inverting input, sets gain.
resistor1 = Resistor(R=20000) [{
"Dyad": {"placement": {"icon": {"x1": 550, "y1": 0, "x2": 750, "y2": 200, "rot": 0}}}
}]
# Load resistor, value 10kOhm, connected from the op-amp output to ground.
resistor2 = Resistor(R=10000) [{
"Dyad": {
"placement": {"icon": {"x1": 800, "y1": 700, "x2": 1000, "y2": 900, "rot": 90}}
}
}]
# Ideal voltage source component for applying the input AC signal.
voltage_source_1 = VoltageSource() [{
"Dyad": {"placement": {"icon": {"x1": 100, "y1": 850, "x2": 300, "y2": 1050, "rot": 0}}}
}]
# Ideal voltage source component for the positive power supply (+15V).
voltage_source_2 = VoltageSource() [{
"Dyad": {"placement": {"icon": {"x1": 550, "y1": 300, "x2": 750, "y2": 500, "rot": 0}}}
}]
# Ideal voltage source component for the negative power supply (-15V).
voltage_source_3 = VoltageSource() [{
"Dyad": {
"placement": {"icon": {"x1": 550, "y1": 850, "x2": 750, "y2": 1050, "rot": 90}}
}
}]
# Sine wave signal generator (12V amplitude, 1kHz) for the amplifier's input.
input_signal1 = BlockComponents.Sine(amplitude=12, frequency=1000, offset=0) [{
"Dyad": {
"placement": {"icon": {"x1": 100, "y1": 1200, "x2": 300, "y2": 1400, "rot": 270}}
}
}]
# Constant signal generator providing +15V for the positive op-amp supply.
input_signal2 = BlockComponents.Constant(k=15) [{
"Dyad": {"placement": {"icon": {"x1": 950, "y1": 150, "x2": 1150, "y2": 350, "rot": 0}}}
}]
# Constant signal generator providing -15V for the negative op-amp supply.
input_signal3 = BlockComponents.Constant(k=-15) [{
"Dyad": {
"placement": {"icon": {"x1": 400, "y1": 1200, "x2": 600, "y2": 1400, "rot": 0}}
}
}]
# Electrical ground reference component for the circuit.
ground = Ground() [{
"Dyad": {
"placement": {"icon": {"x1": 800, "y1": 1200, "x2": 1000, "y2": 1400, "rot": 0}}
}
}]
relations
connect(input_signal1.y, voltage_source_1.V) [{"Dyad": {"edges": [{"S": 1, "E": 2}]}}]
connect(input_signal2.y, voltage_source_2.V) [{
"Dyad": {
"edges": [
{
"S": 1,
"M": [{"x": 1200, "y": 250}, {"x": 1200, "y": 550}, {"x": 650, "y": 550}],
"E": 2
}
]
}
}]
connect(input_signal3.y, voltage_source_3.V) [{
"Dyad": {
"edges": [
{
"S": 1,
"M": [
{"x": 650, "y": 1300},
{"x": 650, "y": 1150},
{"x": 500, "y": 1150},
{"x": 500, "y": 950}
],
"E": 2
}
]
}
}]
initial resistor2.i = 0
initial op_amp.q_fp1 = 0
initial op_amp.q_fr1 = 0
initial op_amp.q_fr2 = 0
initial op_amp.q_fr3 = 0
connect(ground.g, voltage_source_1.n, op_amp.p, resistor2.n, voltage_source_3.n, voltage_source_2.n) [{
"Dyad": {
"edges": [
{"S": 1, "E": -2},
{"S": -3, "E": 2},
{"S": -3, "M": [{"x": 350, "y": 690}], "E": 3},
{"S": -2, "E": 4},
{"S": -1, "E": 5},
{"S": -2, "M": [{"x": 1050, "y": 1100}, {"x": 1050, "y": 400}], "E": 6},
{"S": -1, "E": -2},
{"S": -1, "M": [{"x": 350, "y": 1100}], "E": -3}
],
"junctions": [{"x": 650, "y": 1100}, {"x": 900, "y": 1100}, {"x": 350, "y": 950}]
}
}]
connect(resistor.n, op_amp.n, resistor1.p) [{
"Dyad": {
"edges": [
{"S": 1, "E": -1},
{"S": -1, "E": 2},
{"S": -1, "M": [{"x": 350, "y": 100}], "E": 3}
],
"junctions": [{"x": 350, "y": 610}]
}
}]
connect(resistor1.n, op_amp.outp, resistor2.p) [{
"Dyad": {
"edges": [
{"S": 1, "M": [{"x": 900, "y": 100}], "E": -1},
{"S": 2, "E": -1},
{"S": 3, "E": -1}
],
"junctions": [{"x": 900, "y": 650}]
}
}]
connect(resistor.p, voltage_source_1.p) [{
"Dyad": {"edges": [{"S": 1, "M": [{"x": 50, "y": 610}, {"x": 50, "y": 950}], "E": 2}]}
}]
connect(op_amp.p_supply, voltage_source_2.p) [{"Dyad": {"edges": [{"S": 1, "M": [{"x": 500, "y": 400}], "E": 2}]}}]
connect(op_amp.n_supply, voltage_source_3.p) [{
"Dyad": {"edges": [{"S": 2, "M": [{"x": 650, "y": 800}, {"x": 500, "y": 800}], "E": 1}]}
}]
metadata {
"Dyad": {
"tests": {
"case1": {
"stop": 0.1,
"atol": {"op_amp.outp.v": 0.4},
"expect": {"signals": ["op_amp.outp.v", "voltage_source_1.p.v"]}
}
}
}
}
end
Flattened Source
# Inverting operational amplifier circuit built using a detailed op-amp model.
#
# This circuit implements an inverting amplifier configuration utilizing an `OpAmpDetailed` component.
# An input signal, generated by `input_signal1` (a sine wave with 12V amplitude, 1kHz frequency)
# and conditioned by `voltage_source_1`, is applied to the inverting input terminal of the operational
# amplifier via the input `resistor` (R_in = 10kΩ). The non-inverting input of the op-amp is
# connected to the circuit ground. The operational amplifier is powered by `voltage_source_2` (+15V)
# and `voltage_source_3` (-15V), which are driven by `input_signal2` and `input_signal3` respectively.
# The output of the amplifier is connected to a load `resistor2` (10kΩ).
# The voltage gain of this inverting amplifier is primarily determined by the ratio of the feedback
# resistor `resistor1` (R_f = 20kΩ) to the input `resistor`.
# Given the component values $R_{in} = 10k\Omega$ (parameter `R` of `resistor`) and
# $R_f = 20k\Omega$ (parameter `R` of `resistor1`), the ideal gain is -2.
# The behavior of `OpAmpDetailed` will introduce non-ideal characteristics.
test component AmplifierWithOpAmpDetailed
# Detailed operational amplifier model instance, forming the core of the amplifier.
op_amp = OpAmpDetailed() [{
"Dyad": {"placement": {"icon": {"x1": 400, "y1": 550, "x2": 600, "y2": 750, "rot": 0}}}
}]
# Input resistor (R_in), value 10kOhm, connecting the input signal to the op-amp's inverting input.
resistor = Resistor(R=10000) [{
"Dyad": {"placement": {"icon": {"x1": 100, "y1": 510, "x2": 300, "y2": 710, "rot": 0}}}
}]
# Feedback resistor (R_f), value 20kOhm, from op-amp output to inverting input, sets gain.
resistor1 = Resistor(R=20000) [{
"Dyad": {"placement": {"icon": {"x1": 550, "y1": 0, "x2": 750, "y2": 200, "rot": 0}}}
}]
# Load resistor, value 10kOhm, connected from the op-amp output to ground.
resistor2 = Resistor(R=10000) [{
"Dyad": {
"placement": {"icon": {"x1": 800, "y1": 700, "x2": 1000, "y2": 900, "rot": 90}}
}
}]
# Ideal voltage source component for applying the input AC signal.
voltage_source_1 = VoltageSource() [{
"Dyad": {"placement": {"icon": {"x1": 100, "y1": 850, "x2": 300, "y2": 1050, "rot": 0}}}
}]
# Ideal voltage source component for the positive power supply (+15V).
voltage_source_2 = VoltageSource() [{
"Dyad": {"placement": {"icon": {"x1": 550, "y1": 300, "x2": 750, "y2": 500, "rot": 0}}}
}]
# Ideal voltage source component for the negative power supply (-15V).
voltage_source_3 = VoltageSource() [{
"Dyad": {
"placement": {"icon": {"x1": 550, "y1": 850, "x2": 750, "y2": 1050, "rot": 90}}
}
}]
# Sine wave signal generator (12V amplitude, 1kHz) for the amplifier's input.
input_signal1 = BlockComponents.Sine(amplitude=12, frequency=1000, offset=0) [{
"Dyad": {
"placement": {"icon": {"x1": 100, "y1": 1200, "x2": 300, "y2": 1400, "rot": 270}}
}
}]
# Constant signal generator providing +15V for the positive op-amp supply.
input_signal2 = BlockComponents.Constant(k=15) [{
"Dyad": {"placement": {"icon": {"x1": 950, "y1": 150, "x2": 1150, "y2": 350, "rot": 0}}}
}]
# Constant signal generator providing -15V for the negative op-amp supply.
input_signal3 = BlockComponents.Constant(k=-15) [{
"Dyad": {
"placement": {"icon": {"x1": 400, "y1": 1200, "x2": 600, "y2": 1400, "rot": 0}}
}
}]
# Electrical ground reference component for the circuit.
ground = Ground() [{
"Dyad": {
"placement": {"icon": {"x1": 800, "y1": 1200, "x2": 1000, "y2": 1400, "rot": 0}}
}
}]
relations
connect(input_signal1.y, voltage_source_1.V) [{"Dyad": {"edges": [{"S": 1, "E": 2}]}}]
connect(input_signal2.y, voltage_source_2.V) [{
"Dyad": {
"edges": [
{
"S": 1,
"M": [{"x": 1200, "y": 250}, {"x": 1200, "y": 550}, {"x": 650, "y": 550}],
"E": 2
}
]
}
}]
connect(input_signal3.y, voltage_source_3.V) [{
"Dyad": {
"edges": [
{
"S": 1,
"M": [
{"x": 650, "y": 1300},
{"x": 650, "y": 1150},
{"x": 500, "y": 1150},
{"x": 500, "y": 950}
],
"E": 2
}
]
}
}]
initial resistor2.i = 0
initial op_amp.q_fp1 = 0
initial op_amp.q_fr1 = 0
initial op_amp.q_fr2 = 0
initial op_amp.q_fr3 = 0
connect(ground.g, voltage_source_1.n, op_amp.p, resistor2.n, voltage_source_3.n, voltage_source_2.n) [{
"Dyad": {
"edges": [
{"S": 1, "E": -2},
{"S": -3, "E": 2},
{"S": -3, "M": [{"x": 350, "y": 690}], "E": 3},
{"S": -2, "E": 4},
{"S": -1, "E": 5},
{"S": -2, "M": [{"x": 1050, "y": 1100}, {"x": 1050, "y": 400}], "E": 6},
{"S": -1, "E": -2},
{"S": -1, "M": [{"x": 350, "y": 1100}], "E": -3}
],
"junctions": [{"x": 650, "y": 1100}, {"x": 900, "y": 1100}, {"x": 350, "y": 950}]
}
}]
connect(resistor.n, op_amp.n, resistor1.p) [{
"Dyad": {
"edges": [
{"S": 1, "E": -1},
{"S": -1, "E": 2},
{"S": -1, "M": [{"x": 350, "y": 100}], "E": 3}
],
"junctions": [{"x": 350, "y": 610}]
}
}]
connect(resistor1.n, op_amp.outp, resistor2.p) [{
"Dyad": {
"edges": [
{"S": 1, "M": [{"x": 900, "y": 100}], "E": -1},
{"S": 2, "E": -1},
{"S": 3, "E": -1}
],
"junctions": [{"x": 900, "y": 650}]
}
}]
connect(resistor.p, voltage_source_1.p) [{
"Dyad": {"edges": [{"S": 1, "M": [{"x": 50, "y": 610}, {"x": 50, "y": 950}], "E": 2}]}
}]
connect(op_amp.p_supply, voltage_source_2.p) [{"Dyad": {"edges": [{"S": 1, "M": [{"x": 500, "y": 400}], "E": 2}]}}]
connect(op_amp.n_supply, voltage_source_3.p) [{
"Dyad": {"edges": [{"S": 2, "M": [{"x": 650, "y": 800}, {"x": 500, "y": 800}], "E": 1}]}
}]
metadata {
"Dyad": {
"tests": {
"case1": {
"stop": 0.1,
"atol": {"op_amp.outp.v": 0.4},
"expect": {"signals": ["op_amp.outp.v", "voltage_source_1.p.v"]}
}
}
}
}
end
Test Cases
Test Case case1
plt
plt
Related
Examples
Experiments
Analyses
Tests