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

within Modelica.Magnetic.QuasiStatic.FundamentalWave.BaseClasses;
partial model Machine "Base model of machines"
  constant SI.Angle pi = Modelica.Constants.pi;
  extends Modelica.Electrical.Machines.Icons.QuasiStaticFundamentalWaveMachine;
  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=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*(1 - sqrt(1 -
        0.0667))/(2*pi*fsNominal)) "Stator stray inductance per phase"
  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(
    final 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"
  output SI.Angle gammas(start=0) = airGap.gammas
    "Angle of stator reference frame";
  output SI.Angle gammar(start=0) = airGap.gammar
    "Angle of stator reference frame";
  output SI.Angle gamma(start=0) = airGap.gamma
    "Electrical angle between stator and rotor";
  // Mechanical quantities
  output SI.Angle phiMechanical=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.QuasiStatic.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.ComplexVoltage vs[m]=plug_sp.pin.v - plug_sn.pin.v
    "Complex stator voltage";
  SI.Voltage abs_vs[m]=Modelica.ComplexMath.abs(vs)
    "Magnitude of complex stator voltage";
  SI.Angle arg_vs[m]=Modelica.ComplexMath.arg(vs)
    "Argument of complex stator voltage";

  output SI.ComplexCurrent is[m]=plug_sp.pin.i
    "Complex stator current";
  SI.Current abs_is[m]=Modelica.ComplexMath.abs(is)
    "Magnitude of complex stator current";
  SI.Angle arg_is[m]=Modelica.ComplexMath.arg(is)
    "Argument of complex stator current";

  SI.ActivePower Ps[m]={Modelica.ComplexMath.real(vs[k]*
      Modelica.ComplexMath.conj(is[k])) for k in 1:m}
    "Active stator power";
  SI.ActivePower Ps_total=sum(Ps)
    "Total active stator power";
  SI.ReactivePower Qs[m]={Modelica.ComplexMath.imag(vs[k]*
      Modelica.ComplexMath.conj(is[k])) for k in 1:m}
    "Reactive stator power";
  SI.ReactivePower Qs_total=sum(Qs)
    "Total reactive stator power";
  SI.ApparentPower Ss[m]={Modelica.ComplexMath.abs(vs[k]*
      Modelica.ComplexMath.conj(is[k])) for k in 1:m}
    "Magnitude of complex stator apparent power";
  SI.ApparentPower Ss_total=sqrt(Ps_total^2 + Qs_total^2)
    "Magnitude of total complex stator apparent power";
  Real pfs[m]={cos(Modelica.ComplexMath.arg(Complex(Ps[k], Qs[k]))) for k in
          1:m} "Stator power factor";

  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.QuasiStatic.Polyphase.Interfaces.PositivePlug
    plug_sp(final m=m) "Positive plug of stator"
  Modelica.Electrical.QuasiStatic.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 effectiveTurns=effectiveStatorTurns,
    final TOperational=TsOperational,
    final GcRef=statorCoreParameters.GcRef,
    final alpha20=alpha20s)
    "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.QuasiStatic.FundamentalWave.Components.Ground groundS
    "Ground of stator magnetic circuit"
  BasicMachines.Components.RotorSaliencyAirGap airGap(final p=p, final L0=
       L0)
  Magnetic.QuasiStatic.FundamentalWave.Components.Ground groundR
    "Ground of rotor magnetic circuit"
  Losses.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.QuasiStatic.FundamentalWave;
package BaseClasses "Base classes of fundamental wave machines"
  extends Modelica.Icons.BasesPackage;
end BaseClasses;


Basic quasi-static machine models

within Modelica.Magnetic.QuasiStatic.FundamentalWave;
package BasicMachines "Basic quasi-static machine models"
  extends Modelica.Icons.Package;
end BasicMachines;


within Modelica.Magnetic.QuasiStatic.FundamentalWave.BasicMachines;
package Components "Components for quasi-static machine models"
  extends Modelica.Icons.Package;
end Components;


Permanent magnet model without intrinsic reluctance, represented by magnetic potential difference. Permanent magnet model with magnetic, mechanical and thermal connector including losses. The PM model is source  of constant magnetic potential difference. The PM loss is calculated by
PermanentMagnetLosses.

within Modelica.Magnetic.QuasiStatic.FundamentalWave.BasicMachines.Components;
model PermanentMagnet
  "Permanent magnet model without intrinsic reluctance, represented by magnetic potential difference"
  extends FundamentalWave.Losses.PermanentMagnetLosses;
  extends Magnetic.QuasiStatic.FundamentalWave.Interfaces.TwoPortElementary;
  parameter SI.ComplexMagneticPotentialDifference V_m=
      Complex(re=1, im=0)
    "Complex magnetic potential difference w.r.t. the rotor fixed reference frame";
  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 w.r.t. reference frame";

  SI.Angle gamma "Angle of V_m fixed reference frame";
  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";
  SI.ComplexMagneticPotentialDifference V_mGamma=V_m*
      Modelica.ComplexMath.fromPolar(1, -gamma)
    "Magnetic potential difference w.r.t. the reference frame";
equation
  // Magnetomotive force with respect to rotor fixed reference
  port_p.V_m - port_n.V_m = V_mGamma;
  // Flux into positive port with respect to rotor fixed reference
  port_p.Phi = Phi;
  // Local flux balance
  port_p.Phi + port_n.Phi = Complex(0, 0);
  // Reference angular speed and angle
  gamma = port_p.reference.gamma;
  // Connections.root(port_p.reference);
end PermanentMagnet;


Quasi-static single-phase winding neglecting induced voltage. The single-phase winding consists of a
resistor,  and a
single-phase electromagnetic coupling.

within Modelica.Magnetic.QuasiStatic.FundamentalWave.BasicMachines.Components;
model QuasiStaticAnalogWinding
  "Quasi-static single-phase winding neglecting induced voltage"

  Modelica.Electrical.Analog.Interfaces.PositivePin pin_p "Positive pin"
  Modelica.Electrical.Analog.Interfaces.NegativePin pin_n "Negative pin"
  Interfaces.NegativeMagneticPort port_n "Negative complex magnetic port"
  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 Real effectiveTurns=1 "Effective number of turns per phase";

  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)
  FundamentalWave.Components.QuasiStaticAnalogElectroMagneticConverter
    electroMagneticConverter(final effectiveTurns=effectiveTurns)
  Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a heatPortWinding if
    useHeatPort "Heat ports of winding resistor"
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)
end QuasiStaticAnalogWinding;


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.QuasiStatic.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_ms
    "Complex magnetic potential difference of stator w.r.t. stator fixed frame";
  SI.ComplexMagneticPotentialDifference V_msr=V_ms*
      Modelica.ComplexMath.fromPolar(1, gammar)
    "Complex magnetic potential difference of stator w.r.t. rotor fixed frame";
  SI.ComplexMagneticPotentialDifference V_mr
    "Complex magnetic potential difference of rotor w.r.t. rotor fixed frame";
  SI.ComplexMagneticPotentialDifference V_mrr=V_mr*
      Modelica.ComplexMath.fromPolar(1, gammar)
    "Complex magnetic potential difference of rotor w.r.t. rotor fixed frame";
  // Complex phasors of magnetic fluxes
  SI.ComplexMagneticFlux Phi_s
    "Complex magnetic flux of stator w.r.t. stator fixed frame";
  SI.ComplexMagneticFlux Phi_sr=Phi_s*
      Modelica.ComplexMath.fromPolar(1, gammar)
    "Complex magnetic flux of stator w.r.t. rotor fixed frame";
  SI.ComplexMagneticFlux Phi_r
    "Complex magnetic flux of rotor w.r.t. rotor fixed frame";
  SI.ComplexMagneticFlux Phi_rr=Phi_r*
      Modelica.ComplexMath.fromPolar(1, gammar)
    "Complex magnetic flux of rotor w.r.t. rotor fixed frame";
  // Electrical torque and mechanical angle
  SI.Torque tauElectrical "Electrical torque";
  SI.Angle gamma=p*(flange_a.phi - support.phi)
    "Electrical angle between rotor and stator";
  SI.Angle gammas=port_sp.reference.gamma
    "Angle electrical quantities in stator fixed frame";
  SI.Angle gammar=port_rp.reference.gamma
    "Angle electrical quantities in rotor fixed frame";
equation
  port_sp.Phi = Phi_s "Stator flux into positive stator port";
  port_sp.Phi + port_sn.Phi = Complex(0, 0) "Balance of stator flux";
  port_rp.Phi = Phi_r "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_ms "Magnetomotive force of stator";
  port_rp.V_m - port_rn.V_m = V_mr "Magnetomotive force of rotor";
  // Stator flux and rotor flux are equal
  Phi_s = Phi_r;
  // 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_s.im*V_ms.re - Phi_s.re*V_ms.im);
  flange_a.tau = -tauElectrical;
  support.tau = tauElectrical;
  // Potential root of rotor has been removed. Only the stator positive
  //   plug is a potential root so that being a root determines that not
  //   electrical stator root is connected from outside; in this case the
  //   machine is operated as generator and the rotor angle is set to zero.
  // Magnetic stator and rotor port are (again) connected through
  //   Connections.branch, even though it is not clear yet whether this
  //   implementation is Modelica compliant
  Connections.potentialRoot(port_sp.reference);
  // Connections.potentialRoot(port_rp.reference);
  Connections.branch(port_sp.reference, port_sn.reference);
  port_sp.reference.gamma = port_sn.reference.gamma;
  Connections.branch(port_rp.reference, port_rn.reference);
  port_rp.reference.gamma = port_rn.reference.gamma;
  Connections.branch(port_sp.reference, port_rp.reference);
  gammas = gammar + gamma;
  if Connections.isRoot(port_sp.reference) then
    gammar = 0;
  end if;
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.QuasiStatic.FundamentalWave.BasicMachines.Components;
model SaliencyCageWinding "Rotor cage with saliency in d- and q-axis"
  extends Magnetic.QuasiStatic.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.ComplexBlocks.Interfaces.ComplexOutput i[2]=
      electroMagneticConverter.i "Cage currents";
  Modelica.Blocks.Interfaces.RealOutput lossPower(
    final quantity="Power",
    final unit="W") = sum(resistor.resistor.LossPower) "Damper losses";
  Magnetic.QuasiStatic.FundamentalWave.Components.PolyphaseElectroMagneticConverter
    electroMagneticConverter(final m=2, final effectiveTurns=effectiveTurns)
  Modelica.Electrical.QuasiStatic.Polyphase.Basic.Resistor resistor(
    final useHeatPort=useHeatPort,
    final m=2,
    final T_ref=fill(TRef, 2),
    final T=fill(TOperational, 2),
    R_ref={RRef.d,RRef.q},
    alpha_ref=fill(alphaRef, 2))
  Modelica.Electrical.QuasiStatic.Polyphase.Basic.Star star(final m=
        2)
  Modelica.Electrical.QuasiStatic.SinglePhase.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.QuasiStatic.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(thermalCollector.port_b, heatPortWinding)
  connect(resistor.heatPort, thermalCollector.port_a)
  connect(port_p, electroMagneticConverter.port_p)
  connect(electroMagneticConverter.port_n, port_n)
  connect(star.pin_n, ground.pin)
  connect(strayReluctance.port_p, port_p)
  connect(strayReluctance.port_n, port_n)
  connect(electroMagneticConverter.plug_p, resistor.plug_p)
  connect(electroMagneticConverter.plug_n, star.plug_p)
  connect(star.plug_p, resistor.plug_n)
end SaliencyCageWinding;


Symmetrical rotor cage.

within Modelica.Magnetic.QuasiStatic.FundamentalWave.BasicMachines.Components;
model SymmetricPolyphaseCageWinding "Symmetrical rotor cage"
  import Modelica.Constants.pi;
  extends Magnetic.QuasiStatic.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.ComplexCurrent i[m]=electroMagneticConverter.i
    "Cage currents";
  Magnetic.QuasiStatic.FundamentalWave.Components.PolyphaseElectroMagneticConverter
    electroMagneticConverter(final m=m, final effectiveTurns=effectiveTurns)
    "Symmetric winding"
  Modelica.Electrical.QuasiStatic.Polyphase.Basic.Resistor resistor(
    final useHeatPort=useHeatPort,
    final m=m,
    final T_ref=fill(TRef, m),
    final T=fill(TOperational, m),
    R_ref=fill(RRef, m),
    alpha_ref=fill(alphaRef, m))
  Modelica.Electrical.QuasiStatic.Polyphase.Basic.Star star(final m=
        nBase)
  Modelica.Electrical.QuasiStatic.SinglePhase.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.QuasiStatic.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.QuasiStatic.Polyphase.Basic.MultiStar multiStar(final m=m)
equation
  connect(thermalCollector.port_a, resistor.heatPort)
  connect(thermalCollector.port_b, heatPortWinding)
  connect(port_p, electroMagneticConverter.port_p)
  connect(electroMagneticConverter.port_n, port_n)
  connect(star.pin_n, ground.pin)
  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(multiStar.plug_p, resistor.plug_n)
end SymmetricPolyphaseCageWinding;


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

within Modelica.Magnetic.QuasiStatic.FundamentalWave.BasicMachines.Components;
model SymmetricPolyphaseWinding
  "Symmetric winding model coupling electrical and magnetic domain"
  // Orientation changed
  Modelica.Electrical.QuasiStatic.Polyphase.Interfaces.PositivePlug
    plug_p(final m=m) "Positive plug"
  Modelica.Electrical.QuasiStatic.Polyphase.Interfaces.NegativePlug
    plug_n(final m=m) "Negative plug"
  Interfaces.NegativeMagneticPort port_n "Negative complex magnetic port"
  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 effectiveTurns=1 "Effective number of turns per phase";
  parameter SI.Conductance GcRef
    "Electrical reference core loss reluctance";

  SI.ComplexVoltage v[m]=plug_p.pin.v - plug_n.pin.v
    "Complex voltage";
  SI.Voltage abs_v[m]=Modelica.ComplexMath.abs(v)
    "Magnitude of complex voltage";
  SI.Angle arg_v[m]=Modelica.ComplexMath.arg(v)
    "Argument of complex voltage";
  SI.ComplexCurrent i[m]=plug_p.pin.i "Complex current";
  SI.Current abs_i[m]=Modelica.ComplexMath.abs(i)
    "Magnitude of complex current";
  SI.Angle arg_i[m]=Modelica.ComplexMath.arg(i)
    "Argument of complex current";
  SI.ActivePower P[m]={Modelica.ComplexMath.real(v[k]*
      Modelica.ComplexMath.conj(i[k])) for k in 1:m} "Active power";
  SI.ActivePower P_total=sum(P) "Total active power";
  SI.ReactivePower Q[m]={Modelica.ComplexMath.imag(v[k]*
      Modelica.ComplexMath.conj(i[k])) for k in 1:m} "Reactive power";
  SI.ReactivePower Q_total=sum(Q) "Total reactive power";
  SI.ApparentPower S[m]={Modelica.ComplexMath.abs(v[k]*
      Modelica.ComplexMath.conj(i[k])) for k in 1:m}
    "Magnitude of complex apparent power";
  SI.ApparentPower S_total=sqrt(P_total^2 + Q_total^2)
    "Magnitude of total complex apparent power";
  Real pf[m]={cos(Modelica.ComplexMath.arg(Complex(P[k], Q[k]))) for k in
          1:m} "Power factor";

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

  Magnetic.QuasiStatic.FundamentalWave.Components.PolyphaseElectroMagneticConverter
    electroMagneticConverter(final m=m, final effectiveTurns=effectiveTurns)
    "Symmetric winding"
  Modelica.Electrical.QuasiStatic.Polyphase.Basic.Resistor resistor(
    final m=m,
    final useHeatPort=useHeatPort,
    final T_ref=fill(TRef, m),
    final T=fill(TOperational, m),
    R_ref=fill(RRef, m),
    final alpha_ref=fill(alphaRef, 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 ports of winding resistor"
  Magnetic.QuasiStatic.FundamentalWave.Components.EddyCurrent core(final
      useHeatPort=useHeatPort, final G=(m/2)*GcRef*effectiveTurns^2)
    "Core loss model (currently eddy currents only)"
  Modelica.Magnetic.QuasiStatic.FundamentalWave.Components.Permeance stray(final G_m(
        d=2*Lsigma/m/effectiveTurns^2, q=2*Lsigma/m/effectiveTurns^2)) "Stray permeance equivalent to ideally coupled stray inductances"
equation
  connect(resistor.heatPort, heatPortWinding)
  connect(core.heatPort, heatPortCore)
  connect(stray.port_n, core.port_n)
  connect(electroMagneticConverter.plug_p, resistor.plug_n)
  connect(plug_n, electroMagneticConverter.plug_n)
  connect(plug_p, resistor.plug_p)
  connect(port_p, electroMagneticConverter.port_p)
  connect(stray.port_p, port_p)
  connect(port_n, core.port_n)
  connect(electroMagneticConverter.port_n, core.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, rotor and supply are assumed. The number of stator and rotor phases may be different. The machine models take the following loss effects into account:

within Modelica.Magnetic.QuasiStatic.FundamentalWave.BasicMachines.InductionMachines;
model IM_SlipRing "Induction machine with slip ring rotor"
  parameter Integer mr(min=3) = m "Number of rotor phases"
  extends BaseClasses.Machine(
    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.QuasiStatic.Polyphase.Functions.activePower(vr, ir)));

  Modelica.Electrical.QuasiStatic.Polyphase.Interfaces.NegativePlug
    plug_rn(final m=mr) "Negative plug of rotor"
  Modelica.Electrical.QuasiStatic.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 per phase"
  parameter SI.Inductance Lrsigma(start=3*ZsRef*(1 - sqrt(1 -
        0.0667))/(2*pi*fsNominal))
    "Rotor leakage inductance per phase 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.ComplexVoltage vr[mr]=plug_rp.pin.v - plug_rn.pin.v
    "Complex rotor voltage";
  SI.Voltage abs_vr[mr]=Modelica.ComplexMath.abs(vr)
    "Magnitude of complex rotor voltage";
  SI.Angle arg_vr[mr]=Modelica.ComplexMath.arg(vr)
    "Argument of complex rotor voltage";

  output SI.ComplexCurrent ir[mr]=plug_rp.pin.i
    "Complex rotor current";
  SI.Current abs_ir[mr]=Modelica.ComplexMath.abs(ir)
    "Magnitude of complex rotor current";
  SI.Angle arg_ir[mr]=Modelica.ComplexMath.arg(ir)
    "Argument of complex rotor current";

  SI.ActivePower Pr[mr]={Modelica.ComplexMath.real(vr[k]*
      Modelica.ComplexMath.conj(ir[k])) for k in 1:mr}
    "Active rotor power";
  SI.ActivePower Pr_total=sum(Pr)
    "Total active rotor power";
  SI.ReactivePower Qr[mr]={Modelica.ComplexMath.imag(vr[k]*
      Modelica.ComplexMath.conj(ir[k])) for k in 1:mr}
    "Reactive rotor power";
  SI.ReactivePower Qr_total=sum(Qr)
    "Total reactive rotor power";
  SI.ApparentPower Sr[mr]={Modelica.ComplexMath.abs(vr[k]
      *Modelica.ComplexMath.conj(ir[k])) for k in 1:mr}
    "Magnitude of complex rotor apparent power";
  SI.ApparentPower Sr_total=sqrt(Pr_total^2 + Qr_total^2)
    "Magnitude of total complex rotor apparent power";
  Real pfr[m]={cos(Modelica.ComplexMath.arg(Complex(Pr[k], Qr[k]))) for k in
          1:m} "Rotor power factor";

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 effectiveTurns=effectiveStatorTurns/internalTurnsRatio,
    final useHeatPort=true,
    final RRef=Rr,
    final TRef=TrRef,
    final TOperational=TrOperational,
    final GcRef=rotorCoreParameters.GcRef,
    final m=mr,
    final alpha20=alpha20r)
    "Symmetric rotor winding including resistances, zero and stray inductances and zero core losses"
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, rotor and supply are assumed. The machine models take the following loss effects into account:

within Modelica.Magnetic.QuasiStatic.FundamentalWave.BasicMachines.InductionMachines;
model IM_SquirrelCage "Induction machine with squirrel cage"
  // Removed from extension of FUNDAMENTAL WAVE model: is(start=zeros(m)) ##
  extends BaseClasses.Machine(
    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 per phase"
  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.ComplexCurrent ir[m]=rotorCage.i
    "Rotor current";
  SI.Current abs_ir[m]=Modelica.ComplexMath.abs(ir)
    "Magnitude of complex rotor current";
  SI.Angle arg_ir[m]=Modelica.ComplexMath.arg(ir)
    "Argument of complex rotor current";

  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;


Quasi-static induction machines

within Modelica.Magnetic.QuasiStatic.FundamentalWave.BasicMachines;
package InductionMachines "Quasi-static induction machines"
  extends Modelica.Icons.Package;

end InductionMachines;


Quasi-static synchronous machines

within Modelica.Magnetic.QuasiStatic.FundamentalWave.BasicMachines;
package SynchronousMachines "Quasi-static synchronous machines"
  extends Modelica.Icons.Package;
end SynchronousMachines;


Electrical excited synchronous machine with optional damper cage. Resistances and stray inductances of the machine refer to an m-phase stator. The symmetry of the stator and the supply are 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.QuasiStatic.FundamentalWave.BasicMachines.SynchronousMachines;
model SM_ElectricalExcited
  "Electrical excited synchronous machine with optional damper cage"
  extends BaseClasses.Machine(
    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=0,
      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 per phase, d-axis"
  parameter SI.Inductance Lmq(start=1.5*ZsRef/(2*pi*fsNominal))
    "Stator main field inductance per phase, 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 temperatures
  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 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.ComplexBlocks.Interfaces.ComplexOutput ir[2] if useDamperCage
    "Damper cage currents"
  FundamentalWave.Components.Short short if not useDamperCage
    "Magnetic connection in case the damper cage is not present"
  // Excitation components
  FundamentalWave.BasicMachines.Components.SaliencyCageWinding rotorCage(
    final Lsigma(d=Lrsigmad, q=Lrsigmaq),
    final useHeatPort=true,
    final TRef=TrRef,
    final TOperational=TrOperational,
    final RRef(d=Rrd, q=Rrq),
    final alpha20=alpha20r,
    final effectiveTurns=sqrt(m/2.0)*effectiveStatorTurns)
 if useDamperCage
    "Symmetric rotor cage winding including resistances and stray inductances"
  // Excitation components
  Components.QuasiStaticAnalogWinding excitation(
    final RRef=Re,
    final TRef=TeRef,
    final effectiveTurns=effectiveStatorTurns*turnsRatio*m/2,
    final useHeatPort=true,
    final TOperational=TeOperational,
    final alpha20=alpha20e)
    "Excitation winding including resistance and stray inductance"
  Modelica.Electrical.Machines.Losses.DCMachines.Brush brush(final
      brushParameters=brushParameters, final useHeatPort=true)
  Modelica.Electrical.Analog.Interfaces.PositivePin pin_ep
    "Positive pin of excitation"
  Modelica.Electrical.Analog.Interfaces.NegativePin pin_en
    "Negative pin of excitation"
protected
  final parameter Real turnsRatio=sqrt(2)*VsNominal/(2*pi*fsNominal*Lmd*
      IeOpenCircuit) "Stator current / excitation current";
  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(airGap.port_rn, excitation.port_p)
  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)
  connect(pin_ep, brush.p)
  connect(brush.heatPort, internalThermalPort.heatPortBrush)
  connect(excitation.pin_n, pin_en)
  connect(excitation.pin_p, brush.n)
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 and the supply are 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.QuasiStatic.FundamentalWave.BasicMachines.SynchronousMachines;
model SM_PermanentMagnet
  "Permanent magnet synchronous machine with optional damper cage"
  extends BaseClasses.Machine(
    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 per phase, d-axis"
  parameter SI.Inductance Lmq(start=0.3*ZsRef/(2*pi*fsNominal))
    "Stator main field inductance per phase, 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 temperatures
  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.ComplexBlocks.Interfaces.ComplexOutput ir[2] if useDamperCage
    "Damper cage currents"
  FundamentalWave.Components.Short short if not useDamperCage
    "Magnetic connection in case the damper cage is not present"
  Components.SaliencyCageWinding rotorCage(
    final RRef(d=Rrd, q=Rrq),
    final Lsigma(d=Lrsigmad, q=Lrsigmaq),
    final useHeatPort=true,
    final TRef=TrRef,
    final TOperational=TrOperational,
    final alpha20=alpha20r,
    final effectiveTurns=sqrt(m/2.0)*effectiveStatorTurns)
 if useDamperCage
    "Symmetric rotor cage winding including resistances and stray inductances"
  // Permanent magnet components
  FundamentalWave.BasicMachines.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;


Synchronous reluctance machine with optional damper cage. Resistances and stray inductances of the machine refer to an m-phase stator. The symmetry of the stator and the supply are 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.QuasiStatic.FundamentalWave.BasicMachines.SynchronousMachines;
model SM_ReluctanceRotor
  "Synchronous reluctance machine with optional damper cage"
  extends BaseClasses.Machine(
    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));

  parameter SI.Inductance Lmd(start=2.9*ZsRef/(2*pi*fsNominal))
    "Stator main field inductance per phase, d-axis"
  parameter SI.Inductance Lmq(start=0.9*ZsRef/(2*pi*fsNominal))
    "Stator main field inductance per phase, 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 temperatures
  parameter SI.Temperature TrOperational(start=293.15)
    "Operational temperature of (optional) damper cage"
  // Rotor cage components
  Modelica.ComplexBlocks.Interfaces.ComplexOutput ir[2] if useDamperCage
    "Damper cage currents"
  FundamentalWave.Components.Short short if not useDamperCage
    "Magnetic connection in case the damper cage is not present"
  Components.SaliencyCageWinding rotorCage(
    final RRef(d=Rrd, q=Rrq),
    final Lsigma(d=Lrsigmad, q=Lrsigmaq),
    final useHeatPort=true,
    final TRef=TrRef,
    final TOperational=TrOperational,
    final alpha20=alpha20r,
    final effectiveTurns=sqrt(m/2.0)*effectiveStatorTurns)
 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 connections. This is a simple short cut branch.

within Modelica.Magnetic.QuasiStatic.FundamentalWave.Components;
model Crossing "Crossing of connections"

  Interfaces.PositiveMagneticPort port_p1 "Connected with port_p2"
  Interfaces.NegativeMagneticPort port_n1 "Connected with port_n2"
  Interfaces.PositiveMagneticPort port_p2 "Connected with port_p1"
  Interfaces.NegativeMagneticPort port_n2 "Connected with port_n1"
equation
  connect(port_p1, port_p2)
  connect(port_n2, port_n1)
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 and
FundamentalWave.Components.EddyCurrent.

within Modelica.Magnetic.QuasiStatic.FundamentalWave.Components;
model EddyCurrent
  "Constant loss model under sinusoidal magnetic conditions"
  import Modelica.Constants.pi;
  constant Complex j=Complex(0, 1);
  extends Interfaces.TwoPort;
  parameter SI.Conductance G(min=0)
    "Equivalent symmetric loss conductance";
  extends
    Modelica.Thermal.HeatTransfer.Interfaces.PartialElementaryConditionalHeatPort(
      final T=273.15);
  SI.AngularVelocity omega=der(port_p.reference.gamma)
    "Angular velocity";
equation
  lossPower = (pi/2)*Modelica.ComplexMath.imag(omega*V_m*
    Modelica.ComplexMath.conj(Phi));
  // Alternative calculation of loss power
  // lossPower = -(pi/2)*Modelica.ComplexMath.real(j*omega*V_m*Modelica.ComplexMath.conj(Phi));
  if G > 0 then
    (pi/2)*V_m = j*omega*G*Phi;
  else
    V_m = Complex(0, 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.QuasiStatic.FundamentalWave.Components;
model Ground "Magnetic ground"

  FundamentalWave.Interfaces.PositiveMagneticPort port_p
    "Complex magnetic port"
equation
  Connections.potentialRoot(port_p.reference, 254);
  if Connections.isRoot(port_p.reference) then
    port_p.reference.gamma = 0;
  end if;
  port_p.V_m = Complex(0, 0);
end Ground;


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

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


Basic fundamental wave components

within Modelica.Magnetic.QuasiStatic.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.QuasiStatic.FundamentalWave.Components;
model Permeance "Salient Permeance"
  import Modelica.Constants.pi;
  extends 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.QuasiStatic.FundamentalWave.Components;
model PolyphaseElectroMagneticConverter
  "Polyphase electromagnetic converter"
  import Modelica.Constants.pi;
  constant Complex j=Complex(0, 1);
  Modelica.Electrical.QuasiStatic.Polyphase.Interfaces.PositivePlug
    plug_p(final m=m) "Positive plug"
  Modelica.Electrical.QuasiStatic.Polyphase.Interfaces.NegativePlug
    plug_n(final m=m) "Negative plug"
  FundamentalWave.Interfaces.PositiveMagneticPort port_p
    "Positive complex magnetic port"
  FundamentalWave.Interfaces.NegativeMagneticPort port_n
    "Negative complex magnetic port"
  parameter Integer m=3 "Number of phases"
  parameter Real effectiveTurns "Effective number of turns";
  constant SI.Angle orientation=0
    "Orientation of the first winding axis";
  // Local electric polyphase quantities
  SI.ComplexVoltage v[m] "Complex voltage";
  SI.Voltage abs_v[m]=Modelica.ComplexMath.abs(v)
    "Magnitude of complex voltage";
  SI.Angle arg_v[m]=Modelica.ComplexMath.arg(v)
    "Argument of complex voltage";

  SI.ComplexCurrent i[m] "Complex current";
  SI.Current abs_i[m]=Modelica.ComplexMath.abs(i)
    "Magnitude of complex current";
  SI.Angle arg_i[m]=Modelica.ComplexMath.arg(i)
    "Argument of complex current";

  SI.ActivePower P[m]={Modelica.ComplexMath.real(v[k]*
      Modelica.ComplexMath.conj(i[k])) for k in 1:m} "Active power";
  SI.ActivePower P_total=sum(P) "Total active power";
  SI.ReactivePower Q[m]={Modelica.ComplexMath.imag(v[k]*
      Modelica.ComplexMath.conj(i[k])) for k in 1:m} "Reactive power";
  SI.ReactivePower Q_total=sum(Q) "Total reactive power";
  SI.ApparentPower S[m]={Modelica.ComplexMath.abs(v[k]*
      Modelica.ComplexMath.conj(i[k])) for k in 1:m}
    "Magnitude of complex apparent power";
  SI.ApparentPower S_total=sqrt(P_total^2 + Q_total^2)
    "Magnitude of total complex apparent power";
  Real pf[m]={cos(Modelica.ComplexMath.arg(Complex(P[k], Q[k]))) for k in 1:m}
    "Power factor";

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

  SI.AngularVelocity omega=der(port_p.reference.gamma);
  // A technical solution with a rotator cannot be applied to the equations below
  final parameter Complex N=effectiveTurns*Modelica.ComplexMath.exp(Complex(
      0, orientation)) "Complex effective number of turns";
  SI.ComplexVoltage vSymmetricalComponent[m]
    "Symmetrical components of voltages";
  SI.ComplexCurrent iSymmetricalComponent[m]
    "Symmetrical components of currents";
protected
  final parameter Complex sTM[m,m]=
    Modelica.Electrical.Polyphase.Functions.symmetricTransformationMatrix(m);
  final parameter Integer indexNonPos[:]=
      Modelica.Electrical.Polyphase.Functions.indexNonPositiveSequence(
                                                              m)
    "Indices of all non positive sequence components";
  final parameter Integer indexPos[:]=
      Modelica.Electrical.Polyphase.Functions.indexPositiveSequence(
                                                           m)
    "Indices of all positive sequence components";
equation
  // Symmetrical components (preferred): vSymmetricalComponent = sTM*v; iSymmetricalComponent = sTM*i;
  for j in 1:m loop
    vSymmetricalComponent[j] = Complex(sum({sTM[j,k].re*v[k].re - sTM[j,k].im*v[k].im for k in 1:m}),
                                       sum({sTM[j,k].re*v[k].im + sTM[j,k].im*v[k].re for k in 1:m}));
    iSymmetricalComponent[j] = Complex(sum({sTM[j,k].re*i[k].re - sTM[j,k].im*i[k].im for k in 1:m}),
                                       sum({sTM[j,k].re*i[k].im + sTM[j,k].im*i[k].re for k in 1:m}));
  end for;
  // 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 plugs
  v = plug_p.pin.v - plug_n.pin.v;
  // Current and current balance of the electric plugs
  i = plug_p.pin.i;
  plug_p.pin.i + plug_n.pin.i = {Complex(0, 0) for k in 1:m};
  V_m.re = sqrt(2)*(2.0/pi)*Modelica.ComplexMath.real(N*
    iSymmetricalComponent[1])*m/2;
  V_m.im = sqrt(2)*(2.0/pi)*Modelica.ComplexMath.imag(N*
    iSymmetricalComponent[1])*m/2;
  for k in 1:size(indexNonPos, 1) loop
    iSymmetricalComponent[indexNonPos[k]] = Complex(0, 0);
  end for;
  for k in 2:size(indexPos, 1) loop
    vSymmetricalComponent[indexPos[1]] = vSymmetricalComponent[indexPos[k]];
  end for;
  // Induced voltages from complex magnetic flux, number of turns
  // and angles of orientation of winding
  -sqrt(2)*Complex(Modelica.ComplexMath.real(vSymmetricalComponent[indexPos[
    1]]), Modelica.ComplexMath.imag(vSymmetricalComponent[indexPos[1]])) =
    Modelica.ComplexMath.conj(N)*j*omega*Phi;
  // Potential roots are not used; instead the reference angle is handled
  // by means of Connections.branch between electric plug_p and magnetic port_p
  // It has to be checked whether this Modelica compliant
  //   Connections.potentialRoot(plug_p.reference);
  //   Connections.potentialRoot(port_p.reference);
  Connections.branch(port_p.reference, port_n.reference);
  port_p.reference.gamma = port_n.reference.gamma;
  Connections.branch(plug_p.reference, plug_n.reference);
  plug_p.reference.gamma = plug_n.reference.gamma;
  Connections.branch(plug_p.reference, port_p.reference);
  plug_p.reference.gamma = port_p.reference.gamma;
end PolyphaseElectroMagneticConverter;


Electromagnetic converter to only (!) quasi-static analog, neglecting induced voltage. The analog single-phase winding has an effective number of turns,  and a respective orientation of the winding, . The current in the winding is .

within Modelica.Magnetic.QuasiStatic.FundamentalWave.Components;
model QuasiStaticAnalogElectroMagneticConverter
  "Electromagnetic converter to only (!) quasi-static analog, neglecting induced voltage"
  // Note: It has not whether the transient voltage induction and the
  //   leakage induction shall be considered in this model or not.
  //   This model is required for electrical excited synchronous machines (SMEE)
  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"
  // Local electric single-phase quantities
  SI.Voltage v "Voltage drop";
  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";

  SI.Angle gamma "Angle of V_m fixed reference frame";
  SI.AngularVelocity omega=der(port_p.reference.gamma);
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 the magnetic potential difference
  V_m = (2/pi)*effectiveTurns*i*Modelica.ComplexMath.fromPolar(1, -gamma);
  // Induced voltages is zero due to quasi-static electric analog circuit
  v = 0;
  Connections.branch(port_p.reference, port_n.reference);
  port_p.reference.gamma = port_n.reference.gamma;
  // Reference angle to magnetic potential fixed frame
  gamma = port_p.reference.gamma;
end QuasiStaticAnalogElectroMagneticConverter;


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

within Modelica.Magnetic.QuasiStatic.FundamentalWave.Components;
model Reluctance "Salient reluctance"
  import Modelica.Constants.pi;
  extends 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 connection. This is a simple short cut branch.

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


Examples

within Modelica.Magnetic.QuasiStatic.FundamentalWave;
package Examples "Examples"
  extends Modelica.Icons.ExamplesPackage;

end Examples;


Examples of basic machines

within Modelica.Magnetic.QuasiStatic.FundamentalWave.Examples;
package BasicMachines "Examples of basic machines"
  extends Modelica.Icons.ExamplesPackage;

end BasicMachines;


Characteristic curves of Induction machine with squirrel cage. This examples allows the investigation of characteristic curves of quasi-static polyphase induction machines with squirrel cage rotor
as a function of rotor speed.

within Modelica.Magnetic.QuasiStatic.FundamentalWave.Examples.BasicMachines.InductionMachines;
model IMC_Characteristics "Characteristic curves of Induction machine with squirrel cage"
  extends Modelica.Icons.Example;
  import Modelica.Constants.pi;
  parameter Integer m=3 "Number of phases"
  parameter SI.Voltage VsNominal=100
    "Nominal RMS voltage per phase";
  parameter SI.Frequency fNominal=imcData.fsNominal "Nominal frequency";
  parameter SI.AngularVelocity w_Load(displayUnit="rev/min")=
       1440.45*2*Modelica.Constants.pi/60 "Nominal load speed";
  parameter Integer p=imcData.p "Number of pole pairs";
  Real speedPerUnit = p*imcQS.wMechanical/(2*pi*fNominal) "Per unit speed";
  Real slip = 1-speedPerUnit "Slip";
  output SI.Current Iqs=iSensorQS.I "QS RMS current";
  Modelica.Electrical.QuasiStatic.Polyphase.Sources.VoltageSource vSourceQS(
    m=m,
    f=fNominal,
    V=fill(VsNominal, m),
    phi=-Modelica.Electrical.Polyphase.Functions.symmetricOrientation(m))
  Modelica.Electrical.QuasiStatic.Polyphase.Basic.Star starQS(m=m)
  Modelica.Electrical.QuasiStatic.SinglePhase.Basic.Ground groundQS
  Modelica.Electrical.QuasiStatic.Polyphase.Sensors.PowerSensor pSensorQS(m=m)
  Modelica.Electrical.QuasiStatic.Polyphase.Sensors.CurrentQuasiRMSSensor iSensorQS(m=m)
  parameter
    Modelica.Electrical.Machines.Utilities.ParameterRecords.IM_SquirrelCageData
    imcData "Induction machine data"
  FundamentalWave.BasicMachines.InductionMachines.IM_SquirrelCage imcQS(
    Js=imcData.Js,
    p=imcData.p,
    fsNominal=imcData.fsNominal,
    TsRef=imcData.TsRef,
    alpha20s(displayUnit="1/K") = imcData.alpha20s,
    frictionParameters=imcData.frictionParameters,
    gammar(fixed=true, start=-pi/2),
    statorCoreParameters=imcData.statorCoreParameters,
    strayLoadParameters=imcData.strayLoadParameters,
    alpha20r(displayUnit="1/K") = imcData.alpha20r,
    Rs=imcData.Rs*m/3,
    Lssigma=imcData.Lssigma*m/3,
    Lm=imcData.Lm*m/3,
    Lrsigma=imcData.Lrsigma*m/3,
    Rr=imcData.Rr*m/3,
    TrRef=imcData.TrRef,
    m=m,
    Jr=0*imcData.Jr,
    TsOperational=293.15,
    effectiveStatorTurns=imcData.effectiveStatorTurns,
    TrOperational=293.15)
  Modelica.Electrical.QuasiStatic.SinglePhase.Basic.Ground
    groundMachineQS
  Modelica.Electrical.QuasiStatic.Polyphase.Basic.Star
    starMachineQS(m=
        Modelica.Electrical.Polyphase.Functions.numberOfSymmetricBaseSystems(
                                                                    m))
  Utilities.MultiTerminalBox terminalBoxQS(m=m, terminalConnection="Y")
  Modelica.Mechanics.Rotational.Sources.Speed speed(exact=true)
  Modelica.Blocks.Sources.Ramp ramp(
    height=3*2*pi*fNominal/p,
    duration=1,
    offset=-2*pi*fNominal/p)
equation
  connect(groundQS.pin, starQS.pin_n)
  connect(starQS.plug_p, vSourceQS.plug_n)
  connect(pSensorQS.currentN, iSensorQS.plug_p)
  connect(pSensorQS.voltageP, pSensorQS.currentP)
  connect(pSensorQS.voltageN, starQS.plug_p)
  connect(terminalBoxQS.plug_sn, imcQS.plug_sn)
  connect(terminalBoxQS.plug_sp, imcQS.plug_sp)
  connect(starMachineQS.plug_p, terminalBoxQS.starpoint)
  connect(iSensorQS.plug_n, terminalBoxQS.plugSupply)
  connect(starMachineQS.pin_n, groundMachineQS.pin)
  connect(imcQS.flange, speed.flange)
  connect(ramp.y, speed.w_ref)
  connect(vSourceQS.plug_p, pSensorQS.currentP)
end IMC_Characteristics;


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.QuasiStatic.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;
  parameter 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=imcData.fsNominal
    "Nominal frequency";
  parameter SI.AngularVelocity wNominal=2*pi*fNominal/imcData.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.QuasiStatic.FundamentalWave.BasicMachines.InductionMachines.IM_SquirrelCage
    imcQS(
    p=imcData.p,
    fsNominal=imcData.fsNominal,
    TsRef=imcData.TsRef,
    alpha20s(displayUnit="1/K") = imcData.alpha20s,
    Jr=imcData.Jr,
    Js=imcData.Js,
    frictionParameters=imcData.frictionParameters,
    wMechanical(fixed=true),
    gammar(fixed=true, start=pi/2),
    gamma(fixed=true, start=-pi/2),
    statorCoreParameters=imcData.statorCoreParameters,
    strayLoadParameters=imcData.strayLoadParameters,
    TrRef=imcData.TrRef,
    Rs=imcData.Rs*m/3,
    Lssigma=imcData.Lssigma*m/3,
    Lm=imcData.Lm*m/3,
    Lrsigma=imcData.Lrsigma*m/3,
    Rr=imcData.Rr*m/3,
    m=m,
    TsOperational=293.15,
    effectiveStatorTurns=imcData.effectiveStatorTurns,
    alpha20r=imcData.alpha20r,
    TrOperational=293.15)
  Modelica.Electrical.QuasiStatic.Polyphase.Sensors.CurrentQuasiRMSSensor currentQuasiRMSSensorQS(m=m)
  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)
  Utilities.VfController vfControllerQS(
    final m=m,
    VNominal=VNominal,
    fNominal=fNominal)
  Modelica.Electrical.QuasiStatic.Polyphase.Sources.VariableVoltageSource signalVoltageQS(final m=m)
  Modelica.Electrical.QuasiStatic.Polyphase.Basic.Star starQS(final m=m)
  Modelica.Electrical.QuasiStatic.SinglePhase.Basic.Ground groundQS
  Utilities.MultiTerminalBox terminalBoxQS(terminalConnection="Y", m=m)
  parameter
    Modelica.Electrical.Machines.Utilities.ParameterRecords.IM_SquirrelCageData
    imcData "Induction machine data"
  Modelica.Blocks.Math.Gain gainQS(k=fNominal)
  Modelica.Mechanics.Translational.Components.IdealGearR2T idealGearR2TQS(ratio=1/r)
  Modelica.Mechanics.Translational.Components.Mass massQS(m=JLoad/r^2)
  Modelica.Mechanics.Translational.Sources.SignForce signForceQS(v0(displayUnit
        ="m/s") = 0.01*wNominal*r, f_nominal=-TLoad/r)
  Modelica.Electrical.QuasiStatic.SinglePhase.Basic.Ground groundMachineQS
  Modelica.Electrical.QuasiStatic.Polyphase.Basic.Star starMachineQS(m=
        Modelica.Electrical.Polyphase.Functions.numberOfSymmetricBaseSystems(m))
  Magnetic.FundamentalWave.BasicMachines.InductionMachines.IM_SquirrelCage imc(
    p=imcData.p,
    fsNominal=imcData.fsNominal,
    TsRef=imcData.TsRef,
    alpha20s(displayUnit="1/K") = imcData.alpha20s,
    Jr=imcData.Jr,
    Js=imcData.Js,
    frictionParameters=imcData.frictionParameters,
    phiMechanical(fixed=true),
    wMechanical(fixed=true),
    statorCoreParameters=imcData.statorCoreParameters,
    strayLoadParameters=imcData.strayLoadParameters,
    TrRef=imcData.TrRef,
    Rs=imcData.Rs*m/3,
    Lssigma=imcData.Lssigma*m/3,
    Lszero=imcData.Lszero*m/3,
    Lm=imcData.Lm*m/3,
    Lrsigma=imcData.Lrsigma*m/3,
    Rr=imcData.Rr*m/3,
    m=m,
    TsOperational=293.15,
    effectiveStatorTurns=imcData.effectiveStatorTurns,
    alpha20r=imcData.alpha20r,
    TrOperational=293.15)
  Modelica.Electrical.Polyphase.Sensors.CurrentQuasiRMSSensor currentQuasiRMSSensor(m=m)
  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.MultiTerminalBox terminalBox(
      terminalConnection="Y", m=m)
  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)
  Modelica.Electrical.Polyphase.Basic.Star starMachine(final m=
        Modelica.Electrical.Polyphase.Functions.numberOfSymmetricBaseSystems(m))
  Modelica.Electrical.Analog.Basic.Ground groundMachine
initial equation
  sum(imc.is) = 0;
  imc.is[1:2] = zeros(2);
  imc.rotorCage.electroMagneticConverter.V_m = Complex(0, 0);
equation
  connect(signalVoltageQS.plug_n, starQS.plug_p)
  connect(starQS.pin_n, groundQS.pin)
  connect(signalVoltageQS.plug_p, currentQuasiRMSSensorQS.plug_p)
  connect(terminalBoxQS.plugSupply, currentQuasiRMSSensorQS.plug_n)
  connect(terminalBoxQS.plug_sn, imcQS.plug_sn)
  connect(terminalBoxQS.plug_sp, imcQS.plug_sp)
  connect(imcQS.flange, idealGearR2TQS.flangeR)
  connect(idealGearR2TQS.flangeT, massQS.flange_a)
  connect(massQS.flange_b, signForceQS.flange)
  connect(vfControllerQS.y, signalVoltageQS.V)
  connect(groundMachineQS.pin,starMachineQS. pin_n)
  connect(starMachineQS.plug_p, terminalBoxQS.starpoint)
  connect(dutyCycle.y[1], gainQS.u)
  connect(gainQS.y, signalVoltageQS.f)
  connect(gainQS.y, vfControllerQS.u)
  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, imc.plug_sn)
  connect(terminalBox.plug_sp, imc.plug_sp)
  connect(vfController.u,gain. y)
  connect(imc.flange, idealGearR2T.flangeR)
  connect(idealGearR2T.flangeT,mass. flange_a)
  connect(mass.flange_b,signForce. flange)
  connect(dutyCycle.y[1], gain.u)
  connect(groundMachine.p,starMachine. pin_n)
  connect(terminalBox.starpoint, starMachine.plug_p)
end IMC_Conveyor;


Induction machine with squirrel cage started directly on line (DOL). This example compares a time transient and a quasi-static model of a polyphase induction machine.
At start time tOn a transient and a quasi-static polyphase voltage source are
connected to an induction machine. The machine starts from standstill, accelerating inertias
against load torque quadratic dependent on speed, finally reaching nominal speed.

within Modelica.Magnetic.QuasiStatic.FundamentalWave.Examples.BasicMachines.InductionMachines;
model IMC_DOL
  "Induction machine with squirrel cage started directly on line (DOL)"
  extends Modelica.Icons.Example;
  import Modelica.Constants.pi;
  parameter Integer m=3 "Number of phases"
  parameter SI.Voltage VsNominal=100
    "Nominal RMS voltage per phase";
  parameter SI.Frequency fNominal=imc.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.5 "Load inertia";
  parameter Integer p=2 "Number of pole pairs";
  output SI.Current Itr=currentQuasiRMSSensor.I
    "Transient RMS current";
  output SI.Current Iqs=currentQuasiRMSSensorQS.I
    "QS RMS current";
  Modelica.Electrical.QuasiStatic.Polyphase.Sources.VoltageSource
    voltageSourceQS(
    m=m,
    f=fNominal,
    V=fill(VsNominal, m),
    phi=-Modelica.Electrical.Polyphase.Functions.symmetricOrientation(
        m))
  Modelica.Electrical.QuasiStatic.Polyphase.Basic.Star starQS(m=m)
  Modelica.Electrical.QuasiStatic.SinglePhase.Basic.Ground groundQS
  Modelica.Electrical.QuasiStatic.Polyphase.Sensors.PowerSensor
    powerSensorQS(m=m)
  Modelica.Electrical.QuasiStatic.Polyphase.Sensors.CurrentQuasiRMSSensor currentQuasiRMSSensorQS(m=m)
  Modelica.Electrical.QuasiStatic.Polyphase.Ideal.IdealClosingSwitch
    idealCloserQS(
    final m=m,
    Ron=fill(1e-5*m/3, m),
    Goff=fill(1e-5*3/m, m))
  Modelica.Blocks.Sources.BooleanStep booleanStepQS[m](each startTime=
        tOn, each startValue=false)
  Modelica.Electrical.Analog.Basic.Ground ground
  Modelica.Electrical.Polyphase.Basic.Star star(final m=m)
  Modelica.Electrical.Polyphase.Sources.CosineVoltage cosineVoltage(
    final m=m,
    f=fill(fNominal, m),
    V=fill(sqrt(2.0)*VsNominal, m))
  Modelica.Electrical.Polyphase.Ideal.IdealClosingSwitch idealCloser(
    final m=m,
    Ron=fill(1e-5*m/3, m),
    Goff=fill(1e-5*3/m, m))
  Modelica.Blocks.Sources.BooleanStep booleanStep[m](each startTime=tOn,
      each startValue=false)
  Modelica.Electrical.Polyphase.Sensors.CurrentQuasiRMSSensor currentQuasiRMSSensor(final m=m)
  Modelica.Electrical.Machines.Utilities.MultiTerminalBox terminalBox(m=m,
      terminalConnection="Y")
  Magnetic.FundamentalWave.BasicMachines.InductionMachines.IM_SquirrelCage imc(
    Jr=imcData.Jr,
    Js=imcData.Js,
    p=imcData.p,
    fsNominal=imcData.fsNominal,
    TsRef=imcData.TsRef,
    alpha20s(displayUnit="1/K") = imcData.alpha20s,
    frictionParameters=imcData.frictionParameters,
    statorCoreParameters=imcData.statorCoreParameters,
    strayLoadParameters=imcData.strayLoadParameters,
    alpha20r(displayUnit="1/K") = imcData.alpha20r,
    phiMechanical(fixed=true),
    wMechanical(fixed=true),
    Rs=imcData.Rs*m/3,
    Lssigma=imcData.Lssigma*m/3,
    Lszero=imcData.Lszero*m/3,
    Lm=imcData.Lm*m/3,
    Lrsigma=imcData.Lrsigma*m/3,
    Rr=imcData.Rr*m/3,
    TrRef=imcData.TrRef,
    m=m,
    TsOperational=293.15,
    effectiveStatorTurns=imcData.effectiveStatorTurns,
    TrOperational=293.15)
  Modelica.Mechanics.Rotational.Components.Inertia loadInertia(J=J_Load)
  Modelica.Mechanics.Rotational.Sources.QuadraticSpeedDependentTorque
    quadraticLoadTorque(
    w_nominal=w_Load,
    tau_nominal=-T_Load,
    TorqueDirection=false,
    useSupport=false)
  Modelica.Electrical.Polyphase.Sensors.PowerSensor powerSensor(final
      m=m)
  Modelica.Mechanics.Rotational.Components.Inertia loadInertiaQS(J=
        J_Load)
  Modelica.Mechanics.Rotational.Sources.QuadraticSpeedDependentTorque
    quadraticLoadTorqueQS(
    w_nominal=w_Load,
    tau_nominal=-T_Load,
    TorqueDirection=false,
    useSupport=false)
  parameter
    Modelica.Electrical.Machines.Utilities.ParameterRecords.IM_SquirrelCageData
    imcData "Induction machine data"
  FundamentalWave.BasicMachines.InductionMachines.IM_SquirrelCage imcQS(
    Jr=imcData.Jr,
    Js=imcData.Js,
    p=imcData.p,
    fsNominal=imcData.fsNominal,
    TsRef=imcData.TsRef,
    alpha20s(displayUnit="1/K") = imcData.alpha20s,
    frictionParameters=imcData.frictionParameters,
    statorCoreParameters=imcData.statorCoreParameters,
    strayLoadParameters=imcData.strayLoadParameters,
    alpha20r(displayUnit="1/K") = imcData.alpha20r,
    Rs=imcData.Rs*m/3,
    Lssigma=imcData.Lssigma*m/3,
    Lm=imcData.Lm*m/3,
    Lrsigma=imcData.Lrsigma*m/3,
    Rr=imcData.Rr*m/3,
    TrRef=imcData.TrRef,
    m=m,
    wMechanical(fixed=true),
    gammar(fixed=true, start=pi/2),
    gamma(fixed=true, start=-pi/2),
    TsOperational=293.15,
    effectiveStatorTurns=imcData.effectiveStatorTurns,
    TrOperational=293.15)
  Modelica.Electrical.QuasiStatic.SinglePhase.Basic.Ground
    groundMachineQS
  Modelica.Electrical.QuasiStatic.Polyphase.Basic.Star
    starMachineQS(m=
        Modelica.Electrical.Polyphase.Functions.numberOfSymmetricBaseSystems(
                                                                    m))
  Utilities.MultiTerminalBox terminalBoxQS(m=m, terminalConnection="Y")
  Modelica.Electrical.Polyphase.Basic.Star starMachine(final m=Modelica.Electrical.Polyphase.Functions.numberOfSymmetricBaseSystems(
                                                                                m))
  Modelica.Electrical.Analog.Basic.Ground groundMachine
initial equation
  sum(imc.is) = 0;
  imc.is[1:2] = zeros(2);
  imc.rotorCage.electroMagneticConverter.V_m = Complex(0, 0);

equation
  connect(groundQS.pin, starQS.pin_n)
  connect(starQS.plug_p, voltageSourceQS.plug_n)
  connect(powerSensorQS.currentN, currentQuasiRMSSensorQS.plug_p)
  connect(powerSensorQS.voltageP, powerSensorQS.currentP)
  connect(powerSensorQS.voltageN, starQS.plug_p)
  connect(booleanStepQS.y, idealCloserQS.control)
  connect(star.pin_n, ground.p)
  connect(cosineVoltage.plug_n, star.plug_p)
  connect(imc.flange, loadInertia.flange_a)
  connect(loadInertia.flange_b, quadraticLoadTorque.flange)
  connect(terminalBox.plug_sn, imc.plug_sn)
  connect(terminalBox.plug_sp, imc.plug_sp)
  connect(booleanStep.y, idealCloser.control)
  connect(idealCloser.plug_p, cosineVoltage.plug_p)
  connect(idealCloserQS.plug_p, voltageSourceQS.plug_p)
  connect(idealCloserQS.plug_n, powerSensorQS.currentP)
  connect(idealCloser.plug_n, powerSensor.pc)
  connect(powerSensor.nc, currentQuasiRMSSensor.plug_p)
  connect(currentQuasiRMSSensor.plug_n, terminalBox.plugSupply)
  connect(loadInertiaQS.flange_b, quadraticLoadTorqueQS.flange)
  connect(powerSensor.pv, powerSensor.pc)
  connect(powerSensor.nv, star.plug_p)
  connect(imcQS.flange, loadInertiaQS.flange_a)
  connect(terminalBoxQS.plug_sn, imcQS.plug_sn)
  connect(terminalBoxQS.plug_sp, imcQS.plug_sp)
  connect(starMachineQS.plug_p, terminalBoxQS.starpoint)
  connect(currentQuasiRMSSensorQS.plug_n, terminalBoxQS.plugSupply)
  connect(starMachineQS.pin_n, groundMachineQS.pin)
  connect(starMachine.plug_p, terminalBox.starpoint)
  connect(groundMachine.p, starMachine.pin_n)
end IMC_DOL;


Steady-state initialization of induction machine with squirrel cage.

within Modelica.Magnetic.QuasiStatic.FundamentalWave.Examples.BasicMachines.InductionMachines;
model IMC_Initialize "Steady-state initialization of induction machine with squirrel cage"
  extends Modelica.Icons.Example;
  import Modelica.Constants.pi;
  parameter Integer m=3 "Number of phases"
  parameter SI.Voltage VNominal=100
    "Nominal RMS voltage per phase";
  parameter SI.Frequency fNominal=imc.fsNominal "Nominal frequency";
  parameter SI.AngularVelocity wSync=2*pi*fNominal/imcData.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.QuasiStatic.FundamentalWave.BasicMachines.InductionMachines.IM_SquirrelCage
    imcQS(
    p=imcData.p,
    fsNominal=imcData.fsNominal,
    TsRef=imcData.TsRef,
    alpha20s(displayUnit="1/K") = imcData.alpha20s,
    wMechanical(fixed=true, start=2*pi*imcData.fsNominal/imcData.p),
    gammar(fixed=true, start=pi/2),
    gamma(fixed=true, start=-pi/2),
    Jr=imcData.Jr,
    Js=imcData.Js,
    frictionParameters=imcData.frictionParameters,
    statorCoreParameters=imcData.statorCoreParameters,
    strayLoadParameters=imcData.strayLoadParameters,
    TrRef=imcData.TrRef,
    m=m,
    Rs=imcData.Rs*m/3,
    Lssigma=imcData.Lssigma*m/3,
    Lm=imcData.Lm*m/3,
    Lrsigma=imcData.Lrsigma*m/3,
    Rr=imcData.Rr*m/3,
    TsOperational=293.15,
    effectiveStatorTurns=imcData.effectiveStatorTurns,
    alpha20r=imcData.alpha20r,
    TrOperational=293.15)
  Modelica.Electrical.QuasiStatic.Polyphase.Sensors.CurrentQuasiRMSSensor currentQuasiRMSSensorQS(m=m)
  Modelica.Electrical.QuasiStatic.Polyphase.Sources.VoltageSource sineVoltageQS(
    final m=m,
    f=fNominal,
    V=fill(VNominal, m))
  Modelica.Electrical.QuasiStatic.Polyphase.Basic.Star starQS(final m=m)
  Modelica.Electrical.QuasiStatic.SinglePhase.Basic.Ground groundQS
  Modelica.Mechanics.Rotational.Components.Inertia loadInertiaQS(J=JLoad)
  Modelica.Mechanics.Rotational.Sources.TorqueStep torqueStepQS(
    useSupport=false,
    startTime=tStart,
    stepTorque=-TLoad,
    offsetTorque=0)
  Utilities.MultiTerminalBox
                        terminalBoxQS(m=m, terminalConnection="Y")
  parameter
    Modelica.Electrical.Machines.Utilities.ParameterRecords.IM_SquirrelCageData
    imcData "Induction machine data"

  Magnetic.FundamentalWave.BasicMachines.InductionMachines.IM_SquirrelCage imc(
    p=imcData.p,
    fsNominal=imcData.fsNominal,
    TsRef=imcData.TsRef,
    alpha20s(displayUnit="1/K") = imcData.alpha20s,
    Jr=imcData.Jr,
    Js=imcData.Js,
    frictionParameters=imcData.frictionParameters,
    statorCoreParameters=imcData.statorCoreParameters,
    strayLoadParameters=imcData.strayLoadParameters,
    TrRef=imcData.TrRef,
    phiMechanical(fixed=true),
    Rs=imcData.Rs*m/3,
    Lssigma=imcData.Lssigma*m/3,
    Lszero=imcData.Lszero*m/3,
    Lm=imcData.Lm*m/3,
    Lrsigma=imcData.Lrsigma*m/3,
    Rr=imcData.Rr*m/3,
    m=m,
    TsOperational=293.15,
    effectiveStatorTurns=imcData.effectiveStatorTurns,
    alpha20r=imcData.alpha20r,
    TrOperational=293.15)

  Modelica.Electrical.Polyphase.Sensors.CurrentQuasiRMSSensor currentQuasiRMSSensor(m=m)
  Modelica.Electrical.Polyphase.Sources.SineVoltage sineVoltage(
    final m=m,
    f=fill(fNominal, m),
    V=fill(sqrt(2)*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.MultiTerminalBox terminalBox(m=m,
      terminalConnection="Y")
  Modelica.Electrical.QuasiStatic.Polyphase.Basic.Star starMachineQS(final m=Modelica.Electrical.Polyphase.Functions.numberOfSymmetricBaseSystems(m))
  Modelica.Electrical.Polyphase.Basic.Star starMachine(final m=Modelica.Electrical.Polyphase.Functions.numberOfSymmetricBaseSystems(m))
initial equation
  imc.wMechanical = wSync;
  sum(imc.is) = 0;
  der(imc.airGap.V_msr.re) = 0;
  der(imc.airGap.V_msr.im) = 0;
  der(imc.airGap.V_mrr.re) = 0;
  der(imc.airGap.V_mrr.im) = 0;
equation
  connect(starQS.pin_n, groundQS.pin)
  connect(sineVoltageQS.plug_n, starQS.plug_p)
  connect(terminalBoxQS.plug_sn, imcQS.plug_sn)
  connect(terminalBoxQS.plug_sp, imcQS.plug_sp)
  connect(terminalBoxQS.plugSupply, currentQuasiRMSSensorQS.plug_n)
  connect(loadInertiaQS.flange_b, torqueStepQS.flange)
  connect(imcQS.flange, loadInertiaQS.flange_a)
  connect(sineVoltageQS.plug_p, currentQuasiRMSSensorQS.plug_p)
  connect(star.pin_n,ground. p)
  connect(sineVoltage.plug_n,star. plug_p)
  connect(terminalBox.plug_sn, imc.plug_sn)
  connect(terminalBox.plug_sp, imc.plug_sp)
  connect(terminalBox.plugSupply,currentQuasiRMSSensor. plug_n)
  connect(loadInertia.flange_b,torqueStep. flange)
  connect(imc.flange, loadInertia.flange_a)
  connect(sineVoltage.plug_p,currentQuasiRMSSensor. plug_p)
  connect(starMachineQS.plug_p, terminalBoxQS.starpoint)
  connect(terminalBox.starpoint, starMachine.plug_p)
  connect(starMachine.pin_n, ground.p)
  connect(starMachineQS.pin_n, groundQS.pin)
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 accelerate inertias. At time tStep a load step is applied.

within Modelica.Magnetic.QuasiStatic.FundamentalWave.Examples.BasicMachines.InductionMachines;
model IMC_Inverter
  "Induction machine with squirrel cage and inverter"
  extends Modelica.Icons.Example;
  import Modelica.Constants.pi;
  import Modelica.Constants.small;
  constant Integer m=3 "Number of phases";
  parameter SI.Voltage VNominal=100 "Nominal RMS voltage per phase";
  parameter SI.Frequency fNominal=50 "Nominal frequency";
  parameter SI.Frequency f=50 "Maximum operational frequency";
  parameter SI.Time tRamp=1 "Frequency ramp";
  parameter SI.Torque TLoad=161.4*min(1, fNominal/abs(f)) "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";
  SI.Frequency fs=ramp.y "Stator frequency";
  SI.Frequency fr=s*fs "Rotor frequency";
  Real s=if noEvent(abs(fs)<small) then 0 else 1 - aimc.wMechanical*aimcData.p/(2*pi*fs) "Slip";
  Modelica.Magnetic.QuasiStatic.FundamentalWave.BasicMachines.InductionMachines.IM_SquirrelCage
    aimc(
    m=m,
    p=aimcData.p,
    fsNominal=aimcData.fsNominal,
    TsRef=aimcData.TsRef,
    alpha20s(displayUnit="1/K") = aimcData.alpha20s,
    Jr=aimcData.Jr,
    Js=aimcData.Js,
    frictionParameters=aimcData.frictionParameters,
    phiMechanical(fixed=true, start=0),
    wMechanical(fixed=true, start=0),
    statorCoreParameters=aimcData.statorCoreParameters,
    strayLoadParameters=aimcData.strayLoadParameters,
    TrRef=aimcData.TrRef,
    Rs=aimcData.Rs*m/3,
    Lssigma=aimcData.Lssigma*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.QuasiStatic.Polyphase.Sensors.CurrentQuasiRMSSensor
    currentQuasiRMSSensor(m=m)
  Modelica.Blocks.Sources.Ramp ramp(height=f, duration=tRamp)
  Modelica.Magnetic.QuasiStatic.FundamentalWave.Utilities.VfController
    vfController(
      final m=m,
      VNominal=VNominal,
      fNominal=fNominal)
  Modelica.Electrical.QuasiStatic.Polyphase.Sources.VariableVoltageSource
    voltageSource(final m=m)
  Modelica.Electrical.QuasiStatic.Polyphase.Basic.Star
    star(final m=m)
  Modelica.Electrical.QuasiStatic.SinglePhase.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.Magnetic.QuasiStatic.FundamentalWave.Utilities.TerminalBox
    terminalBox(m=m, terminalConnection="Y")
  parameter
    Modelica.Electrical.Machines.Utilities.ParameterRecords.IM_SquirrelCageData
    aimcData "Induction machine data"
  Modelica.Electrical.QuasiStatic.SinglePhase.Basic.Ground
    ground1
initial equation
  aimc.rotorCage.port_p.reference.gamma=0;
equation
  connect(ramp.y, vfController.u)
  connect(loadTorqueStep.flange, loadInertia.flange_b)
  connect(aimc.flange, loadInertia.flange_a)
  connect(ramp.y, voltageSource.f)
  connect(vfController.y, voltageSource.V)
  connect(terminalBox.plug_sn, aimc.plug_sn)
  connect(terminalBox.plug_sp, aimc.plug_sp)
  connect(terminalBox.plugSupply, currentQuasiRMSSensor.plug_n)
  connect(currentQuasiRMSSensor.plug_p, voltageSource.plug_p)
  connect(star.plug_p, voltageSource.plug_n)
  connect(star.pin_n, ground.pin)
  connect(ground1.pin, terminalBox.starpoint)
end IMC_Inverter;