$(instance)SinRLC Icon

SinRLC

Series RLC circuit driven by a sinusoidal voltage input.

This component models a series RLC circuit. It consists of a resistor (R), an inductor (L), and a capacitor (C) connected in series with an ideal voltage source. The voltage provided by the source is a sinusoidal waveform generated by a Sine block. A ground component provides the reference potential. Initial conditions for the inductor current ($i_L(0)$) and capacitor voltage ($v_C(0)$) are specified directly in the relations section of the component model.

Usage

SinRLC()

Behavior

\[ \begin{equation} \left[ \begin{array}{c} \mathtt{sine.y}\left( t \right) = \mathtt{source.V}\left( t \right) \\ \mathrm{connect}\left( source_{+}n, inductor_{+}p \right) \\ \mathrm{connect}\left( inductor_{+}n, resistor_{+}n, capacitor_{+}n \right) \\ \mathrm{connect}\left( resistor_{+}p, ground_{+}g, capacitor_{+}p, source_{+}p \right) \\ \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{capacitor.v}\left( t \right) = \mathtt{capacitor.p.v}\left( t \right) - \mathtt{capacitor.n.v}\left( t \right) \\ \mathtt{capacitor.i}\left( t \right) = \mathtt{capacitor.p.i}\left( t \right) \\ \mathtt{capacitor.p.i}\left( t \right) + \mathtt{capacitor.n.i}\left( t \right) = 0 \\ \mathtt{capacitor.C} \frac{\mathrm{d} \mathtt{capacitor.v}\left( t \right)}{\mathrm{d}t} = \mathtt{capacitor.i}\left( t \right) \\ \mathtt{inductor.v}\left( t \right) = - \mathtt{inductor.n.v}\left( t \right) + \mathtt{inductor.p.v}\left( t \right) \\ \mathtt{inductor.i}\left( t \right) = \mathtt{inductor.p.i}\left( t \right) \\ \mathtt{inductor.p.i}\left( t \right) + \mathtt{inductor.n.i}\left( t \right) = 0 \\ \mathtt{inductor.L} \frac{\mathrm{d} \mathtt{inductor.i}\left( t \right)}{\mathrm{d}t} = \mathtt{inductor.v}\left( t \right) \\ \mathtt{source.v}\left( t \right) = - \mathtt{source.n.v}\left( t \right) + \mathtt{source.p.v}\left( t \right) \\ \mathtt{source.i}\left( t \right) = \mathtt{source.p.i}\left( t \right) \\ \mathtt{source.p.i}\left( t \right) + \mathtt{source.n.i}\left( t \right) = 0 \\ \mathtt{source.v}\left( t \right) = \mathtt{source.uV} \mathtt{source.V}\left( t \right) \\ \mathtt{sine.y}\left( t \right) = ifelse\left( \mathtt{sine.start\_time} < t, \mathtt{sine.offset} + \mathtt{sine.amplitude} \sin\left( \mathtt{sine.phase} + 6.2832 \mathtt{sine.frequency} \left( - \mathtt{sine.start\_time} + t \right) \right), \mathtt{sine.offset} \right) \\ \mathtt{ground.g.v}\left( t \right) = 0 \\ \end{array} \right] \end{equation} \]

Source

# Series RLC circuit driven by a sinusoidal voltage input.
#
# This component models a series RLC circuit. It consists of a resistor (R),
# an inductor (L), and a capacitor (C) connected in series with an ideal
# voltage source. The voltage provided by the source is a sinusoidal waveform
# generated by a Sine block. A ground component provides the reference potential.
# Initial conditions for the inductor current ($i_L(0)$) and capacitor voltage ($v_C(0)$)
# are specified directly in the `relations` section of the component model.
example component SinRLC
  # Resistor element with a resistance of 100 Ohms.
  resistor = Resistor(R=100) [{
    "Dyad": {
      "placement": {"icon": {"x1": 1100, "y1": 400, "x2": 1300, "y2": 600, "rot": -90}}
    }
  }]
  # Capacitor element with a capacitance of 1 milliFarad.
  capacitor = Capacitor(C=1m) [{
    "Dyad": {
      "placement": {"icon": {"x1": 800, "y1": 400, "x2": 1000, "y2": 600, "rot": -90}}
    }
  }]
  # Inductor element with an inductance of 1 Henry.
  inductor = Inductor(L=1) [{"Dyad": {"placement": {"icon": {"x1": 600, "y1": 100, "x2": 800, "y2": 300}}}}]
  # Ideal voltage source whose output voltage is externally defined.
  source = VoltageSource() [{
    "Dyad": {
      "placement": {"icon": {"x1": 400, "y1": 400, "x2": 600, "y2": 600, "rot": -90}}
    }
  }]
  # Sine wave generator block with configured frequency (1 Hz), amplitude (1 unit), and phase (0 rad).
  sine = BlockComponents.Sine(frequency=1, amplitude=1, phase=0) [{"Dyad": {"placement": {"icon": {"x1": 100, "y1": 400, "x2": 300, "y2": 600}}}}]
  # Ground connection providing the zero-potential reference.
  ground = Ground() [{
    "Dyad": {"placement": {"icon": {"x1": 800, "y1": 900, "x2": 1000, "y2": 1100}}}
  }]
relations
  initial inductor.i = 0
  initial capacitor.v = 10
  connect(sine.y, source.V) [{"Dyad": {"edges": [{"S": 1, "E": 2}]}}]
  connect(source.n, inductor.p) [{"Dyad": {"edges": [{"S": 1, "M": [{"x": 500, "y": 200}], "E": 2}]}}]
  connect(inductor.n, resistor.n, capacitor.n) [{
    "Dyad": {
      "edges": [
        {"S": 1, "E": -1},
        {"S": 2, "M": [{"x": 1200, "y": 200}], "E": -1},
        {"S": 3, "E": -1}
      ],
      "junctions": [{"x": 900, "y": 200}]
    }
  }]
  connect(resistor.p, ground.g, capacitor.p, source.p) [{
    "Dyad": {
      "edges": [
        {"S": 1, "M": [{"x": 1200, "y": 800}], "E": -1},
        {"S": 2, "E": -1},
        {"S": 3, "E": -1},
        {"S": -1, "M": [{"x": 500, "y": 800}], "E": 4}
      ],
      "junctions": [{"x": 900, "y": 800}]
    }
  }]
metadata {
  "Dyad": {
    "tests": {
      "case1": {
        "stop": 10,
        "expect": {"initial": {"capacitor.v": 10}, "final": {"capacitor.v": -0.067835084}}
      }
    }
  }
}
end
Flattened Source
# Series RLC circuit driven by a sinusoidal voltage input.
#
# This component models a series RLC circuit. It consists of a resistor (R),
# an inductor (L), and a capacitor (C) connected in series with an ideal
# voltage source. The voltage provided by the source is a sinusoidal waveform
# generated by a Sine block. A ground component provides the reference potential.
# Initial conditions for the inductor current ($i_L(0)$) and capacitor voltage ($v_C(0)$)
# are specified directly in the `relations` section of the component model.
example component SinRLC
  # Resistor element with a resistance of 100 Ohms.
  resistor = Resistor(R=100) [{
    "Dyad": {
      "placement": {"icon": {"x1": 1100, "y1": 400, "x2": 1300, "y2": 600, "rot": -90}}
    }
  }]
  # Capacitor element with a capacitance of 1 milliFarad.
  capacitor = Capacitor(C=1m) [{
    "Dyad": {
      "placement": {"icon": {"x1": 800, "y1": 400, "x2": 1000, "y2": 600, "rot": -90}}
    }
  }]
  # Inductor element with an inductance of 1 Henry.
  inductor = Inductor(L=1) [{"Dyad": {"placement": {"icon": {"x1": 600, "y1": 100, "x2": 800, "y2": 300}}}}]
  # Ideal voltage source whose output voltage is externally defined.
  source = VoltageSource() [{
    "Dyad": {
      "placement": {"icon": {"x1": 400, "y1": 400, "x2": 600, "y2": 600, "rot": -90}}
    }
  }]
  # Sine wave generator block with configured frequency (1 Hz), amplitude (1 unit), and phase (0 rad).
  sine = BlockComponents.Sine(frequency=1, amplitude=1, phase=0) [{"Dyad": {"placement": {"icon": {"x1": 100, "y1": 400, "x2": 300, "y2": 600}}}}]
  # Ground connection providing the zero-potential reference.
  ground = Ground() [{
    "Dyad": {"placement": {"icon": {"x1": 800, "y1": 900, "x2": 1000, "y2": 1100}}}
  }]
relations
  initial inductor.i = 0
  initial capacitor.v = 10
  connect(sine.y, source.V) [{"Dyad": {"edges": [{"S": 1, "E": 2}]}}]
  connect(source.n, inductor.p) [{"Dyad": {"edges": [{"S": 1, "M": [{"x": 500, "y": 200}], "E": 2}]}}]
  connect(inductor.n, resistor.n, capacitor.n) [{
    "Dyad": {
      "edges": [
        {"S": 1, "E": -1},
        {"S": 2, "M": [{"x": 1200, "y": 200}], "E": -1},
        {"S": 3, "E": -1}
      ],
      "junctions": [{"x": 900, "y": 200}]
    }
  }]
  connect(resistor.p, ground.g, capacitor.p, source.p) [{
    "Dyad": {
      "edges": [
        {"S": 1, "M": [{"x": 1200, "y": 800}], "E": -1},
        {"S": 2, "E": -1},
        {"S": 3, "E": -1},
        {"S": -1, "M": [{"x": 500, "y": 800}], "E": 4}
      ],
      "junctions": [{"x": 900, "y": 800}]
    }
  }]
metadata {
  "Dyad": {
    "tests": {
      "case1": {
        "stop": 10,
        "expect": {"initial": {"capacitor.v": 10}, "final": {"capacitor.v": -0.067835084}}
      }
    }
  }
}
end


Test Cases

Test Case case1

  • Examples
  • Experiments
  • Analyses