$(instance)SeriesResonance Icon

SeriesResonance

Series resonance circuit

Usage

SeriesResonance()

Behavior

\[ \begin{equation} \left[ \begin{array}{c} \mathrm{connect}\left( ramp_{+}y(t), input_{signal1_{+}frequency(t)}, input_{signal2_{+}frequency(t)} \right) \\ \mathrm{connect}\left( const_{signal_{+}y(t)}, input_{signal1_{+}amplitude(t)}, input_{signal2_{+}amplitude(t)} \right) \\ \mathrm{connect}\left( input_{signal1_{+}y(t)}, voltage_{source1_{+}V(t)} \right) \\ \mathrm{connect}\left( input_{signal2_{+}y(t)}, voltage_{source2_{+}V(t)} \right) \\ \mathrm{connect}\left( voltage_{source1_{+}p}, inductor1_{+}p \right) \\ \mathrm{connect}\left( inductor1_{+}n, capacitor1_{+}p \right) \\ \mathrm{connect}\left( capacitor1_{+}n, resistor1_{+}p \right) \\ \mathrm{connect}\left( voltage_{source1_{+}n}, ground1_{+}g \right) \\ \mathrm{connect}\left( current_{sensor1_{+}p}, resistor1_{+}n \right) \\ \mathrm{connect}\left( ground1_{+}g, current_{sensor1_{+}n} \right) \\ \mathrm{connect}\left( voltage_{source2_{+}p}, inductor2_{+}p \right) \\ \mathrm{connect}\left( inductor2_{+}n, capacitor2_{+}p \right) \\ \mathrm{connect}\left( capacitor2_{+}n, resistor2_{+}p \right) \\ \mathrm{connect}\left( voltage_{source2_{+}n}, ground2_{+}g \right) \\ \mathrm{connect}\left( current_{sensor2_{+}p}, resistor2_{+}n \right) \\ \mathrm{connect}\left( ground2_{+}g, current_{sensor2_{+}n} \right) \\ \mathtt{voltage\_source1.v}\left( t \right) = \mathtt{voltage\_source1.p.v}\left( t \right) - \mathtt{voltage\_source1.n.v}\left( t \right) \\ \mathtt{voltage\_source1.i}\left( t \right) = \mathtt{voltage\_source1.p.i}\left( t \right) \\ \mathtt{voltage\_source1.n.i}\left( t \right) + \mathtt{voltage\_source1.p.i}\left( t \right) = 0 \\ \mathtt{voltage\_source1.v}\left( t \right) = \mathtt{voltage\_source1.uV} \mathtt{voltage\_source1.V}\left( t \right) \\ \mathtt{ground1.g.v}\left( t \right) = 0 \\ \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{inductor1.v}\left( t \right) = - \mathtt{inductor1.n.v}\left( t \right) + \mathtt{inductor1.p.v}\left( t \right) \\ \mathtt{inductor1.i}\left( t \right) = \mathtt{inductor1.p.i}\left( t \right) \\ \mathtt{inductor1.n.i}\left( t \right) + \mathtt{inductor1.p.i}\left( t \right) = 0 \\ \mathtt{inductor1.L} \frac{\mathrm{d} \mathtt{inductor1.i}\left( t \right)}{\mathrm{d}t} = \mathtt{inductor1.v}\left( t \right) \\ \mathtt{capacitor1.v}\left( t \right) = - \mathtt{capacitor1.n.v}\left( t \right) + \mathtt{capacitor1.p.v}\left( t \right) \\ \mathtt{capacitor1.i}\left( t \right) = \mathtt{capacitor1.p.i}\left( t \right) \\ \mathtt{capacitor1.n.i}\left( t \right) + \mathtt{capacitor1.p.i}\left( t \right) = 0 \\ \mathtt{capacitor1.C} \frac{\mathrm{d} \mathtt{capacitor1.v}\left( t \right)}{\mathrm{d}t} = \mathtt{capacitor1.i}\left( t \right) \\ \mathtt{current\_sensor1.p.v}\left( t \right) = \mathtt{current\_sensor1.n.v}\left( t \right) \\ \mathtt{current\_sensor1.p.i}\left( t \right) = \mathtt{current\_sensor1.i}\left( t \right) \\ \mathtt{current\_sensor1.n.i}\left( t \right) = - \mathtt{current\_sensor1.i}\left( t \right) \\ \frac{\mathrm{d} \mathtt{input\_signal1.phi}\left( t \right)}{\mathrm{d}t} = 6.2832 \mathtt{input\_signal1.frequency}\left( t \right) \\ \mathtt{input\_signal1.y}\left( t \right) = \mathtt{input\_signal1.offset} + \mathtt{input\_signal1.amplitude}\left( t \right) \sin\left( \mathtt{input\_signal1.phi}\left( t \right) \right) \\ \frac{\mathrm{d} \mathtt{input\_signal2.phi}\left( t \right)}{\mathrm{d}t} = 6.2832 \mathtt{input\_signal2.frequency}\left( t \right) \\ \mathtt{input\_signal2.y}\left( t \right) = \mathtt{input\_signal2.offset} + \mathtt{input\_signal2.amplitude}\left( t \right) \cos\left( \mathtt{input\_signal2.phi}\left( t \right) \right) \\ \mathtt{ramp.y}\left( t \right) = ifelse\left( \mathtt{ramp.start\_time} < t, ifelse\left( t < \mathtt{ramp.duration} + \mathtt{ramp.start\_time}, \mathtt{ramp.offset} + \frac{\mathtt{ramp.height} \left( - \mathtt{ramp.start\_time} + t \right)}{\mathtt{ramp.duration}}, \mathtt{ramp.height} + \mathtt{ramp.offset} \right), \mathtt{ramp.offset} \right) \\ \mathtt{const\_signal.y}\left( t \right) = \mathtt{const\_signal.k} \\ \mathtt{voltage\_source2.v}\left( t \right) = - \mathtt{voltage\_source2.n.v}\left( t \right) + \mathtt{voltage\_source2.p.v}\left( t \right) \\ \mathtt{voltage\_source2.i}\left( t \right) = \mathtt{voltage\_source2.p.i}\left( t \right) \\ \mathtt{voltage\_source2.p.i}\left( t \right) + \mathtt{voltage\_source2.n.i}\left( t \right) = 0 \\ \mathtt{voltage\_source2.v}\left( t \right) = \mathtt{voltage\_source2.uV} \mathtt{voltage\_source2.V}\left( t \right) \\ \mathtt{ground2.g.v}\left( t \right) = 0 \\ \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{inductor2.v}\left( t \right) = - \mathtt{inductor2.n.v}\left( t \right) + \mathtt{inductor2.p.v}\left( t \right) \\ \mathtt{inductor2.i}\left( t \right) = \mathtt{inductor2.p.i}\left( t \right) \\ \mathtt{inductor2.n.i}\left( t \right) + \mathtt{inductor2.p.i}\left( t \right) = 0 \\ \mathtt{inductor2.L} \frac{\mathrm{d} \mathtt{inductor2.i}\left( t \right)}{\mathrm{d}t} = \mathtt{inductor2.v}\left( t \right) \\ \mathtt{capacitor2.v}\left( t \right) = \mathtt{capacitor2.p.v}\left( t \right) - \mathtt{capacitor2.n.v}\left( t \right) \\ \mathtt{capacitor2.i}\left( t \right) = \mathtt{capacitor2.p.i}\left( t \right) \\ \mathtt{capacitor2.n.i}\left( t \right) + \mathtt{capacitor2.p.i}\left( t \right) = 0 \\ \mathtt{capacitor2.C} \frac{\mathrm{d} \mathtt{capacitor2.v}\left( t \right)}{\mathrm{d}t} = \mathtt{capacitor2.i}\left( t \right) \\ \mathtt{current\_sensor2.p.v}\left( t \right) = \mathtt{current\_sensor2.n.v}\left( t \right) \\ \mathtt{current\_sensor2.p.i}\left( t \right) = \mathtt{current\_sensor2.i}\left( t \right) \\ \mathtt{current\_sensor2.n.i}\left( t \right) = - \mathtt{current\_sensor2.i}\left( t \right) \\ \end{array} \right] \end{equation} \]

Source

# Series resonance circuit
example component SeriesResonance
  # Sine
  voltage_source1 = VoltageSource() [{
    "JuliaSim": {
      "placement": {"icon": {"x1": 100, "y1": 100, "x2": 300, "y2": 300, "rot": 180}}
    }
  }]
  ground1 = Ground() [{
    "JuliaSim": {"placement": {"icon": {"x1": 400, "y1": 400, "x2": 600, "y2": 600, "rot": 0}}}
  }]
  resistor1 = Resistor(R=0.5) [{
    "JuliaSim": {
      "placement": {"icon": {"x1": 1000, "y1": 100, "x2": 1200, "y2": 300, "rot": 0}}
    }
  }]
  inductor1 = Inductor(L=0.1/(2*pi)) [{
    "JuliaSim": {"placement": {"icon": {"x1": 400, "y1": 100, "x2": 600, "y2": 300, "rot": 0}}}
  }]
  capacitor1 = Capacitor(C=0.001/(2*pi)) [{
    "JuliaSim": {"placement": {"icon": {"x1": 700, "y1": 100, "x2": 900, "y2": 300, "rot": 0}}}
  }]
  current_sensor1 = CurrentSensor() [{
    "JuliaSim": {
      "placement": {"icon": {"x1": 1300, "y1": 100, "x2": 1500, "y2": 300, "rot": 0}}
    }
  }]
  # Input controllers
  input_signal1 = BlockComponents.SineVariableFrequencyAndAmplitude() [{
    "JuliaSim": {"placement": {"icon": {"x1": -200, "y1": 400, "x2": 0, "y2": 600, "rot": 0}}}
  }]
  input_signal2 = BlockComponents.CosineVariableFrequencyAndAmplitude() [{
    "JuliaSim": {"placement": {"icon": {"x1": -200, "y1": 1000, "x2": 0, "y2": 1200, "rot": 0}}}
  }]
  ramp = BlockComponents.Ramp(start_time=0, duration=1, offset=0, height=200) [{
    "JuliaSim": {
      "placement": {"icon": {"x1": -600, "y1": 250, "x2": -400, "y2": 450, "rot": 0}}
    }
  }]
  const_signal = BlockComponents.Constant(k=1) [{
    "JuliaSim": {
      "placement": {"icon": {"x1": -600, "y1": 550, "x2": -400, "y2": 750, "rot": 0}}
    }
  }]
  # Cosine
  voltage_source2 = VoltageSource() [{
    "JuliaSim": {
      "placement": {"icon": {"x1": 100, "y1": 700, "x2": 300, "y2": 900, "rot": 180}}
    }
  }]
  ground2 = Ground() [{
    "JuliaSim": {
      "placement": {"icon": {"x1": 400, "y1": 1000, "x2": 600, "y2": 1200, "rot": 0}}
    }
  }]
  resistor2 = Resistor(R=0.5) [{
    "JuliaSim": {
      "placement": {"icon": {"x1": 1000, "y1": 700, "x2": 1200, "y2": 900, "rot": 0}}
    }
  }]
  inductor2 = Inductor(L=0.1/(2*pi)) [{
    "JuliaSim": {"placement": {"icon": {"x1": 400, "y1": 700, "x2": 600, "y2": 900, "rot": 0}}}
  }]
  capacitor2 = Capacitor(C=0.001/(2*pi)) [{
    "JuliaSim": {"placement": {"icon": {"x1": 700, "y1": 700, "x2": 900, "y2": 900, "rot": 0}}}
  }]
  current_sensor2 = CurrentSensor() [{
    "JuliaSim": {
      "placement": {"icon": {"x1": 1300, "y1": 700, "x2": 1500, "y2": 900, "rot": 0}}
    }
  }]
relations
  initial inductor1.i = 0
  initial inductor2.i = 0
  initial capacitor1.v = 0
  initial capacitor2.v = 0
  # inputs
  connect(ramp.y, input_signal1.frequency, input_signal2.frequency) [{
    "JuliaSim": {
      "edges": [
        {"S": -1, "M": [{"x": -350, "y": 350}], "E": 1},
        {"S": -1, "E": 2},
        {"S": -1, "M": [{"x": -350, "y": 1140}], "E": 3}
      ],
      "junctions": [{"x": -350, "y": 540}]
    }
  }]
  connect(const_signal.y, input_signal1.amplitude, input_signal2.amplitude) [{
    "JuliaSim": {
      "edges": [
        {"S": -1, "E": 1},
        {"S": -1, "M": [{"x": -300, "y": 460}], "E": 2},
        {"S": -1, "M": [{"x": -300, "y": 1060}], "E": 3}
      ],
      "junctions": [{"x": -300, "y": 650}]
    }
  }]
  connect(input_signal1.y, voltage_source1.V) [{"JuliaSim": {"edges": [{"S": 1, "M": [{"x": 200, "y": 500}], "E": 2}]}}]
  connect(input_signal2.y, voltage_source2.V) [{"JuliaSim": {"edges": [{"S": 1, "M": [{"x": 200, "y": 1100}], "E": 2}]}}]
  # sine
  connect(voltage_source1.p, inductor1.p) [{"JuliaSim": {"edges": [{"S": 1, "E": 2}]}}]
  connect(inductor1.n, capacitor1.p) [{"JuliaSim": {"edges": [{"S": 1, "E": 2}]}}]
  connect(capacitor1.n, resistor1.p) [{"JuliaSim": {"edges": [{"S": 1, "E": 2}]}}]
  connect(voltage_source1.n, ground1.g) [{
    "JuliaSim": {
      "edges": [
        {
          "S": 1,
          "M": [{"x": 50, "y": 200}, {"x": 50, "y": 350}, {"x": 500, "y": 350}],
          "E": 2
        }
      ]
    }
  }]
  connect(current_sensor1.p, resistor1.n) [{"JuliaSim": {"edges": [{"S": 1, "E": 2}]}}]
  connect(ground1.g, current_sensor1.n) [{
    "JuliaSim": {
      "edges": [
        {
          "S": 1,
          "M": [{"x": 500, "y": 350}, {"x": 1550, "y": 350}, {"x": 1550, "y": 200}],
          "E": 2
        }
      ]
    }
  }]
  # cosine
  connect(voltage_source2.p, inductor2.p) [{"JuliaSim": {"edges": [{"S": 1, "E": 2}]}}]
  connect(inductor2.n, capacitor2.p) [{"JuliaSim": {"edges": [{"S": 1, "E": 2}]}}]
  connect(capacitor2.n, resistor2.p) [{"JuliaSim": {"edges": [{"S": 1, "E": 2}]}}]
  connect(voltage_source2.n, ground2.g) [{
    "JuliaSim": {
      "edges": [
        {
          "S": 1,
          "M": [{"x": 50, "y": 800}, {"x": 50, "y": 950}, {"x": 500, "y": 950}],
          "E": 2
        }
      ]
    }
  }]
  connect(current_sensor2.p, resistor2.n) [{"JuliaSim": {"edges": [{"S": 1, "E": 2}]}}]
  connect(ground2.g, current_sensor2.n) [{
    "JuliaSim": {
      "edges": [
        {
          "S": 1,
          "M": [{"x": 500, "y": 950}, {"x": 1550, "y": 950}, {"x": 1550, "y": 800}],
          "E": 2
        }
      ]
    }
  }]
metadata {
  "JuliaSim": {
    "tests": {
      "case1": {"stop": 1, "expect": {"signals": ["current_sensor1.i", "current_sensor2.i"]}}
    }
  }
}
end
Flattened Source
# Series resonance circuit
example component SeriesResonance
  # Sine
  voltage_source1 = VoltageSource() [{
    "JuliaSim": {
      "placement": {"icon": {"x1": 100, "y1": 100, "x2": 300, "y2": 300, "rot": 180}}
    }
  }]
  ground1 = Ground() [{
    "JuliaSim": {"placement": {"icon": {"x1": 400, "y1": 400, "x2": 600, "y2": 600, "rot": 0}}}
  }]
  resistor1 = Resistor(R=0.5) [{
    "JuliaSim": {
      "placement": {"icon": {"x1": 1000, "y1": 100, "x2": 1200, "y2": 300, "rot": 0}}
    }
  }]
  inductor1 = Inductor(L=0.1/(2*pi)) [{
    "JuliaSim": {"placement": {"icon": {"x1": 400, "y1": 100, "x2": 600, "y2": 300, "rot": 0}}}
  }]
  capacitor1 = Capacitor(C=0.001/(2*pi)) [{
    "JuliaSim": {"placement": {"icon": {"x1": 700, "y1": 100, "x2": 900, "y2": 300, "rot": 0}}}
  }]
  current_sensor1 = CurrentSensor() [{
    "JuliaSim": {
      "placement": {"icon": {"x1": 1300, "y1": 100, "x2": 1500, "y2": 300, "rot": 0}}
    }
  }]
  # Input controllers
  input_signal1 = BlockComponents.SineVariableFrequencyAndAmplitude() [{
    "JuliaSim": {"placement": {"icon": {"x1": -200, "y1": 400, "x2": 0, "y2": 600, "rot": 0}}}
  }]
  input_signal2 = BlockComponents.CosineVariableFrequencyAndAmplitude() [{
    "JuliaSim": {"placement": {"icon": {"x1": -200, "y1": 1000, "x2": 0, "y2": 1200, "rot": 0}}}
  }]
  ramp = BlockComponents.Ramp(start_time=0, duration=1, offset=0, height=200) [{
    "JuliaSim": {
      "placement": {"icon": {"x1": -600, "y1": 250, "x2": -400, "y2": 450, "rot": 0}}
    }
  }]
  const_signal = BlockComponents.Constant(k=1) [{
    "JuliaSim": {
      "placement": {"icon": {"x1": -600, "y1": 550, "x2": -400, "y2": 750, "rot": 0}}
    }
  }]
  # Cosine
  voltage_source2 = VoltageSource() [{
    "JuliaSim": {
      "placement": {"icon": {"x1": 100, "y1": 700, "x2": 300, "y2": 900, "rot": 180}}
    }
  }]
  ground2 = Ground() [{
    "JuliaSim": {
      "placement": {"icon": {"x1": 400, "y1": 1000, "x2": 600, "y2": 1200, "rot": 0}}
    }
  }]
  resistor2 = Resistor(R=0.5) [{
    "JuliaSim": {
      "placement": {"icon": {"x1": 1000, "y1": 700, "x2": 1200, "y2": 900, "rot": 0}}
    }
  }]
  inductor2 = Inductor(L=0.1/(2*pi)) [{
    "JuliaSim": {"placement": {"icon": {"x1": 400, "y1": 700, "x2": 600, "y2": 900, "rot": 0}}}
  }]
  capacitor2 = Capacitor(C=0.001/(2*pi)) [{
    "JuliaSim": {"placement": {"icon": {"x1": 700, "y1": 700, "x2": 900, "y2": 900, "rot": 0}}}
  }]
  current_sensor2 = CurrentSensor() [{
    "JuliaSim": {
      "placement": {"icon": {"x1": 1300, "y1": 700, "x2": 1500, "y2": 900, "rot": 0}}
    }
  }]
relations
  initial inductor1.i = 0
  initial inductor2.i = 0
  initial capacitor1.v = 0
  initial capacitor2.v = 0
  # inputs
  connect(ramp.y, input_signal1.frequency, input_signal2.frequency) [{
    "JuliaSim": {
      "edges": [
        {"S": -1, "M": [{"x": -350, "y": 350}], "E": 1},
        {"S": -1, "E": 2},
        {"S": -1, "M": [{"x": -350, "y": 1140}], "E": 3}
      ],
      "junctions": [{"x": -350, "y": 540}]
    }
  }]
  connect(const_signal.y, input_signal1.amplitude, input_signal2.amplitude) [{
    "JuliaSim": {
      "edges": [
        {"S": -1, "E": 1},
        {"S": -1, "M": [{"x": -300, "y": 460}], "E": 2},
        {"S": -1, "M": [{"x": -300, "y": 1060}], "E": 3}
      ],
      "junctions": [{"x": -300, "y": 650}]
    }
  }]
  connect(input_signal1.y, voltage_source1.V) [{"JuliaSim": {"edges": [{"S": 1, "M": [{"x": 200, "y": 500}], "E": 2}]}}]
  connect(input_signal2.y, voltage_source2.V) [{"JuliaSim": {"edges": [{"S": 1, "M": [{"x": 200, "y": 1100}], "E": 2}]}}]
  # sine
  connect(voltage_source1.p, inductor1.p) [{"JuliaSim": {"edges": [{"S": 1, "E": 2}]}}]
  connect(inductor1.n, capacitor1.p) [{"JuliaSim": {"edges": [{"S": 1, "E": 2}]}}]
  connect(capacitor1.n, resistor1.p) [{"JuliaSim": {"edges": [{"S": 1, "E": 2}]}}]
  connect(voltage_source1.n, ground1.g) [{
    "JuliaSim": {
      "edges": [
        {
          "S": 1,
          "M": [{"x": 50, "y": 200}, {"x": 50, "y": 350}, {"x": 500, "y": 350}],
          "E": 2
        }
      ]
    }
  }]
  connect(current_sensor1.p, resistor1.n) [{"JuliaSim": {"edges": [{"S": 1, "E": 2}]}}]
  connect(ground1.g, current_sensor1.n) [{
    "JuliaSim": {
      "edges": [
        {
          "S": 1,
          "M": [{"x": 500, "y": 350}, {"x": 1550, "y": 350}, {"x": 1550, "y": 200}],
          "E": 2
        }
      ]
    }
  }]
  # cosine
  connect(voltage_source2.p, inductor2.p) [{"JuliaSim": {"edges": [{"S": 1, "E": 2}]}}]
  connect(inductor2.n, capacitor2.p) [{"JuliaSim": {"edges": [{"S": 1, "E": 2}]}}]
  connect(capacitor2.n, resistor2.p) [{"JuliaSim": {"edges": [{"S": 1, "E": 2}]}}]
  connect(voltage_source2.n, ground2.g) [{
    "JuliaSim": {
      "edges": [
        {
          "S": 1,
          "M": [{"x": 50, "y": 800}, {"x": 50, "y": 950}, {"x": 500, "y": 950}],
          "E": 2
        }
      ]
    }
  }]
  connect(current_sensor2.p, resistor2.n) [{"JuliaSim": {"edges": [{"S": 1, "E": 2}]}}]
  connect(ground2.g, current_sensor2.n) [{
    "JuliaSim": {
      "edges": [
        {
          "S": 1,
          "M": [{"x": 500, "y": 950}, {"x": 1550, "y": 950}, {"x": 1550, "y": 800}],
          "E": 2
        }
      ]
    }
  }]
metadata {
  "JuliaSim": {
    "tests": {
      "case1": {"stop": 1, "expect": {"signals": ["current_sensor1.i", "current_sensor2.i"]}}
    }
  }
}
end

Test Cases

Test Case case1

Signal `current_sensor1.i` for test `case1` of `SeriesResonance`

Signal `current_sensor2.i` for test `case1` of `SeriesResonance`

  • Examples
  • Experiments
  • Analyses