$(instance)AmplifierWithOpAmpDetailed Icon

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 (Rin = 10kΩ). The non-inverting input of the op-amp is connected to the circuit ground. The operational amplifier is powered by `voltagesource2(+15V) andvoltagesource3(-15V), which are driven byinputsignal2andinputsignal3respectively. 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` (Rf = 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.

Usage

AmplifierWithOpAmpDetailed()

Behavior

\[ \begin{equation} \left[ \begin{array}{c} \mathtt{input\_signal1.y}\left( t \right) = \mathtt{voltage\_source\_1.V}\left( t \right) \\ \mathtt{input\_signal2.y}\left( t \right) = \mathtt{voltage\_source\_2.V}\left( t \right) \\ \mathtt{input\_signal3.y}\left( t \right) = \mathtt{voltage\_source\_3.V}\left( t \right) \\ \mathrm{connect}\left( ground_{+}g, voltage_{source\_1_{+}n}, op_{amp_{+}p}, resistor2_{+}n, voltage_{source\_3_{+}n}, voltage_{source\_2_{+}n} \right) \\ \mathrm{connect}\left( resistor_{+}n, op_{amp_{+}n}, resistor1_{+}p \right) \\ \mathrm{connect}\left( resistor1_{+}n, op_{amp_{+}outp}, resistor2_{+}p \right) \\ \mathrm{connect}\left( resistor_{+}p, voltage_{source\_1_{+}p} \right) \\ \mathrm{connect}\left( op_{amp_{+}p\_supply}, voltage_{source\_2_{+}p} \right) \\ \mathrm{connect}\left( op_{amp_{+}n\_supply}, voltage_{source\_3_{+}p} \right) \\ \mathtt{op\_amp.v\_pos}\left( t \right) = \mathtt{op\_amp.p\_supply.v}\left( t \right) \\ \mathtt{op\_amp.v\_neg}\left( t \right) = \mathtt{op\_amp.n\_supply.v}\left( t \right) \\ \mathtt{op\_amp.p.i}\left( t \right) = \mathtt{op\_amp.i\_vos}\left( t \right) \\ \mathtt{op\_amp.n.i}\left( t \right) = - \mathtt{op\_amp.i\_c3}\left( t \right) - \mathtt{op\_amp.i\_r2}\left( t \right) + \mathtt{op\_amp.i\_4}\left( t \right) \\ 0 = \mathtt{op\_amp.i\_3}\left( t \right) + \mathtt{op\_amp.i\_c3}\left( t \right) - \mathtt{op\_amp.i\_vos}\left( t \right) + \mathtt{op\_amp.i\_r2}\left( t \right) \\ \mathtt{op\_amp.p.v}\left( t \right) - \mathtt{op\_amp.n.v}\left( t \right) = \mathtt{op\_amp.v\_vos}\left( t \right) + \mathtt{op\_amp.v\_in}\left( t \right) \\ \mathtt{op\_amp.v\_4}\left( t \right) = \mathtt{op\_amp.n.v}\left( t \right) \\ \mathtt{op\_amp.v\_3}\left( t \right) = \mathtt{op\_amp.p.v}\left( t \right) - \mathtt{op\_amp.v\_vos}\left( t \right) \\ \mathtt{op\_amp.v\_vos}\left( t \right) = \mathtt{op\_amp.Vos} \\ \mathtt{op\_amp.i\_3}\left( t \right) = \mathtt{op\_amp.I1} + \frac{\mathtt{op\_amp.v\_3}\left( t \right)}{\mathtt{op\_amp.Rcm}} \\ \mathtt{op\_amp.v\_in}\left( t \right) = \mathtt{op\_amp.Rdm} \mathtt{op\_amp.i\_r2}\left( t \right) \\ \mathtt{op\_amp.i\_c3}\left( t \right) = \mathtt{op\_amp.Cin} \frac{\mathrm{d} \mathtt{op\_amp.v\_in}\left( t \right)}{\mathrm{d}t} \\ \mathtt{op\_amp.i\_4}\left( t \right) = \mathtt{op\_amp.I2} + \frac{\mathtt{op\_amp.v\_4}\left( t \right)}{\mathtt{op\_amp.Rcm}} \\ \frac{\mathrm{d} \mathtt{op\_amp.q\_fr1}\left( t \right)}{\mathrm{d}t} = 6.2832 \mathtt{op\_amp.fp2} \left( - \mathtt{op\_amp.q\_fr1}\left( t \right) + \mathtt{op\_amp.v\_in}\left( t \right) \right) \\ \frac{\frac{\mathrm{d} \mathtt{op\_amp.q\_fr2}\left( t \right)}{\mathrm{d}t}}{6.2832 \mathtt{op\_amp.fp3}} + \mathtt{op\_amp.q\_fr2}\left( t \right) = \frac{\frac{\mathrm{d} \mathtt{op\_amp.q\_fr1}\left( t \right)}{\mathrm{d}t}}{6.2832 \mathtt{op\_amp.fz}} + \mathtt{op\_amp.q\_fr1}\left( t \right) \\ \frac{\mathrm{d} \mathtt{op\_amp.q\_fr3}\left( t \right)}{\mathrm{d}t} = 6.2832 \mathtt{op\_amp.fp4} \left( - \mathtt{op\_amp.q\_fr3}\left( t \right) + \mathtt{op\_amp.q\_fr2}\left( t \right) \right) \\ \mathtt{op\_amp.q\_sum}\left( t \right) = \mathtt{op\_amp.Avcm\_val} \left( \mathtt{op\_amp.v\_4}\left( t \right) + \mathtt{op\_amp.v\_3}\left( t \right) \right) + \mathtt{op\_amp.Avd0\_val} \mathtt{op\_amp.q\_fr3}\left( t \right) \\ \mathtt{op\_amp.q\_sum\_help}\left( t \right) = ifelse\left( \left( \mathtt{op\_amp.q\_sum}\left( t \right) > - \mathtt{op\_amp.vcp\_abs} + \mathtt{op\_amp.v\_pos}\left( t \right) \right) \wedge \left( \mathtt{op\_amp.q\_fp1}\left( t \right) \geq - \mathtt{op\_amp.vcp\_abs} + \mathtt{op\_amp.v\_pos}\left( t \right) \right), - \mathtt{op\_amp.vcp\_abs} + \mathtt{op\_amp.v\_pos}\left( t \right), ifelse\left( \left( \mathtt{op\_amp.q\_sum}\left( t \right) < \mathtt{op\_amp.vcm\_abs} + \mathtt{op\_amp.v\_neg}\left( t \right) \right) \wedge \left( \mathtt{op\_amp.q\_fp1}\left( t \right) \leq \mathtt{op\_amp.vcm\_abs} + \mathtt{op\_amp.v\_neg}\left( t \right) \right), \mathtt{op\_amp.vcm\_abs} + \mathtt{op\_amp.v\_neg}\left( t \right), \mathtt{op\_amp.q\_sum}\left( t \right) \right) \right) \\ \frac{\mathrm{d} \mathtt{op\_amp.q\_fp1}\left( t \right)}{\mathrm{d}t} = 6.2832 \mathtt{op\_amp.fp1} \left( - \mathtt{op\_amp.q\_fp1}\left( t \right) + \mathtt{op\_amp.q\_sum\_help}\left( t \right) \right) \\ \frac{\mathrm{d} \mathtt{op\_amp.x}\left( t \right)}{\mathrm{d}t} = \frac{ - \mathtt{op\_amp.v\_source}\left( t \right) + \mathtt{op\_amp.q\_fp1}\left( t \right)}{\mathtt{op\_amp.Ts}} \\ \frac{\mathrm{d} \mathtt{op\_amp.v\_source}\left( t \right)}{\mathrm{d}t} = ifelse\left( \frac{\mathrm{d} \mathtt{op\_amp.x}\left( t \right)}{\mathrm{d}t} > \mathtt{op\_amp.sr\_p\_val}, \mathtt{op\_amp.sr\_p\_val}, ifelse\left( \frac{\mathrm{d} \mathtt{op\_amp.x}\left( t \right)}{\mathrm{d}t} < \mathtt{op\_amp.sr\_m\_val}, \mathtt{op\_amp.sr\_m\_val}, \frac{\mathrm{d} \mathtt{op\_amp.x}\left( t \right)}{\mathrm{d}t} \right) \right) \\ \mathtt{op\_amp.v\_out}\left( t \right) = \mathtt{op\_amp.outp.v}\left( t \right) \\ \mathtt{op\_amp.i\_out}\left( t \right) = \mathtt{op\_amp.outp.i}\left( t \right) \\ \mathtt{op\_amp.i\_out}\left( t \right) = ifelse\left( \mathtt{op\_amp.v\_out}\left( t \right) > \mathtt{op\_amp.v\_source}\left( t \right) + \mathtt{op\_amp.Imaxsi\_val} \mathtt{op\_amp.Rout}, \mathtt{op\_amp.Imaxsi\_val}, ifelse\left( \mathtt{op\_amp.v\_out}\left( t \right) < \mathtt{op\_amp.v\_source}\left( t \right) - \mathtt{op\_amp.Imaxso\_val} \mathtt{op\_amp.Rout}, - \mathtt{op\_amp.Imaxso\_val}, \frac{ - \mathtt{op\_amp.v\_source}\left( t \right) + \mathtt{op\_amp.v\_out}\left( t \right)}{\mathtt{op\_amp.Rout}} \right) \right) \\ \mathtt{op\_amp.p\_supply.i}\left( t \right) = 0 \\ \mathtt{op\_amp.n\_supply.i}\left( t \right) = 0 \\ \mathtt{resistor.v}\left( t \right) = - \mathtt{resistor.n.v}\left( t \right) + \mathtt{resistor.p.v}\left( t \right) \\ \mathtt{resistor.i}\left( t \right) = \mathtt{resistor.p.i}\left( t \right) \\ \mathtt{resistor.p.i}\left( t \right) + \mathtt{resistor.n.i}\left( t \right) = 0 \\ \mathtt{resistor.v}\left( t \right) = \mathtt{resistor.R} \mathtt{resistor.i}\left( t \right) \\ \mathtt{resistor1.v}\left( t \right) = - \mathtt{resistor1.n.v}\left( t \right) + \mathtt{resistor1.p.v}\left( t \right) \\ \mathtt{resistor1.i}\left( t \right) = \mathtt{resistor1.p.i}\left( t \right) \\ \mathtt{resistor1.n.i}\left( t \right) + \mathtt{resistor1.p.i}\left( t \right) = 0 \\ \mathtt{resistor1.v}\left( t \right) = \mathtt{resistor1.R} \mathtt{resistor1.i}\left( t \right) \\ \mathtt{resistor2.v}\left( t \right) = - \mathtt{resistor2.n.v}\left( t \right) + \mathtt{resistor2.p.v}\left( t \right) \\ \mathtt{resistor2.i}\left( t \right) = \mathtt{resistor2.p.i}\left( t \right) \\ \mathtt{resistor2.p.i}\left( t \right) + \mathtt{resistor2.n.i}\left( t \right) = 0 \\ \mathtt{resistor2.v}\left( t \right) = \mathtt{resistor2.R} \mathtt{resistor2.i}\left( t \right) \\ \mathtt{voltage\_source\_1.v}\left( t \right) = - \mathtt{voltage\_source\_1.n.v}\left( t \right) + \mathtt{voltage\_source\_1.p.v}\left( t \right) \\ \mathtt{voltage\_source\_1.i}\left( t \right) = \mathtt{voltage\_source\_1.p.i}\left( t \right) \\ \mathtt{voltage\_source\_1.p.i}\left( t \right) + \mathtt{voltage\_source\_1.n.i}\left( t \right) = 0 \\ \mathtt{voltage\_source\_1.v}\left( t \right) = \mathtt{voltage\_source\_1.uV} \mathtt{voltage\_source\_1.V}\left( t \right) \\ \mathtt{voltage\_source\_2.v}\left( t \right) = - \mathtt{voltage\_source\_2.n.v}\left( t \right) + \mathtt{voltage\_source\_2.p.v}\left( t \right) \\ \mathtt{voltage\_source\_2.i}\left( t \right) = \mathtt{voltage\_source\_2.p.i}\left( t \right) \\ \mathtt{voltage\_source\_2.n.i}\left( t \right) + \mathtt{voltage\_source\_2.p.i}\left( t \right) = 0 \\ \mathtt{voltage\_source\_2.v}\left( t \right) = \mathtt{voltage\_source\_2.uV} \mathtt{voltage\_source\_2.V}\left( t \right) \\ \mathtt{voltage\_source\_3.v}\left( t \right) = - \mathtt{voltage\_source\_3.n.v}\left( t \right) + \mathtt{voltage\_source\_3.p.v}\left( t \right) \\ \mathtt{voltage\_source\_3.i}\left( t \right) = \mathtt{voltage\_source\_3.p.i}\left( t \right) \\ \mathtt{voltage\_source\_3.p.i}\left( t \right) + \mathtt{voltage\_source\_3.n.i}\left( t \right) = 0 \\ \mathtt{voltage\_source\_3.v}\left( t \right) = \mathtt{voltage\_source\_3.uV} \mathtt{voltage\_source\_3.V}\left( t \right) \\ \mathtt{input\_signal1.y}\left( t \right) = ifelse\left( \mathtt{input\_signal1.start\_time} < t, \mathtt{input\_signal1.offset} + \mathtt{input\_signal1.amplitude} \sin\left( \mathtt{input\_signal1.phase} + 6.2832 \mathtt{input\_signal1.frequency} \left( - \mathtt{input\_signal1.start\_time} + t \right) \right), \mathtt{input\_signal1.offset} \right) \\ \mathtt{input\_signal2.y}\left( t \right) = \mathtt{input\_signal2.k} \\ \mathtt{input\_signal3.y}\left( t \right) = \mathtt{input\_signal3.k} \\ \mathtt{ground.g.v}\left( t \right) = 0 \\ \end{array} \right] \end{equation} \]

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
Example block output
plt
Example block output