SaturatingInductorTest
IconSaturatingInductorTest
Test circuit for a saturating inductor component.
This test component evaluates the behavior of a SaturatingInductor
. It constructs an electrical circuit where the saturating inductor is placed in parallel with a standard linear inductor. A constant voltage source, driven by a signal generator block, applies 40 volts across this parallel inductor arrangement. The primary purpose is to observe and verify the dynamic changes in the saturating inductor's apparent inductance (L_actual
) as current builds up, leading to magnetic saturation. Initial conditions are set for the saturating inductor's current, and the test metadata specifies expected inductance values at the beginning and end of the simulation, facilitating automated verification of the saturating inductor model.
Usage
SaturatingInductorTest()
Behavior
\[ \begin{equation} \left[ \begin{array}{c} \mathtt{signal.y}\left( t \right) = \mathtt{source.V}\left( t \right) \\ \mathrm{connect}\left( source_{+}n, ground_{+}g, sat_{inductor_{+}n}, inductor_{+}n \right) \\ \mathrm{connect}\left( sat_{inductor_{+}p}, source_{+}p, inductor_{+}p \right) \\ \mathtt{sat\_inductor.v}\left( t \right) = \mathtt{sat\_inductor.p.v}\left( t \right) - \mathtt{sat\_inductor.n.v}\left( t \right) \\ \mathtt{sat\_inductor.i}\left( t \right) = \mathtt{sat\_inductor.p.i}\left( t \right) \\ \mathtt{sat\_inductor.p.i}\left( t \right) + \mathtt{sat\_inductor.n.i}\left( t \right) = 0 \\ \mathtt{sat\_inductor.L\_actual}\left( t \right) = \mathtt{sat\_inductor.L\_inf} + \frac{\mathtt{sat\_inductor.I\_par} \left( - \mathtt{sat\_inductor.L\_inf} + \mathtt{sat\_inductor.L\_zero} \right) \arctan\left( \frac{\mathtt{sat\_inductor.i}\left( t \right)}{\mathtt{sat\_inductor.I\_par}} \right)}{\mathtt{sat\_inductor.i}\left( t \right)} \\ \mathtt{sat\_inductor.psi}\left( t \right) = \mathtt{sat\_inductor.L\_inf} \mathtt{sat\_inductor.i}\left( t \right) + \mathtt{sat\_inductor.I\_par} \left( - \mathtt{sat\_inductor.L\_inf} + \mathtt{sat\_inductor.L\_zero} \right) \arctan\left( \frac{\mathtt{sat\_inductor.i}\left( t \right)}{\mathtt{sat\_inductor.I\_par}} \right) \\ \mathtt{sat\_inductor.v}\left( t \right) = \frac{\mathrm{d} \mathtt{sat\_inductor.psi}\left( t \right)}{\mathrm{d}t} \\ \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.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{ground.g.v}\left( t \right) = 0 \\ \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) \\ \end{array} \right] \end{equation} \]
Source
# Test circuit for a saturating inductor component.
#
# This test component evaluates the behavior of a `SaturatingInductor`.
# It constructs an electrical circuit where the saturating inductor is
# placed in parallel with a standard linear inductor. A constant voltage
# source, driven by a signal generator block, applies 40 volts across
# this parallel inductor arrangement. The primary purpose is to observe
# and verify the dynamic changes in the saturating inductor's apparent
# inductance (`L_actual`) as current builds up, leading to magnetic
# saturation. Initial conditions are set for the saturating inductor's
# current, and the test metadata specifies expected inductance values at
# the beginning and end of the simulation, facilitating automated
# verification of the saturating inductor model.
test component SaturatingInductorTest
# Instance of the saturating inductor model being tested.
sat_inductor = SaturatingInductor(L_zero=2, L_inf=0.5, L_nominal=1)
# Constant signal generator providing the input for the voltage source.
signal = BlockComponents.Constant(k=40)
# Ideal voltage source component.
source = VoltageSource()
# Electrical ground connection.
ground = Ground()
# Standard linear inductor used in parallel for the test setup.
inductor = Inductor(L=1)
relations
initial sat_inductor.i = 1e-10
connect(signal.y, source.V)
connect(source.n, ground.g, sat_inductor.n, inductor.n)
connect(sat_inductor.p, source.p, inductor.p)
metadata {
"Dyad": {
"tests": {
"case1": {
"stop": 10,
"expect": {
"initial": {"sat_inductor.L_actual": 2},
"final": {"sat_inductor.L_actual": 0.50863266}
}
}
}
}
}
end
Flattened Source
# Test circuit for a saturating inductor component.
#
# This test component evaluates the behavior of a `SaturatingInductor`.
# It constructs an electrical circuit where the saturating inductor is
# placed in parallel with a standard linear inductor. A constant voltage
# source, driven by a signal generator block, applies 40 volts across
# this parallel inductor arrangement. The primary purpose is to observe
# and verify the dynamic changes in the saturating inductor's apparent
# inductance (`L_actual`) as current builds up, leading to magnetic
# saturation. Initial conditions are set for the saturating inductor's
# current, and the test metadata specifies expected inductance values at
# the beginning and end of the simulation, facilitating automated
# verification of the saturating inductor model.
test component SaturatingInductorTest
# Instance of the saturating inductor model being tested.
sat_inductor = SaturatingInductor(L_zero=2, L_inf=0.5, L_nominal=1)
# Constant signal generator providing the input for the voltage source.
signal = BlockComponents.Constant(k=40)
# Ideal voltage source component.
source = VoltageSource()
# Electrical ground connection.
ground = Ground()
# Standard linear inductor used in parallel for the test setup.
inductor = Inductor(L=1)
relations
initial sat_inductor.i = 1e-10
connect(signal.y, source.V)
connect(source.n, ground.g, sat_inductor.n, inductor.n)
connect(sat_inductor.p, source.p, inductor.p)
metadata {
"Dyad": {
"tests": {
"case1": {
"stop": 10,
"expect": {
"initial": {"sat_inductor.L_actual": 2},
"final": {"sat_inductor.L_actual": 0.50863266}
}
}
}
}
}
end
Test Cases
Test Case case1
Related
- Examples
- Experiments
- Analyses
- Tests