Starting of polyphase synchronous reluctance machine with inverter.

within Modelica.Magnetic.FundamentalWave.Examples.BasicMachines.SynchronousMachines.ComparisonPolyphase;
model SMR_Inverter_Polyphase
  "Starting of polyphase synchronous reluctance machine with inverter"

  extends Modelica.Icons.Example;
  constant Integer m3=3 "Number of stator phases of three-phase system";
  parameter Integer m=5 "Number of stator phases"
  parameter SI.Voltage VsNominal=100
    "Nominal RMS voltage per phase";
  parameter SI.Frequency fsNominal=smrData.fsNominal "Nominal frequency";
  parameter SI.Frequency fKnee=50
    "Knee frequency of V/f curve";
  parameter SI.Time tRamp=1 "Frequency ramp";
  parameter SI.Torque T_Load=46 "Nominal load torque";
  parameter SI.Time tStep=1.2 "Time of load torque step";
  parameter SI.Inertia J_Load=0.29 "Load inertia";
  Modelica.Electrical.Machines.Utilities.TerminalBox terminalBoxM(
      terminalConnection="Y", m=m)
  Modelica.Electrical.Machines.Utilities.TerminalBox terminalBox3(
      terminalConnection="Y", m=m3)
  Magnetic.FundamentalWave.BasicMachines.SynchronousMachines.SM_ReluctanceRotor
    smrM(
    Jr=smrData.Jr,
    Js=smrData.Js,
    p=smrData.p,
    fsNominal=smrData.fsNominal,
    TsRef=smrData.TsRef,
    alpha20s(displayUnit="1/K") = smrData.alpha20s,
    ratioCommonStatorLeakage=smrData.ratioCommonStatorLeakage,
    frictionParameters=smrData.frictionParameters,
    statorCoreParameters=smrData.statorCoreParameters,
    strayLoadParameters=smrData.strayLoadParameters,
    phiMechanical(fixed=true),
    wMechanical(fixed=true),
    useDamperCage=smrData.useDamperCage,
    Lrsigmad=smrData.Lrsigmad,
    Lrsigmaq=smrData.Lrsigmaq,
    Rrd=smrData.Rrd,
    Rrq=smrData.Rrq,
    TrRef=smrData.TrRef,
    alpha20r(displayUnit="1/K") = smrData.alpha20r,
    Rs=smrData.Rs*m/3,
    Lssigma=smrData.Lssigma*m/3,
    Lszero=smrData.Lszero*m/3,
    Lmd=smrData.Lmd*m/3,
    Lmq=smrData.Lmq*m/3,
    m=m,
    ir(each fixed=true),
    TsOperational=293.15,
    effectiveStatorTurns=smrData.effectiveStatorTurns,
    TrOperational=293.15)
  Magnetic.FundamentalWave.BasicMachines.SynchronousMachines.SM_ReluctanceRotor
    smr3(
    p=smrData.p,
    fsNominal=smrData.fsNominal,
    Rs=smrData.Rs,
    TsRef=smrData.TsRef,
    alpha20s(displayUnit="1/K") = smrData.alpha20s,
    ratioCommonStatorLeakage=smrData.ratioCommonStatorLeakage,
    Lszero=smrData.Lszero,
    Lssigma=smrData.Lssigma,
    Jr=smrData.Jr,
    Js=smrData.Js,
    frictionParameters=smrData.frictionParameters,
    phiMechanical(fixed=true),
    wMechanical(fixed=true),
    statorCoreParameters=smrData.statorCoreParameters,
    strayLoadParameters=smrData.strayLoadParameters,
    Lmd=smrData.Lmd,
    Lmq=smrData.Lmq,
    useDamperCage=smrData.useDamperCage,
    Lrsigmad=smrData.Lrsigmad,
    Lrsigmaq=smrData.Lrsigmaq,
    Rrd=smrData.Rrd,
    Rrq=smrData.Rrq,
    TrRef=smrData.TrRef,
    alpha20r(displayUnit="1/K") = smrData.alpha20r,
    m=m3,
    ir(each fixed=true),
    TsOperational=293.15,
    effectiveStatorTurns=smrData.effectiveStatorTurns,
    TrOperational=293.15)
  Modelica.Electrical.Machines.Sensors.RotorDisplacementAngle rotorAngle3(
     p=smr3.p)
  Modelica.Mechanics.Rotational.Components.Inertia loadInertiaM(J=J_Load)
  Modelica.Mechanics.Rotational.Components.Inertia loadInertia3(J=J_Load)
  Modelica.Mechanics.Rotational.Sources.TorqueStep torqueStepM(
    startTime=tStep,
    stepTorque=-T_Load,
    useSupport=false,
    offsetTorque=0)
  Modelica.Mechanics.Rotational.Sources.TorqueStep torqueStep3(
    startTime=tStep,
    stepTorque=-T_Load,
    useSupport=false,
    offsetTorque=0)
  parameter
    Modelica.Electrical.Machines.Utilities.ParameterRecords.SM_ReluctanceRotorData
    smrData "Synchronous machine data"
  Modelica.Electrical.Analog.Basic.Ground ground3
  Modelica.Electrical.Polyphase.Basic.Star star3(final m=m3)
  Modelica.Electrical.Polyphase.Sources.SignalVoltage signalVoltage3(
      final m=m3)
  Modelica.Blocks.Sources.Ramp ramp(height=fKnee, duration=tRamp)
  Modelica.Electrical.Machines.Utilities.VfController vfController3(
    VNominal=VsNominal,
    fNominal=fsNominal,
    BasePhase=+Modelica.Constants.pi/2,
    final m=m3,
    orientation=-
        Modelica.Electrical.Polyphase.Functions.symmetricOrientation(m3))
  Modelica.Electrical.Polyphase.Sensors.CurrentQuasiRMSSensor
    currentRMSsensorM(m=m)
  Modelica.Electrical.Machines.Sensors.CurrentQuasiRMSSensor
    currentRMSsensor3
  Modelica.Electrical.Polyphase.Sources.SignalVoltage signalVoltageM(
      final m=m)
  Modelica.Electrical.Polyphase.Basic.Star starM(final m=m)
  Modelica.Electrical.Analog.Basic.Ground groundM
  Modelica.Electrical.Machines.Utilities.VfController vfControllerM(
    VNominal=VsNominal,
    fNominal=fsNominal,
    BasePhase=+Modelica.Constants.pi/2,
    final m=m,
    orientation=-
        Modelica.Electrical.Polyphase.Functions.symmetricOrientation(m))
  Modelica.Blocks.Math.Feedback feedback
  Modelica.Blocks.Math.Gain gain(k=(m/m3))
initial equation
  smr3.is[1:2] = zeros(2);
  smrM.is[1:2] = zeros(2);
  //conditional damper cage currents are defined as fixed start values
equation
  connect(smr3.flange, loadInertia3.flange_a)
  connect(loadInertia3.flange_b, torqueStep3.flange)
  connect(smr3.plug_sn, rotorAngle3.plug_n)
  connect(smr3.plug_sp, rotorAngle3.plug_p)
  connect(smr3.flange, rotorAngle3.flange)
  connect(terminalBox3.plug_sp, smr3.plug_sp)
  connect(terminalBox3.plug_sn, smr3.plug_sn)
  connect(smrM.flange, loadInertiaM.flange_a)
  connect(loadInertiaM.flange_b, torqueStepM.flange)
  connect(terminalBoxM.plug_sp, smrM.plug_sp)
  connect(terminalBoxM.plug_sn, smrM.plug_sn)
  connect(signalVoltage3.plug_n, star3.plug_p)
  connect(star3.pin_n, ground3.p)
  connect(ramp.y, vfController3.u)
  connect(vfController3.y, signalVoltage3.v)
  connect(terminalBoxM.plugSupply, currentRMSsensorM.plug_n)
  connect(signalVoltage3.plug_p, currentRMSsensor3.plug_p)
  connect(signalVoltageM.plug_n, starM.plug_p)
  connect(starM.pin_n, groundM.p)
  connect(vfControllerM.y, signalVoltageM.v)
  connect(vfControllerM.u, ramp.y)
  connect(signalVoltageM.plug_p, currentRMSsensorM.plug_p)
  connect(gain.y, feedback.u2)
  connect(gain.u, currentRMSsensorM.I)
  connect(currentRMSsensor3.plug_n, terminalBox3.plugSupply)
  connect(currentRMSsensor3.I, feedback.u1)
end SMR_Inverter_Polyphase;


Comparison of equivalent circuits of eddy current loss models. In this example the eddy current losses are implemented in two different ways. Compare the loss dissipation powerb_e.power and powerb_m.power of the two models indicated by power meters.

within Modelica.Magnetic.FundamentalWave.Examples.Components;
model EddyCurrentLosses
  "Comparison of equivalent circuits of eddy current loss models"
  extends Modelica.Icons.Example;
  parameter Integer m=3 "Number of phases"
  parameter SI.Resistance R=0.1
    "Resistance of leader cables";
  parameter SI.Conductance Gc=1 "Loss conductance";
  parameter SI.Reluctance R_m=1
    "Reluctance of the magnetic circuit";
  parameter Real N=1 "Number of turns";
  output SI.Power lossPower_e=sum(loss_e.conductor.LossPower);
  output SI.Power lossPower_m=loss_m.lossPower;
  Modelica.Electrical.Analog.Basic.Ground ground_e
  Modelica.Electrical.Analog.Basic.Ground ground_m
  Modelica.Electrical.Polyphase.Basic.Star star_e(m=m)
  Modelica.Electrical.Polyphase.Basic.Star star_m(m=m)
  Modelica.Electrical.Polyphase.Sources.SineVoltage sineVoltage_e(
    m=m,
    V=fill(1, m),
    f=fill(1, m))
  Modelica.Electrical.Polyphase.Sources.SineVoltage sineVoltage_m(
    m=m,
    V=fill(1, m),
    f=fill(1, m))
  Modelica.Electrical.Polyphase.Basic.Resistor resistor_e(m=m, R=fill(R,
        m))
  Modelica.Electrical.Polyphase.Basic.Resistor resistor_m(m=m, R=fill(R,
        m))
  Magnetic.FundamentalWave.Components.PolyphaseElectroMagneticConverter converter_e(
    m=m,
    effectiveTurns=fill(N, m),
    orientation=Modelica.Electrical.Polyphase.Functions.symmetricOrientation(m))
  Magnetic.FundamentalWave.Components.PolyphaseElectroMagneticConverter converter_m(
    m=m,
    effectiveTurns=fill(N, m),
    orientation=Modelica.Electrical.Polyphase.Functions.symmetricOrientation(m))
  Magnetic.FundamentalWave.Components.Reluctance reluctance_e(R_m(d=R_m, q=R_m))
  Magnetic.FundamentalWave.Components.Reluctance reluctance_m(R_m(d=R_m, q=R_m))
  Magnetic.FundamentalWave.Components.Ground mground_e
  Magnetic.FundamentalWave.Components.Ground mground_m
  Modelica.Electrical.Polyphase.Basic.Conductor loss_e(m=m, G=fill(Gc, m))
  Magnetic.FundamentalWave.Components.EddyCurrent loss_m(G=m*N^2*Gc/2)
  Modelica.Electrical.Polyphase.Sensors.PowerSensor powerb_e(m=m)
  Modelica.Electrical.Polyphase.Sensors.PowerSensor powerb_m(m=m)
initial equation
  reluctance_e.Phi = Complex(0, 0);
  reluctance_m.Phi = Complex(0, 0);
equation
  connect(sineVoltage_e.plug_n, converter_e.plug_n)
  connect(sineVoltage_e.plug_n, star_e.plug_p)
  connect(sineVoltage_m.plug_n, star_m.plug_p)
  connect(star_e.pin_n, ground_e.p)
  connect(star_m.pin_n, ground_m.p)
  connect(sineVoltage_m.plug_n, converter_m.plug_n)
  connect(converter_e.port_p, reluctance_e.port_p)
  connect(converter_e.port_n, reluctance_e.port_n)
  connect(converter_e.port_n, mground_e.port_p)
  connect(converter_m.port_n, reluctance_m.port_n)
  connect(converter_m.port_p, loss_m.port_p)
  connect(loss_m.port_n, reluctance_m.port_p)
  connect(converter_m.port_n, mground_m.port_p)
  connect(resistor_e.plug_p, sineVoltage_e.plug_p)
  connect(sineVoltage_m.plug_p, resistor_m.plug_p)
  connect(resistor_e.plug_n, powerb_e.pc)
  connect(powerb_e.pv, powerb_e.pc)
  connect(powerb_e.nc, loss_e.plug_p)
  connect(powerb_e.nv, sineVoltage_e.plug_n)
  connect(resistor_m.plug_n, powerb_m.pc)
  connect(powerb_m.pc, powerb_m.pv)
  connect(powerb_m.nc, converter_m.plug_p)
  connect(powerb_m.nv, sineVoltage_m.plug_n)
  connect(loss_e.plug_n, sineVoltage_e.plug_n)
  connect(loss_e.plug_p, converter_e.plug_p)
end EddyCurrentLosses;


within Modelica.Magnetic.FundamentalWave.Examples;
package Components "Examples of components of the FundamentalWave library"
  extends Modelica.Icons.ExamplesPackage;
end Components;


Polyphase inductance. This example compares an electric polyphase inductor with equivalent fundamental wave reluctance circuits,
one with reluctances individual for each phase (s) and the other with a common reluctance for all phases (m).
The phase inductance L and the magnetic fundamental wave reluctance R_m
for reluctances individual to the phases (s) and for a reluctance common to all phases (m) are related by:

within Modelica.Magnetic.FundamentalWave.Examples.Components;
model PolyphaseInductance "Polyphase inductance"
  extends Modelica.Icons.Example;
  parameter Integer m=3 "Number of phases"
  parameter SI.Frequency f=1 "Supply frequency";
  parameter SI.Voltage VRMS=100 "RMS supply voltage";
  parameter SI.Resistance R=0.1 "Leader cable resistance";
  parameter Real effectiveTurns=5 "Effective number of turns";
  parameter SI.Inductance L=1 "Load inductance";
  final parameter SI.Reluctance R_ms=effectiveTurns^2/L
    "Individual equivalent magnetic reluctances";
  final parameter SI.Reluctance R_mm=m/2*effectiveTurns^2/L
    "Common equivalent magnetic reluctance";
  Electrical.Analog.Basic.Ground ground_e
  Electrical.Analog.Basic.Ground ground_s
  Electrical.Analog.Basic.Ground ground_m
  Electrical.Polyphase.Basic.Star star_e(m=m)
  Electrical.Polyphase.Basic.Star star_s(m=m)
  Electrical.Polyphase.Basic.Star star_m(m=m)
  Electrical.Polyphase.Sources.SineVoltage voltageSource_e(
    m=m,
    f=fill(f, m),
    V=fill(sqrt(2)*VRMS, m),
    phase=-Modelica.Electrical.Polyphase.Functions.symmetricOrientation(
        m) + fill(Modelica.Constants.pi/2, m))
  Electrical.Polyphase.Sources.SineVoltage voltageSource_s(
    m=m,
    f=fill(f, m),
    V=fill(sqrt(2)*VRMS, m),
    phase=-Modelica.Electrical.Polyphase.Functions.symmetricOrientation(m) +
        fill(Modelica.Constants.pi/2, m))
  Electrical.Polyphase.Sources.SineVoltage voltageSource_m(
    m=m,
    f=fill(f, m),
    V=fill(sqrt(2)*VRMS, m),
    phase=-Modelica.Electrical.Polyphase.Functions.symmetricOrientation(m) +
        fill(Modelica.Constants.pi/2, m))
  Electrical.Polyphase.Basic.Resistor resistor_e(m=m, R=fill(R, m))
  Electrical.Polyphase.Basic.Resistor resistor_s(m=m, R=fill(R, m))
  Electrical.Polyphase.Basic.Resistor resistor_m(m=m, R=fill(R, m))
  Modelica.Electrical.Polyphase.Basic.Inductor inductor_e(m=m, L=fill(L, m))
  Electrical.Polyphase.Basic.PlugToPins_p plugToPins_p(m=m)
  Electrical.Polyphase.Basic.PlugToPins_n plugToPins_n(m=m)
  Modelica.Magnetic.FundamentalWave.Components.SinglePhaseElectroMagneticConverter
    converter_s[m](orientation=Modelica.Electrical.Polyphase.Functions.symmetricOrientation(m),
    effectiveTurns=fill(effectiveTurns, m))
  Magnetic.FundamentalWave.Components.PolyphaseElectroMagneticConverter converter_m(
    m=m, orientation=Modelica.Electrical.Polyphase.Functions.symmetricOrientation(m),
    effectiveTurns=fill(effectiveTurns, m))
  Magnetic.FundamentalWave.Components.Reluctance reluctance_m(
    R_m(d=R_mm, q=R_mm))
  Modelica.Magnetic.FundamentalWave.Components.Reluctance reluctance_s[m](
    each R_m(d=R_ms, q=R_ms))
  Modelica.Magnetic.FundamentalWave.Components.Ground groundM_s[m]
  Magnetic.FundamentalWave.Components.Ground groundM_m
initial equation
  resistor_e.i = zeros(m);
  resistor_s.i[1:m] = zeros(m);
  resistor_m.i[1:2] = zeros(2);
equation
  connect(star_e.plug_p, voltageSource_e.plug_n)
  connect(voltageSource_e.plug_n, inductor_e.plug_n)
  connect(converter_m.port_p, reluctance_m.port_p)
  connect(converter_m.port_n, reluctance_m.port_n)
  connect(converter_m.port_n, groundM_m.port_p)
  connect(voltageSource_m.plug_n, star_m.plug_p)
  connect(voltageSource_m.plug_n, converter_m.plug_n)
  connect(voltageSource_e.plug_p, resistor_e.plug_p)
  connect(resistor_e.plug_n, inductor_e.plug_p)
  connect(voltageSource_m.plug_p, resistor_m.plug_p)
  connect(resistor_m.plug_n, converter_m.plug_p)
  connect(star_e.pin_n, ground_e.p)
  connect(voltageSource_s.plug_n, star_s.plug_p)
  connect(star_s.pin_n, ground_s.p)
  connect(star_m.pin_n, ground_m.p)
  connect(converter_s.port_n, reluctance_s.port_n)
  connect(plugToPins_n.pin_n, converter_s.pin_n)
  connect(voltageSource_s.plug_n, plugToPins_n.plug_n)
  connect(converter_s.port_n, groundM_s.port_p)
  connect(voltageSource_s.plug_p, resistor_s.plug_p)
  connect(resistor_s.plug_n, plugToPins_p.plug_p)
  connect(plugToPins_p.pin_p, converter_s.pin_p)
  connect(converter_s.port_p, reluctance_s.port_p)
end PolyphaseInductance;


Single-phase inductance. This example compares an electric single-phase inductor with an equivalent fundamental wave reluctance circuit.
The phase inductance L and the magnetic fundamental wave reluctance R_m are related by:

within Modelica.Magnetic.FundamentalWave.Examples.Components;
model SinglePhaseInductance "Single-phase inductance"
  extends Modelica.Icons.Example;
  parameter SI.Frequency f=1 "Supply frequency";
  parameter SI.Voltage VRMS=100 "RMS supply voltage";
  parameter SI.Resistance R=0.1 "Leader cable resistance";
  parameter SI.Inductance L=1 "Load inductance";
  parameter Real effectiveTurns=5 "Effective number of turns";
  final parameter SI.Reluctance R_m=effectiveTurns^2/L
    "Equivalent magnetic reluctance";
  Modelica.Electrical.Analog.Basic.Ground ground_e
  Modelica.Electrical.Analog.Basic.Ground ground_m
  Modelica.Electrical.Analog.Sources.SineVoltage voltageSource_e(
    f=f,
    V=sqrt(2)*VRMS,
    phase=Modelica.Constants.pi/2)
  Modelica.Electrical.Analog.Sources.SineVoltage voltageSource_m(
    f=f,
    V=sqrt(2)*VRMS,
    phase=Modelica.Constants.pi/2)
  Modelica.Electrical.Analog.Basic.Resistor resistor_e(R=R)
  Modelica.Electrical.Analog.Basic.Resistor resistor_m(R=R)
  Modelica.Electrical.Analog.Basic.Inductor inductor_e(L=L)
  Magnetic.FundamentalWave.Components.SinglePhaseElectroMagneticConverter converter_m(
      effectiveTurns=effectiveTurns, orientation=0)
  Magnetic.FundamentalWave.Components.Reluctance reluctance_m(R_m(d=R_m, q=R_m))
  Magnetic.FundamentalWave.Components.Ground groundM_m
initial equation
  resistor_e.i = 0;
  resistor_m.i = 0;
equation
  connect(converter_m.port_p, reluctance_m.port_p)
  connect(converter_m.port_n, reluctance_m.port_n)
  connect(converter_m.port_n, groundM_m.port_p)
  connect(voltageSource_e.n, inductor_e.n)
  connect(voltageSource_e.n, ground_e.p)
  connect(voltageSource_m.n, converter_m.pin_n)
  connect(voltageSource_m.n, ground_m.p)
  connect(voltageSource_e.p, resistor_e.p)
  connect(resistor_e.n, inductor_e.p)
  connect(voltageSource_m.p, resistor_m.p)
  connect(resistor_m.n, converter_m.pin_p)
end SinglePhaseInductance;


Negative port interface to FluxTubes. Connects a FundamentalWave port with a real and imaginary part FluxTube port.

within Modelica.Magnetic.FundamentalWave.Interfaces;
model NegativePortInterface "Negative port interface to FluxTubes"

  Magnetic.FundamentalWave.Interfaces.NegativeMagneticPort port
    "Magnetic port of fundamental wave machines"
  Magnetic.FluxTubes.Interfaces.NegativeMagneticPort port_re
    "Magnetic port, real part"
  Magnetic.FluxTubes.Interfaces.NegativeMagneticPort port_im
    "Magnetic port, imaginary part"
equation
  port.V_m.re = port_re.V_m;
  port.V_m.im = port_im.V_m;
  port.Phi.re + port_re.Phi = 0;
  port.Phi.im + port_im.Phi = 0;
end NegativePortInterface;


Interfaces and partial models

within Modelica.Magnetic.FundamentalWave;
package Interfaces "Interfaces and partial models"
  extends Modelica.Icons.InterfacesPackage;
end Interfaces;


Positive port interface to FluxTubes. Connects a FundamentalWave port with a real and imaginary part FluxTube port.

within Modelica.Magnetic.FundamentalWave.Interfaces;
model PositivePortInterface "Positive port interface to FluxTubes"

  Magnetic.FundamentalWave.Interfaces.PositiveMagneticPort port
    "Magnetic port of fundamental wave machines"
  Magnetic.FluxTubes.Interfaces.PositiveMagneticPort port_re
    "Magnetic port, real part"
  Magnetic.FluxTubes.Interfaces.PositiveMagneticPort port_im
    "Magnetic port, imaginary part"
equation
  port.V_m.re = port_re.V_m;
  port.V_m.im = port_im.V_m;
  port.Phi.re + port_re.Phi = 0;
  port.Phi.im + port_im.Phi = 0;
end PositivePortInterface;


Transform instantaneous values to space phasors and select states. Transforms instantaneous values into space phasors and zero system currents,
rotates space phasors and sets stateSelect modifiers in order to choose states w.r.t. rotating frame,
i.e., with small derivatives.

within Modelica.Magnetic.FundamentalWave.Interfaces;
model StateSelector
  "Transform instantaneous values to space phasors and select states"
  import Modelica.Constants.pi;
  parameter Integer m(min=3) = 3 "Number of phases"
  input Real xi[m](each stateSelect=StateSelect.avoid)
    "Instantaneous values"
  input SI.Angle gamma "Angle of rotation"
  parameter StateSelect x0StateSelect=StateSelect.prefer
    "Priority to use zero systems as states";
  parameter StateSelect xrStateSelect=StateSelect.prefer
    "Priority to use space phasors w.r.t. rotating frame as states";
  Real x0(stateSelect=x0StateSelect) = 1/sqrt(m)*sum(xi) "Zero system";
  Real x00(stateSelect=x0StateSelect) = 1/sqrt(m)*sum({xi[2*l - 1] - xi[2*l]
    for l in 1:integer(m/2)}) if m == 2*integer(m/2)
    "Second zero system, if present (mp even)";
  final parameter Integer np=integer((m - 1)/2) "Number of space phasors";
  Complex xf[np](each re(stateSelect=StateSelect.avoid), each im(
        stateSelect=StateSelect.avoid)) "Space phasors w.r.t. fixed frame";
  Complex xr[np](each re(stateSelect=xrStateSelect), each im(stateSelect=
          xrStateSelect)) "Space phasors w.r.t. rotating frame";
equation
  //space phasor transformations
  for k in 1:np loop
    xf[k].re = 1/sqrt(m)*sum({cos(k*(l - 1)*2*pi/m)*xi[l] for l in 1:m});
    xf[k].im = 1/sqrt(m)*sum({sin(k*(l - 1)*2*pi/m)*xi[l] for l in 1:m});
    xr[k] = xf[k]*Modelica.ComplexMath.conj(Modelica.ComplexMath.exp(
      Complex(0, gamma)));
  end for;
end StateSelector;


Two magnetic ports for textual modeling. This magnetic two port element only consists of a
positive and a
negative magnetic port.
This model is mainly used to extend from in order build more complex - equation based - models.

within Modelica.Magnetic.FundamentalWave.Interfaces;
partial model TwoPort "Two magnetic ports for textual modeling"
  extends Magnetic.FundamentalWave.Interfaces.TwoPortExtended;
equation
  // Local flux balance
  port_p.Phi + port_n.Phi = Complex(0, 0);
end TwoPort;


Two magnetic ports for graphical modeling. This magnetic two port element consists of a
positive and a
negative magnetic port and
considers the flux balance of the two ports. Additionally the magnetic potential difference (of the positive and the negative port) and the magnetic flux (into the positive magnetic port) are defined. This model is mainly to used to extend from in order build more complex - graphical - models.

within Modelica.Magnetic.FundamentalWave.Interfaces;
partial model TwoPortElementary "Two magnetic ports for graphical modeling"
  PositiveMagneticPort port_p "Positive magnetic port of fundamental wave machines"
  NegativeMagneticPort port_n "Negative magnetic port of fundamental wave machines"
end TwoPortElementary;


Two magnetic ports for graphical modeling with additional variables. This magnetic two port element consists of a positive and a negative magnetic port and some additionally variables, but no physical balance equations.

within Modelica.Magnetic.FundamentalWave.Interfaces;
partial model TwoPortExtended "Two magnetic ports for graphical modeling with additional variables"
  extends TwoPortElementary;
  SI.ComplexMagneticPotentialDifference V_m = port_p.V_m - port_n.V_m
    "Complex magnetic potential difference";
  SI.MagneticPotentialDifference abs_V_m = Modelica.ComplexMath.abs(V_m)
    "Magnitude of complex magnetic potential difference";
  SI.Angle arg_V_m = Modelica.ComplexMath.arg(V_m)
    "Argument of complex magnetic potential difference";
  SI.ComplexMagneticFlux Phi = port_p.Phi
    "Complex magnetic flux";
  SI.MagneticFlux abs_Phi = Modelica.ComplexMath.abs(Phi)
    "Magnitude of complex magnetic flux";
  SI.Angle arg_Phi = Modelica.ComplexMath.arg(Phi)
    "Argument of complex magnetic flux";
end TwoPortExtended;


Sensor to measure magnetic flux. Sensor for magnetic flux.

within Modelica.Magnetic.FundamentalWave.Sensors;
model MagneticFluxSensor "Sensor to measure magnetic flux"
  extends Modelica.Icons.RoundSensor;
  extends Magnetic.FundamentalWave.Interfaces.TwoPortElementary;
  SI.ComplexMagneticPotentialDifference V_m
    "Complex magnetic potential difference";
  Modelica.ComplexBlocks.Interfaces.ComplexOutput Phi
    "Complex magnetic flux from por_ p to port_n as output signal"
equation
  // Flux into positive port
  port_p.V_m - port_n.V_m = V_m;
  // Magnetomotive force
  port_p.Phi = Phi;
  // Local flux balance
  port_p.Phi + port_n.Phi = Complex(0, 0);
  // No magnetic potential difference at sensor
  V_m = Complex(0, 0);
end MagneticFluxSensor;


Sensor to measure magnetic potential difference. Sensor for magnetic potential difference.

within Modelica.Magnetic.FundamentalWave.Sensors;
model MagneticPotentialDifferenceSensor
  "Sensor to measure magnetic potential difference"
  extends Modelica.Icons.RoundSensor;
  extends Magnetic.FundamentalWave.Interfaces.TwoPortElementary;
  Modelica.ComplexBlocks.Interfaces.ComplexOutput V_m
    "Complex magnetic potential difference between port_p and port_n as output signal"
  SI.ComplexMagneticFlux Phi "Complex magnetic flux";
equation
  // Flux into positive port
  port_p.V_m - port_n.V_m = V_m;
  // Magnetomotive force
  port_p.Phi = Phi;
  // Local flux balance
  port_p.Phi + port_n.Phi = Complex(0, 0);
  // No magnetic flux through sensor
  Phi = Complex(0, 0);
end MagneticPotentialDifferenceSensor;


Sensor to measure magnetic potential. Sensor for magnetic potential difference.

within Modelica.Magnetic.FundamentalWave.Sensors;
model MagneticPotentialSensor "Sensor to measure magnetic potential"
  extends Modelica.Icons.RoundSensor;
  Modelica.ComplexBlocks.Interfaces.ComplexOutput V_m
    "Complex magnetic potential as output signal"
  Interfaces.PositiveMagneticPort port_p "Magnetic connector of sensor"
equation
  // No magnetic flux through sensor
  port_p.Phi = Complex(0, 0);
  // Magnetic potential
  V_m = port_p.V_m;
end MagneticPotentialSensor;


within Modelica.Magnetic.FundamentalWave;
package Sensors "Sensors to measure variables in magnetic networks"
  extends Modelica.Icons.SensorsPackage;
end Sensors;


Source of constant magnetic flux. Source of constant magnetic flux.

within Modelica.Magnetic.FundamentalWave.Sources;
model ConstantFlux "Source of constant magnetic flux"
  extends Magnetic.FundamentalWave.Interfaces.TwoPortElementary;
  SI.ComplexMagneticPotentialDifference V_m
    "Complex magnetic potential difference";
  SI.MagneticPotentialDifference abs_V_m=
      Modelica.ComplexMath.abs(V_m)
    "Magnitude of complex magnetic potential difference";
  SI.Angle arg_V_m=Modelica.ComplexMath.arg(V_m)
    "Argument of complex magnetic potential difference";
  parameter SI.ComplexMagneticFlux Phi=Complex(re=1, im=0)
    "Complex magnetic flux";
  SI.MagneticPotentialDifference abs_Phi=
      Modelica.ComplexMath.abs(Phi) "Magnitude of complex magnetic flux";
  SI.Angle arg_Phi=Modelica.ComplexMath.arg(Phi)
    "Argument of complex magnetic flux";

equation
  // Flux into positive port
  port_p.V_m - port_n.V_m = V_m;
  // Magnetomotive force
  port_p.Phi = Phi;
  // Local flux balance
  port_p.Phi + port_n.Phi = Complex(0, 0);
end ConstantFlux;


Source with constant magnetic potential difference. Source of constant magnetomotive force.

within Modelica.Magnetic.FundamentalWave.Sources;
model ConstantMagneticPotentialDifference
  "Source with constant magnetic potential difference"
  extends Magnetic.FundamentalWave.Interfaces.TwoPortElementary;
  parameter SI.ComplexMagneticPotentialDifference V_m=Complex(
      re=1, im=0) "Complex magnetic potential difference";
  SI.MagneticPotentialDifference abs_V_m=
      Modelica.ComplexMath.abs(V_m)
    "Magnitude of complex magnetic potential difference";
  SI.Angle arg_V_m=Modelica.ComplexMath.arg(V_m)
    "Argument of complex magnetic potential difference";

  SI.ComplexMagneticFlux Phi "Complex magnetic flux";
  SI.MagneticPotentialDifference abs_Phi=
      Modelica.ComplexMath.abs(Phi) "Magnitude of complex magnetic flux";
  SI.Angle arg_Phi=Modelica.ComplexMath.arg(Phi)
    "Argument of complex magnetic flux";
equation
  // Flux into positive port
  port_p.V_m - port_n.V_m = V_m;
  // Magnetomotive force
  port_p.Phi = Phi;
  // Local flux balance
  port_p.Phi + port_n.Phi = Complex(0, 0);
end ConstantMagneticPotentialDifference;


Sources

within Modelica.Magnetic.FundamentalWave;
package Sources "Sources"
  extends Modelica.Icons.SourcesPackage;
end Sources;


Source of time varying magnetic flux. Source of magnetic flux with complex signal input.

within Modelica.Magnetic.FundamentalWave.Sources;
model SignalFlux "Source of time varying magnetic flux"
  extends Magnetic.FundamentalWave.Interfaces.TwoPortElementary;
  SI.ComplexMagneticPotentialDifference V_m
    "Complex magnetic potential difference";
  SI.MagneticPotentialDifference abs_V_m=
      Modelica.ComplexMath.abs(V_m)
    "Magnitude of complex magnetic potential difference";
  SI.Angle arg_V_m=Modelica.ComplexMath.arg(V_m)
    "Argument of complex magnetic potential difference";

  Modelica.ComplexBlocks.Interfaces.ComplexInput Phi
    "Complex signal input of magnetic flux"
  SI.MagneticPotentialDifference abs_Phi=
      Modelica.ComplexMath.abs(Phi) "Magnitude of complex magnetic flux";
  SI.Angle arg_Phi=Modelica.ComplexMath.arg(Phi)
    "Argument of complex magnetic flux";

equation
  // Flux into positive port
  port_p.V_m - port_n.V_m = V_m;
  // Magnetomotive force
  port_p.Phi = Phi;
  // Local flux balance
  port_p.Phi + port_n.Phi = Complex(0, 0);
end SignalFlux;


Source of magnetic potential difference with signal input. Source of magnetomotive force with complex signal input.

within Modelica.Magnetic.FundamentalWave.Sources;
model SignalMagneticPotentialDifference
  "Source of magnetic potential difference with signal input"
  extends Magnetic.FundamentalWave.Interfaces.TwoPortElementary;
  Modelica.ComplexBlocks.Interfaces.ComplexInput V_m
    "Complex signal input of magnetic potential difference"
  SI.MagneticPotentialDifference abs_V_m=
      Modelica.ComplexMath.abs(V_m)
    "Magnitude of complex magnetic potential difference";
  SI.Angle arg_V_m=Modelica.ComplexMath.arg(V_m)
    "Argument of complex magnetic potential difference";

  SI.ComplexMagneticFlux Phi "Complex magnetic flux";
  SI.MagneticPotentialDifference abs_Phi=
      Modelica.ComplexMath.abs(Phi) "Magnitude of complex magnetic flux";
  SI.Angle arg_Phi=Modelica.ComplexMath.arg(Phi)
    "Argument of complex magnetic flux";
equation
  // Flux into positive port
  port_p.V_m - port_n.V_m = V_m;
  // Magnetomotive force
  port_p.Phi = Phi;
  // Local flux balance
  port_p.Phi + port_n.Phi = Complex(0, 0);
end SignalMagneticPotentialDifference;


Definition of salient types

within Modelica.Magnetic.FundamentalWave;
package Types "Definition of salient types"
  extends Modelica.Icons.TypesPackage;
end Types;


Quasi-static magnetic package

within Modelica.Magnetic;
package QuasiStatic "Quasi-static magnetic package"
extends Modelica.Icons.Package;
end QuasiStatic;


within Modelica.Magnetic.QuasiStatic;
package FluxTubes "Library for modelling of quasi-static electromagnetic devices with lumped magnetic networks"

  import Modelica.Constants.pi;
  import Modelica.Constants.mu_0;

  extends Modelica.Icons.Package;
end FluxTubes;


Base class for flux tubes with fixed shape during simulation. Please refer to the description of  the subpackage
Shapes.FixedShape
for utilisation of this partial model.

within Modelica.Magnetic.QuasiStatic.FluxTubes.BaseClasses;
partial model FixedShape "Base class for flux tubes with fixed shape during simulation"

  extends Interfaces.TwoPort;

  parameter SI.RelativePermeability mu_rConst = 1 "Constant relative permeability";

  SI.Reluctance R_m "Magnetic reluctance";
  SI.Permeance G_m "Magnetic permeance";
  SI.ComplexMagneticFluxDensity B
  "Magnetic flux density (normal component)";
  SI.MagneticFluxDensity abs_B = Modelica.ComplexMath.abs(B)
  "Magnitude of complex magnetic flux density";
  SI.Angle arg_B = Modelica.ComplexMath.arg(B)
  "Argument of complex magnetic flux density";
  SI.CrossSection A "Area of cross section penetrated by magnetic flux";
  SI.ComplexMagneticFieldStrength H
  "Magnetic field strength (normal component)";
  SI.MagneticFieldStrength abs_H = Modelica.ComplexMath.abs(H)
  "Magnitude of complex magnetic field strength";
  SI.Angle arg_H = Modelica.ComplexMath.arg(H)
  "Argument of complex magnetic field strength";

  SI.RelativePermeability mu_r "Relative magnetic permeability";

equation
  mu_r = mu_rConst;
  R_m = 1/G_m;
  V_m = Phi*R_m;
  B = Phi/A;
  H = B/(mu_0*mu_r);
end FixedShape;


Base class for leakage flux tubes with position-independent permeance and hence no force generation; mu_r=1. Please refer to the description of the subpackage
Shapes.Leakage
for utilisation of this partial model.

within Modelica.Magnetic.QuasiStatic.FluxTubes.BaseClasses;
partial model Leakage "Base class for leakage flux tubes with position-independent permeance and hence no force generation; mu_r=1"

  extends Interfaces.TwoPort;
  extends Modelica.Magnetic.QuasiStatic.FluxTubes.Icons.Reluctance;

  SI.Reluctance R_m "Magnetic reluctance";
  SI.Permeance G_m "Magnetic permeance";

equation
  V_m = Phi*R_m;
  R_m = 1/G_m;
end Leakage;


Base classes containing partial models

within Modelica.Magnetic.QuasiStatic.FluxTubes;
package BaseClasses "Base classes containing partial models"
  extends Modelica.Icons.BasesPackage;
end BaseClasses;


Constant permeance. This constant permeance is provided for test purposes and simple magnetic network models. The permeance is not calculated from geometry and permeability of a flux tube, but is provided as parameter.

within Modelica.Magnetic.QuasiStatic.FluxTubes.Basic;
model ConstantPermeance "Constant permeance"

  extends Interfaces.TwoPort;
  extends Modelica.Magnetic.QuasiStatic.FluxTubes.Icons.Reluctance;

  parameter SI.Permeance G_m=1 "Magnetic permeance";

equation
  G_m * V_m = Phi;
end ConstantPermeance;


Constant reluctance. This constant reluctance is provided for test purposes and simple magnetic network models. The reluctance is not calculated from geometry and permeability of a flux tube, but is provided as parameter.

within Modelica.Magnetic.QuasiStatic.FluxTubes.Basic;
model ConstantReluctance "Constant reluctance"

  extends Interfaces.TwoPort;
  extends Modelica.Magnetic.QuasiStatic.FluxTubes.Icons.Reluctance;

  parameter SI.Reluctance R_m=1 "Magnetic reluctance";

equation
  V_m = Phi*R_m;
end ConstantReluctance;


Crossing of two branches. This is a simple crossing of two branches. The ports port_p1 and port_p2 are connected, as well as port_n1 and port_n2.

within Modelica.Magnetic.QuasiStatic.FluxTubes.Basic;
model Crossing "Crossing of two branches"

  FluxTubes.Interfaces.PositiveMagneticPort port_p1 "Positive port_p1 connected with port_p2"
  FluxTubes.Interfaces.PositiveMagneticPort port_p2 "Positive port_p2 connected with port_p1"
  FluxTubes.Interfaces.NegativeMagneticPort port_n1 "Negative port_n1 connected with port_n2"
  FluxTubes.Interfaces.NegativeMagneticPort port_n2 "Negative port_n2 connected with port_n1"

equation
  Connections.branch(port_p1.reference, port_p2.reference);
  Connections.branch(port_n1.reference, port_n2.reference);
  port_p1.reference.gamma = port_p2.reference.gamma;
  port_n1.reference.gamma = port_n2.reference.gamma;

  port_p1.V_m = port_p2.V_m;
  port_p1.Phi + port_p2.Phi = Complex(0,0);
  port_n1.V_m = port_n2.V_m;
  port_n1.Phi + port_n2.Phi = Complex(0,0);
end Crossing;


For modelling of eddy current in a conductive magnetic flux tube. Eddy currents are induced in a conductive magnetic flux tube when the flux changes with time. This causes a magnetic voltage drop in addition to the voltage drop that is due to the reluctance of this flux tube. The eddy current component can be thought of as a short-circuited secondary winding of a transformer with only one turn. Its resistance is then determined by the geometry and resistivity of the eddy current path. Alternatively, a total conductance parameter can be used.

within Modelica.Magnetic.QuasiStatic.FluxTubes.Basic;
model EddyCurrent
"For modelling of eddy current in a conductive magnetic flux tube"

  constant Complex j=Complex(0, 1);
  extends Interfaces.TwoPort;

  parameter Boolean useConductance = false
  "Use conductance instead of geometry data and rho"
  parameter SI.Conductance G(min=0) = 1/0.098e-6
  "Equivalent loss conductance G=A/rho/l"
  parameter SI.Resistivity rho=0.098e-6
  "Resistivity of flux tube material (default: Iron at 20degC)"
  parameter SI.Length l=1 "Average length of eddy current path"
  parameter SI.Area A=1 "Cross sectional area of eddy current path"

  final parameter SI.Resistance R=rho*l/A
  "Electrical resistance of eddy current path"

  extends
    Modelica.Thermal.HeatTransfer.Interfaces.PartialElementaryConditionalHeatPort(
      final T=273.15);

equation
  lossPower = (pi/2)*Modelica.ComplexMath.imag(omega*V_m*
    Modelica.ComplexMath.conj(Phi));
  // Alternative calculation of loss power
  // lossPower = -(pi/2)*Modelica.ComplexMath.real(j*omega*V_m*Modelica.ComplexMath.conj(Phi));
  if G > 0 then
    (pi/2)*V_m = j*omega*Phi * (if useConductance then G else 1/R);
  else
    V_m = Complex(0, 0);
  end if;
end EddyCurrent;


Electromagnetic energy conversion. The electromagnetic energy conversion is given by Ampere's law and Faraday's law respectively:

within Modelica.Magnetic.QuasiStatic.FluxTubes.Basic;
model ElectroMagneticConverter "Electromagnetic energy conversion"

  constant Complex j=Complex(0, 1);
  FluxTubes.Interfaces.PositiveMagneticPort port_p "Positive magnetic port"
  FluxTubes.Interfaces.NegativeMagneticPort port_n "Negative magnetic port"
  Modelica.Electrical.QuasiStatic.SinglePhase.Interfaces.PositivePin pin_p
  "Positive electric pin"
  Modelica.Electrical.QuasiStatic.SinglePhase.Interfaces.NegativePin pin_n
  "Negative electric pin"
  SI.ComplexVoltage v "Voltage";
  SI.ComplexCurrent i(re(start=0, stateSelect=StateSelect.prefer),
                                    im(start=0, stateSelect=StateSelect.prefer))
  "Current";
  SI.ComplexMagneticPotentialDifference V_m
  "Magnetic potential difference";
  SI.ComplexMagneticFlux Phi
  "Magnetic flux coupled into magnetic circuit";
  SI.AngularVelocity omega;

  parameter Real N=1 "Number of turns";

  //for information only:
  SI.ComplexMagneticFlux Psi
  "Flux linkage for information only";
  SI.Inductance L_stat "Static inductance abs(Psi/i) for information only";

protected
  Real eps=100*Modelica.Constants.eps;
equation
  v = pin_p.v - pin_n.v;
  Complex(0) = pin_p.i + pin_n.i;
  i = pin_p.i;

  V_m = port_p.V_m - port_n.V_m;
  Complex(0) = port_p.Phi + port_n.Phi;
  Phi = port_p.Phi;

  // Induced voltages from complex magnetic flux, number of turns
  // and angles of orientation of winding
  v = -j*omega*N*Phi;
  // Amperes law
  V_m = N*i;
  // for information only:
  Psi = N*Phi;
  // Use of abs for positive results; due to Modelica sign conventions for flow into connectors:
  L_stat = noEvent(if Modelica.ComplexMath.abs(i) > eps then Modelica.ComplexMath.abs(Psi/i) else Modelica.ComplexMath.abs(Psi/eps));

  omega = der(port_p.reference.gamma);

  // Potential roots are not used; instead the reference angle is handled
  // by means of Connections.branch between electric pin_p and magnetic port_p
  Connections.branch(port_p.reference, port_n.reference);
  port_p.reference.gamma = port_n.reference.gamma;
  Connections.branch(pin_p.reference, pin_n.reference);
  pin_p.reference.gamma = pin_n.reference.gamma;
  Connections.branch(port_p.reference, pin_p.reference);
  port_p.reference.gamma = pin_p.reference.gamma;
end ElectroMagneticConverter;


Zero magnetic potential. The magnetic potential at the magnetic ground node is zero. Every magnetic network model must contain at least one magnetic ground object.

within Modelica.Magnetic.QuasiStatic.FluxTubes.Basic;
model Ground "Zero magnetic potential"

  FluxTubes.Interfaces.PositiveMagneticPort port
equation
  port.V_m = Complex(0);
end Ground;


Idle running branch. This is a simple idle running branch. The magnetic flux through this component is equal to zero.

within Modelica.Magnetic.QuasiStatic.FluxTubes.Basic;
model Idle "Idle running branch"
  extends Interfaces.TwoPort;
equation
  Phi = Complex(0);
end Idle;


Leakage reluctance with respect to the reluctance of a useful flux path (not for dynamic simulation of actuators). Differently from the flux tube elements of package Shapes.Leakage
that are calculated from their geometry, this leakage reluctance is calculated with reference to the total reluctance of a useful flux path. Parameter c_usefulFlux is the ratio of the useful flux over the total flux.

within Modelica.Magnetic.QuasiStatic.FluxTubes.Basic;
model LeakageWithCoefficient
"Leakage reluctance with respect to the reluctance of a useful flux path (not for dynamic simulation of actuators)"

  extends BaseClasses.Leakage;
  import Modelica.Constants.eps;
  parameter SI.CouplingCoefficient c_usefulFlux(final min=eps, final max=1-eps, start=0.7)
    "Ratio useful flux/(leakage flux + useful flux) = useful flux/total flux"
  Blocks.Interfaces.RealInput R_mUsefulTot(quantity="Reluctance", unit="H-1")

equation
  (1 - c_usefulFlux)*R_m = c_usefulFlux*R_mUsefulTot;
  // Generalized Kirchhoff's current law
end LeakageWithCoefficient;


within Modelica.Magnetic.QuasiStatic.FluxTubes;
package Basic "Basic elements of magnetic network models"
  extends Modelica.Icons.Package;
end Basic;


Short cut branch. This is a simple short cut branch. The magnetic voltage of this component is equal to zero.

within Modelica.Magnetic.QuasiStatic.FluxTubes.Basic;
model Short "Short cut branch"
  extends Interfaces.TwoPort;
equation
  V_m = Complex(0,0);
end Short;


Variable permeance. This constant permeance is provided for test purposes and simple magnetic network models. The permeance is not calculated from geometry and permeability of a flux tube, but is provided as parameter.

within Modelica.Magnetic.QuasiStatic.FluxTubes.Basic;
model VariablePermeance "Variable permeance"

  extends Interfaces.TwoPort;
  extends Modelica.Magnetic.QuasiStatic.FluxTubes.Icons.Reluctance;

  Blocks.Interfaces.RealInput G_m(quantity="Permeance", unit="H") "Magnetic permeance"
equation
  G_m * V_m = Phi;
end VariablePermeance;


Variable reluctance. The reluctance of this model is controlled by a real signal input.

within Modelica.Magnetic.QuasiStatic.FluxTubes.Basic;
model VariableReluctance "Variable reluctance"

  extends Interfaces.TwoPort;
  extends Modelica.Magnetic.QuasiStatic.FluxTubes.Icons.Reluctance;

  Blocks.Interfaces.RealInput R_m(quantity="Reluctance", unit="H-1") "Magnetic reluctance"
equation
  V_m = Phi*R_m;
end VariableReluctance;


Linear inductor with ferromagnetic core. This model compares a transient-linear magnetic circuit with a quasi-static magnetic circuit. A sinusoidal voltage is applied to an inductor with a closed ferromagnetic core of rectangular shape.

within Modelica.Magnetic.QuasiStatic.FluxTubes.Examples;
model LinearInductor "Linear inductor with ferromagnetic core"
  extends Modelica.Icons.Example;
  output SI.Current deviation = feedback.y "Deviation of transient and quasi-static current";
  FluxTubes.Basic.Ground ground_mQS
  Modelica.Electrical.QuasiStatic.SinglePhase.Sources.VoltageSource
    sourceQS(
    f=50,
    V=230,
  gamma(fixed=true),
  phi=1.5707963267949) "Voltage applied to inductor"
  Modelica.Electrical.QuasiStatic.SinglePhase.Basic.Resistor
    rQS(R_ref=7.5) "Inductor coil resistance"
  FluxTubes.Basic.ElectroMagneticConverter coilQS(N=600) "Inductor coil"
  Basic.ConstantReluctance r_mLeakQS(R_m=1.2e6) "Constant leakage reluctance"
  Shapes.FixedShape.GenericFluxTube r_mAirParQS(
    mu_rConst=1,
    l=0.0001,
    area=0.025^2)
  "Reluctance of small parasitic air gap (ferromagnetic core packeted from single sheets)"
  Shapes.FixedShape.GenericFluxTube r_mFeQS(
    mu_rConst=1000,
    l=4*0.065,
    area=0.025^2) "Reluctance of ferromagnetic inductor core"

  Modelica.Electrical.QuasiStatic.SinglePhase.Basic.Ground groundQS

  Magnetic.FluxTubes.Basic.Ground ground_m
  Modelica.Electrical.Analog.Sources.SineVoltage source(
    f=50,
    phase=pi/2,
    V=230*sqrt(2)) "Voltage applied to inductor"
  Modelica.Electrical.Analog.Basic.Resistor r(R=7.5)
  "Inductor coil resistance"
  Magnetic.FluxTubes.Basic.ElectroMagneticConverter coil(N=600, i(fixed=true))
    "Inductor coil"
  Magnetic.FluxTubes.Basic.ConstantReluctance r_mLeak(R_m=1.2e6)
    "Constant leakage reluctance"
  Magnetic.FluxTubes.Shapes.FixedShape.GenericFluxTube r_mAirPar(
    nonLinearPermeability=false,
    mu_rConst=1,
    l=0.0001,
    area=0.025^2)
    "Reluctance of small parasitic air gap (ferromagnetic core packeted from single sheets)"
  Magnetic.FluxTubes.Shapes.FixedShape.GenericFluxTube r_mFe(
    mu_rConst=1000,
    l=4*0.065,
    material=Magnetic.FluxTubes.Material.SoftMagnetic.ElectricSheet.M350_50A(),

    B(start=0),
    nonLinearPermeability=false,
    area=0.025^2) "Reluctance of ferromagnetic inductor core"
  Modelica.Electrical.Analog.Basic.Ground ground
  Modelica.Electrical.QuasiStatic.SinglePhase.Sensors.CurrentSensor
    currentSensorQS
  Modelica.ComplexBlocks.ComplexMath.ComplexToPolar complexToPolar
  Modelica.Electrical.Analog.Sensors.CurrentSensor currentSensor
  Modelica.Blocks.Math.Feedback feedback
Modelica.Blocks.Math.RootMeanSquare rootMeanSquare(f=50)
equation
  connect(coilQS.port_p, r_mLeakQS.port_p)
  connect(r_mLeakQS.port_p, r_mAirParQS.port_p)
  connect(r_mAirParQS.port_n, r_mFeQS.port_p)
  connect(r_mFeQS.port_n, r_mLeakQS.port_n)
  connect(r_mFeQS.port_n, coilQS.port_n)
  connect(ground_mQS.port, r_mFeQS.port_n)
  connect(rQS.pin_n, coilQS.pin_p)
  connect(sourceQS.pin_n, coilQS.pin_n)
  connect(sourceQS.pin_n, groundQS.pin)
  connect(r.n, coil.p)
  connect(source.n, coil.n)
  connect(coil.port_p, r_mLeak.port_p)
  connect(r_mLeak.port_p, r_mAirPar.port_p)
  connect(r_mAirPar.port_n, r_mFe.port_p)
  connect(r_mFe.port_n, r_mLeak.port_n)
  connect(r_mFe.port_n, coil.port_n)
  connect(ground.p, source.n)
  connect(ground_m.port, r_mFe.port_n)
  connect(sourceQS.pin_p, currentSensorQS.pin_p)
  connect(currentSensorQS.pin_n, rQS.pin_p)
  connect(currentSensorQS.i, complexToPolar.u)
  connect(source.p, currentSensor.p)
  connect(currentSensor.n, r.p)
connect(currentSensor.i, rootMeanSquare.u)
connect(rootMeanSquare.y, feedback.u1)
connect(complexToPolar.len, feedback.u2)
end LinearInductor;


Non linear inductor with ferromagnetic core. This model compares a transient non-linear magnetic circuit with a linearized quasi-static magnetic circuit. A sinusoidal voltage is applied to an inductor with a closed ferromagnetic core of rectangular shape.

within Modelica.Magnetic.QuasiStatic.FluxTubes.Examples;
model NonLinearInductor "Non linear inductor with ferromagnetic core"
  extends Modelica.Icons.Example;
  output SI.Current deviation = feedback.y "Deviation of transient and quasi-static current";
  FluxTubes.Basic.Ground ground_mQS
  Modelica.Electrical.QuasiStatic.SinglePhase.Sources.VoltageSource
    sourceQS(
    f=50,
    V=230,
  gamma(fixed=true),
  phi=1.5707963267949) "Voltage applied to inductor"
  Modelica.Electrical.QuasiStatic.SinglePhase.Basic.Resistor
    rQS(R_ref=7.5) "Inductor coil resistance"
  FluxTubes.Basic.ElectroMagneticConverter coilQS(N=600) "Inductor coil"
  Basic.ConstantReluctance r_mLeakQS(R_m=1.2e6)
  "Constant leakage reluctance"
  Shapes.FixedShape.GenericFluxTube
                           r_mAirParQS(
    l=0.0001,
    mu_rConst=1,
    area=0.025^2)
  "Reluctance of small parasitic air gap (ferromagnetic core packeted from single sheets)"
  Shapes.FixedShape.GenericFluxTube
                           r_mFeQS(
    l=4*0.065,
    mu_rConst=655,
    area=0.025^2) "Reluctance of ferromagnetic inductor core"

  Modelica.Electrical.QuasiStatic.SinglePhase.Basic.Ground
    groundQS

  Magnetic.FluxTubes.Basic.Ground ground_m
  Modelica.Electrical.Analog.Sources.SineVoltage source(
    f=50,
    phase=pi/2,
    V=230*sqrt(2)) "Voltage applied to inductor"
  Modelica.Electrical.Analog.Basic.Resistor r(R=7.5)
  "Inductor coil resistance"
  Magnetic.FluxTubes.Basic.ElectroMagneticConverter coil(N=600, i(fixed=true))
    "Inductor coil"
  Magnetic.FluxTubes.Basic.ConstantReluctance r_mLeak(R_m=1.2e6)
    "Constant leakage reluctance"
  Magnetic.FluxTubes.Shapes.FixedShape.GenericFluxTube r_mAirPar(
    nonLinearPermeability=false,
    mu_rConst=1,
    l=0.0001,
    area=0.025^2)
    "Reluctance of small parasitic air gap (ferromagnetic core packeted from single sheets)"
  Magnetic.FluxTubes.Shapes.FixedShape.GenericFluxTube r_mFe(
    l=4*0.065,
    material=Magnetic.FluxTubes.Material.SoftMagnetic.ElectricSheet.M350_50A(),

    B(start=0),
    mu_rConst=655,
    nonLinearPermeability=true,
    area=0.025^2) "Reluctance of ferromagnetic inductor core"
  Modelica.Electrical.Analog.Basic.Ground ground
  Modelica.Electrical.QuasiStatic.SinglePhase.Sensors.CurrentSensor
    currentSensorQS
  Modelica.ComplexBlocks.ComplexMath.ComplexToPolar complexToPolar
  Modelica.Electrical.Analog.Sensors.CurrentSensor currentSensor
  Modelica.Blocks.Math.Feedback feedback
  Sensors.Transient.FundamentalWavePermabilitySensor
    fundamentalWavePermabilitySensor(
    f=50,
    A=0.025^2,
    l=4*0.065)
Modelica.Blocks.Math.Harmonic rootMeanSquare(f=50, k=1)
equation
  connect(coilQS.port_p, r_mLeakQS.port_p)
  connect(r_mLeakQS.port_p, r_mAirParQS.port_p)
  connect(r_mAirParQS.port_n, r_mFeQS.port_p)
  connect(r_mFeQS.port_n, r_mLeakQS.port_n)
  connect(r_mFeQS.port_n, coilQS.port_n)
  connect(ground_mQS.port, r_mFeQS.port_n)
  connect(rQS.pin_n, coilQS.pin_p)
  connect(sourceQS.pin_n, coilQS.pin_n)
  connect(sourceQS.pin_n, groundQS.pin)
  connect(r.n, coil.p)
  connect(source.n, coil.n)
  connect(coil.port_p, r_mLeak.port_p)
  connect(r_mLeak.port_p, r_mAirPar.port_p)
  connect(r_mFe.port_n, r_mLeak.port_n)
  connect(r_mFe.port_n, coil.port_n)
  connect(ground.p, source.n)
  connect(ground_m.port, r_mFe.port_n)
  connect(sourceQS.pin_p, currentSensorQS.pin_p)
  connect(currentSensorQS.pin_n, rQS.pin_p)
  connect(currentSensorQS.i, complexToPolar.u)
  connect(source.p, currentSensor.p)
  connect(currentSensor.n, r.p)
  connect(r_mAirPar.port_n,
    fundamentalWavePermabilitySensor.fluxP)
  connect(fundamentalWavePermabilitySensor.fluxN,
    r_mFe.port_p)
  connect(fundamentalWavePermabilitySensor.fluxP,
    fundamentalWavePermabilitySensor.potentialP)
  connect(fundamentalWavePermabilitySensor.potentialN,
    r_mFe.port_n)
connect(complexToPolar.len, feedback.u2)
connect(currentSensor.i, rootMeanSquare.u)
connect(rootMeanSquare.y_rms, feedback.u1)
end NonLinearInductor;


within Modelica.Magnetic.QuasiStatic.FluxTubes;
package Examples "Illustration of component usage with simple models of various devices"
  extends Modelica.Icons.ExamplesPackage;
end Examples;


Educational examples

within Modelica.Magnetic.QuasiStatic.FluxTubes.Examples;
package BasicExamples "Educational examples"
extends Modelica.Icons.ExamplesPackage;

end BasicExamples;


Educational example: iron core with airgap. Educational example of a magnetic circuit containing an iron core and an airgap:

within Modelica.Magnetic.QuasiStatic.FluxTubes.Examples.BasicExamples;
model QuadraticCoreAirgap "Educational example: iron core with airgap"
  extends Modelica.Icons.Example;

  parameter SI.Length l=0.1 "Outer length of iron core";
  parameter SI.Length a=0.01 "Side length of square cross section";
  parameter Real mu_r=1000 "Relative permeability of core";
  parameter SI.Length delta=0.001 "Length of airgap";
  parameter Real sigma=0.1 "Leakage coefficient";
  parameter Integer N=500 "Number of turns of exciting coil";
  parameter SI.Current I=1.5 "Maximum exciting current";
  Modelica.Magnetic.QuasiStatic.FluxTubes.Basic.ElectroMagneticConverter excitingCoil(N=N)
  Modelica.Magnetic.QuasiStatic.FluxTubes.Shapes.FixedShape.Cuboid leftLeg(
    mu_rConst=mu_r,
    l=l - a,
    a=a,
    b=a)
  Modelica.Magnetic.QuasiStatic.FluxTubes.Shapes.FixedShape.Cuboid upperYoke(
    mu_rConst=mu_r,
    l=l - a,
    a=a,
    b=a)
  Modelica.Magnetic.QuasiStatic.FluxTubes.Shapes.FixedShape.Cuboid rightLeg(
    mu_rConst=mu_r,
    l=l - a - delta,
    a=a,
    b=a)
  Modelica.Magnetic.QuasiStatic.FluxTubes.Shapes.FixedShape.Cuboid airGap(
    mu_rConst=1,
    l=delta,
    a=a,
    b=a)
  Modelica.Magnetic.QuasiStatic.FluxTubes.Basic.ElectroMagneticConverter measuringCoil(N=1)
  Modelica.Magnetic.QuasiStatic.FluxTubes.Shapes.FixedShape.Cuboid lowerYoke(
    mu_rConst=mu_r,
    l=l - a,
    a=a,
    b=a)
  Modelica.Magnetic.QuasiStatic.FluxTubes.Basic.Ground magneticGround
  Modelica.Electrical.QuasiStatic.SinglePhase.Basic.Ground electricGround1
  Modelica.Electrical.QuasiStatic.SinglePhase.Sources.VariableCurrentSource currentSource(gamma(fixed=true, start=0))
  Modelica.Magnetic.QuasiStatic.FluxTubes.Sensors.MagneticFluxSensor magFluxSensor
  Modelica.Electrical.QuasiStatic.SinglePhase.Basic.Ground electricGround2
  Modelica.Electrical.QuasiStatic.SinglePhase.Sensors.VoltageSensor voltageSensor
  Modelica.Magnetic.QuasiStatic.FluxTubes.Basic.LeakageWithCoefficient leakage(c_usefulFlux=1 - sigma)
  Modelica.Blocks.Sources.RealExpression usefulReluctance(y=1/airGap.G_m)
  Modelica.Blocks.Sources.Constant const(k=10.6103)
  Modelica.ComplexBlocks.Sources.ComplexRampPhasor complexRamp(
    magnitude1=0,
    magnitude2=I,
    phi=0,
    startTime=0.01,
    duration=0.015)
equation
  connect(excitingCoil.port_p, leftLeg.port_p)
  connect(leftLeg.port_n, upperYoke.port_p)
  connect(upperYoke.port_n, rightLeg.port_p)
  connect(rightLeg.port_n, measuringCoil.port_p)
  connect(measuringCoil.port_n, airGap.port_p)
  connect(lowerYoke.port_p, airGap.port_n)
  connect(lowerYoke.port_n, magneticGround.port)
  connect(excitingCoil.port_n, magFluxSensor.port_n)
  connect(magFluxSensor.port_p, magneticGround.port)
  connect(leakage.port_n, airGap.port_n)
  connect(measuringCoil.port_p, leakage.port_p)
  connect(leakage.R_mUsefulTot, usefulReluctance.y)
  connect(currentSource.pin_n, excitingCoil.pin_p)
  connect(currentSource.pin_p, electricGround1.pin)
  connect(electricGround1.pin, excitingCoil.pin_n)
  connect(measuringCoil.pin_p, voltageSensor.pin_p)
  connect(measuringCoil.pin_n, electricGround2.pin)
  connect(electricGround2.pin, voltageSensor.pin_n)
  connect(const.y, currentSource.f)
  connect(complexRamp.y, currentSource.I)
end QuadraticCoreAirgap;


Educational example: iron core with airgap. Educational example of a magnetic circuit containing a toroidal iron core with circular cross section and an airgap:

within Modelica.Magnetic.QuasiStatic.FluxTubes.Examples.BasicExamples;
model ToroidalCoreAirgap "Educational example: iron core with airgap"
  extends Modelica.Icons.Example;
  import Modelica.Constants.pi;
  parameter SI.Length r=0.05 "Middle radius of iron core";
  parameter SI.Length d=0.01 "Diameter of cylindrical cross section";
  parameter SI.RelativePermeability mu_r=1000 "Relative permeability of core";
  parameter SI.Length delta=0.001 "Length of airgap";
  parameter SI.Angle alpha=(1 - delta/(2*pi*r))*2*pi "Section angle of toroidal core";
  parameter Integer N=500 "Number of exciting coil turns";
  parameter SI.Current I=1.5 "Maximum exciting current";
  Modelica.Magnetic.QuasiStatic.FluxTubes.Basic.ElectroMagneticConverter excitingCoil(N=N)
  Modelica.Magnetic.QuasiStatic.FluxTubes.Shapes.FixedShape.Toroid core(
    mu_rConst=mu_r,
    r=r,
    d=d,
    alpha=alpha)
  Modelica.Magnetic.QuasiStatic.FluxTubes.Shapes.FixedShape.Toroid airGap(
    mu_rConst=1,
    r=r,
    d=d,
    alpha=2*pi - alpha)
  Modelica.Magnetic.QuasiStatic.FluxTubes.Basic.ElectroMagneticConverter measuringCoil(N=1)
  Modelica.Magnetic.QuasiStatic.FluxTubes.Basic.Ground magneticGround
  Modelica.Electrical.QuasiStatic.SinglePhase.Basic.Ground electricGround1
  Modelica.Magnetic.QuasiStatic.FluxTubes.Sensors.MagneticFluxSensor magFluxSensor
  Modelica.Electrical.QuasiStatic.SinglePhase.Basic.Ground electricGround2
  Modelica.Electrical.QuasiStatic.SinglePhase.Sensors.VoltageSensor voltageSensor
  Modelica.Electrical.QuasiStatic.SinglePhase.Sources.VariableCurrentSource currentSource(gamma(fixed=true, start=0))
  Modelica.Blocks.Sources.Constant const(k=50)
  Modelica.ComplexBlocks.Sources.ComplexRampPhasor complexRamp(
    magnitude1=0,
    magnitude2=I,
    phi=0,
    startTime=0.01,
    duration=0.015)
equation
  connect(core.port_n, measuringCoil.port_p)
  connect(measuringCoil.port_n, airGap.port_p)
  connect(excitingCoil.port_n, magFluxSensor.port_n)
  connect(magFluxSensor.port_p, magneticGround.port)
  connect(magneticGround.port, airGap.port_n)
  connect(excitingCoil.port_p, core.port_p)
  connect(electricGround1.pin, excitingCoil.pin_n)
  connect(measuringCoil.pin_p, voltageSensor.pin_p)
  connect(measuringCoil.pin_n, electricGround2.pin)
  connect(electricGround2.pin, voltageSensor.pin_n)
  connect(const.y, currentSource.f)
  connect(complexRamp.y, currentSource.I)
  connect(currentSource.pin_p, electricGround1.pin)
  connect(currentSource.pin_n, excitingCoil.pin_p)
end ToroidalCoreAirgap;


Educational example: iron core with airgap. Educational example of a magnetic circuit containing a toroidal iron core with rectangular cross section and an airgap:

within Modelica.Magnetic.QuasiStatic.FluxTubes.Examples.BasicExamples;
model ToroidalCoreQuadraticCrossSection "Educational example: iron core with airgap"
  extends Modelica.Icons.Example;
  import Modelica.Constants.pi;
  parameter SI.Length r_o=0.055 "Outer radius of iron core";
  parameter SI.Length r_i=0.045 "Inner radius of iron core";
  parameter SI.Length l=0.01 "Length of rectangular cross section";
  parameter SI.RelativePermeability mu_r=1000 "Relative permeability of core";
  parameter SI.Length delta=0.001 "Length of airgap";
  parameter SI.Angle alpha=(1 - delta/(2*pi*(r_o + r_i)/2))*2*pi "Section angle of toroidal core";
  parameter Integer N=500 "Number of exciting coil turns";
  parameter SI.Current I=1.5 "Maximum exciting current";
  Modelica.Magnetic.QuasiStatic.FluxTubes.Basic.ElectroMagneticConverter excitingCoil(N=N)
  Modelica.Magnetic.QuasiStatic.FluxTubes.Shapes.FixedShape.HollowCylinderCircumferentialFlux core(
    mu_rConst=mu_r,
    l=l,
    r_i=r_i,
    r_o=r_o,
    alpha=alpha)
  Modelica.Magnetic.QuasiStatic.FluxTubes.Shapes.FixedShape.HollowCylinderCircumferentialFlux airGap(
    mu_rConst=1,
    l=l,
    r_i=r_i,
    r_o=r_o,
    alpha=2*pi - alpha)
  Modelica.Magnetic.QuasiStatic.FluxTubes.Basic.ElectroMagneticConverter measuringCoil(N=1)
  Modelica.Magnetic.QuasiStatic.FluxTubes.Basic.Ground magneticGround
  Modelica.Electrical.QuasiStatic.SinglePhase.Basic.Ground electricGround1
  Modelica.Electrical.QuasiStatic.SinglePhase.Sources.VariableCurrentSource currentSource(gamma(fixed=true, start=0))
  Modelica.Magnetic.QuasiStatic.FluxTubes.Sensors.MagneticFluxSensor magFluxSensor
  Modelica.Electrical.QuasiStatic.SinglePhase.Basic.Ground electricGround2
  Modelica.Electrical.QuasiStatic.SinglePhase.Sensors.VoltageSensor voltageSensor
  Blocks.Sources.Constant const(k=50)
  ComplexBlocks.Sources.ComplexRampPhasor complexRamp(
    magnitude1=0,
    magnitude2=I,
    phi=0,
    startTime=0.01,
    duration=0.015)
equation
  connect(excitingCoil.port_n, magFluxSensor.port_n)
  connect(magFluxSensor.port_p, magneticGround.port)
  connect(magneticGround.port, airGap.port_n)
  connect(excitingCoil.port_p, core.port_p)
  connect(currentSource.pin_n, excitingCoil.pin_p)
  connect(currentSource.pin_p, electricGround1.pin)
  connect(electricGround1.pin, excitingCoil.pin_n)
  connect(electricGround2.pin, voltageSensor.pin_n)
  connect(const.y, currentSource.f)
  connect(complexRamp.y, currentSource.I)
  connect(measuringCoil.pin_n, electricGround2.pin)
  connect(measuringCoil.pin_p, voltageSensor.pin_p)
  connect(core.port_n, measuringCoil.port_p)
  connect(airGap.port_p, measuringCoil.port_n)
end ToroidalCoreQuadraticCrossSection;


Magnetic circuit using different cuboid sections. This model investigates a magnetic circuit consisting of four different cuboid sections. The circuit is operated at 50Hz and variable magnetic potential difference.

within Modelica.Magnetic.QuasiStatic.FluxTubes.Examples.FixedShapes;
model CuboidSections "Magnetic circuit using different cuboid sections"
  extends Modelica.Icons.Example;
  parameter SI.RelativePermeability mu_rConst = 100
  "Relative permeability";
Basic.Ground ground
Sources.SignalMagneticPotentialDifference source(gamma(fixed=true, start=0))
  Shapes.FixedShape.Cuboid cuboidBottom(
    mu_rConst=mu_rConst,
    l=0.1,
    a=0.01,
    b=0.01)
  Shapes.FixedShape.Cuboid cuboidTop(
    mu_rConst=mu_rConst,
    a=0.01,
    l=0.1,
    b=0.01)
  Shapes.FixedShape.Cuboid cuboidRight(
    mu_rConst=mu_rConst,
    a=0.01,
    l=0.005,
    b=0.01)
  Shapes.FixedShape.Cuboid cuboidLeft(
    mu_rConst=mu_rConst,
    a=0.01,
    l=0.005,
    b=0.01)
  Modelica.Blocks.Sources.Constant constFrequency(k=50)
  Basic.Short short
  Basic.Idle idle
  Modelica.ComplexBlocks.Sources.ComplexRampPhasor complexRamp(
    magnitude2=0.0008,
    phi=0,
    duration=1,
    magnitude1=0)
equation
  connect(source.port_n, ground.port)
  connect(cuboidLeft.port_p, cuboidTop.port_p)
  connect(cuboidTop.port_n, cuboidRight.port_n)
  connect(cuboidBottom.port_p, source.port_p)
  connect(source.port_n, cuboidLeft.port_n)
  connect(constFrequency.y, source.f)
  connect(cuboidBottom.port_n, short.port_p)
  connect(short.port_n, cuboidRight.port_p)
  connect(idle.port_p, cuboidTop.port_n)
  connect(idle.port_n, short.port_n)
  connect(complexRamp.y, source.V_m)
end CuboidSections;


Magnetic circuit using different cylinder sections. This model tests different types of cylinder sections in one example. The circuit is operated at 50Hz and variable magnetic flux.

within Modelica.Magnetic.QuasiStatic.FluxTubes.Examples.FixedShapes;
model CylinderSections
"Magnetic circuit using different cylinder sections"
  extends Modelica.Icons.Example;
  parameter SI.RelativePermeability mu_rConst = 100
  "Relative permeability";
Shapes.FixedShape.HollowCylinderAxialFlux hollowCylinderAxialInner(
  l=0.01,
  r_o=0.02,
  r_i=0.01,
    mu_rConst=mu_rConst)
Shapes.FixedShape.HollowCylinderRadialFlux hollowCylinderRadiaLRight(
    mu_rConst=mu_rConst,
    l=0.02,
    r_i=0.015,
    r_o=0.055)
Shapes.FixedShape.HollowCylinderRadialFlux hollowCylinderRadialLeft(
    mu_rConst=mu_rConst,
    l=0.02,
    r_i=0.015,
    r_o=0.055)
Shapes.FixedShape.HollowCylinderAxialFlux hollowCylinderAxialOuter(
  l=0.01,
  r_i=0.05,
    mu_rConst=mu_rConst,
    r_o=0.06)
Basic.Ground ground
  Modelica.Blocks.Sources.Constant constFrequency(k=50)
Sources.SignalMagneticFlux source(gamma(fixed=true, start=0))
  Basic.Crossing crossing
  Modelica.ComplexBlocks.Sources.ComplexRampPhasor complexRamp(
    magnitude2=0.0008,
    phi=0,
    duration=1,
    magnitude1=0)
equation
connect(hollowCylinderAxialInner.port_n, hollowCylinderRadiaLRight.port_p)
connect(hollowCylinderRadiaLRight.port_n, hollowCylinderAxialOuter.port_p)
connect(hollowCylinderAxialOuter.port_n, hollowCylinderRadialLeft.port_p)
  connect(constFrequency.y, source.f)
  connect(hollowCylinderRadialLeft.port_n, ground.port)
  connect(source.port_p, crossing.port_p2)
  connect(source.port_n, crossing.port_n1)
  connect(crossing.port_n2, hollowCylinderAxialInner.port_p)
  connect(crossing.port_p1, ground.port)
  connect(complexRamp.y, source.Phi)
end CylinderSections;


within Modelica.Magnetic.QuasiStatic.FluxTubes.Examples;
package FixedShapes "Examples of fixed shape magnetic circuits"
extends Modelica.Icons.ExamplesPackage;
end FixedShapes;


Testing cylinder leakage models. Test of one source and cylindrical components with leakage and various sensors.

within Modelica.Magnetic.QuasiStatic.FluxTubes.Examples.Leakage;
model CylinderLeakage "Testing cylinder leakage models"
  extends Modelica.Icons.Example;
  import Modelica.Constants.pi;
  parameter SI.RelativePermeability mu_rConst = 100
  "Relative permeability";
  Shapes.Leakage.QuarterCylinder quarterCylinder1(l=2*pi*0.1)
  Shapes.FixedShape.HollowCylinderAxialFlux hollowCylinderAxialFlux1(
    r_i=0,
    r_o=0.04,
    l=0.1,
    mu_rConst=mu_rConst)
  Shapes.FixedShape.HollowCylinderAxialFlux hollowCylinderAxialFlux2(
    r_i=0,
    l=0.1,
    r_o=0.05,
    mu_rConst=mu_rConst)
  Shapes.Leakage.QuarterCylinder quarterCylinder2(l=2*pi*0.1)
  Sources.ConstantMagneticFlux constantSource(
    gamma(fixed=true, start=0), f=50, Phi=Complex(re=5E-3, im=0))
  Basic.Ground ground1
  Shapes.FixedShape.HollowCylinderAxialFlux hollowCylinderAxialAir1(
    r_i=0,
    r_o=0.04,
    l=0.01)
  Shapes.FixedShape.HollowCylinderAxialFlux hollowCylinderAxialAir2(
    r_i=0,
    r_o=0.04,
    l=0.01)
Sensors.MagneticPotentialSensor magneticPotentialSensor
Sensors.MagneticPotentialDifferenceSensor
  magneticPotentialDifferenceSensor
Sensors.MagneticFluxSensor magneticFluxSensor
Sensors.ReferenceSensor referenceSensor
Sensors.FrequencySensor frequencySensor
equation
  connect(quarterCylinder2.port_p, hollowCylinderAxialFlux2.port_n)
  connect(hollowCylinderAxialFlux2.port_p, quarterCylinder1.port_n)
  connect(quarterCylinder1.port_p, hollowCylinderAxialFlux1.port_n)
  connect(hollowCylinderAxialAir2.port_n, quarterCylinder2.port_n)
  connect(hollowCylinderAxialAir2.port_p, hollowCylinderAxialFlux2.port_n)
  connect(hollowCylinderAxialAir1.port_n, hollowCylinderAxialFlux2.port_p)
  connect(hollowCylinderAxialAir1.port_p, hollowCylinderAxialFlux1.port_n)
connect(ground1.port, constantSource.port_n)
connect(constantSource.port_p, hollowCylinderAxialFlux1.port_p)
connect(ground1.port, magneticPotentialDifferenceSensor.port_n)
connect(magneticPotentialDifferenceSensor.port_p,
  hollowCylinderAxialFlux1.port_p)
connect(hollowCylinderAxialFlux1.port_p, magneticPotentialSensor.port)
connect(magneticFluxSensor.port_n, ground1.port)
connect(magneticFluxSensor.port_p, quarterCylinder2.port_n)
connect(frequencySensor.port, hollowCylinderAxialFlux1.port_p)
connect(referenceSensor.port, hollowCylinderAxialFlux1.port_p)
end CylinderLeakage;


Magnetic circuit with generic leakage mode. Magnetic circuit with two reluctances, leakage reluctance,  and eddy current loss.

within Modelica.Magnetic.QuasiStatic.FluxTubes.Examples.Leakage;
model GeneralLeakage "Magnetic circuit with generic leakage mode"
  extends Modelica.Icons.Example;
  Basic.ConstantReluctance constantReluctance(R_m=1E-5)
  Basic.LeakageWithCoefficient leakageWithCoefficient(c_usefulFlux=0.7,
                                                      R_mUsefulTot=1E-5)
  Basic.EddyCurrent eddyCurrent(useConductance=true, G=10000)
  Sources.ConstantMagneticPotentialDifference constantSource(
    gamma(fixed=true, start=0), f=50, V_m(re=100, im=0))
  Basic.Ground ground
equation
  connect(constantReluctance.port_p, constantSource.port_p)
  connect(constantReluctance.port_n, eddyCurrent.port_p)
  connect(eddyCurrent.port_n, leakageWithCoefficient.port_p)
  connect(leakageWithCoefficient.port_n, constantSource.port_n)
  connect(ground.port, constantSource.port_n)
end GeneralLeakage;


within Modelica.Magnetic.QuasiStatic.FluxTubes.Examples;
package Leakage "Examples of magnetic circuits with leakage"
extends Modelica.Icons.ExamplesPackage;
end Leakage;


Icon for cuboid.

within Modelica.Magnetic.QuasiStatic.FluxTubes.Icons;
partial model Cuboid "Icon for cuboid"
end Cuboid;


Icon for cylinder with axial flux.

within Modelica.Magnetic.QuasiStatic.FluxTubes.Icons;
partial model HollowCylinderAxialFlux "Icon for cylinder with axial flux"
end HollowCylinderAxialFlux;


Icon for cylinder with circumferential flux.

within Modelica.Magnetic.QuasiStatic.FluxTubes.Icons;
partial model HollowCylinderCircumferentialFlux "Icon for cylinder with circumferential flux"
end HollowCylinderCircumferentialFlux;


Icon for cylinder with radial flux.

within Modelica.Magnetic.QuasiStatic.FluxTubes.Icons;
partial model HollowCylinderRadialFlux "Icon for cylinder with radial flux"
end HollowCylinderRadialFlux;


Icons for FluxTubes components

within Modelica.Magnetic.QuasiStatic.FluxTubes;
package Icons "Icons for FluxTubes components"
  extends Modelica.Icons.IconsPackage;

end Icons;


Icon for reluctance / permeance components.

within Modelica.Magnetic.QuasiStatic.FluxTubes.Icons;
partial model Reluctance "Icon for reluctance / permeance components"
end Reluctance;


Icon for toroid.

within Modelica.Magnetic.QuasiStatic.FluxTubes.Icons;
partial model Toroid "Icon for toroid"
end Toroid;


Partial potential sensor. The absolute sensor partial model provides a single
PositiveMagneticPort
to measure the complex magnetic potential. Additionally this model contains a base icon and a definition
of the angular frequency.

within Modelica.Magnetic.QuasiStatic.FluxTubes.Interfaces;
partial model AbsoluteSensor "Partial potential sensor"
  extends Modelica.Icons.RoundSensor;
  SI.AngularVelocity omega;
  FluxTubes.Interfaces.PositiveMagneticPort port "Quasi-static magnetic port"
equation
  omega = der(port.reference.gamma);
  port.Phi = Complex(0);
end AbsoluteSensor;


within Modelica.Magnetic.QuasiStatic.FluxTubes;
package Interfaces "Interfaces of magnetic network components"
  extends Modelica.Icons.InterfacesPackage;
end Interfaces;


Partial magnetic voltage or flux sensor. The relative sensor partial model relies on the
TwoPort
to measure the complex magnetic voltage, flux or power. Additionally this model contains a base icon and a definition
of the angular frequency.

within Modelica.Magnetic.QuasiStatic.FluxTubes.Interfaces;
partial model RelativeSensor "Partial magnetic voltage or flux sensor"
  extends Modelica.Icons.RoundSensor;
  extends TwoPort;
  Modelica.ComplexBlocks.Interfaces.ComplexOutput y
end RelativeSensor;


Partial magnetic voltage or flux source. The source model provides a positive and negative magnetic port. Additionally this model contains a base icon
and a definition of the angular frequency.

within Modelica.Magnetic.QuasiStatic.FluxTubes.Interfaces;
partial model Source "Partial magnetic voltage or flux source"
  FluxTubes.Interfaces.PositiveMagneticPort port_p "Positive magnetic port"
  FluxTubes.Interfaces.NegativeMagneticPort port_n "Negative magnetic port"

  SI.AngularVelocity omega;
  SI.Angle gamma(start=0) = port_p.reference.gamma;
equation
  Connections.root(port_p.reference);
  Connections.branch(port_p.reference, port_n.reference);
  port_p.reference.gamma = port_n.reference.gamma;
  omega = der(port_p.reference.gamma);
end Source;


Two magnetic ports for textual modeling. It is assumed that the magnetic flux flowing into port_p
is identical to the flux flowing out of port_n.

within Modelica.Magnetic.QuasiStatic.FluxTubes.Interfaces;
partial model TwoPort "Two magnetic ports for textual modeling"
  extends TwoPortElementary;

equation
  Complex(0) = port_p.Phi + port_n.Phi;
end TwoPort;


Two magnetic ports for graphical modeling. Partial model of a flux tube component with two magnetic ports:
the positive port connector port_p, and the negative port
connector port_n. The total magnetic potential difference
V_m and the flux flowing into the positive port,
Phi are also defined in this model.

within Modelica.Magnetic.QuasiStatic.FluxTubes.Interfaces;
partial model TwoPortElementary "Two magnetic ports for graphical modeling"

  FluxTubes.Interfaces.PositiveMagneticPort port_p "Positive quasi-static magnetic port"
  FluxTubes.Interfaces.NegativeMagneticPort port_n "Negative quasi-static magnetic port"
  SI.ComplexMagneticPotentialDifference V_m
  "Magnetic potential difference of both ports";
  SI.MagneticPotentialDifference abs_V_m = Modelica.ComplexMath.abs(V_m)
  "Magnitude of complex magnetic potential difference";
  SI.Angle arg_V_m=Modelica.ComplexMath.arg(V_m)
  "Argument of complex magnetic potential difference";
  SI.ComplexMagneticFlux Phi(re(start=0),im(start=0))
  "Magnetic flux from port_p to port_n";
  SI.MagneticFlux abs_Phi=
      Modelica.ComplexMath.abs(Phi) "Magnitude of complex magnetic flux";
  SI.Angle arg_Phi=Modelica.ComplexMath.arg(Phi)
  "Argument of complex magnetic flux";
  SI.AngularVelocity omega;
equation
  Connections.branch(port_p.reference, port_n.reference);
  port_p.reference.gamma = port_n.reference.gamma;
  omega = der(port_p.reference.gamma);

  V_m = port_p.V_m - port_n.V_m;
  Phi = port_p.Phi;
end TwoPortElementary;


Frequency sensor. This sensor can be used to measure the frequency of the reference system.
The integral of the angular frequency of the quasi-static magnetic system is equal to the reference angle.

within Modelica.Magnetic.QuasiStatic.FluxTubes.Sensors;
model FrequencySensor "Frequency sensor"
  extends FluxTubes.Interfaces.AbsoluteSensor;
  import Modelica.Constants.pi;
  Modelica.Blocks.Interfaces.RealOutput y(unit="Hz")
equation
  2*pi*y = omega;
end FrequencySensor;


Sensor to measure magnetic flux. This sensor can be used to measure the complex magnetic flux Phi of a quasi-static magnetic system.

within Modelica.Magnetic.QuasiStatic.FluxTubes.Sensors;
model MagneticFluxSensor "Sensor to measure magnetic flux"
  extends FluxTubes.Interfaces.RelativeSensor;

equation
  V_m = Complex(0);
  y = Phi;
end MagneticFluxSensor;


Sensor to measure magnetic potential difference. This sensor can be used to measure the complex magnetic potential difference V_m
in a quasi-static magnetic system.

within Modelica.Magnetic.QuasiStatic.FluxTubes.Sensors;
model MagneticPotentialDifferenceSensor
"Sensor to measure magnetic potential difference"
  extends FluxTubes.Interfaces.RelativeSensor;

equation
  Phi = Complex(0);
  y = V_m;
end MagneticPotentialDifferenceSensor;


Potential sensor. This sensor can be used to measure the complex magnetic potential V_m in a quasi-static magnetic system.

within Modelica.Magnetic.QuasiStatic.FluxTubes.Sensors;
model MagneticPotentialSensor "Potential sensor"
  extends FluxTubes.Interfaces.AbsoluteSensor;
  Modelica.ComplexBlocks.Interfaces.ComplexOutput y
equation
  y = port.V_m;
end MagneticPotentialSensor;


within Modelica.Magnetic.QuasiStatic.FluxTubes;
package Sensors "Sensors to measure variables in magnetic networks"
  extends Modelica.Icons.SensorsPackage;
end Sensors;


Sensor of reference angle gamma. This sensor determines the reference angle of the connected quasi-static magnetic system.
The integral of the angular frequency of the quasi-static magnetic system is equal to the reference angle.

within Modelica.Magnetic.QuasiStatic.FluxTubes.Sensors;
model ReferenceSensor "Sensor of reference angle gamma"
  extends FluxTubes.Interfaces.AbsoluteSensor;
  Modelica.Blocks.Interfaces.RealOutput y(unit="rad") "Reference angle"
equation
  y = port.reference.gamma;
end ReferenceSensor;


Sensor of fundamental wave permeability. This sensor is used to determined the effective fundamental wave permeability of a saturated lumped circuit reluctance. For this purpose the sensor is placed such way that the magnetic flux and the magnetic potential difference of the investigated reluctance are sensed. The area of cross section and the effective length of the investigated magnetic path have to be provided as parameters.

within Modelica.Magnetic.QuasiStatic.FluxTubes.Sensors.Transient;
model FundamentalWavePermabilitySensor
"Sensor of fundamental wave permeability"
  extends Modelica.Icons.RoundSensor;
  parameter SI.Frequency f "Fundamental wave frequency";
  parameter SI.Area A "Area of cross section";
  parameter SI.Length l "Length";

  Magnetic.FluxTubes.Interfaces.PositiveMagneticPort fluxP
    "Positive port of flux path"
  Magnetic.FluxTubes.Interfaces.NegativeMagneticPort fluxN
    "Negative port of flux path"
  Magnetic.FluxTubes.Interfaces.PositiveMagneticPort potentialP
    "Positive port of magnetic potential difference path"
  Magnetic.FluxTubes.Interfaces.NegativeMagneticPort potentialN
    "Negative port of magnetic potential difference path"
  Magnetic.FluxTubes.Sensors.MagneticPotentialDifferenceSensor magneticPotentialDifferenceSensor
  Magnetic.FluxTubes.Sensors.MagneticFluxSensor magneticFluxSensor
  Modelica.Blocks.Math.Harmonic harmonicPotential(
    final f=f,
    final k=1,
    final x0Cos=0,
    final x0Sin=0) "Fundamental wave of magnetic potential difference"
  Modelica.Blocks.Math.Harmonic harmonicFlux(
    final f=f,
    final k=1,
    final x0Cos=0,
    final x0Sin=0) "Fundamental wave of magnetic flux"
  Modelica.Blocks.Interfaces.RealOutput mu(unit="H/m") "Absolute permeability"
  Modelica.Blocks.Interfaces.RealOutput mur(unit="1") "Relative permeability"
  Permeability permeability(final A=A, final l=l)
  "Determines relative and absolute permeability"
equation
  connect(magneticPotentialDifferenceSensor.port_n,
    potentialN)
  connect(magneticPotentialDifferenceSensor.port_p,
    potentialP)
  connect(magneticFluxSensor.port_p, fluxP)
  connect(magneticFluxSensor.port_n, fluxN)
  connect(harmonicFlux.u, magneticFluxSensor.Phi)
  connect(magneticPotentialDifferenceSensor.V_m,
    harmonicPotential.u)
  connect(permeability.V_m, harmonicPotential.y_rms)
  connect(permeability.Phi, harmonicFlux.y_rms)
  connect(permeability.mur, mur)
  connect(permeability.mu, mu)
end FundamentalWavePermabilitySensor;


Transient fundamental wave sensors

within Modelica.Magnetic.QuasiStatic.FluxTubes.Sensors;
package Transient "Transient fundamental wave sensors"
  extends Modelica.Icons.SensorsPackage;
end Transient;


Determines permeability from flux and magnetic potential difference. This model determines the absolute and relative permeability from two real inputs:

within Modelica.Magnetic.QuasiStatic.FluxTubes.Sensors.Transient;
model Permeability
"Determines permeability from flux and magnetic potential difference"

  parameter SI.Area A
  "Area of cross section penetrated by flux";
  parameter SI.Length l
  "Length associated with magnetic potential difference";

  Modelica.Blocks.Interfaces.RealInput Phi(unit="Wb") "Magnetic flux"
  Modelica.Blocks.Interfaces.RealInput V_m(unit="A")
  "Magnetic potential difference"
  Modelica.Blocks.Interfaces.RealOutput mu(unit="H/m") "Absolute permeability"
  Modelica.Blocks.Interfaces.RealOutput mur(unit="1") "Relative permeability"

equation
  if noEvent(abs(V_m) < Modelica.Constants.eps) then
     mu = 0;
     mur = 0;
  else
     mu =Phi /V_m*l/A;
     mur = mu/Modelica.Constants.mu_0;
  end if;
end Permeability;


within Modelica.Magnetic.QuasiStatic.FluxTubes;
package Shapes "Reluctance and permeance elements respectively based on geometric shapes"
  extends Modelica.Icons.Package;
end Shapes;


Flux tube with rectangular cross-section of fixed shape and linear material characteristics. The cuboid models the reluctance with rectangular dimensions a and b, and length, l
the magnetic reluctance by:

within Modelica.Magnetic.QuasiStatic.FluxTubes.Shapes.FixedShape;
model Cuboid
"Flux tube with rectangular cross-section of fixed shape and linear material characteristics"

  extends BaseClasses.FixedShape;
  extends Modelica.Magnetic.QuasiStatic.FluxTubes.Icons.Cuboid;

  parameter SI.Length l=0.01 "Length in direction of flux"
  parameter SI.Length a=0.01 "Width of rectangular cross-section"
  parameter SI.Length b=0.01 "Height of rectangular cross-section"

equation
  A = a*b;
  G_m = mu_0*mu_r*A/l;
end Cuboid;


Flux tube with fixed cross-section, fixed length and linear material characteristics. The generic flux tube models the reluctance with constant
area of cross section, and length, l
the magnetic reluctance by:

within Modelica.Magnetic.QuasiStatic.FluxTubes.Shapes.FixedShape;
model GenericFluxTube
"Flux tube with fixed cross-section, fixed length and linear material characteristics"

  extends BaseClasses.FixedShape;
  extends Modelica.Magnetic.QuasiStatic.FluxTubes.Icons.Reluctance;

  parameter SI.Length l=0.01 "Length in direction of flux"
  parameter SI.CrossSection area=0.0001 "Area of cross section"
equation
  A=area;
  G_m = mu_0*mu_r*A/l;
end GenericFluxTube;


(Hollow) cylinder with axial flux of fixed shape and linear material characteristics. The axial cylinder models is characterized by the outer diameter, , the inner diameter, , length, . The magnetic reluctance is determined by:

within Modelica.Magnetic.QuasiStatic.FluxTubes.Shapes.FixedShape;
model HollowCylinderAxialFlux
"(Hollow) cylinder with axial flux of fixed shape and linear material characteristics"

  extends BaseClasses.FixedShape;
  extends Modelica.Magnetic.QuasiStatic.FluxTubes.Icons.HollowCylinderAxialFlux;

  parameter SI.Length l=0.01 "Axial length (in direction of flux)"
  parameter SI.Radius r_i=0
  "Inner radius of hollow cylinder (zero for cylinder)"
  parameter SI.Radius r_o=0.01 "Outer radius of (hollow) cylinder"
  parameter SI.Angle alpha=2*pi "Central angle"
equation
  A = (r_o^2 - r_i^2)*alpha/2;
  G_m = mu_0*mu_r*A/l;
end HollowCylinderAxialFlux;


within Modelica.Magnetic.QuasiStatic.FluxTubes.Shapes.FixedShape;
model HollowCylinderCircumferentialFlux "Hollow cylinder with circumferential flux; fixed shape"

  extends Modelica.Magnetic.QuasiStatic.FluxTubes.BaseClasses.FixedShape;
  extends Modelica.Magnetic.QuasiStatic.FluxTubes.Icons.HollowCylinderCircumferentialFlux;
  import Modelica.Constants.pi;
  parameter SI.Length l=0.02 "Width (orthogonal to flux direction)"
  parameter SI.Radius r_i=0.01 "Inner radius of hollow cylinder"
  parameter SI.Radius r_o=0.02 "Outer radius of hollow cylinder"
  parameter SI.Angle alpha=pi/2 "Angle of cylinder section"
equation
  A = (r_o - r_i)*l;
  G_m = mu_0*mu_r*A/((r_o + r_i)/2*alpha);
end HollowCylinderCircumferentialFlux;


Hollow cylinder with radial flux of fixed shape and linear material characteristics. The radial cylinder model is characterized by the outer diameter, , the inner diameter, , length, , and the angle . The magnetic reluctance is determined by:

within Modelica.Magnetic.QuasiStatic.FluxTubes.Shapes.FixedShape;
model HollowCylinderRadialFlux
"Hollow cylinder with radial flux of fixed shape and linear material characteristics"

  extends BaseClasses.FixedShape;
  extends Modelica.Magnetic.QuasiStatic.FluxTubes.Icons.HollowCylinderRadialFlux;

  parameter SI.Length l=0.01 "Width (orthogonal to flux direction)"
  parameter SI.Radius r_i=0.01 "Inner radius of hollow cylinder"
  parameter SI.Radius r_o=0.02 "Outer radius of hollow cylinder"
  parameter SI.Angle alpha=2*pi "Central angle";
equation
  A = l*alpha*(r_o + r_i)/2;
  // Area at arithmetic mean radius for calculation of average flux density
  G_m = mu_0*mu_r*alpha*l/Modelica.Math.log(r_o/r_i);
end HollowCylinderRadialFlux;


within Modelica.Magnetic.QuasiStatic.FluxTubes.Shapes;
package FixedShape "Flux tubes with fixed shape during simulation and linear material characteristics"
  extends Modelica.Icons.VariantsPackage;
end FixedShape;


within Modelica.Magnetic.QuasiStatic.FluxTubes.Shapes.FixedShape;
model Toroid "Toroid with circular cross section; fixed shape"

  extends Modelica.Magnetic.QuasiStatic.FluxTubes.BaseClasses.FixedShape;
  extends Modelica.Magnetic.QuasiStatic.FluxTubes.Icons.Toroid;
  import Modelica.Constants.pi;
  parameter SI.Radius r=0.1 "Radius of toroid (middle)"
  parameter SI.Radius d=0.01 "Diameter of cylindrical core"
  parameter SI.Angle alpha=pi/2 "Angle of toroid section"
equation
  A = d^2*pi/4 "Area at arithmetic mean radius for calculation of average flux density";
  G_m = mu_0*mu_r*A/(r*alpha);
end Toroid;


Leakage flux between the end planes of a inner solid cylinder and a coaxial outer hollow cylinder. In
[Ro41]
the equations for determining the reluctance

are summarized. As an alternative to the geometry based data a
generic leakage model is provided in this library.

within Modelica.Magnetic.QuasiStatic.FluxTubes.Shapes.Leakage;
model CoaxCylindersEndFaces
"Leakage flux between the end planes of a inner solid cylinder and a coaxial outer hollow cylinder"

  extends BaseClasses.Leakage;

  parameter SI.Radius r_0=10e-3 "Radius of inner solid cylinder"
  parameter SI.Radius r_1=17e-3 "Inner radius of outer hollow cylinder";
  parameter SI.Radius r_2=20e-3 "Outer radius of outer hollow cylinder";

  final parameter SI.Distance l_g=r_1 - r_0
  "Radial gap length between both cylinders";
  final parameter SI.Length t=r_2 - r_1
  "Radial thickness of outer hollow cylinder";

equation
  // [Ro41], p. 139, Eq. (22)
  G_m = if t <= r_0 then 2*mu_0*(r_0 + l_g/2)*Modelica.Math.log(1 + 2*t/
    l_g) else 2*mu_0*(r_0 + l_g/2)*Modelica.Math.log(1 + 2*r_0/l_g);
end CoaxCylindersEndFaces;


Leakage flux through one edge and the opposite plane of an eighth of a hollow sphere. In
[Ro41]
the equations for determining the reluctance

are summarized. As an alternative to the geometry based data a
generic leakage model is provided in this library.

within Modelica.Magnetic.QuasiStatic.FluxTubes.Shapes.Leakage;
model EighthOfHollowSphere
"Leakage flux through one edge and the opposite plane of an eighth of a hollow sphere"

  extends BaseClasses.Leakage;

  parameter SI.Length t(start=0.01) "Thickness of spherical shell"

equation
  G_m = mu_0*0.5*t;
end EighthOfHollowSphere;


Leakage flux through one edge and the opposite plane of an eighth of a sphere. In
[Ro41]
the equations for determining the reluctance

are summarized. As an alternative to the geometry based data a
generic leakage model is provided in this library.

within Modelica.Magnetic.QuasiStatic.FluxTubes.Shapes.Leakage;
model EighthOfSphere
"Leakage flux through one edge and the opposite plane of an eighth of a sphere"

  extends BaseClasses.Leakage;

  parameter SI.Radius r=0.01 "Radius of eighth of sphere"

equation
  G_m = mu_0*0.308*r;
end EighthOfSphere;


Leakage flux through the edges of a half cylinder. In
[Ro41]
the equations for determining the reluctance

are summarized. As an alternative to the geometry based data a
generic leakage model is provided in this library.

within Modelica.Magnetic.QuasiStatic.FluxTubes.Shapes.Leakage;
model HalfCylinder "Leakage flux through the edges of a half cylinder"

  extends BaseClasses.Leakage;

  parameter SI.Length l=0.1
  "Axial length orthogonal to flux (=2*pi*r for cylindrical pole and r>>distance between edges)"

equation
  G_m = mu_0*0.26*l;
end HalfCylinder;


Leakage flux in circumferential direction through a half hollow cylinder. In
[Ro41]
the equations for determining the reluctance

are summarized. As an alternative to the geometry based data a
generic leakage model is provided in this library.

within Modelica.Magnetic.QuasiStatic.FluxTubes.Shapes.Leakage;
model HalfHollowCylinder
"Leakage flux in circumferential direction through a half hollow cylinder"

  extends BaseClasses.Leakage;

  parameter SI.Length l=0.1
  "Axial length orthogonal to flux (=2*pi*r for cylindrical pole and r>>r_i)"
  parameter Real ratio(start=1) "Constant ratio t/r_i";

equation
  G_m = mu_0*l*Modelica.Math.log(1 + ratio)/pi;
end HalfHollowCylinder;


within Modelica.Magnetic.QuasiStatic.FluxTubes.Shapes;
package Leakage "Leakage flux tubes with position-independent permeance and hence no force generation; mu_r=1"
  extends Modelica.Icons.VariantsPackage;
end Leakage;


Leakage flux from one edge to the opposite plane through a quarter cylinder. In
[Ro41]
the equations for determining the reluctance

are summarized. As an alternative to the geometry based data a
generic leakage model is provided in this library.

within Modelica.Magnetic.QuasiStatic.FluxTubes.Shapes.Leakage;
model QuarterCylinder
"Leakage flux from one edge to the opposite plane through a quarter cylinder"

  extends BaseClasses.Leakage;

  parameter SI.Length l=0.1
  "Axial length orthogonal to flux (=2*pi*r for cylindrical pole and r>>distance between edge and plane)"
equation
  G_m = mu_0*0.52*l;
end QuarterCylinder;


Leakage flux in circumferential direction through a quarter hollow cylinder. In
[Ro41]
the equations for determining the reluctance

are summarized. As an alternative to the geometry based data a
generic leakage model is provided in this library.

within Modelica.Magnetic.QuasiStatic.FluxTubes.Shapes.Leakage;
model QuarterHollowCylinder
"Leakage flux in circumferential direction through a quarter hollow cylinder"

  extends BaseClasses.Leakage;

  parameter SI.Length l=0.1
  "Axial length orthogonal to flux (=2*pi*r for cylindrical pole and r>>r_i)"
  parameter Real ratio(start=1) "Constant ratio t/r_i";

equation
  G_m = 2*mu_0*l*Modelica.Math.log(1 + ratio)/pi;
end QuarterHollowCylinder;


Leakage flux through the edges of a quarter hollow sphere. In
[Ro41]
the equations for determining the reluctance

are summarized. As an alternative to the geometry based data a
generic leakage model is provided in this library.

within Modelica.Magnetic.QuasiStatic.FluxTubes.Shapes.Leakage;
model QuarterHollowSphere
"Leakage flux through the edges of a quarter hollow sphere"

  extends BaseClasses.Leakage;

  parameter SI.Length t(start=0.01) "Thickness of spherical shell"

equation
  G_m = mu_0*0.25*t;
end QuarterHollowSphere;


Leakage flux through the corners of a quarter sphere. In
[Ro41]
the equations for determining the reluctance

are summarized. As an alternative to the geometry based data a
generic leakage model is provided in this library.

within Modelica.Magnetic.QuasiStatic.FluxTubes.Shapes.Leakage;
model QuarterSphere
"Leakage flux through the corners of a quarter sphere"

  extends BaseClasses.Leakage;

  parameter SI.Radius r=0.005 "Radius of quarter sphere"

equation
  G_m = mu_0*0.077*2*r;
end QuarterSphere;


Source of constant magnetic flux. This source provides a constant quasi-static magnetic flux Phi at fixed frequency, f.

within Modelica.Magnetic.QuasiStatic.FluxTubes.Sources;
model ConstantMagneticFlux "Source of constant magnetic flux"

  extends FluxTubes.Interfaces.Source;
  parameter SI.Frequency f(start=1) "Frequency of the source";
  SI.ComplexMagneticPotentialDifference V_m
  "Magnetic potential difference between both ports";
  parameter SI.ComplexMagneticFlux Phi=Complex(1,0)
  "Magnetic flux";

equation
  omega = 2*Modelica.Constants.pi*f;
  V_m = port_p.V_m - port_n.V_m;
  Complex(0) = port_p.Phi + port_n.Phi;
  Phi = port_p.Phi;
end ConstantMagneticFlux;


Constant magnetomotive force. This source provides a constant quasi-static magnetic potential difference V_m (or magnetomotive force, mmf),
at fixed frequency, f.

within Modelica.Magnetic.QuasiStatic.FluxTubes.Sources;
model ConstantMagneticPotentialDifference "Constant magnetomotive force"

  extends FluxTubes.Interfaces.Source;
  parameter SI.Frequency f(start=1) "Frequency of the source";
  parameter SI.ComplexMagneticPotentialDifference V_m
  "Magnetic potential difference";
  SI.ComplexMagneticFlux Phi(re(start=0),im(start=0))
  "Magnetic flux from port_p to port_n";

equation
  omega = 2*Modelica.Constants.pi*f;
  V_m = port_p.V_m - port_n.V_m;
  Complex(0) = port_p.Phi + port_n.Phi;
  Phi = port_p.Phi;
end ConstantMagneticPotentialDifference;


within Modelica.Magnetic.QuasiStatic.FluxTubes;
package Sources "Sources of different complexity of magnetomotive force and magnetic flux"
  extends Modelica.Icons.SourcesPackage;
end Sources;


Signal-controlled magnetic flux source. This source provides a quasi-static magnetic flux with inputs for:

within Modelica.Magnetic.QuasiStatic.FluxTubes.Sources;
model SignalMagneticFlux "Signal-controlled magnetic flux source"

  extends FluxTubes.Interfaces.Source;
  Modelica.Blocks.Interfaces.RealInput f(unit="Hz")
  SI.ComplexMagneticPotentialDifference V_m
  "Magnetic potential difference between both ports";
  Modelica.ComplexBlocks.Interfaces.ComplexInput Phi

equation
  omega = 2*Modelica.Constants.pi*f;
  V_m = port_p.V_m - port_n.V_m;
  Complex(0) = port_p.Phi + port_n.Phi;
  Phi = port_p.Phi;
end SignalMagneticFlux;


Signal-controlled magnetomotive force. This source provides a quasi-static magnetic potential difference V_m (or magnetomotive force, mmf)
with signal inputs for:

within Modelica.Magnetic.QuasiStatic.FluxTubes.Sources;
model SignalMagneticPotentialDifference
"Signal-controlled magnetomotive force"

  extends FluxTubes.Interfaces.Source;
  Modelica.Blocks.Interfaces.RealInput f(unit="Hz")
  Modelica.ComplexBlocks.Interfaces.ComplexInput V_m
  SI.ComplexMagneticFlux Phi(re(start=0),im(start=0))
  "Magnetic flux from port_p to port_n";
equation
  omega = 2*Modelica.Constants.pi*f;
  V_m = port_p.V_m - port_n.V_m;
  Complex(0) = port_p.Phi + port_n.Phi;
  Phi = port_p.Phi;
end SignalMagneticPotentialDifference;


within Modelica.Magnetic.QuasiStatic;
package FundamentalWave "Quasi-static fundamental wave electric machines"
  extends Modelica.Icons.Package;
end FundamentalWave;