Skip to content
DeSauty.md

DeSauty

AC bridge circuit for comparing capacitances

This component models a De Sauty bridge, an electrical circuit configuration used for measuring capacitances. The bridge consists of four arms: Arm 1: capacitor1 (with capacitance C₁) Arm 2: resistor1 (with resistance R1 = 5.0 Ohm) Arm 3: capacitor2 (with capacitance C₂) Arm 4: resistor2 (with resistance R2 = 2.0 Ohm) An AC voltage, generated by input_signal and applied through source, is connected across the overall bridge structure. Specifically, one terminal of the source (source.p) connects to the common point of capacitor1.n and capacitor2.n. The other terminal of the source (source.n) connects to the common point of resistor1.p and resistor2.p, which is also connected to ground. A current_sensor acts as a detector, connected between the junction of capacitor1.p/resistor1.n and the junction of capacitor2.p/resistor2.n. The bridge is said to be balanced when no current flows through the current_sensor. This occurs when the potentials at its connection points are equal. The condition for balance in this De Sauty bridge configuration is given by the equation:

R1C1=R2C2

where R₁ is the resistance of resistor1 and C₁ is the capacitance of capacitor1, and R₂ is the resistance of resistor2 and C₂ is the capacitance of capacitor2. This model allows for the simulation of the bridge's behavior under AC excitation, including observing whether it is balanced for the given parameter values C₁ and C₂, and fixed resistances resistor1.R = 5.0 and resistor2.R = 2.0. The initial voltage across capacitor2 is set to 0.0V by the statement initial capacitor2.v = 0.0 in the relations section.

Usage

DeSauty(C₁=30μ, C₂=45μ)

Parameters:

NameDescriptionUnitsDefault value
C₁Capacitance of the first capacitor (capacitor1).F0.000029999999999999997
C₂Capacitance of the second capacitor (capacitor2).F0.000044999999999999996

Behavior

[input_signal.y(t)=source.V(t)connect(source+p,capacitor1+n,capacitor2+n)connect(source+n,resistor1+p,resistor2+p)connect(source+n,ground+g)connect(resistor1+n,currentsensor+n,capacitor1+p)connect(resistor2+n,currentsensor+p,capacitor2+p)resistor1.v(t)=resistor1.n.v(t)+resistor1.p.v(t)resistor1.i(t)=resistor1.p.i(t)resistor1.n.i(t)+resistor1.p.i(t)=0resistor1.v(t)=resistor1.Rresistor1.i(t)resistor2.v(t)=resistor2.n.v(t)+resistor2.p.v(t)resistor2.i(t)=resistor2.p.i(t)resistor2.p.i(t)+resistor2.n.i(t)=0resistor2.v(t)=resistor2.Rresistor2.i(t)capacitor1.v(t)=capacitor1.n.v(t)+capacitor1.p.v(t)capacitor1.i(t)=capacitor1.p.i(t)capacitor1.n.i(t)+capacitor1.p.i(t)=0capacitor1.Cdcapacitor1.v(t)dt=capacitor1.i(t)capacitor2.v(t)=capacitor2.p.v(t)capacitor2.n.v(t)capacitor2.i(t)=capacitor2.p.i(t)capacitor2.n.i(t)+capacitor2.p.i(t)=0capacitor2.Cdcapacitor2.v(t)dt=capacitor2.i(t)current_sensor.p.v(t)=current_sensor.n.v(t)current_sensor.p.i(t)=current_sensor.i(t)current_sensor.n.i(t)=current_sensor.i(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)input_signal.y(t)=ifelse(input_signal.start_time<t,input_signal.offset+input_signal.amplitudesin(input_signal.phase+6.2832input_signal.frequency(input_signal.start_time+t)),input_signal.offset)ground.g.v(t)=0]

Source

dyad
# AC bridge circuit for comparing capacitances
#
# This component models a De Sauty bridge, an electrical circuit configuration used for measuring capacitances.
# The bridge consists of four arms:
# Arm 1: `capacitor1` (with capacitance `C₁`)
# Arm 2: `resistor1` (with resistance `R1 = 5.0 Ohm`)
# Arm 3: `capacitor2` (with capacitance `C₂`)
# Arm 4: `resistor2` (with resistance `R2 = 2.0 Ohm`)
# An AC voltage, generated by `input_signal` and applied through `source`, is connected across the overall bridge structure.
# Specifically, one terminal of the source (`source.p`) connects to the common point of `capacitor1.n` and `capacitor2.n`.
# The other terminal of the source (`source.n`) connects to the common point of `resistor1.p` and `resistor2.p`, which is also connected to `ground`.
# A `current_sensor` acts as a detector, connected between the junction of `capacitor1.p`/`resistor1.n` and the junction of `capacitor2.p`/`resistor2.n`.
# The bridge is said to be balanced when no current flows through the `current_sensor`. This occurs when the potentials at its connection points are equal.
# The condition for balance in this De Sauty bridge configuration is given by the equation:
# ```math
# R_1 C_1 = R_2 C_2
# ```
# where `R₁` is the resistance of `resistor1` and `C₁` is the capacitance of `capacitor1`, and
# `R₂` is the resistance of `resistor2` and `C₂` is the capacitance of `capacitor2`.
# This model allows for the simulation of the bridge's behavior under AC excitation, including observing whether it is balanced for the given parameter values `C₁` and `C₂`,
# and fixed resistances `resistor1.R = 5.0` and `resistor2.R = 2.0`.
# The initial voltage across `capacitor2` is set to `0.0V` by the statement `initial capacitor2.v = 0.0` in the relations section.
example component DeSauty
  # First resistor in one arm of the De Sauty bridge.
  resistor1 = Resistor(R=5.0) [{
    "Dyad": {
      "placement": {"icon": {"x1": 800, "y1": 700, "x2": 1000, "y2": 900, "rot": 180}}
    }
  }]
  # Second resistor in the other arm of the De Sauty bridge.
  resistor2 = Resistor(R=2.0) [{
    "Dyad": {
      "placement": {"icon": {"x1": 800, "y1": 1300, "x2": 1000, "y2": 1500, "rot": 180}}
    }
  }]
  # First capacitor in one arm of the De Sauty bridge, with capacitance C₁.
  capacitor1 = Capacitor(C=C₁) [{
    "Dyad": {
      "placement": {"icon": {"x1": 200, "y1": 700, "x2": 400, "y2": 900, "rot": 180}}
    }
  }]
  # Second capacitor in the other arm of the De Sauty bridge, with capacitance C₂.
  capacitor2 = Capacitor(C=C₂) [{
    "Dyad": {
      "placement": {"icon": {"x1": 200, "y1": 1300, "x2": 400, "y2": 1500, "rot": 180}}
    }
  }]
  # Measures the current between the two branches of the bridge, acting as the detector.
  current_sensor = CurrentSensor() [{
    "Dyad": {
      "placement": {"icon": {"x1": 500, "y1": 1000, "x2": 700, "y2": 1200, "rot": 90}}
    }
  }]
  # AC voltage source supplying the bridge.
  source = VoltageSource() [{"Dyad": {"placement": {"icon": {"x1": 500, "y1": 400, "x2": 700, "y2": 600}}}}]
  # Generates the sinusoidal input voltage for the AC source.
  input_signal = BlockComponents.Sine(frequency=100.0, amplitude=1, phase=0) [{
    "Dyad": {"placement": {"icon": {"x1": 500, "y1": 100, "x2": 700, "y2": 300, "rot": 90}}}
  }]
  # Reference ground for the circuit.
  ground = Ground() [{
    "Dyad": {"placement": {"icon": {"x1": 1150, "y1": 1150, "x2": 1350, "y2": 1350}}}
  }]
  # Capacitance of the first capacitor (`capacitor1`).
  parameter C₁::Capacitance = 30μ
  # Capacitance of the second capacitor (`capacitor2`).
  parameter C₂::Capacitance = 45μ
relations
  initial capacitor2.v = 0.0
  connect(input_signal.y, source.V) [{"Dyad": {"edges": [{"S": 1, "E": 2}]}}]
  connect(source.p, capacitor1.n, capacitor2.n) [{
    "Dyad": {
      "edges": [
        {"S": 1, "M": [{"x": 100, "y": 500}, {"x": 100, "y": 1100}], "E": -1},
        {"S": 2, "M": [{"x": 150, "y": 800}], "E": -1},
        {"S": 3, "M": [{"x": 150, "y": 1400}], "E": -1}
      ],
      "junctions": [{"x": 150, "y": 1100}]
    }
  }]
  connect(source.n, resistor1.p, resistor2.p) [{
    "Dyad": {
      "edges": [
        {"S": 1, "M": [{"x": 1100, "y": 500}, {"x": 1100, "y": 1100}], "E": -1},
        {"S": 2, "M": [{"x": 1050, "y": 800}], "E": -1},
        {"S": 3, "M": [{"x": 1050, "y": 1400}], "E": -1}
      ],
      "junctions": [{"x": 1050, "y": 1100}]
    }
  }]
  connect(source.n, ground.g) [{
    "Dyad": {
      "edges": [{"S": 2, "M": [{"x": 1250, "y": 1100}], "E": -1}],
      "junctions": [{"x": 1100, "y": 1100}]
    }
  }]
  connect(resistor1.n, current_sensor.n, capacitor1.p) [{
    "Dyad": {
      "edges": [{"S": 1, "E": -1}, {"S": 2, "E": -1}, {"S": 3, "E": -1}],
      "junctions": [{"x": 600, "y": 800}]
    }
  }]
  connect(resistor2.n, current_sensor.p, capacitor2.p) [{
    "Dyad": {
      "edges": [{"S": 1, "E": -1}, {"S": 2, "E": -1}, {"S": 3, "E": -1}],
      "junctions": [{"x": 600, "y": 1400}]
    }
  }]
end
Flattened Source
dyad
# AC bridge circuit for comparing capacitances
#
# This component models a De Sauty bridge, an electrical circuit configuration used for measuring capacitances.
# The bridge consists of four arms:
# Arm 1: `capacitor1` (with capacitance `C₁`)
# Arm 2: `resistor1` (with resistance `R1 = 5.0 Ohm`)
# Arm 3: `capacitor2` (with capacitance `C₂`)
# Arm 4: `resistor2` (with resistance `R2 = 2.0 Ohm`)
# An AC voltage, generated by `input_signal` and applied through `source`, is connected across the overall bridge structure.
# Specifically, one terminal of the source (`source.p`) connects to the common point of `capacitor1.n` and `capacitor2.n`.
# The other terminal of the source (`source.n`) connects to the common point of `resistor1.p` and `resistor2.p`, which is also connected to `ground`.
# A `current_sensor` acts as a detector, connected between the junction of `capacitor1.p`/`resistor1.n` and the junction of `capacitor2.p`/`resistor2.n`.
# The bridge is said to be balanced when no current flows through the `current_sensor`. This occurs when the potentials at its connection points are equal.
# The condition for balance in this De Sauty bridge configuration is given by the equation:
# ```math
# R_1 C_1 = R_2 C_2
# ```
# where `R₁` is the resistance of `resistor1` and `C₁` is the capacitance of `capacitor1`, and
# `R₂` is the resistance of `resistor2` and `C₂` is the capacitance of `capacitor2`.
# This model allows for the simulation of the bridge's behavior under AC excitation, including observing whether it is balanced for the given parameter values `C₁` and `C₂`,
# and fixed resistances `resistor1.R = 5.0` and `resistor2.R = 2.0`.
# The initial voltage across `capacitor2` is set to `0.0V` by the statement `initial capacitor2.v = 0.0` in the relations section.
example component DeSauty
  # First resistor in one arm of the De Sauty bridge.
  resistor1 = Resistor(R=5.0) [{
    "Dyad": {
      "placement": {"icon": {"x1": 800, "y1": 700, "x2": 1000, "y2": 900, "rot": 180}}
    }
  }]
  # Second resistor in the other arm of the De Sauty bridge.
  resistor2 = Resistor(R=2.0) [{
    "Dyad": {
      "placement": {"icon": {"x1": 800, "y1": 1300, "x2": 1000, "y2": 1500, "rot": 180}}
    }
  }]
  # First capacitor in one arm of the De Sauty bridge, with capacitance C₁.
  capacitor1 = Capacitor(C=C₁) [{
    "Dyad": {
      "placement": {"icon": {"x1": 200, "y1": 700, "x2": 400, "y2": 900, "rot": 180}}
    }
  }]
  # Second capacitor in the other arm of the De Sauty bridge, with capacitance C₂.
  capacitor2 = Capacitor(C=C₂) [{
    "Dyad": {
      "placement": {"icon": {"x1": 200, "y1": 1300, "x2": 400, "y2": 1500, "rot": 180}}
    }
  }]
  # Measures the current between the two branches of the bridge, acting as the detector.
  current_sensor = CurrentSensor() [{
    "Dyad": {
      "placement": {"icon": {"x1": 500, "y1": 1000, "x2": 700, "y2": 1200, "rot": 90}}
    }
  }]
  # AC voltage source supplying the bridge.
  source = VoltageSource() [{"Dyad": {"placement": {"icon": {"x1": 500, "y1": 400, "x2": 700, "y2": 600}}}}]
  # Generates the sinusoidal input voltage for the AC source.
  input_signal = BlockComponents.Sine(frequency=100.0, amplitude=1, phase=0) [{
    "Dyad": {"placement": {"icon": {"x1": 500, "y1": 100, "x2": 700, "y2": 300, "rot": 90}}}
  }]
  # Reference ground for the circuit.
  ground = Ground() [{
    "Dyad": {"placement": {"icon": {"x1": 1150, "y1": 1150, "x2": 1350, "y2": 1350}}}
  }]
  # Capacitance of the first capacitor (`capacitor1`).
  parameter C₁::Capacitance = 30μ
  # Capacitance of the second capacitor (`capacitor2`).
  parameter C₂::Capacitance = 45μ
relations
  initial capacitor2.v = 0.0
  connect(input_signal.y, source.V) [{"Dyad": {"edges": [{"S": 1, "E": 2}]}}]
  connect(source.p, capacitor1.n, capacitor2.n) [{
    "Dyad": {
      "edges": [
        {"S": 1, "M": [{"x": 100, "y": 500}, {"x": 100, "y": 1100}], "E": -1},
        {"S": 2, "M": [{"x": 150, "y": 800}], "E": -1},
        {"S": 3, "M": [{"x": 150, "y": 1400}], "E": -1}
      ],
      "junctions": [{"x": 150, "y": 1100}]
    }
  }]
  connect(source.n, resistor1.p, resistor2.p) [{
    "Dyad": {
      "edges": [
        {"S": 1, "M": [{"x": 1100, "y": 500}, {"x": 1100, "y": 1100}], "E": -1},
        {"S": 2, "M": [{"x": 1050, "y": 800}], "E": -1},
        {"S": 3, "M": [{"x": 1050, "y": 1400}], "E": -1}
      ],
      "junctions": [{"x": 1050, "y": 1100}]
    }
  }]
  connect(source.n, ground.g) [{
    "Dyad": {
      "edges": [{"S": 2, "M": [{"x": 1250, "y": 1100}], "E": -1}],
      "junctions": [{"x": 1100, "y": 1100}]
    }
  }]
  connect(resistor1.n, current_sensor.n, capacitor1.p) [{
    "Dyad": {
      "edges": [{"S": 1, "E": -1}, {"S": 2, "E": -1}, {"S": 3, "E": -1}],
      "junctions": [{"x": 600, "y": 800}]
    }
  }]
  connect(resistor2.n, current_sensor.p, capacitor2.p) [{
    "Dyad": {
      "edges": [{"S": 1, "E": -1}, {"S": 2, "E": -1}, {"S": 3, "E": -1}],
      "junctions": [{"x": 600, "y": 1400}]
    }
  }]
metadata {}
end


Test Cases

This is setup code, that must be run before each test case.

julia
using ElectricalComponents
using ModelingToolkit, OrdinaryDiffEqDefault
using Plots
using CSV, DataFrames

snapshotsdir = joinpath(dirname(dirname(pathof(ElectricalComponents))), "test", "snapshots")
"/home/actions-runner-10/.julia/packages/ElectricalComponents/bmmPM/test/snapshots"
  • Examples

  • Experiments

  • Analyses