Skip to content
SaturatingInductor.md

SaturatingInductor

Inductor model exhibiting magnetic saturation.

Represents an inductor where the inductance value decreases as the current increases, simulating the effect of magnetic core saturation. The model defines the inductance L_actual as a function of current i, transitioning from L_zero (inductance at zero current) to L_inf (inductance at large currents). The relationship between magnetic flux (\psi), current (i), and voltage (v) is governed by:

Lactual=Linf+(LzeroLinf)atan(i/Ipar)i/Iparψ=Linfi+(LzeroLinf)Iparatan(i/Ipar)v=dψdt

where I_par is a characteristic current derived from nominal values:

Ipar=Inominaltan(LnominalLinfLzeroLinf)

This component extends from OnePort

Usage

SaturatingInductor(I_nominal=1, L_nominal=1, L_zero=2*L_nominal, L_inf=L_nominal/2, I_par=I_nominal/tan((L_nominal-L_inf)/(L_zero-L_inf)))

Parameters:

NameDescriptionUnitsDefault value
I_nominalNominal operating current for defining saturation characteristics.A1
L_nominalInductance value at the nominal current I_nominal.H1
L_zeroInductance value at or near zero current (maximum inductance).H2 * L_nominal
L_infInductance value at large currents (fully saturated inductance, minimum inductance).HL_nominal / 2

Connectors

Variables

NameDescriptionUnits
vVoltage across the component (between pin p and pin n).V
iCurrent flowing through the component (from pin p to pin n).A
L_actualThe actual current-dependent inductance of the component (psi/i).H
psiThe magnetic flux linking the inductor windings.Wb

Behavior

v(t)=p.v(t)n.v(t)i(t)=p.i(t)n.i(t)+p.i(t)=0L_actual(t)=L_inf+I_par(L_inf+L_zero)arctan(i(t)I_par)i(t)psi(t)=L_infi(t)+I_par(L_inf+L_zero)arctan(i(t)I_par)v(t)=dpsi(t)dt

Source

dyad
# Inductor model exhibiting magnetic saturation.
#
# Represents an inductor where the inductance value decreases as the current increases,
# simulating the effect of magnetic core saturation. The model defines the inductance
# `L_actual` as a function of current `i`, transitioning from `L_zero` (inductance at
# zero current) to `L_inf` (inductance at large currents). The relationship between
# magnetic flux (`\psi`), current (`i`), and voltage (`v`) is governed by:
# ```math
# L_{actual} = L_{inf} + (L_{zero} - L_{inf}) \frac{atan(i/I_{par})}{i/I_{par}}
# ```
# ```math
# \psi = L_{inf}i + (L_{zero} - L_{inf})I_{par}atan(i/I_{par})
# ```
# ```math
# v = \frac{d\psi}{dt}
# ```
# where `I_par` is a characteristic current derived from nominal values:
# ```math
# I_{par} = \frac{I_{nominal}}{tan(\frac{L_{nominal} - L_{inf}}{L_{zero} - L_{inf}})}
# ```
component SaturatingInductor
  extends OnePort
  # Nominal operating current for defining saturation characteristics.
  parameter I_nominal::Current = 1
  # Inductance value at the nominal current I_nominal.
  parameter L_nominal::Inductance = 1
  # Inductance value at or near zero current (maximum inductance).
  parameter L_zero::Inductance = 2*L_nominal
  # Inductance value at large currents (fully saturated inductance, minimum inductance).
  parameter L_inf::Inductance = L_nominal/2
  # The actual current-dependent inductance of the component (psi/i).
  variable L_actual::Inductance
  # The magnetic flux linking the inductor windings.
  variable psi::MagneticFlux
  # Characteristic current parameter used in the saturation function, derived from other inductance and current parameters.
  final parameter I_par::Current = I_nominal/tan((L_nominal-L_inf)/(L_zero-L_inf))
relations
  # assert L_zero > L_nominal "L_zero $(L_zero) should be greater than L_nominal $(L_nominal)"
  # assert L_inf < L_nominal "Linf $(Linf) should be less than L_nominal $(L_nominal)"
  L_actual = L_inf+(L_zero-L_inf)*atan(i/I_par)/(i/I_par)
  psi = L_inf*i+(L_zero-L_inf)*I_par*atan(i/I_par)
  v = der(psi)
end
Flattened Source
dyad
# Inductor model exhibiting magnetic saturation.
#
# Represents an inductor where the inductance value decreases as the current increases,
# simulating the effect of magnetic core saturation. The model defines the inductance
# `L_actual` as a function of current `i`, transitioning from `L_zero` (inductance at
# zero current) to `L_inf` (inductance at large currents). The relationship between
# magnetic flux (`\psi`), current (`i`), and voltage (`v`) is governed by:
# ```math
# L_{actual} = L_{inf} + (L_{zero} - L_{inf}) \frac{atan(i/I_{par})}{i/I_{par}}
# ```
# ```math
# \psi = L_{inf}i + (L_{zero} - L_{inf})I_{par}atan(i/I_{par})
# ```
# ```math
# v = \frac{d\psi}{dt}
# ```
# where `I_par` is a characteristic current derived from nominal values:
# ```math
# I_{par} = \frac{I_{nominal}}{tan(\frac{L_{nominal} - L_{inf}}{L_{zero} - L_{inf}})}
# ```
component SaturatingInductor
  # Positive electrical pin.
  p = Pin() [{
    "Dyad": {
      "placement": {"icon": {"iconName": "pos", "x1": -50, "y1": 450, "x2": 50, "y2": 550}}
    }
  }]
  # Negative electrical pin.
  n = Pin() [{
    "Dyad": {
      "placement": {"icon": {"iconName": "neg", "x1": 950, "y1": 450, "x2": 1050, "y2": 550}}
    }
  }]
  # Voltage across the component (between pin p and pin n).
  variable v::Voltage
  # Current flowing through the component (from pin p to pin n).
  variable i::Current
  # Nominal operating current for defining saturation characteristics.
  parameter I_nominal::Current = 1
  # Inductance value at the nominal current I_nominal.
  parameter L_nominal::Inductance = 1
  # Inductance value at or near zero current (maximum inductance).
  parameter L_zero::Inductance = 2*L_nominal
  # Inductance value at large currents (fully saturated inductance, minimum inductance).
  parameter L_inf::Inductance = L_nominal/2
  # The actual current-dependent inductance of the component (psi/i).
  variable L_actual::Inductance
  # The magnetic flux linking the inductor windings.
  variable psi::MagneticFlux
  # Characteristic current parameter used in the saturation function, derived from other inductance and current parameters.
  final parameter I_par::Current = I_nominal/tan((L_nominal-L_inf)/(L_zero-L_inf))
relations
  v = p.v-n.v
  i = p.i
  p.i+n.i = 0
  # assert L_zero > L_nominal "L_zero $(L_zero) should be greater than L_nominal $(L_nominal)"
  # assert L_inf < L_nominal "Linf $(Linf) should be less than L_nominal $(L_nominal)"
  L_actual = L_inf+(L_zero-L_inf)*atan(i/I_par)/(i/I_par)
  psi = L_inf*i+(L_zero-L_inf)*I_par*atan(i/I_par)
  v = der(psi)
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"