Base model of machines. This partial model for induction machines contains elements common in all machine models.

within Modelica.Magnetic.FundamentalWave.BaseClasses;
partial model Machine "Base model of machines"
  constant SI.Angle pi = Modelica.Constants.pi;
  extends Modelica.Electrical.Machines.Icons.FundamentalWaveMachine;
  parameter Integer m(min=3) = 3 "Number of stator phases"
  // Mechanical parameters
  parameter SI.Inertia Jr(start=0.29) "Rotor inertia";
  parameter Boolean useSupport=false
    "Enable / disable (=fixed stator) support"
  parameter SI.Inertia Js(start=Jr) "Stator inertia"
  parameter Boolean useThermalPort=false
    "Enable / disable (=fixed temperatures) thermal port"
  parameter Integer p(min=1, start=2) "Number of pole pairs (Integer)";
  parameter SI.Frequency fsNominal(start=50)
    "Nominal frequency";
  parameter SI.Temperature TsOperational(start=293.15)
    "Operational temperature of stator resistance"
  parameter SI.Resistance Rs(start=ZsRef*0.03)
    "Stator resistance per phase at TRef"
  parameter SI.Temperature TsRef(start=293.15)
    "Reference temperature of stator resistance"
  parameter
    Modelica.Electrical.Machines.Thermal.LinearTemperatureCoefficient20
    alpha20s(start=0)
    "Temperature coefficient of stator resistance at 20 degC"
  parameter Real effectiveStatorTurns=1 "Effective number of stator turns";
  parameter SI.Inductance Lssigma(start=3*ZsRef*(1 - sqrt(1 -
        0.0667))/(2*pi*fsNominal)) "Stator stray inductance"
  parameter Real ratioCommonStatorLeakage(final min=0, final max=1)=1
    "Ratio of common stray inductance / total stray inductance of stator winding"
  parameter SI.Inductance Lszero=Lssigma
    "Stator zero inductance"
  parameter Magnetic.FundamentalWave.Types.SalientInductance L0(d(start=1), q(
        start=1)) "Salient inductance of an unchorded coil"
  parameter Modelica.Electrical.Machines.Losses.FrictionParameters
    frictionParameters(wRef=2*pi*fsNominal/p)
    "Friction loss parameter record"
  parameter Modelica.Electrical.Machines.Losses.CoreParameters
    statorCoreParameters(
    m=m,
    wRef=2*pi*fsNominal/p,
    VRef(start=100))
    "Stator core loss parameter record; all parameters refer to stator side"
  parameter Modelica.Electrical.Machines.Losses.StrayLoadParameters
    strayLoadParameters(IRef(start=100), wRef=2*pi*fsNominal/p)
    "Stray load loss parameter record"
  // Mechanical quantities
  output SI.Angle phiMechanical(start=0) = flange.phi -
    internalSupport.phi "Mechanical angle of rotor against stator";
  output SI.AngularVelocity wMechanical(
    start=0,
    displayUnit="rev/min") = der(phiMechanical)
    "Mechanical angular velocity of rotor against stator";
  output SI.Torque tauElectrical=inertiaRotor.flange_a.tau
    "Electromagnetic torque";
  output SI.Torque tauShaft=-flange.tau "Shaft torque";
  replaceable output
    Modelica.Electrical.Machines.Interfaces.InductionMachines.PartialPowerBalanceInductionMachines
    powerBalance(
    final powerStator=Modelica.Electrical.Polyphase.Functions.activePower(
        vs, is),
    final powerMechanical=wMechanical*tauShaft,
    final powerInertiaStator=inertiaStator.J*inertiaStator.a*inertiaStator.w,
    final powerInertiaRotor=inertiaRotor.J*inertiaRotor.a*inertiaRotor.w,
    final lossPowerStatorWinding=sum(stator.resistor.resistor.LossPower),
    final lossPowerStatorCore=stator.core.lossPower,
    final lossPowerStrayLoad=strayLoad.lossPower,
    final lossPowerFriction=friction.lossPower) "Power balance";

  // Stator voltages and currents
  output SI.Voltage vs[m]=plug_sp.pin.v - plug_sn.pin.v
    "Stator instantaneous voltages";
  output SI.Current is[m]=plug_sp.pin.i
    "Stator instantaneous currents";
  Modelica.Mechanics.Rotational.Interfaces.Flange_a flange "Shaft"
  Modelica.Mechanics.Rotational.Components.Inertia inertiaRotor(final J=Jr)
  Modelica.Mechanics.Rotational.Interfaces.Flange_a support if useSupport
    "Support at which the reaction torque is acting"
  Modelica.Mechanics.Rotational.Components.Inertia inertiaStator(final J=Js)
  Modelica.Mechanics.Rotational.Components.Fixed fixed if (not useSupport)
  Modelica.Electrical.Polyphase.Interfaces.PositivePlug plug_sp(final m=m)
    "Positive plug of stator"
  Modelica.Electrical.Polyphase.Interfaces.NegativePlug plug_sn(final m=m)
    "Negative plug of stator"
  BasicMachines.Components.SymmetricPolyphaseWinding stator(
    final useHeatPort=true,
    final m=m,
    final RRef=Rs,
    final TRef=TsRef,
    final Lsigma=Lssigma,
    final ratioCommonLeakage=ratioCommonStatorLeakage,
    final effectiveTurns=effectiveStatorTurns,
    final TOperational=TsOperational,
    final GcRef=statorCoreParameters.GcRef,
    final alpha20=alpha20s,
    final Lzero=Lszero)
    "Symmetric stator winding including resistances, zero and stray inductances and core losses"
  replaceable
    Modelica.Electrical.Machines.Interfaces.InductionMachines.PartialThermalAmbientInductionMachines
    thermalAmbient(
    final useTemperatureInputs=false,
    final Ts=TsOperational,
    final m=m) if not useThermalPort
  replaceable
    Modelica.Electrical.Machines.Interfaces.InductionMachines.PartialThermalPortInductionMachines
    thermalPort(final m=m) if useThermalPort
    "Thermal port of induction machines"
  Magnetic.FundamentalWave.Components.Ground groundS
    "Ground of stator magnetic circuit"
  Magnetic.FundamentalWave.BasicMachines.Components.RotorSaliencyAirGap airGap(final p=p,
      final L0=L0)
  Magnetic.FundamentalWave.Components.Ground groundR
    "Ground of rotor magnetic circuit"
  /* previously used: state selection, now commented
  FundamentalWave.Interfaces.StateSelector stateSelectorS(
    final m=m,
    final xi=is,
    final gamma=p*phiMechanical) "State selection of stator currents"
  */
  Modelica.Electrical.Machines.Losses.InductionMachines.StrayLoad strayLoad(
    final strayLoadParameters=strayLoadParameters,
    final useHeatPort=true,
    final m=m)
  Modelica.Electrical.Machines.Losses.Friction friction(final
      frictionParameters=frictionParameters, final useHeatPort=true)
protected
  replaceable
    Modelica.Electrical.Machines.Interfaces.InductionMachines.PartialThermalPortInductionMachines
    internalThermalPort(final m=m)
  Modelica.Mechanics.Rotational.Interfaces.Support internalSupport
  final parameter SI.Impedance ZsRef = 1 "Reference phase impedance based on nominal voltage 100 V and nominal current 100 A; per phase";
initial algorithm
  assert(not Modelica.Math.isPowerOf2(m), String(m) +
    " phases are currently not supported in this version of FundametalWave");

equation
  connect(stator.plug_n, plug_sn)
  connect(inertiaRotor.flange_b, flange)
  connect(internalSupport, inertiaStator.flange_a)
  connect(internalSupport, fixed.flange)
  connect(inertiaStator.flange_b, support)
  connect(airGap.flange_a, inertiaRotor.flange_a)
  connect(airGap.support, internalSupport)
  connect(groundR.port_p, airGap.port_rn)
  connect(stator.plug_p, strayLoad.plug_n)
  connect(plug_sp, strayLoad.plug_p)
  connect(strayLoad.support, internalSupport)
  connect(strayLoad.heatPort, internalThermalPort.heatPortStrayLoad)
  connect(friction.support, internalSupport)
  connect(strayLoad.flange, inertiaRotor.flange_b)
  connect(friction.flange, inertiaRotor.flange_b)
  connect(friction.heatPort, internalThermalPort.heatPortFriction)
  connect(groundS.port_p, airGap.port_sp)
  connect(stator.port_n, airGap.port_sp)
  connect(stator.port_p, airGap.port_sn)
  connect(stator.heatPortWinding, internalThermalPort.heatPortStatorWinding)
  connect(stator.heatPortCore, internalThermalPort.heatPortStatorCore)
  connect(thermalAmbient.thermalPort, internalThermalPort)
  connect(internalThermalPort, thermalPort)
end Machine;


within Modelica.Magnetic.FundamentalWave;
package BaseClasses "Base classes of fundamental wave machines"
  extends Modelica.Icons.BasesPackage;
end BaseClasses;


Basic machine components and models

within Modelica.Magnetic.FundamentalWave;
package BasicMachines "Basic machine components and models"
  extends Modelica.Icons.Package;
end BasicMachines;


within Modelica.Magnetic.FundamentalWave.BasicMachines;
package Components "Components specially for electric machines"
  extends Modelica.Icons.Package;
end Components;


Permanent magnet represented by magnetic potential difference. Simple model of a permanent magnet, containing:

within Modelica.Magnetic.FundamentalWave.BasicMachines.Components;
model PermanentMagnet
  "Permanent magnet represented by magnetic potential difference"
  extends Magnetic.FundamentalWave.Sources.ConstantMagneticPotentialDifference;
  extends
    Modelica.Electrical.Machines.Losses.InductionMachines.PermanentMagnetLosses;
end PermanentMagnet;


Air gap model with rotor saliency. This salient air gap model can be used for machines with uniform air gaps and for machines with rotor saliency. The air gap model is not symmetrical towards stator and rotor since it is assumed the saliency always refers to the rotor. The saliency of the air gap is represented by a main field inductance in the d- and q-axis.

within Modelica.Magnetic.FundamentalWave.BasicMachines.Components;
model RotorSaliencyAirGap "Air gap model with rotor saliency"
  import Modelica.Constants.pi;
  Interfaces.PositiveMagneticPort port_sp
    "Positive complex magnetic stator port"
  Interfaces.NegativeMagneticPort port_sn
    "Negative complex magnetic stator port"
  Interfaces.PositiveMagneticPort port_rp
    "Positive complex magnetic rotor port"
  Interfaces.NegativeMagneticPort port_rn
    "Negative complex magnetic rotor port"
  Modelica.Mechanics.Rotational.Interfaces.Flange_a flange_a
    "Flange of the rotor"
  Modelica.Mechanics.Rotational.Interfaces.Flange_a support
    "Support at which the reaction torque is acting"
  parameter Integer p "Number of pole pairs";
  parameter Magnetic.FundamentalWave.Types.SalientInductance L0(d(start=1), q(
        start=1))
    "Salient inductance of a single unchorded coil w.r.t. the fundamental wave";
  final parameter Magnetic.FundamentalWave.Types.SalientReluctance R_m(d=1/L0.d,
      q=1/L0.q) "Reluctance of the air gap model";
  // Complex phasors of magnetic potential differences
  SI.ComplexMagneticPotentialDifference V_mss
    "Complex magnetic potential difference of stator w.r.t. stator fixed frame";
  SI.ComplexMagneticPotentialDifference V_msr
    "Complex magnetic potential difference of stator w.r.t. rotor fixed frame";
  SI.ComplexMagneticPotentialDifference V_mrr
    "Complex magnetic potential difference of rotor w.r.t. rotor fixed frame";
  // Complex phasors of magnetic fluxes
  SI.ComplexMagneticFlux Phi_ss
    "Complex magnetic flux of stator w.r.t. stator fixed frame";
  SI.ComplexMagneticFlux Phi_sr
    "Complex magnetic flux of stator w.r.t. rotor fixed frame";
  SI.ComplexMagneticFlux Phi_rr
    "Complex magnetic flux of rotor w.r.t. rotor fixed frame";
  // Electrical torque and mechanical angle
  SI.Torque tauElectrical "Electrical torque";
  SI.Angle gamma
    "Electrical angle between rotor and stator";
  Complex rotator "Equivalent vector representation of orientation";
equation
  port_sp.Phi = Phi_ss "Stator flux into positive stator port";
  port_sp.Phi + port_sn.Phi = Complex(0, 0) "Balance of stator flux";
  port_rp.Phi = Phi_rr "Rotor flux into positive rotor port";
  port_rp.Phi + port_rn.Phi = Complex(0, 0) "Balance of rotor flux";
  port_sp.V_m - port_sn.V_m = V_mss "Magnetomotive force of stator";
  port_rp.V_m - port_rn.V_m = V_mrr "Magnetomotive force of rotor";
  // Transformations between stator and rotor fixed frame
  V_msr = V_mss*Modelica.ComplexMath.conj(rotator);
  Phi_sr = Phi_ss*Modelica.ComplexMath.conj(rotator);
  // Stator flux and rotor flux are equal
  Phi_sr = Phi_rr;
  // Local balance of magnetomotive force
  (pi/2.0)*(V_mrr.re + V_msr.re) = Phi_rr.re*R_m.d;
  (pi/2.0)*(V_mrr.im + V_msr.im) = Phi_rr.im*R_m.q;
  // Torque
  tauElectrical = -(pi*p/2.0)*(Phi_ss.im*V_mss.re - Phi_ss.re*V_mss.im);
  flange_a.tau = -tauElectrical;
  support.tau = tauElectrical;
  // Electrical angle between stator and rotor
  gamma = p*(flange_a.phi - support.phi);
  rotator = Modelica.ComplexMath.exp(Complex(0, gamma));
end RotorSaliencyAirGap;


Rotor cage with saliency in d- and q-axis. The salient cage model is a two axis model with two phases. The electromagnetic coupling therefore is also two phase coupling model. The angles of the two orientations are 0 and <img src=\"modelica://Modelica/Resources/Images/Magnetic/FundamentalWave/pi_over_2.png\">. This way an asymmetrical rotor cage with different resistances and stray inductances in d- and q-axis can be modeled.

within Modelica.Magnetic.FundamentalWave.BasicMachines.Components;
model SaliencyCageWinding "Rotor cage with saliency in d- and q-axis"
  extends Magnetic.FundamentalWave.Interfaces.TwoPortExtended;
  parameter Boolean useHeatPort=false
    "Enable / disable (=fixed temperatures) thermal port"
  parameter Magnetic.FundamentalWave.Types.SalientResistance RRef(d(start=1), q(
        start=1)) "Salient cage resistance";
  parameter SI.Temperature TRef(start=293.15)
    "Reference temperature of winding";
  parameter
    Modelica.Electrical.Machines.Thermal.LinearTemperatureCoefficient20
    alpha20(start=0) "Temperature coefficient of winding at 20 degC";
  final parameter SI.LinearTemperatureCoefficient alphaRef=
      Modelica.Electrical.Machines.Thermal.convertAlpha(
            alpha20,
            TRef,
            293.15) "Temperature coefficient of winding at reference temperature";
  parameter SI.Temperature TOperational(start=293.15)
    "Operational temperature of winding"
  parameter Magnetic.FundamentalWave.Types.SalientInductance Lsigma(d(start=1),
      q(start=1)) "Salient cage stray inductance";
  parameter Real effectiveTurns=1 "Effective number of turns";
  Modelica.Blocks.Interfaces.RealOutput i[2](
    each final quantity="ElectricCurrent",
    each final unit="A") = electroMagneticConverter.i
    "Currents out from damper";
  Modelica.Blocks.Interfaces.RealOutput iRMS(
    final quantity="ElectricCurrent",
    final unit="A") = sqrt(i[1]^2+i[2]^2)/sqrt(2)
    "RMS current out from damper";
  Modelica.Blocks.Interfaces.RealOutput lossPower(
    final quantity="Power",
    final unit="W") = sum(resistor.resistor.LossPower) "Damper losses";
  Magnetic.FundamentalWave.Components.PolyphaseElectroMagneticConverter electroMagneticConverter(
    final m=2,
    final orientation={0,Modelica.Constants.pi/2},
    final effectiveTurns=fill(effectiveTurns, 2))
  Modelica.Electrical.Polyphase.Basic.Resistor resistor(
    final useHeatPort=useHeatPort,
    final m=2,
    final R={RRef.d,RRef.q},
    final T_ref=fill(TRef, 2),
    final alpha=fill(alphaRef, 2),
    final T=fill(TOperational, 2))
  Modelica.Electrical.Polyphase.Basic.Star star(final m=2)
  Modelica.Electrical.Analog.Basic.Ground ground
  Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a heatPortWinding if
    useHeatPort "Heat ports of winding resistor"
  Modelica.Thermal.HeatTransfer.Components.ThermalCollector thermalCollector(final m=2)
    if useHeatPort "Connector of thermal rotor resistance heat ports"
  Magnetic.FundamentalWave.Components.Reluctance strayReluctance(final R_m(d=
          effectiveTurns^2/Lsigma.d, q=effectiveTurns^2/Lsigma.q))
    "Stray reluctance equivalent to ideally coupled stray inductances"
equation
  connect(port_p, electroMagneticConverter.port_p)
  connect(electroMagneticConverter.port_n, port_n)
  connect(ground.p, star.pin_n)
  connect(electroMagneticConverter.plug_n, resistor.plug_n)
  connect(star.plug_p, electroMagneticConverter.plug_n)
  connect(thermalCollector.port_b, heatPortWinding)
  connect(resistor.heatPort, thermalCollector.port_a)
  connect(electroMagneticConverter.plug_p, resistor.plug_p)
  connect(strayReluctance.port_p, port_p)
  connect(strayReluctance.port_n, port_n)
end SaliencyCageWinding;


Symmetric winding model coupling electrical and magnetic domain. The single-phase winding consists of a winding
resistor, a
single-phase electromagnetic coupling and a stray reluctance.

within Modelica.Magnetic.FundamentalWave.BasicMachines.Components;
model SinglePhaseWinding
  "Symmetric winding model coupling electrical and magnetic domain"

  Modelica.Electrical.Analog.Interfaces.PositivePin pin_p "Positive pin"
  Modelica.Electrical.Analog.Interfaces.NegativePin pin_n "Negative pin"
  Magnetic.FundamentalWave.Interfaces.NegativeMagneticPort port_n
    "Negative complex magnetic port"
  Magnetic.FundamentalWave.Interfaces.PositiveMagneticPort port_p
    "Positive complex magnetic port"
  parameter Boolean useHeatPort=false
    "Enable / disable (=fixed temperatures) thermal port"
  parameter SI.Resistance RRef
    "Winding resistance per phase at TRef";
  parameter SI.Temperature TRef(start=293.15)
    "Reference temperature of winding";
  parameter
    Modelica.Electrical.Machines.Thermal.LinearTemperatureCoefficient20
    alpha20(start=0) "Temperature coefficient of winding at 20 degC";
  final parameter SI.LinearTemperatureCoefficient alphaRef=
      Modelica.Electrical.Machines.Thermal.convertAlpha(
            alpha20,
            TRef,
            293.15) "Temperature coefficient of winding at reference temperature";
  parameter SI.Temperature TOperational(start=293.15)
    "Operational temperature of winding"
  parameter SI.Inductance Lsigma
    "Winding stray inductance per phase";
  parameter Real effectiveTurns=1 "Effective number of turns per phase";
  parameter SI.Angle orientation
    "Orientation of the resulting fundamental wave field phasor";

  SI.Voltage v=pin_p.v - pin_n.v "Voltage";
  SI.Current i=pin_p.i "Current";

  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";

  Modelica.Electrical.Analog.Basic.Resistor resistor(
    final useHeatPort=useHeatPort,
    final R=RRef,
    final T_ref=TRef,
    final alpha=alphaRef,
    final T=TOperational)
  Magnetic.FundamentalWave.Components.SinglePhaseElectroMagneticConverter electroMagneticConverter(final
      effectiveTurns=effectiveTurns, final orientation=orientation) "Winding"
  Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a heatPortWinding if
    useHeatPort "Heat ports of winding resistor"
  Modelica.Magnetic.FundamentalWave.Components.Permeance stray(final G_m(d=
          Lsigma/effectiveTurns^2, q=Lsigma/effectiveTurns^2))
equation
  connect(pin_p, resistor.p)
  connect(electroMagneticConverter.pin_n, pin_n)
  connect(electroMagneticConverter.port_p, port_p)
  connect(electroMagneticConverter.port_n, port_n)
  connect(heatPortWinding, resistor.heatPort)
  connect(resistor.n, electroMagneticConverter.pin_p)
  connect(electroMagneticConverter.port_p, stray.port_p)
  connect(electroMagneticConverter.port_n, stray.port_n)
end SinglePhaseWinding;


Symmetrical rotor cage.

within Modelica.Magnetic.FundamentalWave.BasicMachines.Components;
model SymmetricPolyphaseCageWinding "Symmetrical rotor cage"
  extends Magnetic.FundamentalWave.Interfaces.TwoPortExtended;
  parameter Integer m=3 "Number of phases"
  parameter Boolean useHeatPort=false
    "Enable / disable (=fixed temperatures) thermal port"
  parameter SI.Resistance RRef
    "Winding resistance per phase at TRef";
  parameter SI.Temperature TRef(start=293.15)
    "Reference temperature of winding";
  parameter
    Modelica.Electrical.Machines.Thermal.LinearTemperatureCoefficient20
    alpha20(start=0) "Temperature coefficient of winding at 20 degC";
  final parameter SI.LinearTemperatureCoefficient alphaRef=
      Modelica.Electrical.Machines.Thermal.convertAlpha(
            alpha20,
            TRef,
            293.15) "Temperature coefficient of winding at reference temperature";
  parameter SI.Temperature TOperational(start=293.15)
    "Operational temperature of winding"
  parameter SI.Inductance Lsigma "Cage stray inductance";
  parameter Real effectiveTurns=1 "Effective number of turns";
  final parameter Integer nBase=Modelica.Electrical.Polyphase.Functions.numberOfSymmetricBaseSystems(m)
    "Number of base systems";
  SI.Current i[m]=electroMagneticConverter.i
    "Cage currents";
  Magnetic.FundamentalWave.Components.PolyphaseElectroMagneticConverter electroMagneticConverter(
    final m=m,
    final effectiveTurns=fill(effectiveTurns, m),
    final orientation=
        Modelica.Electrical.Polyphase.Functions.symmetricOrientation(m))
    "Symmetric winding"
  Modelica.Electrical.Polyphase.Basic.Resistor resistor(
    final useHeatPort=useHeatPort,
    final m=m,
    final R=fill(RRef, m),
    final T_ref=fill(TRef, m),
    final alpha=fill(alphaRef, m),
    final T=fill(TOperational, m))
  Modelica.Electrical.Polyphase.Basic.Star star(final m=nBase)
  Modelica.Electrical.Analog.Basic.Ground ground
  Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a heatPortWinding if
    useHeatPort "Heat ports of winding resistor"
  Modelica.Thermal.HeatTransfer.Components.ThermalCollector thermalCollector(final m=m) if
       useHeatPort "Connector of thermal rotor resistance heat ports"
  Magnetic.FundamentalWave.Components.Reluctance strayReluctance(final R_m(d=m*
          effectiveTurns^2/2/Lsigma, q=m*effectiveTurns^2/2/Lsigma))
    "Stray reluctance equivalent to ideally coupled stray inductances"
  Modelica.Electrical.Polyphase.Basic.MultiStar multiStar(final m=m)
equation
  connect(port_p, electroMagneticConverter.port_p)
  connect(electroMagneticConverter.port_n, port_n)
  connect(ground.p, star.pin_n)
  connect(thermalCollector.port_a, resistor.heatPort)
  connect(thermalCollector.port_b, heatPortWinding)
  connect(strayReluctance.port_p, port_p)
  connect(strayReluctance.port_n, port_n)
  connect(electroMagneticConverter.plug_p, resistor.plug_p)
  connect(electroMagneticConverter.plug_n, multiStar.plug_p)
  connect(multiStar.starpoints, star.plug_p)
  connect(resistor.plug_n, multiStar.plug_p)
end SymmetricPolyphaseCageWinding;


Symmetric winding model coupling electrical and magnetic domain. The symmetrical polyphase winding consists of a symmetrical winding
resistor, a
zero inductor as well as a symmetrical
polyphase electromagnetic coupling and a
stray reluctance and a
core loss model including
heat port.

within Modelica.Magnetic.FundamentalWave.BasicMachines.Components;
model SymmetricPolyphaseWinding
  "Symmetric winding model coupling electrical and magnetic domain"
  import Modelica.Constants.eps;
  // Orientation changed
  Modelica.Electrical.Polyphase.Interfaces.PositivePlug plug_p(final m=m)
    "Positive plug"
  Modelica.Electrical.Polyphase.Interfaces.NegativePlug plug_n(final m=m)
    "Negative plug"
  Magnetic.FundamentalWave.Interfaces.NegativeMagneticPort port_n
    "Negative complex magnetic port"
  Magnetic.FundamentalWave.Interfaces.PositiveMagneticPort port_p
    "Positive complex magnetic port"
  parameter Integer m=3 "Number of phases"
  parameter Boolean useHeatPort=false
    "Enable / disable (=fixed temperatures) thermal port"
  // Resistor model
  parameter SI.Resistance RRef "Winding resistance per phase at TRef";
  parameter SI.Temperature TRef(start=293.15)
    "Reference temperature of winding";
  parameter
    Modelica.Electrical.Machines.Thermal.LinearTemperatureCoefficient20
    alpha20(start=0) "Temperature coefficient of winding at 20 degC";
  final parameter SI.LinearTemperatureCoefficient alphaRef=
      Modelica.Electrical.Machines.Thermal.convertAlpha(
            alpha20,
            TRef,
            293.15)
    "Temperature coefficient of winding at reference temperature";
  parameter SI.Temperature TOperational(start=293.15)
    "Operational temperature of winding"
  parameter SI.Inductance Lsigma "Winding stray inductance per phase";
  parameter Real ratioCommonLeakage(final min=0, final max=1)=1
    "Ratio of common stray inductance / total stray inductance";
  parameter SI.Inductance Lzero "Zero sequence inductance of winding";
  parameter Real effectiveTurns=1 "Effective number of turns per phase";
  parameter SI.Conductance GcRef "Electrical reference core loss reluctance";
  final parameter Integer nBase=Modelica.Electrical.Polyphase.Functions.numberOfSymmetricBaseSystems(m)
    "Number of base systems";
  final parameter Integer mBase=integer(m/nBase)
    "Number of phase of the base systems";

  SI.Voltage v[m]=plug_p.pin.v - plug_n.pin.v "Voltage";
  SI.Current i[m]=plug_p.pin.i "Current";

  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";

  Modelica.Magnetic.FundamentalWave.Components.PolyphaseElectroMagneticConverter
    electroMagneticConverter(
    m=m,
    final effectiveTurns=fill(effectiveTurns, m),
    final orientation=
        Modelica.Electrical.Polyphase.Functions.symmetricOrientation(m),
    final useStrayPermeance=ratioCommonLeakage < (1 - eps),
    final Lsigma=(1 - ratioCommonLeakage)*Lsigma)
                                            "Symmetric winding"
  Modelica.Electrical.Polyphase.Basic.ZeroInductor zeroInductor(final m=m, final Lzero=Lzero) if
       mBase<>2 "Zero sequence inductance of winding"
  Modelica.Electrical.Polyphase.Ideal.Short short(final m=m) if mBase == 2
  Modelica.Electrical.Polyphase.Basic.Resistor resistor(
    final m=m,
    final useHeatPort=useHeatPort,
    final R=fill(RRef, m),
    final T_ref=fill(TRef, m),
    final alpha=fill(alphaRef, m),
    final T=fill(TOperational, m)) "Winding resistor"
  Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a heatPortWinding[m] if
       useHeatPort "Heat ports of winding resistors"
  Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a heatPortCore if
       useHeatPort "Heat port of core"
  Magnetic.FundamentalWave.Components.EddyCurrent core(
    final useHeatPort=useHeatPort, final G=(m/2)*GcRef*effectiveTurns^2)
    "Core loss model (currently eddy currents only)"
  Modelica.Magnetic.FundamentalWave.Components.Permeance stray(final G_m(
    d=2/m*ratioCommonLeakage*Lsigma/effectiveTurns^2,
    q=2/m*ratioCommonLeakage*Lsigma/effectiveTurns^2)) if ratioCommonLeakage>eps
    "Common stray permeance equivalent to ideally coupled stray inductances"

equation
  connect(plug_p, resistor.plug_p)
  connect(resistor.heatPort, heatPortWinding)
  connect(core.port_n, port_n)
  connect(core.heatPort, heatPortCore)
  connect(stray.port_n, core.port_n)
  connect(short.plug_n, plug_n)
  connect(plug_n, zeroInductor.plug_n)
  connect(port_p, stray.port_p)
  connect(electroMagneticConverter.port_n, core.port_p)
  connect(zeroInductor.plug_p, electroMagneticConverter.plug_n)
  connect(short.plug_p, electroMagneticConverter.plug_n)
  connect(resistor.plug_n, electroMagneticConverter.plug_p)
  connect(electroMagneticConverter.port_p, port_p)
end SymmetricPolyphaseWinding;


Induction machine with slip ring rotor. Resistances and stray inductances of the machine always refer to either stator or rotor. The symmetry of the stator and rotor is assumed. The number of stator and rotor phases may be different. The machine models take the following loss effects into account:

within Modelica.Magnetic.FundamentalWave.BasicMachines.InductionMachines;
model IM_SlipRing "Induction machine with slip ring rotor"
  parameter Integer mr(min=3) = m "Number of rotor phases"
  extends Magnetic.FundamentalWave.BaseClasses.Machine(
    is(start=zeros(m)),
    Rs(start=0.03*ZsRef),
    Lssigma(start=3*ZsRef*(1 - sqrt(1 - 0.0667))/(2*pi*fsNominal)),
    final L0(d=2.0*Lm/m/effectiveStatorTurns^2, q=2.0*Lm/m/effectiveStatorTurns
          ^2),
    redeclare final
      Modelica.Electrical.Machines.Thermal.InductionMachines.ThermalAmbientIMS
      thermalAmbient(final Tr=TrOperational, final mr=mr),
    redeclare final
      Modelica.Electrical.Machines.Interfaces.InductionMachines.ThermalPortIMS
      thermalPort(final mr=mr),
    redeclare final
      Modelica.Electrical.Machines.Interfaces.InductionMachines.ThermalPortIMS
      internalThermalPort(final mr=mr),
    redeclare final
      Modelica.Electrical.Machines.Interfaces.InductionMachines.PowerBalanceIMS
      powerBalance(
      final lossPowerRotorWinding=sum(rotor.resistor.resistor.LossPower),
      final lossPowerRotorCore=rotor.core.lossPower,
      final lossPowerBrush=0,
      final powerRotor=Modelica.Electrical.Polyphase.Functions.activePower(vr,
          ir)));

  Modelica.Electrical.Polyphase.Interfaces.NegativePlug plug_rn(final m=
        mr) "Negative plug of rotor"
  Modelica.Electrical.Polyphase.Interfaces.PositivePlug plug_rp(final m=
        mr) "Positive plug of rotor"
  parameter SI.Inductance Lm(start=3*ZsRef*sqrt(1 - 0.0667)/(2*pi
        *fsNominal)) "Stator main field inductance"
  parameter SI.Inductance Lrsigma(start=3*ZsRef*(1 - sqrt(1 -
        0.0667))/(2*pi*fsNominal))
    "Rotor leakage inductance w.r.t. rotor side"
  parameter Real ratioCommonRotorLeakage(final min=0, final max=1)=1
    "Ratio of common stray inductance / total stray inductance of rotor winding"
  parameter SI.Inductance Lrzero=Lrsigma
    "Rotor zero inductance w.r.t. rotor side"
  parameter SI.Resistance Rr(start=0.04*ZsRef)
    "Rotor resistance per phase w.r.t. rotor side"
  parameter SI.Temperature TrRef(start=293.15)
    "Reference temperature of rotor resistance"
  parameter
    Modelica.Electrical.Machines.Thermal.LinearTemperatureCoefficient20
    alpha20r(start=0)
    "Temperature coefficient of rotor resistance at 20 degC"
  parameter SI.Temperature TrOperational(start=293.15)
    "Operational temperature of rotor resistance"
  parameter Boolean useTurnsRatio(start=true)
    "Use TurnsRatio or calculate from locked-rotor voltage?";
  parameter Real TurnsRatio(final min=Modelica.Constants.small, start=1)
    "Effective number of stator turns / effective number of rotor turns"
  parameter SI.Voltage VsNominal(start=100)
    "Nominal stator voltage per phase"
  parameter SI.Voltage VrLockedRotor(start=100*(2*pi*
        fsNominal*Lm)/sqrt(Rs^2 + (2*pi*fsNominal*(Lm + Lssigma))^2))
    "Locked rotor voltage per phase"
  parameter Modelica.Electrical.Machines.Losses.CoreParameters
    rotorCoreParameters(
    final m=3,
    PRef=0,
    VRef(start=1) = 1,
    wRef(start=1) = 1)
    "Rotor core loss parameter record, all quantities refer to rotor side"
  output SI.Voltage vr[mr]=plug_rp.pin.v - plug_rn.pin.v
    "Rotor instantaneous voltages";
  output SI.Current ir[mr]=plug_rp.pin.i
    "Rotor instantaneous currents";
protected
  final parameter Real internalTurnsRatio=if useTurnsRatio then
      TurnsRatio else VsNominal/VrLockedRotor*(2*pi*fsNominal*Lm)/sqrt(Rs
      ^2 + (2*pi*fsNominal*(Lm + Lssigma))^2);
public
  Components.SymmetricPolyphaseWinding rotor(
    final Lsigma=Lrsigma,
    final ratioCommonLeakage=ratioCommonRotorLeakage,
    final effectiveTurns=effectiveStatorTurns/internalTurnsRatio,
    final useHeatPort=true,
    final RRef=Rr,
    final TRef=TrRef,
    final TOperational=TrOperational,
    final Lzero=Lrsigma,
    final GcRef=rotorCoreParameters.GcRef,
    final m=mr,
    final alpha20=alpha20r)
    "Symmetric rotor winding including resistances, zero and stray inductances and zero core losses"
  /* previously used: state selection, now commented
  FundamentalWave.Interfaces.StateSelector stateSelectorR(
    final m=m,
    final xi=ir,
    final gamma=0) "State selection of rotor currents"
  */
equation
  connect(rotor.plug_n, plug_rn)
  connect(rotor.heatPortCore, internalThermalPort.heatPortRotorCore)

  connect(rotor.heatPortWinding, internalThermalPort.heatPortRotorWinding)
  connect(plug_rp, rotor.plug_p)
  connect(airGap.port_rn, rotor.port_p)
  connect(airGap.port_rp, rotor.port_n)
end IM_SlipRing;


Induction machine with squirrel cage. Resistances and stray inductances of the machine refer to an m-phase stator. The symmetry of the stator and rotor is assumed. The machine models take the following loss effects into account:

within Modelica.Magnetic.FundamentalWave.BasicMachines.InductionMachines;
model IM_SquirrelCage
  "Induction machine with squirrel cage"
  extends Magnetic.FundamentalWave.BaseClasses.Machine(
    is(start=zeros(m)),
    Rs(start=0.03*ZsRef),
    Lssigma(start=3*ZsRef*(1 - sqrt(1 - 0.0667))/(2*pi*fsNominal)),
    final L0(d=2.0*Lm/m/effectiveStatorTurns^2, q=2.0*Lm/m/effectiveStatorTurns
          ^2),
    redeclare final
      Modelica.Electrical.Machines.Thermal.InductionMachines.ThermalAmbientIMC
      thermalAmbient(final Tr=TrOperational),
    redeclare final
      Modelica.Electrical.Machines.Interfaces.InductionMachines.ThermalPortIMC
      thermalPort,
    redeclare final
      Modelica.Electrical.Machines.Interfaces.InductionMachines.ThermalPortIMC
      internalThermalPort,
    redeclare final
      Modelica.Electrical.Machines.Interfaces.InductionMachines.PowerBalanceIMC
      powerBalance(final lossPowerRotorWinding=sum(rotorCage.resistor.resistor.LossPower),
        final lossPowerRotorCore=0));
  parameter SI.Inductance Lm(start=3*ZsRef*sqrt(1 - 0.0667)/(2*pi
        *fsNominal)) "Stator main field inductance"
  parameter SI.Inductance Lrsigma(start=3*ZsRef*(1 - sqrt(1 -
        0.0667))/(2*pi*fsNominal))
    "Rotor leakage inductance of equivalent m phase winding w.r.t. stator side"
  parameter SI.Resistance Rr(start=0.04*ZsRef)
    "Rotor resistance of equivalent m phase winding w.r.t. stator side"
  parameter SI.Temperature TrRef(start=293.15)
    "Reference temperature of rotor resistance"
  parameter
    Modelica.Electrical.Machines.Thermal.LinearTemperatureCoefficient20
    alpha20r(start=0)
    "Temperature coefficient of rotor resistance at 20 degC"
  parameter SI.Temperature TrOperational(start=293.15)
    "Operational temperature of rotor resistance"
  output SI.Current ir[m]=rotorCage.i "Rotor cage currents";
  Magnetic.FundamentalWave.BasicMachines.Components.SymmetricPolyphaseCageWinding
    rotorCage(
    final Lsigma=Lrsigma,
    final effectiveTurns=effectiveStatorTurns,
    final useHeatPort=true,
    final RRef=Rr,
    final TRef=TrRef,
    final TOperational=TrRef,
    final m=m,
    final alpha20=alpha20r)
    "Symmetric rotor cage winding including resistances and stray inductances"
equation
  connect(rotorCage.heatPortWinding, internalThermalPort.heatPortRotorWinding)
  connect(airGap.port_rn, rotorCage.port_p)
  connect(airGap.port_rp, rotorCage.port_n)
end IM_SquirrelCage;


Induction machines

within Modelica.Magnetic.FundamentalWave.BasicMachines;
package InductionMachines "Induction machines"
  extends Modelica.Icons.VariantsPackage;
end InductionMachines;


Synchronous machines

within Modelica.Magnetic.FundamentalWave.BasicMachines;
package SynchronousMachines "Synchronous machines"
  extends Modelica.Icons.VariantsPackage;
end SynchronousMachines;


Electrical excited synchronous machine with optional damper cage. The symmetry of the stator is assumed. For rotor asymmetries can be taken into account by different resistances and stray inductances in the d- and q-axis. The machine models take the following loss effects into account:

within Modelica.Magnetic.FundamentalWave.BasicMachines.SynchronousMachines;
model SM_ElectricalExcited
  "Electrical excited synchronous machine with optional damper cage"
  extends Magnetic.FundamentalWave.BaseClasses.Machine(
    is(start=zeros(m)),
    Rs(start=0.03*ZsRef),
    Lssigma(start=0.1*ZsRef/(2*pi*fsNominal)),
    final L0(d=2.0*Lmd/m/effectiveStatorTurns^2, q=2.0*Lmq/m/
          effectiveStatorTurns^2),
    redeclare final
      Modelica.Electrical.Machines.Thermal.SynchronousMachines.ThermalAmbientSMEE
      thermalAmbient(
      final useDamperCage=useDamperCage,
      final Te=TeOperational,
      final Tr=TrOperational),
    redeclare final
      Modelica.Electrical.Machines.Interfaces.InductionMachines.ThermalPortSMEE
      thermalPort(final useDamperCage=useDamperCage),
    redeclare final
      Modelica.Electrical.Machines.Interfaces.InductionMachines.ThermalPortSMEE
      internalThermalPort(final useDamperCage=useDamperCage),
    redeclare final
      Modelica.Electrical.Machines.Interfaces.InductionMachines.PowerBalanceSMEE
      powerBalance(
      final lossPowerRotorWinding=damperCageLossPower,
      final powerExcitation=ve*ie,
      final lossPowerExcitation=excitation.resistor.LossPower,
      final lossPowerBrush=brush.lossPower,
      final lossPowerRotorCore=0));
  // Main field parameters
  parameter SI.Inductance Lmd(start=1.5*ZsRef/(2*pi*fsNominal))
    "Stator main field inductance, d-axis"
  parameter SI.Inductance Lmq(start=1.5*ZsRef/(2*pi*fsNominal))
    "Stator main field inductance, q-axis"
  // Rotor cage parameters
  parameter Boolean useDamperCage(start=true)
    "Enable/disable damper cage"
  parameter SI.Inductance Lrsigmad(start=0.05*ZsRef/(2*pi*
        fsNominal))
    "Rotor damper cage leakage inductance, d-axis, w.r.t. stator side"
  parameter SI.Inductance Lrsigmaq=Lrsigmad
    "Rotor damper cage leakage inductance, q-axis, w.r.t. stator side"
  parameter SI.Resistance Rrd(start=0.04*ZsRef)
    "Rotor damper cage resistance, d-axis, w.r.t. stator side"
  parameter SI.Resistance Rrq=Rrd
    "Rotor damper cage resistance, q-axis, w.r.t. stator side"
  parameter SI.Temperature TrRef(start=293.15)
    "Reference temperature of damper resistances in d- and q-axis"
  parameter
    Modelica.Electrical.Machines.Thermal.LinearTemperatureCoefficient20
    alpha20r(start=0)
    "Temperature coefficient of damper resistances in d- and q-axis"
  // Operational temperature
  parameter SI.Temperature TrOperational(start=293.15)
    "Operational temperature of (optional) damper cage"
  parameter SI.Temperature TeOperational(start=293.15)
    "Operational excitation temperature"
  // Excitation parameters
  parameter SI.Voltage VsNominal(start=100)
    "Nominal stator voltage"
  parameter SI.Current IeOpenCircuit(start=10)
    "Open circuit excitation current @ nominal voltage and frequency"
  parameter SI.Resistance Re(start=2.5)
    "Warm excitation resistance"
  parameter SI.Temperature TeRef(start=293.15)
    "Reference temperature of excitation resistance"
  parameter
    Modelica.Electrical.Machines.Thermal.LinearTemperatureCoefficient20
    alpha20e(start=0) "Temperature coefficient of excitation resistance"
  parameter Real sigmae(
    min=0,
    max=1,
    start=0.025) "Stray fraction of total excitation inductance"
  parameter Modelica.Electrical.Machines.Losses.BrushParameters
    brushParameters "Brush loss parameter record"
  output SI.Voltage ve=pin_ep.v - pin_en.v
    "Excitation voltage";
  output SI.Current ie=pin_ep.i "Excitation current";
  // Rotor cage components
  Modelica.Blocks.Interfaces.RealOutput ir[2](
    start=zeros(2),
    each final quantity="ElectricCurrent",
    each final unit="A") if useDamperCage "Damper cage currents"
  Modelica.Blocks.Interfaces.RealOutput irRMS(
    final quantity="ElectricCurrent",
    final unit="A") if useDamperCage "Damper cage RMS current"
  FundamentalWave.Components.Short short if not useDamperCage
    "Magnetic connection in case the damper cage is not present"
  Components.SaliencyCageWinding rotorCage(
    final Lsigma(d=Lrsigmad, q=Lrsigmaq),
    final effectiveTurns=sqrt(3.0/2.0)*effectiveStatorTurns,
    final useHeatPort=true,
    final TRef=TrRef,
    final TOperational=TrOperational,
    final RRef(d=Rrd, q=Rrq),
    final alpha20=alpha20r) if useDamperCage
    "Symmetric rotor cage winding including resistances and stray inductances"
  // Excitation components
  Components.SinglePhaseWinding excitation(
    final orientation=0,
    final RRef=Re,
    final TRef=TeRef,
    final Lsigma=Lesigma,
    final effectiveTurns=effectiveStatorTurns*turnsRatio*m/2,
    final useHeatPort=true,
    final TOperational=TeOperational,
    final alpha20=alpha20e)
    "Excitation winding including resistance and stray inductance"
  Modelica.Electrical.Analog.Interfaces.PositivePin pin_ep
    "Positive pin of excitation"
  Modelica.Electrical.Analog.Interfaces.NegativePin pin_en
    "Negative pin of excitation"
  Modelica.Electrical.Machines.Losses.DCMachines.Brush brush(final
      brushParameters=brushParameters, final useHeatPort=true)
protected
  final parameter Real turnsRatio=sqrt(2)*VsNominal/(2*pi*fsNominal*Lmd*
      IeOpenCircuit) "Stator current / excitation current";
  final parameter SI.Inductance Lesigma=Lmd*turnsRatio^2*3/
      2*sigmae/(1 - sigmae)
    "Leakage inductance of the excitation winding";
  Modelica.Blocks.Interfaces.RealOutput damperCageLossPower(final
      quantity="Power", final unit="W") "Damper losses";
equation
  connect(ir, rotorCage.i);
  connect(irRMS, rotorCage.iRMS);
  connect(damperCageLossPower, rotorCage.lossPower);
  if not useDamperCage then
    damperCageLossPower = 0;
  end if;
  connect(pin_en, excitation.pin_n)
  connect(airGap.port_rn, excitation.port_p)
  connect(pin_ep, brush.p)
  connect(brush.n, excitation.pin_p)
  connect(brush.heatPort, internalThermalPort.heatPortBrush)
  connect(excitation.heatPortWinding, internalThermalPort.heatPortExcitation)
  connect(airGap.port_rp, rotorCage.port_n)
  connect(short.port_n, airGap.port_rp)
  connect(rotorCage.port_p, excitation.port_n)
  connect(short.port_p, excitation.port_n)
  connect(rotorCage.heatPortWinding, internalThermalPort.heatPortRotorWinding)
end SM_ElectricalExcited;


Permanent magnet synchronous machine with optional damper cage. Resistances and stray inductances of the machine refer to an m-phase stator. The symmetry of the stator is assumed. For rotor asymmetries can be taken into account by different resistances and stray inductances in the d- and q-axis. The machine models take the following loss effects into account:

within Modelica.Magnetic.FundamentalWave.BasicMachines.SynchronousMachines;
model SM_PermanentMagnet
  "Permanent magnet synchronous machine with optional damper cage"
  extends Magnetic.FundamentalWave.BaseClasses.Machine(
    is(start=zeros(m)),
    Rs(start=0.03*ZsRef),
    Lssigma(start=0.1*ZsRef/(2*pi*fsNominal)),
    final L0(d=2.0*Lmd/m/effectiveStatorTurns^2, q=2.0*Lmq/m/
          effectiveStatorTurns^2),
    redeclare final
      Modelica.Electrical.Machines.Thermal.SynchronousMachines.ThermalAmbientSMPM
      thermalAmbient(
      final useDamperCage=useDamperCage,
      final Tr=TrOperational,
      final Tpm=TpmOperational),
    redeclare final
      Modelica.Electrical.Machines.Interfaces.InductionMachines.ThermalPortSMPM
      thermalPort(final useDamperCage=useDamperCage),
    redeclare final
      Modelica.Electrical.Machines.Interfaces.InductionMachines.ThermalPortSMPM
      internalThermalPort(final useDamperCage=useDamperCage),
    redeclare final
      Modelica.Electrical.Machines.Interfaces.InductionMachines.PowerBalanceSMPM
      powerBalance(
      final lossPowerRotorWinding=damperCageLossPower,
      final lossPowerRotorCore=0,
      final lossPowerPermanentMagnet=permanentMagnet.lossPower));
  // Main field parameters
  parameter SI.Inductance Lmd(start=0.3*ZsRef/(2*pi*fsNominal))
    "Stator main field inductance, d-axis"
  parameter SI.Inductance Lmq(start=0.3*ZsRef/(2*pi*fsNominal))
    "Stator main field inductance, q-axis"
  // Rotor cage parameters
  parameter Boolean useDamperCage(start=true)
    "Enable/disable damper cage"
  parameter SI.Inductance Lrsigmad(start=0.05*ZsRef/(2*pi*
        fsNominal))
    "Rotor damper cage leakage inductance, d-axis, w.r.t. stator side"
  parameter SI.Inductance Lrsigmaq=Lrsigmad
    "Rotor damper cage leakage inductance, q-axis, w.r.t. stator side"
  parameter SI.Resistance Rrd(start=0.04*ZsRef)
    "Rotor damper cage resistance, d-axis, w.r.t. stator side"
  parameter SI.Resistance Rrq=Rrd
    "Rotor damper cage resistance, q-axis, w.r.t. stator side"
  parameter SI.Temperature TrRef(start=293.15)
    "Reference temperature of damper resistances in d- and q-axis"
  parameter
    Modelica.Electrical.Machines.Thermal.LinearTemperatureCoefficient20
    alpha20r(start=0)
    "Temperature coefficient of damper resistances in d- and q-axis"
  // Operational parameters
  final parameter SI.Temperature TpmOperational=293.15
    "Operational temperature of permanent magnet"
  parameter SI.Temperature TrOperational(start=293.15)
    "Operational temperature of (optional) damper cage"
  // Permanent magnet parameters
  parameter SI.Voltage VsOpenCircuit(start=112.3)
    "Open circuit RMS voltage per phase @ fsNominal";
  parameter
    Modelica.Electrical.Machines.Losses.PermanentMagnetLossParameters
    permanentMagnetLossParameters(IRef(start=100), wRef(start=2*pi*
          fsNominal/p)) "Permanent magnet loss parameter record"
  // Rotor cage components
  Modelica.Blocks.Interfaces.RealOutput ir[2](
    start=zeros(2),
    each final quantity="ElectricCurrent",
    each final unit="A") if useDamperCage "Damper cage currents"
  Magnetic.FundamentalWave.Components.Short short if not useDamperCage
    "Magnetic connection in case the damper cage is not present"
  Magnetic.FundamentalWave.BasicMachines.Components.SaliencyCageWinding rotorCage(
    final RRef(d=Rrd, q=Rrq),
    final Lsigma(d=Lrsigmad, q=Lrsigmaq),
    final effectiveTurns=sqrt(3.0/2.0)*effectiveStatorTurns,
    final useHeatPort=true,
    final TRef=TrRef,
    final alpha20=alpha20r,
    final TOperational=TrOperational) if useDamperCage
    "Symmetric rotor cage winding including resistances and stray inductances"
  // Permanent magnet components
  Components.PermanentMagnet permanentMagnet(
    final V_m=Complex(V_mPM, 0),
    final m=m,
    final permanentMagnetLossParameters=permanentMagnetLossParameters,
    final useHeatPort=true,
    final is=is) "Magnetic potential difference of permanent magnet"
protected
  final parameter SI.MagneticPotentialDifference V_mPM=(2/
      pi)*sqrt(2)*(m/2)*VsOpenCircuit/effectiveStatorTurns/(Lmd/
      effectiveStatorTurns^2*2*pi*fsNominal)
    "Equivalent excitation magnetic potential difference";
  Modelica.Blocks.Interfaces.RealOutput damperCageLossPower(final
      quantity="Power", final unit="W") "Damper losses";
equation
  connect(ir, rotorCage.i);
  connect(damperCageLossPower, rotorCage.lossPower);
  if not useDamperCage then
    damperCageLossPower = 0;
  end if;
  connect(permanentMagnet.port_p, airGap.port_rn)
  connect(permanentMagnet.support, airGap.support)
  connect(permanentMagnet.heatPort, internalThermalPort.heatPortPermanentMagnet)
  connect(permanentMagnet.flange, inertiaRotor.flange_b)
  connect(airGap.port_rp, rotorCage.port_n)

  connect(short.port_n, airGap.port_rp)
  connect(short.port_p, permanentMagnet.port_n)
  connect(rotorCage.port_p, permanentMagnet.port_n)
  connect(rotorCage.heatPortWinding, internalThermalPort.heatPortRotorWinding)
end SM_PermanentMagnet;


Reluctance machine with optional damper cage. The symmetry of the stator is assumed. For rotor asymmetries can be taken into account by different resistances and stray inductances in the d- and q-axis. The machine models take the following loss effects into account:

within Modelica.Magnetic.FundamentalWave.BasicMachines.SynchronousMachines;
model SM_ReluctanceRotor "Reluctance machine with optional damper cage"
  extends Magnetic.FundamentalWave.BaseClasses.Machine(
    is(start=zeros(m)),
    Rs(start=0.03*ZsRef),
    Lssigma(start=0.1*ZsRef/(2*pi*fsNominal)),
    final L0(d=2.0*Lmd/m/effectiveStatorTurns^2, q=2.0*Lmq/m/
          effectiveStatorTurns^2),
    redeclare final
      Modelica.Electrical.Machines.Thermal.SynchronousMachines.ThermalAmbientSMR
      thermalAmbient(final useDamperCage=useDamperCage, final Tr=TrOperational),
    redeclare final
      Modelica.Electrical.Machines.Interfaces.InductionMachines.ThermalPortSMR
      thermalPort(final useDamperCage=useDamperCage),
    redeclare final
      Modelica.Electrical.Machines.Interfaces.InductionMachines.ThermalPortSMR
      internalThermalPort(final useDamperCage=useDamperCage),
    redeclare final
      Modelica.Electrical.Machines.Interfaces.InductionMachines.PowerBalanceSMR
      powerBalance(final lossPowerRotorWinding=damperCageLossPower, final
        lossPowerRotorCore=0));

  // Main field parameters
  parameter SI.Temperature TrOperational(start=293.15)
    "Operational temperature of (optional) damper cage"
  parameter SI.Inductance Lmd(start=2.9*ZsRef/(2*pi*fsNominal))
    "Stator main field inductance, d-axis"
  parameter SI.Inductance Lmq(start=0.9*ZsRef/(2*pi*fsNominal))
    "Stator main field inductance, q-axis"
  // Rotor cage parameters
  parameter Boolean useDamperCage(start=true)
    "Enable/disable damper cage"
  parameter SI.Inductance Lrsigmad(start=0.05*ZsRef/(2*pi*
        fsNominal))
    "Rotor damper cage leakage inductance, d-axis, w.r.t. stator side"
  parameter SI.Inductance Lrsigmaq=Lrsigmad
    "Rotor damper cage leakage inductance, q-axis, w.r.t. stator side"
  parameter SI.Resistance Rrd(start=0.04*ZsRef)
    "Rotor damper cage resistance, d-axis, w.r.t. stator side"
  parameter SI.Resistance Rrq=Rrd
    "Rotor damper cage resistance, q-axis, w.r.t. stator side"
  parameter SI.Temperature TrRef(start=293.15)
    "Reference temperature of damper resistances in d- and q-axis"
  parameter
    Modelica.Electrical.Machines.Thermal.LinearTemperatureCoefficient20
    alpha20r(start=0)
    "Temperature coefficient of damper resistances in d- and q-axis"
  // Rotor cage components
  Modelica.Blocks.Interfaces.RealOutput ir[2](
    start=zeros(2),
    each final quantity="ElectricCurrent",
    each final unit="A") if useDamperCage "Damper cage currents"
  Magnetic.FundamentalWave.Components.Short short if not useDamperCage
    "Magnetic connection in case the damper cage is not present"
  Magnetic.FundamentalWave.BasicMachines.Components.SaliencyCageWinding rotorCage(
    final RRef(d=Rrd, q=Rrq),
    final Lsigma(d=Lrsigmad, q=Lrsigmaq),
    final effectiveTurns=sqrt(3.0/2.0)*effectiveStatorTurns,
    final useHeatPort=true,
    final TRef=TrRef,
    final alpha20=alpha20r,
    final TOperational=TrOperational) if useDamperCage
    "Symmetric rotor cage winding including resistances and stray inductances"
protected
  Modelica.Blocks.Interfaces.RealOutput damperCageLossPower(final
      quantity="Power", final unit="W") "Damper losses";
equation
  connect(ir, rotorCage.i);
  connect(damperCageLossPower, rotorCage.lossPower);
  if not useDamperCage then
    damperCageLossPower = 0;
  end if;
  connect(rotorCage.port_n, airGap.port_rp)

  connect(short.port_n, airGap.port_rp)
  connect(rotorCage.port_p, airGap.port_rn)

  connect(short.port_p, airGap.port_rn)
  connect(rotorCage.heatPortWinding, internalThermalPort.heatPortRotorWinding)
end SM_ReluctanceRotor;


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.FundamentalWave.Components;
model Crossing "Crossing of two branches"

  Interfaces.PositiveMagneticPort port_p1
    "Positive port_p1 connected with port_p2"
  Interfaces.PositiveMagneticPort port_p2
    "Positive port_p2 connected with port_p1"
  Interfaces.NegativeMagneticPort port_n1
    "Negative port_n1 connected with port_n2"
  Interfaces.NegativeMagneticPort port_n2
    "Negative port_n2 connected with port_n1"
equation
  connect(port_p1, port_p2)
  connect(port_n1, port_n2)
end Crossing;


Constant loss model under sinusoidal magnetic conditions. The eddy current loss model with respect to fundamental wave effects is designed in accordance to
FluxTubes.Basic.EddyCurrent.

within Modelica.Magnetic.FundamentalWave.Components;
model EddyCurrent
  "Constant loss model under sinusoidal magnetic conditions"
  import Modelica.Constants.pi;
  extends Magnetic.FundamentalWave.Interfaces.TwoPort;
  parameter SI.Conductance G(min=0)
    "Equivalent symmetric loss conductance";
  extends
    Modelica.Thermal.HeatTransfer.Interfaces.PartialElementaryConditionalHeatPort(
      final T=273.15);
equation
  lossPower = (pi/2)*(V_m.re*der(Phi.re) + V_m.im*der(Phi.im));
  if G > 0 then
    (pi/2)*V_m.re = G*der(Phi.re);
    (pi/2)*V_m.im = G*der(Phi.im);
  else
    V_m.re = 0;
    V_m.im = 0;
  end if;
end EddyCurrent;


Magnetic ground. Grounding of the complex magnetic potential. Each magnetic circuit has to be grounded at least one point of the circuit.

within Modelica.Magnetic.FundamentalWave.Components;
model Ground "Magnetic ground"
  Interfaces.PositiveMagneticPort port_p "Complex magnetic port"
equation
  port_p.V_m = Complex(0, 0);
end Ground;


Idle running branch. This is a simple idle running branch.

within Modelica.Magnetic.FundamentalWave.Components;
model Idle "Idle running branch"
  extends Magnetic.FundamentalWave.Interfaces.TwoPort;
equation
  Phi = Complex(0, 0);
end Idle;


Basic fundamental wave components

within Modelica.Magnetic.FundamentalWave;
package Components "Basic fundamental wave components"
  extends Modelica.Icons.Package;
end Components;


Salient Permeance. The salient permeance models the relationship between the complex magnetic potential difference
 and the complex magnetic flux :

within Modelica.Magnetic.FundamentalWave.Components;
model Permeance "Salient Permeance"
  import Modelica.Constants.pi;
  extends Magnetic.FundamentalWave.Interfaces.TwoPort;
  parameter Magnetic.FundamentalWave.Types.SalientPermeance G_m(d(start=1), q(
        start=1)) "Magnetic permeance in d=re and q=im axis";
equation
  (pi/2)*G_m.d*V_m.re = Phi.re;
  (pi/2)*G_m.q*V_m.im = Phi.im;
end Permeance;


Polyphase electromagnetic converter. Each phase  of an  phase winding has an effective number of turns,  and an respective winging angle  and a phase current .

within Modelica.Magnetic.FundamentalWave.Components;
model PolyphaseElectroMagneticConverter
  "Polyphase electromagnetic converter"

  import Modelica.Magnetic.FundamentalWave.Types.SalientPermeance;

  // Global plug and port variables
  SI.Voltage v[m]=plug_p.pin.v - plug_n.pin.v "Voltage";
  SI.Current i[m]=plug_p.pin.i "Current";
  SI.ComplexMagneticPotentialDifference V_m=port_p.V_m -
      port_n.V_m "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 "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";

  Modelica.Electrical.Polyphase.Interfaces.PositivePlug plug_p(final m=m)
    "Positive plug"
  Modelica.Electrical.Polyphase.Interfaces.NegativePlug plug_n(final m=m)
    "Negative plug"
  Magnetic.FundamentalWave.Interfaces.PositiveMagneticPort port_p
    "Positive complex magnetic port"
  Magnetic.FundamentalWave.Interfaces.NegativeMagneticPort port_n
    "Negative complex magnetic port"
  parameter Integer m=3 "Number of phases"
  parameter Real effectiveTurns[m] "Effective number of turns";
  parameter SI.Angle orientation[m]
    "Orientation of the resulting fundamental wave field phasor";
  parameter Boolean useStrayPermeance=false "Use optional stray permeance";
  parameter SI.Inductance Lsigma=0 "Optional stray inductance"
  Magnetic.FundamentalWave.Components.SinglePhaseElectroMagneticConverter singlePhaseElectroMagneticConverter[m](
    final effectiveTurns=effectiveTurns, final orientation=orientation)
  Permeance strayPermeance[m](final G_m={SalientPermeance(
    d=Lsigma/effectiveTurns[k]^2, q=Lsigma/effectiveTurns[k]^2) for k in 1:m}) if useStrayPermeance
equation
  connect(plug_p.pin, singlePhaseElectroMagneticConverter.pin_p)
  connect(singlePhaseElectroMagneticConverter.pin_n, plug_n.pin)
  connect(singlePhaseElectroMagneticConverter[1].port_p, port_p)
  for k in 2:m loop
    connect(singlePhaseElectroMagneticConverter[k - 1].port_n,
      singlePhaseElectroMagneticConverter[k].port_p);
  end for;
  connect(singlePhaseElectroMagneticConverter[m].port_n, port_n)
  connect(singlePhaseElectroMagneticConverter.port_p, strayPermeance.port_p)
  connect(singlePhaseElectroMagneticConverter.port_n, strayPermeance.port_n)
end PolyphaseElectroMagneticConverter;


Salient reluctance. The salient reluctance models the relationship between the complex magnetic potential difference
 and the complex magnetic flux ,

within Modelica.Magnetic.FundamentalWave.Components;
model Reluctance "Salient reluctance"
  import Modelica.Constants.pi;
  extends Magnetic.FundamentalWave.Interfaces.TwoPort;
  parameter Magnetic.FundamentalWave.Types.SalientReluctance R_m(d(start=1), q(
        start=1)) "Magnetic reluctance in d=re and q=im axis";
equation
  (pi/2)*V_m.re = R_m.d*Phi.re;
  (pi/2)*V_m.im = R_m.q*Phi.im;
end Reluctance;


Short cut branch. This is a simple short cut branch.

within Modelica.Magnetic.FundamentalWave.Components;
model Short "Short cut branch"
  extends Magnetic.FundamentalWave.Interfaces.TwoPortElementary;
equation
  connect(port_p, port_n)
end Short;


Single-phase electromagnetic converter. The single-phase winding has an effective number of turns,  and a respective orientation of the winding, . The current in winding is .

within Modelica.Magnetic.FundamentalWave.Components;
model SinglePhaseElectroMagneticConverter
  "Single-phase electromagnetic converter"
  import Modelica.Constants.pi;
  Modelica.Electrical.Analog.Interfaces.PositivePin pin_p "Positive pin"
  Modelica.Electrical.Analog.Interfaces.NegativePin pin_n "Negative pin"
  Interfaces.PositiveMagneticPort port_p "Positive complex magnetic port"
  Interfaces.NegativeMagneticPort port_n "Negative complex magnetic port"
  parameter Real effectiveTurns "Effective number of turns"
  parameter SI.Angle orientation
    "Orientation of the resulting fundamental wave V_m phasor"
  // Local electric single-phase quantities
  SI.Voltage v "Voltage";
  SI.Current i "Current";

  // Local electromagnetic fundamental wave quantities
  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";

  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";

  final parameter Complex N=effectiveTurns*Modelica.ComplexMath.exp(Complex(
      0, orientation)) "Complex number of turns";
equation
  // Magnetic flux and flux balance of the magnetic ports
  port_p.Phi = Phi;
  port_p.Phi + port_n.Phi = Complex(0, 0);
  // Magnetic potential difference of the magnetic ports
  port_p.V_m - port_n.V_m = V_m;
  // Voltage drop between the electrical pins
  v = pin_p.v - pin_n.v;
  // Current and current balance of the electric pins
  i = pin_p.i;
  pin_p.i + pin_n.i = 0;
  // Complex magnetic potential difference is determined from currents, number
  // of turns and angles of orientation of winding
  // V_m.re = (2/pi) * effectiveTurns*cos(orientation)*i;
  // V_m.im = (2/pi) * effectiveTurns*sin(orientation)*i;
  V_m = (2.0/pi)*N*i;
  // Induced voltages is determined from complex magnetic flux, number of turns
  // and angles of orientation of winding
  // -v = effectiveTurns*cos(orientation)*der(Phi.re)
  //    + effectiveTurns*sin(orientation)*der(Phi.im);
  -v = Modelica.ComplexMath.real(Modelica.ComplexMath.conj(N)*Complex(der(
    Phi.re), der(Phi.im)));
end SinglePhaseElectroMagneticConverter;


within Modelica.Magnetic.FundamentalWave;
package Examples "Examples of electric machines based on the FundamentalWave concept"
  extends Modelica.Icons.ExamplesPackage;
end Examples;


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


Induction machine with squirrel cage and inverter driving a conveyor. An ideal frequency inverter is modeled by using a VfController and a three-phase SignalVoltage.
Frequency is driven by a load cycle of acceleration, constant speed, deceleration and standstill.
The mechanical load is a constant torque like a conveyor (with regularization around zero speed).

within Modelica.Magnetic.FundamentalWave.Examples.BasicMachines.InductionMachines;
model IMC_Conveyor
  "Induction machine with squirrel cage and inverter driving a conveyor"
  extends Modelica.Icons.Example;
  import Modelica.Constants.pi;
  constant Integer m=3 "Number of phases";
  constant SI.Frequency unitFrequency=1
  parameter SI.Voltage VNominal=100
    "Nominal RMS voltage per phase";
  parameter SI.Frequency fNominal=aimcData.fsNominal
    "Nominal frequency";
  parameter SI.AngularVelocity wNominal=2*pi*fNominal/aimcData.p
    "Nominal speed";
  parameter SI.Torque TLoad=161.4 "Nominal load torque";
  parameter SI.Inertia JLoad=0.29
    "Load's moment of inertia";
  parameter SI.Length r=0.05 "Transmission radius";
  Magnetic.FundamentalWave.BasicMachines.InductionMachines.IM_SquirrelCage aimc(
    p=aimcData.p,
    fsNominal=aimcData.fsNominal,
    TsRef=aimcData.TsRef,
    alpha20s(displayUnit="1/K") = aimcData.alpha20s,
    Jr=aimcData.Jr,
    Js=aimcData.Js,
    ratioCommonStatorLeakage=aimcData.ratioCommonStatorLeakage,
    frictionParameters=aimcData.frictionParameters,
    phiMechanical(fixed=true),
    wMechanical(fixed=true),
    statorCoreParameters=aimcData.statorCoreParameters,
    strayLoadParameters=aimcData.strayLoadParameters,
    TrRef=aimcData.TrRef,
    Rs=aimcData.Rs*m/3,
    Lssigma=aimcData.Lssigma*m/3,
    Lszero=aimcData.Lszero*m/3,
    Lm=aimcData.Lm*m/3,
    Lrsigma=aimcData.Lrsigma*m/3,
    Rr=aimcData.Rr*m/3,
    TsOperational=293.15,
    effectiveStatorTurns=aimcData.effectiveStatorTurns,
    alpha20r=aimcData.alpha20r,
    TrOperational=293.15)
  Modelica.Electrical.Machines.Sensors.CurrentQuasiRMSSensor currentQuasiRMSSensor
  Modelica.Blocks.Sources.CombiTimeTable dutyCycle(
    table=[0,0; 1,1; 4,1; 5,0; 10,0; 11,-1; 14,-1; 15,0; 20,0],
    extrapolation=Modelica.Blocks.Types.Extrapolation.Periodic)
  Modelica.Electrical.Machines.Utilities.VfController vfController(
    final m=m,
    VNominal=VNominal,
    fNominal=fNominal)
  Modelica.Electrical.Polyphase.Sources.SignalVoltage signalVoltage(
      final m=m)
  Modelica.Electrical.Polyphase.Basic.Star star(final m=m)
  Modelica.Electrical.Analog.Basic.Ground ground
  Modelica.Electrical.Machines.Utilities.TerminalBox terminalBox(
      terminalConnection="Y")
  parameter
    Modelica.Electrical.Machines.Utilities.ParameterRecords.IM_SquirrelCageData
    aimcData "Induction machine data"
  Modelica.Blocks.Math.Gain gain(k=fNominal)
  Modelica.Mechanics.Translational.Components.IdealGearR2T idealGearR2T(ratio=1/r)
  Modelica.Mechanics.Translational.Components.Mass mass(m=JLoad/r^2)
  Modelica.Mechanics.Translational.Sources.SignForce signForce(v0(displayUnit=
          "m/s") = 0.01*wNominal*r, f_nominal=-TLoad/r)
initial equation
  aimc.is[1:2] = zeros(2);
  aimc.rotorCage.electroMagneticConverter.V_m = Complex(0, 0);
equation
  connect(signalVoltage.plug_n, star.plug_p)
  connect(star.pin_n, ground.p)
  connect(vfController.y, signalVoltage.v)
  connect(signalVoltage.plug_p, currentQuasiRMSSensor.plug_p)
  connect(terminalBox.plugSupply, currentQuasiRMSSensor.plug_n)
  connect(terminalBox.plug_sn, aimc.plug_sn)
  connect(terminalBox.plug_sp, aimc.plug_sp)
  connect(vfController.u, gain.y)
  connect(dutyCycle.y[1], gain.u)
  connect(aimc.flange, idealGearR2T.flangeR)
  connect(idealGearR2T.flangeT, mass.flange_a)
  connect(mass.flange_b, signForce.flange)
end IMC_Conveyor;


Direct on line (DOL) start of induction machine with squirrel cage. At start time tStart three-phase voltage is supplied to the
induction machine with squirrel cage.
The machine starts from standstill, accelerating
inertias against load torque quadratic dependent on speed, finally reaching nominal speed.

within Modelica.Magnetic.FundamentalWave.Examples.BasicMachines.InductionMachines;
model IMC_DOL
  "Direct on line (DOL) start of induction machine with squirrel cage"
  extends Modelica.Icons.Example;
  constant Integer m=3 "Number of stator phases";
  parameter SI.Voltage VsNominal=100
    "Nominal RMS voltage per phase";
  parameter SI.Frequency fNominal=aimcData.fsNominal "Nominal frequency";
  parameter SI.Time tOn=0.1 "Start time of machine";
  parameter SI.Torque T_Load=161.4 "Nominal load torque";
  parameter SI.AngularVelocity w_Load(displayUnit="rev/min")=
       1440.45*2*Modelica.Constants.pi/60 "Nominal load speed";
  parameter SI.Inertia J_Load=0.29 "Load inertia";
  parameter Integer p=2 "Number of pole pairs";
  Modelica.Electrical.Analog.Basic.Ground ground
  Modelica.Electrical.Polyphase.Basic.Star star(final m=m)
  Modelica.Electrical.Polyphase.Sources.SineVoltage sineVoltage(
    final m=m,
    f=fill(fNominal, m),
    V=fill(sqrt(2.0/3.0)*VsNominal, m))
  Modelica.Electrical.Polyphase.Ideal.IdealClosingSwitch idealCloser(
    final m=m,
    Ron=fill(1e-5, m),
    Goff=fill(1e-5, m))
  Modelica.Blocks.Sources.BooleanStep booleanStep[m](each startTime=tOn, each
      startValue=false)
  Modelica.Electrical.Machines.Sensors.CurrentQuasiRMSSensor
    currentRMSsensorM
  Modelica.Electrical.Machines.Sensors.CurrentQuasiRMSSensor
    currentRMSsensorE
  Modelica.Electrical.Machines.Utilities.TerminalBox terminalBoxM(
      terminalConnection="D")
  Modelica.Electrical.Machines.Utilities.TerminalBox terminalBoxE(
      terminalConnection="D")
  Magnetic.FundamentalWave.BasicMachines.InductionMachines.IM_SquirrelCage aimcM(
    Jr=aimcData.Jr,
    Js=aimcData.Js,
    p=aimcData.p,
    fsNominal=aimcData.fsNominal,
    Rs=aimcData.Rs,
    TsRef=aimcData.TsRef,
    alpha20s(displayUnit="1/K") = aimcData.alpha20s,
    Lssigma=aimcData.Lssigma,
    ratioCommonStatorLeakage=aimcData.ratioCommonStatorLeakage,
    Lszero=aimcData.Lszero,
    frictionParameters=aimcData.frictionParameters,
    statorCoreParameters=aimcData.statorCoreParameters,
    strayLoadParameters=aimcData.strayLoadParameters,
    Lm=aimcData.Lm,
    Lrsigma=aimcData.Lrsigma,
    Rr=aimcData.Rr,
    TrRef=aimcData.TrRef,
    alpha20r(displayUnit="1/K") = aimcData.alpha20r,
    phiMechanical(fixed=true),
    wMechanical(fixed=true),
    TsOperational=293.15,
    effectiveStatorTurns=aimcData.effectiveStatorTurns,
    TrOperational=293.15)
  Modelica.Electrical.Machines.BasicMachines.InductionMachines.IM_SquirrelCage
    aimcE(
    p=aimcData.p,
    fsNominal=aimcData.fsNominal,
    Rs=aimcData.Rs,
    TsRef=aimcData.TsRef,
    alpha20s(displayUnit="1/K") = aimcData.alpha20s,
    Lszero=aimcData.Lszero,
    Lssigma=aimcData.Lssigma,
    Jr=aimcData.Jr,
    Js=aimcData.Js,
    frictionParameters=aimcData.frictionParameters,
    phiMechanical(fixed=true),
    wMechanical(fixed=true),
    statorCoreParameters=aimcData.statorCoreParameters,
    strayLoadParameters=aimcData.strayLoadParameters,
    Lm=aimcData.Lm,
    Lrsigma=aimcData.Lrsigma,
    Rr=aimcData.Rr,
    alpha20r(displayUnit="1/K") = aimcData.alpha20r,
    TsOperational=293.15,
    TrRef=aimcData.TrRef,
    TrOperational=293.15)
  Modelica.Mechanics.Rotational.Components.Inertia loadInertiaM(J=J_Load)
  Modelica.Mechanics.Rotational.Components.Inertia loadInertiaE(J=J_Load)
  Modelica.Mechanics.Rotational.Sources.QuadraticSpeedDependentTorque
    quadraticLoadTorqueM(
    w_nominal=w_Load,
    tau_nominal=-T_Load,
    TorqueDirection=false,
    useSupport=false)
  Modelica.Mechanics.Rotational.Sources.QuadraticSpeedDependentTorque
    quadraticLoadTorqueE(
    w_nominal=w_Load,
    tau_nominal=-T_Load,
    TorqueDirection=false,
    useSupport=false)
  parameter
    Modelica.Electrical.Machines.Utilities.ParameterRecords.IM_SquirrelCageData
    aimcData "Induction machine data"
  Modelica.Electrical.Polyphase.Sensors.CurrentQuasiRMSSensor currentQuasiRMSSensor
initial equation
  aimcE.is = zeros(m);
  aimcE.ir = zeros(2);
  aimcM.is = zeros(m);
  aimcM.rotorCage.electroMagneticConverter.Phi = Complex(0, 0);

equation
  connect(star.pin_n, ground.p)
  connect(sineVoltage.plug_n, star.plug_p)
  connect(aimcM.flange, loadInertiaM.flange_a)
  connect(loadInertiaM.flange_b, quadraticLoadTorqueM.flange)
  connect(terminalBoxM.plug_sn, aimcM.plug_sn)
  connect(terminalBoxM.plug_sp, aimcM.plug_sp)
  connect(aimcE.flange, loadInertiaE.flange_a)
  connect(loadInertiaE.flange_b, quadraticLoadTorqueE.flange)
  connect(terminalBoxE.plug_sn, aimcE.plug_sn)
  connect(terminalBoxE.plug_sp, aimcE.plug_sp)
  connect(currentRMSsensorE.plug_n, terminalBoxE.plugSupply)
  connect(sineVoltage.plug_p, idealCloser.plug_p)
  connect(idealCloser.plug_n, currentRMSsensorM.plug_p)
  connect(booleanStep.y, idealCloser.control)
  connect(currentRMSsensorE.plug_p, idealCloser.plug_n)
  connect(currentRMSsensorM.plug_n, currentQuasiRMSSensor.plug_p)
  connect(terminalBoxM.plugSupply, currentQuasiRMSSensor.plug_n)
end IMC_DOL;


Steady-state initialization of induction machine with squirrel cage. The induction machine with squirrel cage is initialized in steady-state at no-load;
at time tStart a load torque step is applied.

within Modelica.Magnetic.FundamentalWave.Examples.BasicMachines.InductionMachines;
model IMC_Initialize
  "Steady-state initialization of induction machine with squirrel cage"
  extends Modelica.Icons.Example;
  import Modelica.Constants.pi;
  constant Integer m=3 "Number of phases";
  parameter SI.Voltage VNominal=100
    "Nominal RMS voltage per phase";
  parameter SI.Frequency fNominal=aimcData.fsNominal "Nominal frequency";
  parameter SI.AngularVelocity wSync=2*pi*fNominal/aimc.p "Synchronous speed";
  parameter SI.Time tStart=0.5 "Start time";
  parameter SI.Torque TLoad=161.4 "Nominal load torque";
  parameter SI.AngularVelocity wLoad(displayUnit="rev/min")=
       1440.45*2*Modelica.Constants.pi/60 "Nominal load speed";
  parameter SI.Inertia JLoad=0.29
    "Load's moment of inertia";
  Magnetic.FundamentalWave.BasicMachines.InductionMachines.IM_SquirrelCage aimc(
    p=aimcData.p,
    fsNominal=aimcData.fsNominal,
    TsRef=aimcData.TsRef,
    alpha20s(displayUnit="1/K") = aimcData.alpha20s,
    Jr=aimcData.Jr,
    Js=aimcData.Js,
    ratioCommonStatorLeakage=aimcData.ratioCommonStatorLeakage,
    frictionParameters=aimcData.frictionParameters,
    statorCoreParameters=aimcData.statorCoreParameters,
    strayLoadParameters=aimcData.strayLoadParameters,
    TrRef=aimcData.TrRef,
    phiMechanical(fixed=true),
    Rs=aimcData.Rs*m/3,
    Lssigma=aimcData.Lssigma*m/3,
    Lszero=aimcData.Lszero*m/3,
    Lm=aimcData.Lm*m/3,
    Lrsigma=aimcData.Lrsigma*m/3,
    Rr=aimcData.Rr*m/3,
    TsOperational=293.15,
    effectiveStatorTurns=aimcData.effectiveStatorTurns,
    alpha20r=aimcData.alpha20r,
    TrOperational=293.15)
  Modelica.Electrical.Machines.Sensors.CurrentQuasiRMSSensor currentQuasiRMSSensor
  Modelica.Electrical.Polyphase.Sources.SineVoltage sineVoltage(
    final m=m,
    f=fill(fNominal, m),
    V=fill(sqrt(2/3)*VNominal, m))
  Modelica.Electrical.Polyphase.Basic.Star star(final m=m)
  Modelica.Electrical.Analog.Basic.Ground ground
  Modelica.Mechanics.Rotational.Components.Inertia loadInertia(J=JLoad)
  Modelica.Mechanics.Rotational.Sources.TorqueStep torqueStep(
    useSupport=false,
    startTime=tStart,
    stepTorque=-TLoad,
    offsetTorque=0)
  Modelica.Electrical.Machines.Utilities.TerminalBox terminalBox(
      terminalConnection="D")
  parameter
    Modelica.Electrical.Machines.Utilities.ParameterRecords.IM_SquirrelCageData
    aimcData "Induction machine data"
initial equation
  aimc.wMechanical = wSync;
  sum(aimc.is) = 0;
  der(aimc.airGap.V_msr.re) = 0;
  der(aimc.airGap.V_msr.im) = 0;
  der(aimc.airGap.V_mrr.re) = 0;
  der(aimc.airGap.V_mrr.im) = 0;
equation
  connect(star.pin_n, ground.p)
  connect(sineVoltage.plug_n, star.plug_p)
  connect(terminalBox.plug_sn, aimc.plug_sn)
  connect(terminalBox.plug_sp, aimc.plug_sp)
  connect(terminalBox.plugSupply, currentQuasiRMSSensor.plug_n)
  connect(loadInertia.flange_b, torqueStep.flange)
  connect(aimc.flange, loadInertia.flange_a)
  connect(sineVoltage.plug_p, currentQuasiRMSSensor.plug_p)
end IMC_Initialize;


Induction machine with squirrel cage and inverter. An ideal frequency inverter is modeled by using a VfController and a three-phase SignalVoltage.
Frequency is raised by a ramp, causing the induction machine with squirrel cage to start,
and accelerating inertias. At time tStep a load step is applied.

within Modelica.Magnetic.FundamentalWave.Examples.BasicMachines.InductionMachines;
model IMC_Inverter
  "Induction machine with squirrel cage and inverter"
  extends Modelica.Icons.Example;
  constant Integer m=3 "Number of phases";
  parameter SI.Voltage VNominal=100
    "Nominal RMS voltage per phase";
  parameter SI.Frequency fNominal=aimcData.fsNominal "Nominal frequency";
  parameter SI.Frequency f=fNominal "Maximum operational frequency";
  SI.Frequency fActual=ramp.y "Actual frequency";
  parameter SI.Time tRamp=1 "Frequency ramp";
  parameter SI.Torque TLoad=161.4 "Nominal load torque";
  parameter SI.Time tStep=1.2 "Time of load torque step";
  parameter SI.Inertia JLoad=0.29
    "Load's moment of inertia";
  Magnetic.FundamentalWave.BasicMachines.InductionMachines.IM_SquirrelCage aimc(
    p=aimcData.p,
    fsNominal=aimcData.fsNominal,
    TsRef=aimcData.TsRef,
    alpha20s(displayUnit="1/K") = aimcData.alpha20s,
    Jr=aimcData.Jr,
    Js=aimcData.Js,
    ratioCommonStatorLeakage=aimcData.ratioCommonStatorLeakage,
    frictionParameters=aimcData.frictionParameters,
    phiMechanical(fixed=true),
    wMechanical(fixed=true),
    statorCoreParameters=aimcData.statorCoreParameters,
    strayLoadParameters=aimcData.strayLoadParameters,
    TrRef=aimcData.TrRef,
    Rs=aimcData.Rs*m/3,
    Lssigma=aimcData.Lssigma*m/3,
    Lszero=aimcData.Lszero*m/3,
    Lm=aimcData.Lm*m/3,
    Lrsigma=aimcData.Lrsigma*m/3,
    Rr=aimcData.Rr*m/3,
    TsOperational=293.15,
    effectiveStatorTurns=aimcData.effectiveStatorTurns,
    alpha20r=aimcData.alpha20r,
    TrOperational=293.15)
  Modelica.Electrical.Machines.Sensors.CurrentQuasiRMSSensor currentQuasiRMSSensor
  Modelica.Blocks.Sources.Ramp ramp(height=f, duration=tRamp)
  Modelica.Electrical.Machines.Utilities.VfController vfController(
    final m=m,
    VNominal=VNominal,
    fNominal=fNominal)
  Modelica.Electrical.Polyphase.Sources.SignalVoltage signalVoltage(
      final m=m)
  Modelica.Electrical.Polyphase.Basic.Star star(final m=m)
  Modelica.Electrical.Analog.Basic.Ground ground
  Modelica.Mechanics.Rotational.Components.Inertia loadInertia(J=JLoad)
  Modelica.Mechanics.Rotational.Sources.TorqueStep loadTorqueStep(
    startTime=tStep,
    stepTorque=-TLoad,
    useSupport=false,
    offsetTorque=0)
  Modelica.Electrical.Machines.Utilities.TerminalBox terminalBox(
      terminalConnection="Y")
  parameter
    Modelica.Electrical.Machines.Utilities.ParameterRecords.IM_SquirrelCageData
    aimcData "Induction machine data"
initial equation
  aimc.is[1:2] = zeros(2);
  aimc.rotorCage.electroMagneticConverter.V_m = Complex(0, 0);
equation
  connect(signalVoltage.plug_n, star.plug_p)
  connect(star.pin_n, ground.p)
  connect(ramp.y, vfController.u)
  connect(vfController.y, signalVoltage.v)
  connect(loadTorqueStep.flange, loadInertia.flange_b)
  connect(signalVoltage.plug_p, currentQuasiRMSSensor.plug_p)
  connect(terminalBox.plugSupply, currentQuasiRMSSensor.plug_n)
  connect(terminalBox.plug_sn, aimc.plug_sn)
  connect(terminalBox.plug_sp, aimc.plug_sp)
  connect(aimc.flange, loadInertia.flange_a)
end IMC_Inverter;


Induction machine with squirrel cage and Steinmetz-connection. At start time tStart single-phase voltage is supplied to the induction machine with squirrel cage;
the machine starts from standstill, accelerating inertias against load torque quadratic dependent on speed,
finally reaching nominal speed.

within Modelica.Magnetic.FundamentalWave.Examples.BasicMachines.InductionMachines;
model IMC_Steinmetz
  "Induction machine with squirrel cage and Steinmetz-connection"

  extends Modelica.Icons.Example;
  constant Integer m=3 "Number of phases";
  parameter SI.Voltage VNominal=100
    "Nominal RMS voltage per phase";
  parameter SI.Frequency fNominal=aimcData.fsNominal "Nominal frequency";
  parameter SI.Time tStart1=0.1 "Start time";
  parameter SI.Capacitance Cr=0.0035
    "Motor's running capacitor";
  parameter SI.Capacitance Cs=5*Cr
    "Motor's (additional) starting capacitor";
  parameter SI.AngularVelocity wSwitch(displayUnit="rev/min")=
       1350*2*Modelica.Constants.pi/60
    "Speed for switching off the starting capacitor";
  parameter SI.Torque TLoad=2/3*161.4 "Nominal load torque";
  parameter SI.AngularVelocity wLoad(displayUnit="rev/min")=
       1462.5*2*Modelica.Constants.pi/60 "Nominal load speed";
  parameter SI.Inertia JLoad=0.29
    "Load's moment of inertia";
  Magnetic.FundamentalWave.BasicMachines.InductionMachines.IM_SquirrelCage aimc(
    p=aimcData.p,
    fsNominal=aimcData.fsNominal,
    TsRef=aimcData.TsRef,
    alpha20s(displayUnit="1/K") = aimcData.alpha20s,
    Jr=aimcData.Jr,
    Js=aimcData.Js,
    ratioCommonStatorLeakage=aimcData.ratioCommonStatorLeakage,
    frictionParameters=aimcData.frictionParameters,
    phiMechanical(fixed=true),
    wMechanical(fixed=true),
    statorCoreParameters=aimcData.statorCoreParameters,
    strayLoadParameters=aimcData.strayLoadParameters,
    TrRef=aimcData.TrRef,
    Rs=aimcData.Rs*m/3,
    Lssigma=aimcData.Lssigma*m/3,
    Lszero=aimcData.Lszero*m/3,
    Lm=aimcData.Lm*m/3,
    Lrsigma=aimcData.Lrsigma*m/3,
    Rr=aimcData.Rr*m/3,
    TsOperational=293.15,
    effectiveStatorTurns=aimcData.effectiveStatorTurns,
    alpha20r=aimcData.alpha20r,
    TrOperational=293.15)
  Modelica.Electrical.Analog.Sources.SineVoltage sineVoltage(f=
        fNominal, V=sqrt(2)*VNominal)
  Modelica.Electrical.Analog.Basic.Ground ground
  Modelica.Blocks.Sources.BooleanStep booleanStep(startTime=tStart1)
  Modelica.Electrical.Analog.Ideal.IdealClosingSwitch idealCloser
  Modelica.Mechanics.Rotational.Components.Inertia loadInertia(J=JLoad)
  Modelica.Mechanics.Rotational.Sources.QuadraticSpeedDependentTorque
    quadraticLoadTorque(
    w_nominal=wLoad,
    TorqueDirection=false,
    tau_nominal=-TLoad,
    useSupport=false)
  Modelica.Electrical.Machines.Utilities.TerminalBox TerminalBox1(
      terminalConnection="D")
  Modelica.Electrical.Polyphase.Basic.PlugToPin_p plugToPin_p3(m=m, k=3)
  Modelica.Electrical.Polyphase.Basic.PlugToPin_p plugToPin_p2(m=m, k=2)
  Modelica.Electrical.Polyphase.Basic.PlugToPin_p plugToPin_p1(m=m, k=1)
  Modelica.Electrical.Analog.Basic.Capacitor cRun(C=Cr)
  Modelica.Electrical.Analog.Basic.Capacitor cStart(C=Cs)
  Modelica.Electrical.Analog.Ideal.IdealOpeningSwitch idealOpener
  Modelica.Blocks.Logical.GreaterThreshold greaterThreshold(threshold=
        wSwitch)
  Modelica.Mechanics.Rotational.Sensors.SpeedSensor relSpeedSensor
  parameter
    Modelica.Electrical.Machines.Utilities.ParameterRecords.IM_SquirrelCageData
    aimcData "Induction machine data"
  Modelica.Electrical.Machines.Sensors.CurrentQuasiRMSSensor currentQuasiRMSSensor
initial equation
  aimc.is = zeros(3);
  aimc.rotorCage.electroMagneticConverter.V_m = Complex(0, 0);
  cStart.v = 0;
  cRun.v = 0;
equation
  connect(ground.p, sineVoltage.n)
  connect(sineVoltage.p, idealCloser.p)
  connect(booleanStep.y, idealCloser.control)
  connect(plugToPin_p3.pin_p, sineVoltage.n)
  connect(idealCloser.n, plugToPin_p2.pin_p)
  connect(cRun.n, plugToPin_p1.pin_p)
  connect(loadInertia.flange_b, quadraticLoadTorque.flange)
  connect(cRun.p, idealCloser.n)
  connect(plugToPin_p1.pin_p, cStart.n)
  connect(idealOpener.n, cStart.p)
  connect(idealOpener.p, idealCloser.n)
  connect(greaterThreshold.y, idealOpener.control)
  connect(TerminalBox1.plug_sn, aimc.plug_sn)
  connect(TerminalBox1.plug_sp, aimc.plug_sp)
  connect(aimc.flange, loadInertia.flange_a)
  connect(relSpeedSensor.flange, aimc.flange)
  connect(relSpeedSensor.w, greaterThreshold.u)
  connect(plugToPin_p3.plug_p, currentQuasiRMSSensor.plug_p)
  connect(plugToPin_p2.plug_p, currentQuasiRMSSensor.plug_p)
  connect(plugToPin_p1.plug_p, currentQuasiRMSSensor.plug_p)
  connect(currentQuasiRMSSensor.plug_n, TerminalBox1.plugSupply)
end IMC_Steinmetz;


Induction machine with squirrel cage starting with transformer. At start time tStart1 three-phase voltage is supplied to the induction machine with squirrel cage via the transformer;
the machine starts from standstill, accelerating inertias against load torque quadratic dependent on speed;
at start time tStart2 the machine is fed directly from the voltage source, finally reaching nominal speed.

within Modelica.Magnetic.FundamentalWave.Examples.BasicMachines.InductionMachines;
model IMC_Transformer
  "Induction machine with squirrel cage starting with transformer"

  extends Modelica.Icons.Example;
  constant Integer m=3 "Number of phases";
  parameter SI.Voltage VNominal=100
    "Nominal RMS voltage per phase";
  parameter SI.Frequency fNominal=aimcData.fsNominal "Nominal frequency";
  parameter SI.Time tStart1=0.1 "Start time";
  parameter SI.Time tStart2=2.0
    "Start time of bypass transformer";
  parameter SI.Torque TLoad=161.4 "Nominal load torque";
  parameter SI.AngularVelocity wLoad(displayUnit="rev/min")=
       1440.45*2*Modelica.Constants.pi/60 "Nominal load speed";
  parameter SI.Inertia JLoad=0.29
    "Load's moment of inertia";
  Magnetic.FundamentalWave.BasicMachines.InductionMachines.IM_SquirrelCage aimc(
    p=aimcData.p,
    fsNominal=aimcData.fsNominal,
    TsRef=aimcData.TsRef,
    alpha20s(displayUnit="1/K") = aimcData.alpha20s,
    Jr=aimcData.Jr,
    Js=aimcData.Js,
    ratioCommonStatorLeakage=aimcData.ratioCommonStatorLeakage,
    frictionParameters=aimcData.frictionParameters,
    phiMechanical(fixed=true),
    wMechanical(fixed=true),
    statorCoreParameters=aimcData.statorCoreParameters,
    strayLoadParameters=aimcData.strayLoadParameters,
    TrRef=aimcData.TrRef,
    Rs=aimcData.Rs*m/3,
    Lssigma=aimcData.Lssigma*m/3,
    Lszero=aimcData.Lszero*m/3,
    Lm=aimcData.Lm*m/3,
    Lrsigma=aimcData.Lrsigma*m/3,
    Rr=aimcData.Rr*m/3,
    TsOperational=293.15,
    effectiveStatorTurns=aimcData.effectiveStatorTurns,
    alpha20r=aimcData.alpha20r,
    TrOperational=293.15)
  Modelica.Electrical.Machines.Sensors.CurrentQuasiRMSSensor currentQuasiRMSSensor
  Modelica.Electrical.Polyphase.Sources.SineVoltage sineVoltage(
    final m=m,
    f=fill(fNominal, m),
    V=fill(sqrt(2/3)*VNominal, m))
  Modelica.Electrical.Polyphase.Basic.Star star(final m=m)
  Modelica.Electrical.Analog.Basic.Ground ground
  Modelica.Blocks.Sources.BooleanStep booleanStep1[m](each startTime=
        tStart1)
  Modelica.Electrical.Polyphase.Ideal.IdealClosingSwitch idealCloser(
    final m=m,
    Ron=fill(1e-5, m),
    Goff=fill(1e-5, m))
  Modelica.Electrical.Machines.BasicMachines.Transformers.Yy.Yy00 transformer(
    n=transformerData.n,
    R1=transformerData.R1,
    L1sigma=transformerData.L1sigma,
    R2=transformerData.R2,
    L2sigma=transformerData.L2sigma,
    T1Ref=293.15,
    alpha20_1(displayUnit="1/K") = Modelica.Electrical.Machines.Thermal.Constants.alpha20Zero,
    T2Ref=293.15,
    alpha20_2(displayUnit="1/K") = Modelica.Electrical.Machines.Thermal.Constants.alpha20Zero,
    T1Operational=293.15,
    T2Operational=293.15)

  Modelica.Electrical.Analog.Basic.Ground ground2
  parameter Modelica.Electrical.Machines.Utilities.TransformerData transformerData(
    f=fNominal,
    V1=VNominal,
    C1=Modelica.Utilities.Strings.substring(
        transformer.VectorGroup,
        1,
        1),
    V2=VNominal/sqrt(3),
    C2=Modelica.Utilities.Strings.substring(
        transformer.VectorGroup,
        2,
        2),
    SNominal=50E3,
    v_sc=0.06,
    P_sc=500) "Transformer data"
  Modelica.Blocks.Sources.BooleanStep booleanStep2[m](each startTime=
        tStart2)
  Modelica.Electrical.Polyphase.Ideal.IdealCommutingSwitch
    idealCommutingSwitch(
    final m=m,
    Ron=fill(1e-5, m),
    Goff=fill(50E-5, m))
  Modelica.Mechanics.Rotational.Components.Inertia loadInertia(J=JLoad)
  Modelica.Mechanics.Rotational.Sources.QuadraticSpeedDependentTorque
    quadraticLoadTorque(
    w_nominal=wLoad,
    TorqueDirection=false,
    tau_nominal=-TLoad,
    useSupport=false)
  Modelica.Electrical.Machines.Utilities.TerminalBox terminalBox(
      terminalConnection="D")
  parameter
    Modelica.Electrical.Machines.Utilities.ParameterRecords.IM_SquirrelCageData
    aimcData "Induction machine data"
initial equation
  aimc.is = zeros(3);
  aimc.rotorCage.electroMagneticConverter.V_m = Complex(0, 0);
  transformer.i1[1:2] = zeros(2);
equation
  connect(star.pin_n, ground.p)
  connect(terminalBox.plug_sn, aimc.plug_sn)
  connect(terminalBox.plug_sp, aimc.plug_sp)
  connect(loadInertia.flange_b, quadraticLoadTorque.flange)
  connect(aimc.flange, loadInertia.flange_a)
  connect(star.plug_p, sineVoltage.plug_n)
  connect(booleanStep2.y, idealCommutingSwitch.control)
  connect(transformer.starpoint2, ground2.p)
  connect(idealCommutingSwitch.plug_p, terminalBox.plugSupply)
  connect(transformer.plug2, idealCommutingSwitch.plug_n1)
  connect(sineVoltage.plug_p, currentQuasiRMSSensor.plug_p)
  connect(booleanStep1.y, idealCloser.control)
  connect(currentQuasiRMSSensor.plug_n, idealCloser.plug_p)
  connect(transformer.plug1, idealCloser.plug_n)
  connect(idealCloser.plug_n, idealCommutingSwitch.plug_n2)
end IMC_Transformer;


Induction machine with squirrel cage and losses.

within Modelica.Magnetic.FundamentalWave.Examples.BasicMachines.InductionMachines;
model IMC_withLosses
  "Induction machine with squirrel cage and losses"
  extends Modelica.Icons.Example;
  constant Integer m=3 "Number of phases";
  import Modelica.Constants.pi;
  import Modelica.Units.Conversions.from_rpm;
  import Modelica.Units.Conversions.to_rpm;
  import Modelica.Units.Conversions.from_degC;
protected
  parameter SI.Power PNominal=18500 "Nominal output";
  parameter SI.Voltage VNominal=400 "Nominal RMS voltage";
  parameter SI.Current INominal=32.85 "Nominal RMS current";
  parameter Real pfNominal=0.898 "Nominal power factor";
  parameter SI.Power PsNominal=sqrt(3)*VNominal*INominal*pfNominal "Nominal stator power";
  parameter SI.Power lossNominal=PsNominal-PNominal "Nominal losses";
  parameter Real etaNominal=0.9049 "Nominal efficiency";
  parameter SI.Frequency fNominal=aimcData.fsNominal "Nominal frequency";
  parameter SI.AngularVelocity wNominal=from_rpm(1462.5)
    "Nominal speed";
  parameter SI.Torque TNominal=PNominal/wNominal
    "Nominal torque";
  parameter SI.Temperature TempNominal=from_degC(90)
    "Nominal temperature";
  SI.Power Pel=electricalPowerSensor.P;
  SI.ReactivePower Qel=electricalPowerSensor.Q;
  SI.ApparentPower Sel=sqrt(Pel^2 + Qel^2);
  parameter Real Ptable[:]={1E-6,1845,3549,5325,7521,9372,11010,12930,
      14950,16360,18500,18560,20180,22170} "Table of measured power data";
  parameter Real Itable[:]={11.0,11.20,12.27,13.87,16.41,18.78,21.07,
      23.92,27.05,29.40,32.85,32.95,35.92,39.35} "Table of measured current data";
  parameter Real wtable[:]=from_rpm({1500,1496,1493,1490,1486,1482,1479,1475,1471,
      1467,1462,1462,1458,1453}) "Table of measured speed data";
  parameter Real ctable[:]={0.085,0.327,0.506,0.636,0.741,0.797,0.831,
      0.857,0.875,0.887,0.896,0.896,0.902,0.906} "Table of measured power factor data";
  parameter Real etable[:]={0,0.7250,0.8268,0.8698,0.8929,0.9028,0.9064,
      0.9088,0.9089,0.9070,0.9044,0.9043,0.9008,0.8972} "Table of measured efficiency data";
public
  output SI.Power Pmech=powerSensor.power "Mechanical output";
  output SI.Power Ps_sim=sqrt(3)*VNominal*I_sim*pf_sim "Simulated stator power";
  output SI.Power Ps_meas=sqrt(3)*VNominal*I_meas*pf_meas "Simulated stator power";
  output SI.Power loss_sim=Ps_sim-Pmech "Simulated total losses";
  output SI.Power loss_meas=Ps_meas-Pmech "Measured total losses";
  output SI.Current I_sim=currentQuasiRMSSensor.I "Simulated current";
  output SI.Current I_meas=combiTable1Ds.y[1] "Measured current";
  output SI.AngularVelocity w_sim(displayUnit="rev/min")=aimc.wMechanical "Simulated speed";
  output SI.AngularVelocity w_meas(displayUnit="rev/min")=combiTable1Ds.y[2] "Measured speed";
  output Real pf_sim=if noEvent(Sel > Modelica.Constants.small) then Pel/Sel else 0 "Simulated power factor";
  output Real pf_meas=combiTable1Ds.y[3] "Measured power factor";
  output Real eff_sim=if noEvent(abs(Pel) > Modelica.Constants.small) then Pmech/Pel else 0 "Simulated efficiency";
  output Real eff_meas=combiTable1Ds.y[4] "Measured efficiency";
  Magnetic.FundamentalWave.BasicMachines.InductionMachines.IM_SquirrelCage aimc(
    p=aimcData.p,
    fsNominal=aimcData.fsNominal,
    TsRef=aimcData.TsRef,
    alpha20s(displayUnit="1/K") = aimcData.alpha20s,
    Jr=aimcData.Jr,
    Js=aimcData.Js,
    ratioCommonStatorLeakage=aimcData.ratioCommonStatorLeakage,
    frictionParameters=aimcData.frictionParameters,
    phiMechanical(fixed=true),
    statorCoreParameters=aimcData.statorCoreParameters,
    strayLoadParameters=aimcData.strayLoadParameters,
    TrRef=aimcData.TrRef,
    TsOperational=TempNominal,
    TrOperational=TempNominal,
    wMechanical(fixed=true, start=2*pi*aimcData.fsNominal/aimcData.p),
    Rs=aimcData.Rs*m/3,
    Lssigma=aimcData.Lssigma*m/3,
    Lszero=aimcData.Lszero*m/3,
    Lm=aimcData.Lm*m/3,
    Lrsigma=aimcData.Lrsigma*m/3,
    Rr=aimcData.Rr*m/3,
    effectiveStatorTurns=aimcData.effectiveStatorTurns,
    alpha20r=aimcData.alpha20r)
  Modelica.Electrical.Machines.Utilities.TerminalBox terminalBox(
      terminalConnection="D")
  Modelica.Electrical.Machines.Sensors.ElectricalPowerSensor electricalPowerSensor
  Modelica.Electrical.Machines.Sensors.CurrentQuasiRMSSensor currentQuasiRMSSensor
  Modelica.Electrical.Polyphase.Sources.SineVoltage sineVoltage(
    final m=m,
    f=fill(fNominal, m),
    V=fill(sqrt(2/3)*VNominal, m))
  Modelica.Electrical.Polyphase.Basic.Star star(final m=m)
  Modelica.Electrical.Analog.Basic.Ground ground
  Modelica.Mechanics.Rotational.Sensors.PowerSensor powerSensor
  Modelica.Mechanics.Rotational.Components.Inertia loadInertia(J=aimcData.Jr)
  Modelica.Mechanics.Rotational.Sources.Torque torque
  Modelica.Blocks.Math.Gain gain(k=-1)
  Modelica.Blocks.Continuous.PI PI(
    k=0.01,
    T=0.01,
    initType=Modelica.Blocks.Types.Init.InitialState)
  Modelica.Blocks.Math.Feedback feedback
  Modelica.Blocks.Sources.Ramp ramp(
    height=1.2*PNominal,
    offset=0,
    startTime=4.5,
    duration=5.5)
  Modelica.Blocks.Tables.CombiTable1Ds combiTable1Ds(table={{Ptable[j],
        Itable[j],wtable[j],ctable[j],etable[j]} for j in 1:size(Ptable,
        1)}, smoothness=Modelica.Blocks.Types.Smoothness.ContinuousDerivative)
  parameter
    Modelica.Electrical.Machines.Utilities.ParameterRecords.IM_SquirrelCageData
    aimcData(
    statorCoreParameters(PRef=410, VRef=387.9),
    Jr=0.12,
    Rs=0.56,
    alpha20s(displayUnit="1/K") = Modelica.Electrical.Machines.Thermal.Constants.alpha20Copper,
    Lssigma=1.52/(2*pi*fNominal),
    frictionParameters(PRef=180, wRef=wNominal),
    strayLoadParameters(
      PRef=0.005*sqrt(3)*VNominal*INominal*pfNominal,
      IRef=INominal/sqrt(3),
      wRef=wNominal),
    Lm=66.4/(2*pi*fNominal),
    Lrsigma=2.31/(2*pi*fNominal),
    Rr=0.42,
    alpha20r(displayUnit="1/K") = Modelica.Electrical.Machines.Thermal.Constants.alpha20Aluminium)
    "Induction machine data"

initial equation
  sum(aimc.is) = 0;
  der(aimc.airGap.V_msr.re) = 0;
  der(aimc.airGap.V_msr.im) = 0;
  der(aimc.airGap.V_mrr.re) = 0;
  der(aimc.airGap.V_mrr.im) = 0;
equation
  connect(star.pin_n, ground.p)
  connect(sineVoltage.plug_n, star.plug_p)
  connect(terminalBox.plug_sn, aimc.plug_sn)
  connect(terminalBox.plug_sp, aimc.plug_sp)
  connect(currentQuasiRMSSensor.plug_n, electricalPowerSensor.plug_p)

  connect(electricalPowerSensor.plug_nv, star.plug_p)
  connect(electricalPowerSensor.plug_ni, terminalBox.plugSupply)
  connect(aimc.flange, powerSensor.flange_a)
  connect(powerSensor.flange_b, loadInertia.flange_a)
  connect(torque.flange, loadInertia.flange_b)
  connect(gain.y, torque.tau)
  connect(sineVoltage.plug_p, currentQuasiRMSSensor.plug_p)
  connect(powerSensor.power, feedback.u2)
  connect(feedback.y, PI.u)
  connect(PI.y, gain.u)
  connect(ramp.y, feedback.u1)
  connect(powerSensor.power, combiTable1Ds.u)
end IMC_withLosses;


Induction machine with squirrel cage starting Y-D. At start time tStart three-phase voltage is supplied to the induction machine with squirrel cage,
first star-connected, then delta-connected; the machine starts from standstill,
accelerating inertias against load torque quadratic dependent on speed, finally reaching nominal speed.

within Modelica.Magnetic.FundamentalWave.Examples.BasicMachines.InductionMachines;
model IMC_YD
  "Induction machine with squirrel cage starting Y-D"

  extends Modelica.Icons.Example;
  constant Integer m=3 "Number of phases";
  parameter SI.Voltage VNominal=100
    "Nominal RMS voltage per phase";
  parameter SI.Frequency fNominal=aimcData.fsNominal "Nominal frequency";
  parameter SI.Time tStart1=0.1 "Start time";
  parameter SI.Time tStart2=2.0 "Start time from Y to D";
  parameter SI.Torque TLoad=161.4 "Nominal load torque";
  parameter SI.AngularVelocity wLoad(displayUnit="rev/min")=
       1440.45*2*Modelica.Constants.pi/60 "Nominal load speed";
  parameter SI.Inertia JLoad=0.29
    "Load's moment of inertia";
  Magnetic.FundamentalWave.BasicMachines.InductionMachines.IM_SquirrelCage aimc(
    p=aimcData.p,
    fsNominal=aimcData.fsNominal,
    TsRef=aimcData.TsRef,
    alpha20s(displayUnit="1/K") = aimcData.alpha20s,
    Jr=aimcData.Jr,
    Js=aimcData.Js,
    ratioCommonStatorLeakage=aimcData.ratioCommonStatorLeakage,
    frictionParameters=aimcData.frictionParameters,
    phiMechanical(fixed=true),
    wMechanical(fixed=true),
    statorCoreParameters=aimcData.statorCoreParameters,
    strayLoadParameters=aimcData.strayLoadParameters,
    TrRef=aimcData.TrRef,
    Rs=aimcData.Rs*m/3,
    Lssigma=aimcData.Lssigma*m/3,
    Lszero=aimcData.Lszero*m/3,
    Lm=aimcData.Lm*m/3,
    Lrsigma=aimcData.Lrsigma*m/3,
    Rr=aimcData.Rr*m/3,
    TsOperational=293.15,
    effectiveStatorTurns=aimcData.effectiveStatorTurns,
    alpha20r=aimcData.alpha20r,
    TrOperational=293.15)
  Modelica.Electrical.Machines.Sensors.CurrentQuasiRMSSensor currentQuasiRMSSensor
  Modelica.Electrical.Polyphase.Sources.SineVoltage sineVoltage(
    final m=m,
    f=fill(fNominal, m),
    V=fill(sqrt(2/3)*VNominal, m))
  Modelica.Electrical.Polyphase.Basic.Star star(final m=m)
  Modelica.Electrical.Analog.Basic.Ground ground
  Modelica.Blocks.Sources.BooleanStep booleanStep[m](each startTime=
        tStart1)
  Modelica.Electrical.Polyphase.Ideal.IdealClosingSwitch idealCloser(
    final m=m,
    Ron=fill(1e-5, m),
    Goff=fill(1e-5, m))
  Modelica.Electrical.Machines.Utilities.SwitchYD switchYD(m=m)
  Modelica.Blocks.Sources.BooleanStep booleanStepYD[m](each startTime=
        tStart2)
  Modelica.Mechanics.Rotational.Components.Inertia loadInertia(J=JLoad)
  Modelica.Mechanics.Rotational.Sources.QuadraticSpeedDependentTorque
    quadraticLoadTorque(
    w_nominal=wLoad,
    TorqueDirection=false,
    tau_nominal=-TLoad,
    useSupport=false)
  parameter
    Modelica.Electrical.Machines.Utilities.ParameterRecords.IM_SquirrelCageData
    aimcData "Induction machine data"
initial equation
  aimc.is = zeros(3);
  aimc.rotorCage.electroMagneticConverter.V_m = Complex(0, 0);
equation
  connect(star.pin_n, ground.p)
  connect(sineVoltage.plug_n, star.plug_p)
  connect(sineVoltage.plug_p, idealCloser.plug_p)
  connect(loadInertia.flange_b, quadraticLoadTorque.flange)
  connect(booleanStep.y, idealCloser.control)
  connect(booleanStepYD.y, switchYD.control)
  connect(idealCloser.plug_n, currentQuasiRMSSensor.plug_p)
  connect(switchYD.plug_sn, aimc.plug_sn)
  connect(switchYD.plug_sp, aimc.plug_sp)
  connect(switchYD.plugSupply, currentQuasiRMSSensor.plug_n)
  connect(aimc.flange, loadInertia.flange_a)
end IMC_YD;