---
url: /dyad/stable/stdlib/ElectricalComponents/examples/Analog.Examples.RLCModel.md
description: >-
  Dyad Analog.Examples.RLCModel docs.  An electrical circuit model featuring an
  inductor in series with a parallel resistor-capacitor combination, driven by a
  constant voltage sou...
---

# `Analog.Examples.RLCModel` {#Analog.Examples.RLCModel}

An electrical circuit model featuring an inductor in series with a parallel resistor-capacitor combination, driven by a constant voltage source.

This model represents an electrical circuit where an inductor (L) is connected in series with a parallel arrangement of a resistor (R) and a capacitor (C). This L-(R||C) configuration is subjected to a constant voltage provided by a voltage source.  The key dynamics are governed by Kirchhoff's laws. Initial conditions are specified for $i_L(0) = 0A$ and $v_C(0) = 10V$. The system is expected to reach a steady state where $v_C = V\_{sig} = 30V$.

## Usage {#Usage}

`ElectricalComponents.Analog.Examples.RLCModel()`

## Behavior {#Behavior}

$$ \begin{align}
0 &= \mathrm{connect}\left( signal\_{+}y, source\_{+}V \right) \\
0 &= \mathrm{connect}\left( source\_{+}n, inductor\_{+}p \right) \\
0 &= \mathrm{connect}\left( inductor\_{+}n, resistor\_{+}n, capacitor\_{+}n \right) \\
0 &= \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.n.i}\left( t \right) + \mathtt{resistor.p.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.n.v}\left( t \right) + \mathtt{capacitor.p.v}\left( t \right) \\
\mathtt{capacitor.i}\left( t \right) &= \mathtt{capacitor.p.i}\left( t \right) \\
\mathtt{capacitor.n.i}\left( t \right) + \mathtt{capacitor.p.i}\left( t \right) &= 0 \\
\frac{\mathrm{d}\mathtt{capacitor.v}\left( t \right)}{\mathrm{d}t} ~ \mathtt{capacitor.C} &= \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.n.i}\left( t \right) + \mathtt{inductor.p.i}\left( t \right) &= 0 \\
\frac{\mathrm{d}\mathtt{inductor.i}\left( t \right)}{\mathrm{d}t} ~ \mathtt{inductor.L} &= \mathtt{inductor.v}\left( t \right) \\
\mathtt{signal.y}\left( t \right) &= \mathtt{signal.k} \\
\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.n.i}\left( t \right) + \mathtt{source.p.i}\left( t \right) &= 0 \\
\mathtt{source.v}\left( t \right) &= \mathtt{source.V}\left( t \right) ~ \mathtt{source.uV} \\
\mathtt{ground.g.v}\left( t \right) &= 0
\end{align}
$$

## Source {#Source}

```dyad
"""
An electrical circuit model featuring an inductor in series with a parallel resistor-capacitor combination, driven by a constant voltage source.

This model represents an electrical circuit where an inductor (L) is connected in series with a parallel arrangement of a resistor (R) and a capacitor (C).
This L-(R||C) configuration is subjected to a constant voltage provided by a voltage source.  The key dynamics are governed by Kirchhoff's laws.
Initial conditions are specified for $i_L(0) = 0A$ and $v_C(0) = 10V$. The system is expected to reach a steady state where $v_C = V_{sig} = 30V$.
"""
example component RLCModel
  "Resistor subcomponent with a resistance value of 100 Ohms."
  resistor = ElectricalComponents.Analog.Basic.Resistor(R = 100) {
    "Dyad": {
      "placement": {"diagram": {"x1": 850, "y1": 450, "x2": 950, "y2": 550, "rot": -90}}
    }
  }
  "Capacitor subcomponent with a capacitance value of 1 milliFarad."
  capacitor = ElectricalComponents.Analog.Basic.Capacitor(C = 1m) {
    "Dyad": {
      "placement": {"diagram": {"x1": 550, "y1": 450, "x2": 650, "y2": 550, "rot": -90}}
    }
  }
  "Inductor subcomponent with an inductance value of 1 Henry."
  inductor = ElectricalComponents.Analog.Basic.Inductor(L = 1) {
    "Dyad": {
      "placement": {"diagram": {"x1": 375, "y1": 250, "x2": 475, "y2": 350, "rot": 0}}
    }
  }
  "Constant signal generator block providing an output value of 30."
  signal = BlockComponents.Sources.Constant(k = 30) {"Dyad": {"placement": {"icon": {"x1": 0, "y1": 450, "x2": 100, "y2": 550}}}}
  "Voltage source subcomponent providing the electromotive force."
  source = ElectricalComponents.Analog.Sources.VoltageSource() {
    "Dyad": {
      "placement": {"diagram": {"x1": 200, "y1": 450, "x2": 300, "y2": 550, "rot": -90}}
    }
  }
  "Ground subcomponent providing the reference potential (0V)."
  ground = ElectricalComponents.Analog.Basic.Ground() {
    "Dyad": {
      "placement": {"diagram": {"x1": 550, "y1": 800, "x2": 650, "y2": 900, "rot": 0}}
    }
  }
relations
  initial inductor.i = 0
  initial capacitor.v = 10
  connect(signal.y, source.V) {"Dyad": {"edges": [{"S": 1, "E": 2}]}}
  connect(source.n, inductor.p) {"Dyad": {"edges": [{"S": 1, "M": [{"x": 250, "y": 300}], "E": 2}]}}
  connect(inductor.n, resistor.n, capacitor.n) {
    "Dyad": {
      "edges": [
        {"S": 1, "E": -1},
        {"S": 2, "M": [{"x": 900, "y": 300}], "E": -1},
        {"S": 3, "E": -1}
      ],
      "junctions": [{"x": 600, "y": 300}]
    }
  }
  connect(resistor.p, ground.g, capacitor.p, source.p) {
    "Dyad": {
      "edges": [
        {"S": 1, "M": [{"x": 900, "y": 700}], "E": -1},
        {"S": 2, "E": -1},
        {"S": 3, "E": -1},
        {"S": -1, "M": [{"x": 250, "y": 700}], "E": 4}
      ],
      "junctions": [{"x": 600, "y": 700}]
    }
  }
metadata {
  "Dyad": {
    "experiments": {},
    "tests": {
      "case1": {
        "solver": "Auto",
        "start": 0,
        "stop": 10,
        "params": {},
        "initial": {},
        "atol": {},
        "rtol": {},
        "abstol": 0.000001,
        "reltol": 0.000001,
        "expect": {"initial": {"capacitor.v": 10}, "final": {"capacitor.v": 30}, "signals": []}
      }
    },
    "labels": [
      {
        "label": "RLC Model",
        "x": 530,
        "y": 110,
        "rot": 0,
        "layer": "diagram",
        "attrs": {
          "fill": "black",
          "font-size": "100",
          "dominant-baseline": "central",
          "text-anchor": "middle"
        }
      }
    ],
    "icons": {"default": "dyad://ElectricalComponents/Example.svg"},
    "path": {},
    "doc": {"behavior": true}
  }
}
end
```

```dyad
"""
An electrical circuit model featuring an inductor in series with a parallel resistor-capacitor combination, driven by a constant voltage source.

This model represents an electrical circuit where an inductor (L) is connected in series with a parallel arrangement of a resistor (R) and a capacitor (C).
This L-(R||C) configuration is subjected to a constant voltage provided by a voltage source.  The key dynamics are governed by Kirchhoff's laws.
Initial conditions are specified for $i_L(0) = 0A$ and $v_C(0) = 10V$. The system is expected to reach a steady state where $v_C = V_{sig} = 30V$.
"""
example component RLCModel
  "Resistor subcomponent with a resistance value of 100 Ohms."
  resistor = ElectricalComponents.Analog.Basic.Resistor(R = 100) {
    "Dyad": {
      "placement": {"diagram": {"x1": 850, "y1": 450, "x2": 950, "y2": 550, "rot": -90}}
    }
  }
  "Capacitor subcomponent with a capacitance value of 1 milliFarad."
  capacitor = ElectricalComponents.Analog.Basic.Capacitor(C = 1m) {
    "Dyad": {
      "placement": {"diagram": {"x1": 550, "y1": 450, "x2": 650, "y2": 550, "rot": -90}}
    }
  }
  "Inductor subcomponent with an inductance value of 1 Henry."
  inductor = ElectricalComponents.Analog.Basic.Inductor(L = 1) {
    "Dyad": {
      "placement": {"diagram": {"x1": 375, "y1": 250, "x2": 475, "y2": 350, "rot": 0}}
    }
  }
  "Constant signal generator block providing an output value of 30."
  signal = BlockComponents.Sources.Constant(k = 30) {"Dyad": {"placement": {"icon": {"x1": 0, "y1": 450, "x2": 100, "y2": 550}}}}
  "Voltage source subcomponent providing the electromotive force."
  source = ElectricalComponents.Analog.Sources.VoltageSource() {
    "Dyad": {
      "placement": {"diagram": {"x1": 200, "y1": 450, "x2": 300, "y2": 550, "rot": -90}}
    }
  }
  "Ground subcomponent providing the reference potential (0V)."
  ground = ElectricalComponents.Analog.Basic.Ground() {
    "Dyad": {
      "placement": {"diagram": {"x1": 550, "y1": 800, "x2": 650, "y2": 900, "rot": 0}}
    }
  }
relations
  initial inductor.i = 0
  initial capacitor.v = 10
  connect(signal.y, source.V) {"Dyad": {"edges": [{"S": 1, "E": 2}]}}
  connect(source.n, inductor.p) {"Dyad": {"edges": [{"S": 1, "M": [{"x": 250, "y": 300}], "E": 2}]}}
  connect(inductor.n, resistor.n, capacitor.n) {
    "Dyad": {
      "edges": [
        {"S": 1, "E": -1},
        {"S": 2, "M": [{"x": 900, "y": 300}], "E": -1},
        {"S": 3, "E": -1}
      ],
      "junctions": [{"x": 600, "y": 300}]
    }
  }
  connect(resistor.p, ground.g, capacitor.p, source.p) {
    "Dyad": {
      "edges": [
        {"S": 1, "M": [{"x": 900, "y": 700}], "E": -1},
        {"S": 2, "E": -1},
        {"S": 3, "E": -1},
        {"S": -1, "M": [{"x": 250, "y": 700}], "E": 4}
      ],
      "junctions": [{"x": 600, "y": 700}]
    }
  }
metadata {
  "Dyad": {
    "experiments": {},
    "tests": {
      "case1": {
        "solver": "Auto",
        "start": 0,
        "stop": 10,
        "params": {},
        "initial": {},
        "atol": {},
        "rtol": {},
        "abstol": 0.000001,
        "reltol": 0.000001,
        "expect": {"initial": {"capacitor.v": 10}, "final": {"capacitor.v": 30}, "signals": []}
      }
    },
    "labels": [
      {
        "label": "RLC Model",
        "x": 530,
        "y": 110,
        "rot": 0,
        "layer": "diagram",
        "attrs": {
          "fill": "black",
          "font-size": "100",
          "dominant-baseline": "central",
          "text-anchor": "middle"
        }
      }
    ],
    "icons": {"default": "dyad://ElectricalComponents/Example.svg"},
    "path": {},
    "doc": {"behavior": true}
  }
}
end
```

## Test Cases {#Test-Cases}

### Test Case `case1` {#Test-Case-case1}

## Related {#Related}

* Examples

* Experiments

* Analyses
