Skip to content
SinRLC.md

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 (iL(0)) and capacitor voltage (vC(0)) are specified directly in the relations section of the component model.

Usage

SinRLC()

Behavior

[sine.y(t)=source.V(t)connect(source+n,inductor+p)connect(inductor+n,resistor+n,capacitor+n)connect(resistor+p,ground+g,capacitor+p,source+p)resistor.v(t)=resistor.n.v(t)+resistor.p.v(t)resistor.i(t)=resistor.p.i(t)resistor.p.i(t)+resistor.n.i(t)=0resistor.v(t)=resistor.Rresistor.i(t)capacitor.v(t)=capacitor.p.v(t)capacitor.n.v(t)capacitor.i(t)=capacitor.p.i(t)capacitor.p.i(t)+capacitor.n.i(t)=0capacitor.Cdcapacitor.v(t)dt=capacitor.i(t)inductor.v(t)=inductor.n.v(t)+inductor.p.v(t)inductor.i(t)=inductor.p.i(t)inductor.p.i(t)+inductor.n.i(t)=0inductor.Ldinductor.i(t)dt=inductor.v(t)source.v(t)=source.n.v(t)+source.p.v(t)source.i(t)=source.p.i(t)source.p.i(t)+source.n.i(t)=0source.v(t)=source.uVsource.V(t)sine.y(t)=ifelse(sine.start_time<t,sine.offset+sine.amplitudesin(sine.phase+6.2832sine.frequency(sine.start_time+t)),sine.offset)ground.g.v(t)=0]

Source

dyad
# 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
dyad
# 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