Starting of induction machine with slip rings. At start time tOn three-phase voltage is supplied to the
induction machine with sliprings.
The machine starts from standstill, accelerating inertias against load torque quadratic dependent on speed,
using a starting resistance. At time tRheostat external rotor resistance is shortened, finally reaching nominal speed.

within Modelica.Magnetic.FundamentalWave.Examples.BasicMachines.InductionMachines;
model IMS_Start
  "Starting of induction machine with slip rings"
  extends Modelica.Icons.Example;
  constant Integer m=3 "Number of phases";
  parameter SI.Voltage VsNominal=100
    "Nominal RMS voltage per phase";
  parameter SI.Frequency fNominal=aimsData.fsNominal "Nominal frequency";
  parameter SI.Time tOn=0.1 "Start time of machine";
  parameter SI.Resistance RStart=0.16/aimsData.turnsRatio^2
    "Starting resistance";
  parameter SI.Time tRheostat=1.0
    "Time of shortening the rheostat";
  parameter SI.Torque T_Load=161.4 "Nominal load torque";
  parameter SI.AngularVelocity w_Load(displayUnit="rev/min")=
       Modelica.Units.Conversions.from_rpm(1440.45)
    "Nominal load speed";
  parameter SI.Inertia J_Load=0.29 "Load inertia";
  Modelica.Electrical.Analog.Basic.Ground ground
  Modelica.Electrical.Polyphase.Basic.Star star(final m=m)
  Modelica.Electrical.Polyphase.Sources.SineVoltage sineVoltage(
    final m=m,
    V=fill(sqrt(2.0/3.0)*VsNominal, m),
    f=fill(fNominal, m))
  Modelica.Electrical.Polyphase.Ideal.IdealClosingSwitch idealCloser(
    final m=m,
    Ron=fill(1e-5, m),
    Goff=fill(1e-5, m))
  Modelica.Blocks.Sources.BooleanStep booleanStep[m](each startTime=tOn)
  Modelica.Electrical.Polyphase.Sensors.CurrentQuasiRMSSensor currentRMSsensorM
  Modelica.Electrical.Machines.Sensors.CurrentQuasiRMSSensor
    currentRMSsensorE
  Modelica.Electrical.Machines.Utilities.TerminalBox terminalBoxM(
      terminalConnection="D")
  Modelica.Electrical.Machines.Utilities.TerminalBox terminalBoxE(
      terminalConnection="D")
  Magnetic.FundamentalWave.BasicMachines.InductionMachines.IM_SlipRing aimsM(
    Jr=aimsData.Jr,
    Js=aimsData.Js,
    p=aimsData.p,
    fsNominal=aimsData.fsNominal,
    Rs=aimsData.Rs,
    TsRef=aimsData.TsRef,
    alpha20s(displayUnit="1/K") = aimsData.alpha20s,
    Lssigma=aimsData.Lssigma,
    ratioCommonStatorLeakage=aimsData.ratioCommonStatorLeakage,
    Lszero=aimsData.Lszero,
    frictionParameters=aimsData.frictionParameters,
    statorCoreParameters=aimsData.statorCoreParameters,
    strayLoadParameters=aimsData.strayLoadParameters,
    phiMechanical(fixed=true),
    wMechanical(fixed=true),
    Lm=aimsData.Lm,
    Lrsigma=aimsData.Lrsigma,
    ratioCommonRotorLeakage=aimsData.ratioCommonRotorLeakage,
    Lrzero=aimsData.Lrzero,
    Rr=aimsData.Rr,
    TrRef=aimsData.TrRef,
    alpha20r(displayUnit="1/K") = aimsData.alpha20r,
    useTurnsRatio=aimsData.useTurnsRatio,
    VsNominal=aimsData.VsNominal,
    VrLockedRotor=aimsData.VrLockedRotor,
    rotorCoreParameters=aimsData.rotorCoreParameters,
    TurnsRatio=aimsData.turnsRatio,
    TsOperational=293.15,
    effectiveStatorTurns=aimsData.effectiveStatorTurns,
    TrOperational=293.15)
  Modelica.Electrical.Machines.BasicMachines.InductionMachines.IM_SlipRing
    aimsE(
    p=aimsData.p,
    fsNominal=aimsData.fsNominal,
    Rs=aimsData.Rs,
    TsRef=aimsData.TsRef,
    alpha20s(displayUnit="1/K") = aimsData.alpha20s,
    Lszero=aimsData.Lszero,
    Lssigma=aimsData.Lssigma,
    Jr=aimsData.Jr,
    Js=aimsData.Js,
    frictionParameters=aimsData.frictionParameters,
    phiMechanical(fixed=true),
    wMechanical(fixed=true),
    statorCoreParameters=aimsData.statorCoreParameters,
    strayLoadParameters=aimsData.strayLoadParameters,
    Lm=aimsData.Lm,
    Lrsigma=aimsData.Lrsigma,
    Lrzero=aimsData.Lrzero,
    Rr=aimsData.Rr,
    TrRef=aimsData.TrRef,
    alpha20r(displayUnit="1/K") = aimsData.alpha20r,
    useTurnsRatio=aimsData.useTurnsRatio,
    VsNominal=aimsData.VsNominal,
    VrLockedRotor=aimsData.VrLockedRotor,
    rotorCoreParameters=aimsData.rotorCoreParameters,
    TsOperational=566.3,
    turnsRatio=aimsData.turnsRatio,
    TrOperational=566.3)
  Modelica.Electrical.Machines.Utilities.SwitchedRheostat rheostatM(
    RStart=RStart,
    tStart=tRheostat,
    m=m)
  Modelica.Electrical.Machines.Utilities.SwitchedRheostat rheostatE(
    RStart=RStart,
    tStart=tRheostat,
    m=m)
  Modelica.Mechanics.Rotational.Components.Inertia loadInertiaM(J=J_Load)
  Modelica.Mechanics.Rotational.Components.Inertia loadInertiaE(J=J_Load)
  Modelica.Mechanics.Rotational.Sources.QuadraticSpeedDependentTorque
    quadraticLoadTorqueM(
    tau_nominal=-T_Load,
    TorqueDirection=false,
    useSupport=false,
    w_nominal=w_Load)
  Modelica.Mechanics.Rotational.Sources.QuadraticSpeedDependentTorque
    quadraticLoadTorqueE(
    tau_nominal=-T_Load,
    TorqueDirection=false,
    useSupport=false,
    w_nominal=w_Load)
  parameter
    Modelica.Electrical.Machines.Utilities.ParameterRecords.IM_SlipRingData aimsData
    "Induction machine data"
initial equation
  aimsE.is = zeros(3);
  aimsE.ir = zeros(3);
  aimsM.is = zeros(3);
  aimsM.ir = zeros(3);
equation
  connect(star.pin_n, ground.p)
  connect(sineVoltage.plug_n, star.plug_p)
  connect(loadInertiaE.flange_b, quadraticLoadTorqueE.flange)
  connect(aimsE.flange, loadInertiaE.flange_a)
  connect(booleanStep.y, idealCloser.control)
  connect(terminalBoxE.plug_sn, aimsE.plug_sn)
  connect(terminalBoxE.plug_sp, aimsE.plug_sp)
  connect(rheostatE.plug_p, aimsE.plug_rp)
  connect(rheostatE.plug_n, aimsE.plug_rn)
  connect(loadInertiaM.flange_b, quadraticLoadTorqueM.flange)
  connect(aimsM.flange, loadInertiaM.flange_a)
  connect(terminalBoxM.plug_sp, aimsM.plug_sp)
  connect(terminalBoxM.plug_sn, aimsM.plug_sn)
  connect(currentRMSsensorM.plug_n, terminalBoxM.plugSupply)
  connect(rheostatM.plug_p, aimsM.plug_rp)
  connect(rheostatM.plug_n, aimsM.plug_rn)
  connect(currentRMSsensorE.plug_n, terminalBoxE.plugSupply)
  connect(idealCloser.plug_n, currentRMSsensorM.plug_p)

  connect(currentRMSsensorE.plug_p, idealCloser.plug_n)
  connect(idealCloser.plug_p, sineVoltage.plug_p)
end IMS_Start;


Induction machines examples

within Modelica.Magnetic.FundamentalWave.Examples.BasicMachines;
package InductionMachines "Induction machines examples"
  extends Modelica.Icons.ExamplesPackage;
end InductionMachines;


Direct on line start of polyphase induction machine with squirrel cage. At start time tStart voltages are supplied to the
polyphase induction machines with squirrel cage.
The machines starts from standstill, accelerating inertias against load torque quadratic dependent on speed, finally reaching nominal speed.
Three equivalent machines with different parameter ratioCommonLeakage are compared.
Note that due to the mode of operation, the behaviour of all three machines is identical.
Only when fed by switching power electronics, parameter ratioCommonLeakage is essential.

within Modelica.Magnetic.FundamentalWave.Examples.BasicMachines.InductionMachines.ComparisonPolyphase;
model IMC_DOL_CommonLeakage
  "Direct on line start of polyphase induction machine with squirrel cage"
  extends Modelica.Icons.Example;
  import Modelica.Electrical.Polyphase.Functions.numberOfSymmetricBaseSystems;
  parameter Integer m=5 "Number of stator phases"
  final parameter Integer mBase=numberOfSymmetricBaseSystems(m) "Number of symmetric base systems";
  parameter SI.Voltage VsNominal=100
    "Nominal RMS voltage per phase";
  parameter SI.Frequency fNominal=aimcData.fsNominal "Nominal frequency";
  parameter SI.Time tOn=0.1 "Start time of machine";
  parameter SI.Torque T_Load=161.4 "Nominal load torque";
  parameter SI.AngularVelocity w_Load(displayUnit="rev/min")=
       1440.45*2*Modelica.Constants.pi/60 "Nominal load speed";
  parameter SI.Inertia J_Load=0.29 "Load inertia";
  Modelica.Electrical.Analog.Basic.Ground groundM
  Modelica.Electrical.Polyphase.Basic.Star starM(final m=m)
  Modelica.Electrical.Polyphase.Sources.SineVoltage sineVoltageM(
    final m=m,
    f=fill(fNominal, m),
    V=fill(sqrt(2.0)*VsNominal, m),
    phase=-Modelica.Electrical.Polyphase.Functions.symmetricOrientation(
        m))
  Modelica.Electrical.Polyphase.Ideal.IdealClosingSwitch idealCloserM(
    final m=m,
    Ron=fill(1e-5*m/3, m),
    Goff=fill(1e-5*3/m, m))
  Modelica.Blocks.Sources.BooleanStep booleanStepM[m](each startTime=tOn, each
      startValue=false)
  Modelica.Electrical.Polyphase.Sensors.CurrentQuasiRMSSensor currentRMSsensor0(m=m)
  Electrical.Machines.Utilities.MultiTerminalBox     terminalBox0(m=m,
      terminalConnection="Y")
  Magnetic.FundamentalWave.BasicMachines.InductionMachines.IM_SquirrelCage aimc0(
    Jr=aimcData.Jr,
    Js=aimcData.Js,
    p=aimcData.p,
    fsNominal=aimcData.fsNominal,
    TsRef=aimcData.TsRef,
    alpha20s(displayUnit="1/K") = aimcData.alpha20s,
    ratioCommonStatorLeakage=0,
    frictionParameters=aimcData.frictionParameters,
    statorCoreParameters=aimcData.statorCoreParameters,
    strayLoadParameters=aimcData.strayLoadParameters,
    TrRef=aimcData.TrRef,
    alpha20r(displayUnit="1/K") = aimcData.alpha20r,
    phiMechanical(fixed=true),
    wMechanical(fixed=true),
    m=m,
    Rs=aimcData.Rs*m/3,
    Lssigma=aimcData.Lssigma*m/3,
    Lszero=aimcData.Lszero*m/3,
    Lm=aimcData.Lm*m/3,
    Lrsigma=aimcData.Lrsigma*m/3,
    Rr=aimcData.Rr*m/3,
    TsOperational=293.15,
    effectiveStatorTurns=aimcData.effectiveStatorTurns,
    TrOperational=293.15)
  Modelica.Mechanics.Rotational.Components.Inertia loadInertia0(J=J_Load)
  Modelica.Mechanics.Rotational.Sources.QuadraticSpeedDependentTorque
    quadraticLoadTorque0(
    w_nominal=w_Load,
    tau_nominal=-T_Load,
    TorqueDirection=false,
    useSupport=false)
  parameter
    Modelica.Electrical.Machines.Utilities.ParameterRecords.IM_SquirrelCageData
    aimcData "Induction machine data"
  Electrical.Polyphase.Sensors.CurrentQuasiRMSSensor currentRMSsensorH(m=m)
  Electrical.Machines.Utilities.MultiTerminalBox
                                            terminalBoxH(m=m,
      terminalConnection="Y")
  Modelica.Magnetic.FundamentalWave.BasicMachines.InductionMachines.IM_SquirrelCage
    aimcH(
    Jr=aimcData.Jr,
    Js=aimcData.Js,
    p=aimcData.p,
    fsNominal=aimcData.fsNominal,
    TsRef=aimcData.TsRef,
    alpha20s(displayUnit="1/K") = aimcData.alpha20s,
    ratioCommonStatorLeakage=0.5,
    frictionParameters=aimcData.frictionParameters,
    statorCoreParameters=aimcData.statorCoreParameters,
    strayLoadParameters=aimcData.strayLoadParameters,
    TrRef=aimcData.TrRef,
    alpha20r(displayUnit="1/K") = aimcData.alpha20r,
    phiMechanical(fixed=true),
    wMechanical(fixed=true),
    m=m,
    Rs=aimcData.Rs*m/3,
    Lssigma=aimcData.Lssigma*m/3,
    Lszero=aimcData.Lszero*m/3,
    Lm=aimcData.Lm*m/3,
    Lrsigma=aimcData.Lrsigma*m/3,
    Rr=aimcData.Rr*m/3,
    TsOperational=293.15,
    effectiveStatorTurns=aimcData.effectiveStatorTurns,
    TrOperational=293.15)
  Mechanics.Rotational.Components.Inertia loadInertiaH(J=J_Load)
  Mechanics.Rotational.Sources.QuadraticSpeedDependentTorque quadraticLoadTorqueH(
    w_nominal=w_Load,
    tau_nominal=-T_Load,
    TorqueDirection=false,
    useSupport=false)
  Electrical.Polyphase.Sensors.CurrentQuasiRMSSensor          currentRMSsensor1(m=m)
  Electrical.Machines.Utilities.MultiTerminalBox     terminalBox1(m=m,
      terminalConnection="Y")
  Modelica.Magnetic.FundamentalWave.BasicMachines.InductionMachines.IM_SquirrelCage
                                                                           aimc1(
    Jr=aimcData.Jr,
    Js=aimcData.Js,
    p=aimcData.p,
    fsNominal=aimcData.fsNominal,
    TsRef=aimcData.TsRef,
    alpha20s(displayUnit="1/K") = aimcData.alpha20s,
    ratioCommonStatorLeakage=1,
    frictionParameters=aimcData.frictionParameters,
    statorCoreParameters=aimcData.statorCoreParameters,
    strayLoadParameters=aimcData.strayLoadParameters,
    TrRef=aimcData.TrRef,
    alpha20r(displayUnit="1/K") = aimcData.alpha20r,
    phiMechanical(fixed=true),
    wMechanical(fixed=true),
    m=m,
    Rs=aimcData.Rs*m/3,
    Lssigma=aimcData.Lssigma*m/3,
    Lszero=aimcData.Lszero*m/3,
    Lm=aimcData.Lm*m/3,
    Lrsigma=aimcData.Lrsigma*m/3,
    Rr=aimcData.Rr*m/3,
    TsOperational=293.15,
    effectiveStatorTurns=aimcData.effectiveStatorTurns,
    TrOperational=293.15)
  Mechanics.Rotational.Components.Inertia          loadInertia1(J=J_Load)
  Mechanics.Rotational.Sources.QuadraticSpeedDependentTorque
    quadraticLoadTorque1(
    w_nominal=w_Load,
    tau_nominal=-T_Load,
    TorqueDirection=false,
    useSupport=false)
  Electrical.Polyphase.Basic.Star starBase0(m=mBase)
  Electrical.Polyphase.Basic.Star starBaseH(m=mBase)
  Electrical.Polyphase.Basic.Star starBase1(m=mBase)
initial equation
  aimc0.is[1:m - 1] = zeros(m - 1);
  aimc0.rotorCage.electroMagneticConverter.Phi = Complex(0, 0);
  aimcH.is[1:m - 1] = zeros(m - 1);
  aimcH.rotorCage.electroMagneticConverter.Phi = Complex(0, 0);
  aimc1.is[1:2] = zeros(2);
  aimc1.rotorCage.electroMagneticConverter.Phi = Complex(0, 0);
equation
  connect(starM.pin_n, groundM.p)
  connect(sineVoltageM.plug_n, starM.plug_p)
  connect(aimc0.flange,loadInertia0. flange_a)
  connect(terminalBox0.plug_sn,aimc0. plug_sn)
  connect(terminalBox0.plug_sp,aimc0. plug_sp)
  connect(sineVoltageM.plug_p, idealCloserM.plug_p)
  connect(idealCloserM.plug_n,currentRMSsensor0. plug_p)
  connect(booleanStepM.y, idealCloserM.control)
  connect(loadInertia0.flange_b,quadraticLoadTorque0. flange)
  connect(currentRMSsensor0.plug_n,terminalBox0. plugSupply)
  connect(aimcH.flange, loadInertiaH.flange_a)
  connect(terminalBoxH.plug_sn, aimcH.plug_sn)
  connect(terminalBoxH.plug_sp, aimcH.plug_sp)
  connect(idealCloserM.plug_n, currentRMSsensorH.plug_p)
  connect(loadInertiaH.flange_b, quadraticLoadTorqueH.flange)
  connect(currentRMSsensorH.plug_n, terminalBoxH.plugSupply)
  connect(aimc1.flange,loadInertia1. flange_a)
  connect(terminalBox1.plug_sn,aimc1. plug_sn)
  connect(terminalBox1.plug_sp,aimc1. plug_sp)
  connect(idealCloserM.plug_n,currentRMSsensor1. plug_p)
  connect(loadInertia1.flange_b,quadraticLoadTorque1. flange)
  connect(currentRMSsensor1.plug_n,terminalBox1. plugSupply)
  connect(terminalBox0.starpoint, starBase0.plug_p)
  connect(starBaseH.plug_p, terminalBoxH.starpoint)
  connect(starBase1.plug_p, terminalBox1.starpoint)
end IMC_DOL_CommonLeakage;


Direct on line start of polyphase induction machine with squirrel cage. At start time tStart voltages are supplied to the
polyphase induction machines with squirrel cage.
The machines starts from standstill, accelerating
inertias against load torque quadratic dependent on speed, finally reaching nominal speed. Two equivalent machines with different numbers of phases are compared and their equal behavior is demonstrated.

within Modelica.Magnetic.FundamentalWave.Examples.BasicMachines.InductionMachines.ComparisonPolyphase;
model IMC_DOL_Polyphase
  "Direct on line start of polyphase induction machine with squirrel cage"

  import Modelica.Constants.pi;
  extends Modelica.Icons.Example;
  constant Integer m3=3 "Number of stator phases of three-phase system";
  parameter Integer m=5 "Number of stator phases"
  parameter SI.Voltage VsNominal=100 "Nominal RMS voltage per phase";
  parameter SI.Frequency fNominal=aimcData3.fsNominal "Nominal frequency";
  parameter SI.Time tOn=0.1 "Start time of machine";
  parameter SI.Torque T_Load=161.4 "Nominal load torque";
  parameter SI.AngularVelocity w_Load(displayUnit="rev/min")=
       1440.45*2*Modelica.Constants.pi/60 "Nominal load speed";
  parameter SI.Inertia J_Load=0.29 "Load inertia";
  parameter Integer p=2 "Number of pole pairs";
  Modelica.Electrical.Analog.Basic.Ground groundM
  Modelica.Electrical.Polyphase.Basic.Star starM(final m=m)
  Modelica.Electrical.Polyphase.Sources.SineVoltage sineVoltageM(
    final m=m,
    f=fill(fNominal, m),
    V=fill(sqrt(2.0)*VsNominal, m),
    phase=-Modelica.Electrical.Polyphase.Functions.symmetricOrientation(
        m))
  Modelica.Electrical.Polyphase.Ideal.IdealClosingSwitch idealCloserM(
    final m=m,
    Ron=fill(1e-5*m/m3, m),
    Goff=fill(1e-5*m3/m, m))
  Modelica.Blocks.Sources.BooleanStep booleanStepM[m](each startTime=tOn, each
      startValue=false)
  Modelica.Electrical.Polyphase.Sensors.CurrentQuasiRMSSensor currentRMSsensorM(m=m)
  Modelica.Electrical.Machines.Utilities.TerminalBox terminalBoxM(m=m,
      terminalConnection="Y")
  Magnetic.FundamentalWave.BasicMachines.InductionMachines.IM_SquirrelCage
    aimcM(
    Jr=aimcDataM.Jr,
    Js=aimcData3.Js,
    p=aimcDataM.p,
    fsNominal=aimcDataM.fsNominal,
    TsRef=aimcDataM.TsRef,
    alpha20s(displayUnit="1/K") = aimcDataM.alpha20s,
    ratioCommonStatorLeakage=aimcDataM.ratioCommonStatorLeakage,
    frictionParameters=aimcDataM.frictionParameters,
    statorCoreParameters=aimcDataM.statorCoreParameters,
    strayLoadParameters=aimcDataM.strayLoadParameters,
    TrRef=aimcDataM.TrRef,
    alpha20r(displayUnit="1/K") = aimcData3.alpha20r,
    phiMechanical(fixed=true),
    wMechanical(fixed=true),
    m=m,
    Rs=aimcDataM.Rs,
    Lssigma=aimcDataM.Lssigma,
    Lszero=aimcDataM.Lszero,
    Lm=aimcDataM.Lm,
    Lrsigma=aimcDataM.Lrsigma,
    Rr=aimcDataM.Rr,
    TsOperational=293.15,
    effectiveStatorTurns=aimcDataM.effectiveStatorTurns,
    TrOperational=293.15)
  Modelica.Mechanics.Rotational.Components.Inertia loadInertiaM(J=J_Load)
  Modelica.Mechanics.Rotational.Sources.QuadraticSpeedDependentTorque
    quadraticLoadTorqueM(
    w_nominal=w_Load,
    tau_nominal=-T_Load,
    TorqueDirection=false,
    useSupport=false)
  parameter
    Modelica.Electrical.Machines.Utilities.ParameterRecords.IM_SquirrelCageData
    aimcData3 "Induction machine data of a three-phase machine"
  Modelica.Electrical.Analog.Basic.Ground ground3
  Modelica.Electrical.Polyphase.Basic.Star star3(final m=m3)
  Modelica.Electrical.Polyphase.Sources.SineVoltage sineVoltage3(
    final m=m3,
    V=fill(sqrt(2.0)*VsNominal, m3),
    phase=-Modelica.Electrical.Polyphase.Functions.symmetricOrientation(
        m3),
    f=fill(fNominal, m3))
  Modelica.Electrical.Polyphase.Ideal.IdealClosingSwitch idealCloser3(
    final m=m3,
    Ron=fill(1e-5, m3),
    Goff=fill(1e-5, m3))
  Modelica.Blocks.Sources.BooleanStep booleanStep3[m3](each startTime=tOn,
      each startValue=false)
  Modelica.Electrical.Machines.Sensors.CurrentQuasiRMSSensor currentRMSsensor3(m=3)
  Modelica.Electrical.Machines.Utilities.TerminalBox terminalBox3(
      terminalConnection="Y", m=m3)
  Magnetic.FundamentalWave.BasicMachines.InductionMachines.IM_SquirrelCage
    aimc3(
    Jr=aimcData3.Jr,
    Js=aimcData3.Js,
    p=aimcData3.p,
    fsNominal=aimcData3.fsNominal,
    Rs=aimcData3.Rs,
    TsRef=aimcData3.TsRef,
    alpha20s(displayUnit="1/K") = aimcData3.alpha20s,
    Lssigma=aimcData3.Lssigma,
    ratioCommonStatorLeakage=aimcData3.ratioCommonStatorLeakage,
    Lszero=aimcData3.Lszero,
    frictionParameters=aimcData3.frictionParameters,
    statorCoreParameters=aimcData3.statorCoreParameters,
    strayLoadParameters=aimcData3.strayLoadParameters,
    Lm=aimcData3.Lm,
    Lrsigma=aimcData3.Lrsigma,
    Rr=aimcData3.Rr,
    TrRef=aimcData3.TrRef,
    alpha20r(displayUnit="1/K") = aimcData3.alpha20r,
    phiMechanical(fixed=true),
    wMechanical(fixed=true),
    m=3,
    TsOperational=293.15,
    effectiveStatorTurns=aimcData3.effectiveStatorTurns,
    TrOperational=293.15)
  Modelica.Mechanics.Rotational.Components.Inertia loadInertia3(J=J_Load)
  Modelica.Mechanics.Rotational.Sources.QuadraticSpeedDependentTorque
    quadraticLoadTorque3(
    w_nominal=w_Load,
    tau_nominal=-T_Load,
    TorqueDirection=false,
    useSupport=false)
  Modelica.Blocks.Math.Gain gain(k=(m/m3))
  Modelica.Blocks.Math.Feedback feedback
  parameter
    Electrical.Machines.Utilities.ParameterRecords.IM_SquirrelCageData
    aimcDataM(
    m=m,
    Rs=0.03*m/3,
    Lszero=3*(1 - sqrt(1 - 0.0667))/(2*pi*fNominal)*m/3,
    Lssigma=3*(1 - sqrt(1 - 0.0667))/(2*pi*fNominal)*m/3,
    statorCoreParameters(m=m),
    Lm=3*sqrt(1 - 0.0667)/(2*pi*fNominal)*m/3,
    Lrsigma=3*(1 - sqrt(1 - 0.0667))/(2*pi*fNominal)*m/3,
    Rr=0.04*m/3) "Induction machine data of an m-phase machine"
initial equation
  aimc3.is[1:2] = zeros(2);
  aimc3.ir[1:2] = zeros(2);
  aimcM.is[1:2] = zeros(2);
  aimcM.rotorCage.electroMagneticConverter.Phi = Complex(0, 0);

equation
  connect(starM.pin_n, groundM.p)
  connect(sineVoltageM.plug_n, starM.plug_p)
  connect(aimcM.flange, loadInertiaM.flange_a)
  connect(terminalBoxM.plug_sn, aimcM.plug_sn)
  connect(terminalBoxM.plug_sp, aimcM.plug_sp)
  connect(sineVoltageM.plug_p, idealCloserM.plug_p)
  connect(idealCloserM.plug_n, currentRMSsensorM.plug_p)
  connect(booleanStepM.y, idealCloserM.control)
  connect(star3.pin_n, ground3.p)
  connect(sineVoltage3.plug_n, star3.plug_p)
  connect(aimc3.flange, loadInertia3.flange_a)
  connect(loadInertia3.flange_b, quadraticLoadTorque3.flange)
  connect(terminalBox3.plug_sn, aimc3.plug_sn)
  connect(terminalBox3.plug_sp, aimc3.plug_sp)
  connect(terminalBox3.plugSupply, currentRMSsensor3.plug_n)
  connect(sineVoltage3.plug_p, idealCloser3.plug_p)
  connect(idealCloser3.plug_n, currentRMSsensor3.plug_p)
  connect(booleanStep3.y, idealCloser3.control)
  connect(currentRMSsensorM.I, gain.u)
  connect(loadInertiaM.flange_b, quadraticLoadTorqueM.flange)
  connect(currentRMSsensor3.I, feedback.u1)
  connect(feedback.u2, gain.y)
  connect(currentRMSsensorM.plug_n, terminalBoxM.plugSupply)
end IMC_DOL_Polyphase;


Starting of polyphase induction machine with slip rings. At start time tOn voltages are supplied to the
induction machines with sliprings.
The two machine start from standstill, accelerating inertias against load torque quadratic dependent on speed,
using a starting resistance. At time tRheostat external rotor resistance is shortened, finally reaching nominal speed. Two equivalent machines with different numbers of phases are compared and their equal behavior is demonstrated.

within Modelica.Magnetic.FundamentalWave.Examples.BasicMachines.InductionMachines.ComparisonPolyphase;
model IMS_Start_Polyphase
  "Starting of polyphase induction machine with slip rings"

  import Modelica.Constants.pi;
  extends Modelica.Icons.Example;
  constant Integer m3=3 "Number of stator phases of three-phase system";
  parameter Integer m=5 "Number of stator phases"
  parameter Integer mr=5 "Number of rotor phases"
  parameter SI.Voltage VsNominal=100
    "Nominal RMS voltage per phase";
  parameter SI.Frequency fNominal=aimsData3.fsNominal "Nominal frequency";
  parameter SI.Time tOn=0.1 "Start time of machine";
  parameter SI.Resistance RStart=0.16/aimsData3.turnsRatio^2
    "Starting resistance";
  parameter SI.Time tRheostat=1.0
    "Time of shortening the rheostat";
  parameter SI.Torque T_Load=161.4 "Nominal load torque";
  parameter SI.AngularVelocity w_Load(displayUnit="rev/min")=
       Modelica.Units.Conversions.from_rpm(1440.45)
    "Nominal load speed";
  parameter SI.Inertia J_Load=0.29 "Load inertia";
  Modelica.Electrical.Machines.Utilities.TerminalBox terminalBoxM(m=m,
      terminalConnection="Y")
  Modelica.Electrical.Machines.Utilities.TerminalBox terminalBox3(
      terminalConnection="Y", m=m3)
  Magnetic.FundamentalWave.BasicMachines.InductionMachines.IM_SlipRing aimsM(
    Jr=aimsData3.Jr,
    Js=aimsData3.Js,
    p=aimsData3.p,
    fsNominal=aimsData3.fsNominal,
    TsRef=aimsData3.TsRef,
    alpha20s(displayUnit="1/K") = aimsData3.alpha20s,
    ratioCommonStatorLeakage=aimsData3.ratioCommonStatorLeakage,
    frictionParameters=aimsDataM.frictionParameters,
    statorCoreParameters=aimsDataM.statorCoreParameters,
    strayLoadParameters=aimsDataM.strayLoadParameters,
    phiMechanical(fixed=true),
    wMechanical(fixed=true),
    ratioCommonRotorLeakage=aimsData3.ratioCommonRotorLeakage,
    TrRef=aimsData3.TrRef,
    alpha20r(displayUnit="1/K") = aimsData3.alpha20r,
    useTurnsRatio=aimsData3.useTurnsRatio,
    VsNominal=aimsData3.VsNominal,
    VrLockedRotor=aimsData3.VrLockedRotor,
    rotorCoreParameters=aimsDataM.rotorCoreParameters,
    TurnsRatio=aimsData3.turnsRatio,
    mr=mr,
    m=m,
    Rs=aimsData3.Rs*m/3,
    Lssigma=aimsData3.Lssigma*m/3,
    Lszero=aimsData3.Lszero*m/3,
    Lm=aimsData3.Lm*m/3,
    Lrsigma=aimsData3.Lrsigma*mr/3,
    Lrzero=aimsData3.Lrzero*mr/3,
    Rr=aimsData3.Rr*mr/3,
    TsOperational=293.15,
    effectiveStatorTurns=aimsData3.effectiveStatorTurns,
    TrOperational=293.15)
  Magnetic.FundamentalWave.BasicMachines.InductionMachines.IM_SlipRing aims3(
    p=aimsData3.p,
    fsNominal=aimsData3.fsNominal,
    Rs=aimsData3.Rs,
    TsRef=aimsData3.TsRef,
    alpha20s(displayUnit="1/K") = aimsData3.alpha20s,
    ratioCommonStatorLeakage=aimsData3.ratioCommonStatorLeakage,
    Lszero=aimsData3.Lszero,
    Lssigma=aimsData3.Lssigma,
    Jr=aimsData3.Jr,
    Js=aimsData3.Js,
    frictionParameters=aimsData3.frictionParameters,
    phiMechanical(fixed=true),
    wMechanical(fixed=true),
    statorCoreParameters=aimsData3.statorCoreParameters,
    strayLoadParameters=aimsData3.strayLoadParameters,
    Lm=aimsData3.Lm,
    Lrsigma=aimsData3.Lrsigma,
    ratioCommonRotorLeakage=aimsData3.ratioCommonRotorLeakage,
    Lrzero=aimsData3.Lrzero,
    Rr=aimsData3.Rr,
    TrRef=aimsData3.TrRef,
    alpha20r(displayUnit="1/K") = aimsData3.alpha20r,
    useTurnsRatio=aimsData3.useTurnsRatio,
    VsNominal=aimsData3.VsNominal,
    VrLockedRotor=aimsData3.VrLockedRotor,
    rotorCoreParameters=aimsData3.rotorCoreParameters,
    m=m3,
    TurnsRatio=aimsData3.turnsRatio,
    TsOperational=566.3,
    effectiveStatorTurns=aimsData3.effectiveStatorTurns,
    TrOperational=566.3)
  Modelica.Electrical.Machines.Utilities.SwitchedRheostat rheostatM(
    tStart=tRheostat,
    m=mr,
    RStart=RStart*mr/m3)
  Modelica.Electrical.Machines.Utilities.SwitchedRheostat rheostat3(
    RStart=RStart,
    tStart=tRheostat,
    m=m3)
  Modelica.Mechanics.Rotational.Components.Inertia loadInertiaM(J=J_Load)
  Modelica.Mechanics.Rotational.Components.Inertia loadInertia3(J=J_Load)
  Modelica.Mechanics.Rotational.Sources.QuadraticSpeedDependentTorque
    quadraticLoadTorqueM(
    tau_nominal=-T_Load,
    TorqueDirection=false,
    useSupport=false,
    w_nominal=w_Load)
  Modelica.Mechanics.Rotational.Sources.QuadraticSpeedDependentTorque
    quadraticLoadTorque3(
    tau_nominal=-T_Load,
    TorqueDirection=false,
    useSupport=false,
    w_nominal=w_Load)
  parameter
    Modelica.Electrical.Machines.Utilities.ParameterRecords.IM_SlipRingData aimsData3
    "Induction machine data of a three-phase machine"
  Modelica.Electrical.Analog.Basic.Ground groundM
  Modelica.Electrical.Polyphase.Basic.Star starM(final m=m)
  Modelica.Electrical.Polyphase.Sources.SineVoltage sineVoltageM(
    final m=m,
    f=fill(fNominal, m),
    V=fill(sqrt(2.0)*VsNominal, m),
    phase=-Modelica.Electrical.Polyphase.Functions.symmetricOrientation(m))
  Modelica.Electrical.Polyphase.Ideal.IdealClosingSwitch idealCloserM(
    final m=m,
    Ron=fill(1e-5*m/3, m),
    Goff=fill(1e-5*m3/m, m))
  Modelica.Blocks.Sources.BooleanStep booleanStepM[m](each startTime=tOn, each
      startValue=false)
  Modelica.Electrical.Polyphase.Sensors.CurrentQuasiRMSSensor
    currentRMSsensorM(m=m)
  Modelica.Electrical.Analog.Basic.Ground ground3
  Modelica.Electrical.Polyphase.Basic.Star star3(final m=m3)
  Modelica.Electrical.Polyphase.Sources.SineVoltage sineVoltage3(
    final m=m3,
    V=fill(sqrt(2.0)*VsNominal, m3),
    phase=-Modelica.Electrical.Polyphase.Functions.symmetricOrientation(m3),
    f=fill(fNominal, m3))
  Modelica.Electrical.Polyphase.Ideal.IdealClosingSwitch idealCloser3(
    final m=m3,
    Ron=fill(1e-5, m3),
    Goff=fill(1e-5, m3))
  Modelica.Blocks.Sources.BooleanStep booleanStep3[m3](each startTime=tOn,
      each startValue=false)
  Modelica.Electrical.Machines.Sensors.CurrentQuasiRMSSensor
    currentRMSsensor3(m=3)
  Modelica.Blocks.Math.Gain gain(k=(m/m3))
  Modelica.Blocks.Math.Feedback feedback
  parameter
    Electrical.Machines.Utilities.ParameterRecords.IM_SlipRingData          aimsDataM(
    m=m,
    Rs=0.03*m/3,
    Lszero=3*(1 - sqrt(1 - 0.0667))/(2*pi*fNominal)*m/3,
    Lssigma=3*(1 - sqrt(1 - 0.0667))/(2*pi*fNominal)*m/3,
    statorCoreParameters(m=m),
    Lm=3*sqrt(1 - 0.0667)/(2*pi*fNominal),
    Lrsigma=3*(1 - sqrt(1 - 0.0667))/(2*pi*fNominal)/aimsDataM.turnsRatio^2,
    Lrzero=3*(1 - sqrt(1 - 0.0667))/(2*pi*fNominal)/aimsDataM.turnsRatio^2,
    Rr=0.04/aimsDataM.turnsRatio^2,
    rotorCoreParameters(m=m)) "Induction machine data of an m-phase machine"
initial equation
  aims3.is[1:2] = zeros(2);
  aims3.ir[1:3] = zeros(3);
  aimsM.is[1:2] = zeros(2);
  aimsM.ir[1:mr - 2] = zeros(mr - 2);
equation
  connect(loadInertia3.flange_b, quadraticLoadTorque3.flange)
  connect(aims3.flange, loadInertia3.flange_a)
  connect(terminalBox3.plug_sn, aims3.plug_sn)
  connect(terminalBox3.plug_sp, aims3.plug_sp)
  connect(rheostat3.plug_p, aims3.plug_rp)
  connect(rheostat3.plug_n, aims3.plug_rn)
  connect(loadInertiaM.flange_b, quadraticLoadTorqueM.flange)
  connect(aimsM.flange, loadInertiaM.flange_a)
  connect(terminalBoxM.plug_sp, aimsM.plug_sp)
  connect(terminalBoxM.plug_sn, aimsM.plug_sn)
  connect(rheostatM.plug_p, aimsM.plug_rp)
  connect(rheostatM.plug_n, aimsM.plug_rn)
  connect(starM.pin_n, groundM.p)
  connect(sineVoltageM.plug_n, starM.plug_p)
  connect(sineVoltageM.plug_p, idealCloserM.plug_p)
  connect(idealCloserM.plug_n, currentRMSsensorM.plug_p)
  connect(booleanStepM.y, idealCloserM.control)
  connect(star3.pin_n, ground3.p)
  connect(sineVoltage3.plug_n, star3.plug_p)
  connect(sineVoltage3.plug_p, idealCloser3.plug_p)
  connect(idealCloser3.plug_n, currentRMSsensor3.plug_p)
  connect(booleanStep3.y, idealCloser3.control)
  connect(currentRMSsensorM.I, gain.u)
  connect(currentRMSsensor3.plug_n, terminalBox3.plugSupply)
  connect(currentRMSsensorM.plug_n, terminalBoxM.plugSupply)
  connect(currentRMSsensor3.I, feedback.u1)
  connect(feedback.u2, gain.y)
end IMS_Start_Polyphase;


within Modelica.Magnetic.FundamentalWave.Examples.BasicMachines.InductionMachines;
package ComparisonPolyphase "Compare polyphase machines with three-phase machines"
  extends Modelica.Icons.ExamplesPackage;

end ComparisonPolyphase;


Synchronous machines examples

within Modelica.Magnetic.FundamentalWave.Examples.BasicMachines;
package SynchronousMachines "Synchronous machines examples"
  extends Modelica.Icons.ExamplesPackage;
end SynchronousMachines;


ElectricalExcitedSynchronousMachine starting direct on line. An electrically excited synchronous generator is started direct on line utilizing the damper cage
(and the shorted excitation winding) at 0 seconds.

within Modelica.Magnetic.FundamentalWave.Examples.BasicMachines.SynchronousMachines;
model SMEE_DOL
  "ElectricalExcitedSynchronousMachine starting direct on line"
  extends Modelica.Icons.Example;
  parameter 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.Voltage Ve=smeeData.Re*smeeData.IeOpenCircuit "Excitation current";
  parameter SI.Angle gamma0(displayUnit="deg") = 0 "Initial rotor displacement angle";
  Modelica.Blocks.Interfaces.RealOutput irRMS(
    final quantity="ElectricCurrent",
    final unit="A") if smee.useDamperCage "Damper cage RMS current"
  Magnetic.FundamentalWave.BasicMachines.SynchronousMachines.SM_ElectricalExcited
    smee(
    ratioCommonStatorLeakage=smeeData.ratioCommonStatorLeakage,
    phiMechanical(start=-(Modelica.Constants.pi + gamma0)/smee.p, fixed=true),
    fsNominal=smeeData.fsNominal,
    TsRef=smeeData.TsRef,
    Lrsigmad=smeeData.Lrsigmad,
    Lrsigmaq=smeeData.Lrsigmaq,
    Rrd=smeeData.Rrd,
    Rrq=smeeData.Rrq,
    TrRef=smeeData.TrRef,
    VsNominal=smeeData.VsNominal,
    IeOpenCircuit=smeeData.IeOpenCircuit,
    Re=smeeData.Re,
    TeRef=smeeData.TeRef,
    p=2,
    Jr=0.29,
    Js=0.29,
    useDamperCage=true,
    statorCoreParameters(VRef=100),
    strayLoadParameters(IRef=100),
    brushParameters(ILinear=0.01),
    ir(each fixed=true),
    wMechanical(fixed=true),
    m=m,
    Rs=smeeData.Rs*m/3,
    Lssigma=smeeData.Lssigma*m/3,
    Lmd=smeeData.Lmd*m/3,
    Lmq=smeeData.Lmq*m/3,
    TsOperational=293.15,
    alpha20s=smeeData.alpha20s,
    alpha20r=smeeData.alpha20r,
    TrOperational=293.15,
    TeOperational=293.15,
    alpha20e=smeeData.alpha20e,
    sigmae=smeeData.sigmae*m/3)
  Modelica.Electrical.Machines.Sensors.RotorDisplacementAngle rotorDisplacementAngle(p=smee.p, m=m)
  Modelica.Electrical.Analog.Basic.Ground groundExcitation
  Modelica.Mechanics.Rotational.Sensors.MultiSensor mechanicalSensor
  Modelica.Electrical.Polyphase.Sensors.MultiSensor electricalSensor(m=m)
  Modelica.Electrical.Polyphase.Sensors.CurrentQuasiRMSSensor currentRMSSensor(m=m)
  Modelica.Electrical.Polyphase.Sources.SineVoltage sineVoltage(
    final m=m,
    final V=fill(VNominal*sqrt(2), m),
    final f=fill(fNominal, m))
  Modelica.Electrical.Polyphase.Basic.Star star(final m=m)
  Modelica.Electrical.Analog.Basic.Ground ground
  Modelica.Electrical.Analog.Sources.RampVoltage rampVoltage(
    duration=0.1,
    V=Ve,
    offset=0,
    startTime=0.5)
  Modelica.Electrical.Machines.Utilities.TerminalBox terminalBox(terminalConnection="Y", m=m)
  parameter Modelica.Electrical.Machines.Utilities.SynchronousMachineData smeeData(
    SNominal=30e3,
    VsNominal=100,
    fsNominal=50,
    IeOpenCircuit=10,
    x0=0.1,
    xd=1.6,
    xq=1.6,
    xdTransient=0.1375,
    xdSubtransient=0.121428571,
    xqSubtransient=0.148387097,
    Ta=0.014171268,
    Td0Transient=0.261177343,
    Td0Subtransient=0.006963029,
    Tq0Subtransient=0.123345081,
    alpha20s(displayUnit="1/K") = Modelica.Electrical.Machines.Thermal.Constants.alpha20Zero,
    alpha20r(displayUnit="1/K") = Modelica.Electrical.Machines.Thermal.Constants.alpha20Zero,
    alpha20e(displayUnit="1/K") = Modelica.Electrical.Machines.Thermal.Constants.alpha20Zero,
    TsSpecification=293.15,
    TsRef=293.15,
    TrSpecification=293.15,
    TrRef=293.15,
    TeSpecification=293.15,
    TeRef=293.15) "Synchronous machine data"

  Modelica.Electrical.Polyphase.Ideal.IdealClosingSwitch switch(
    final m=m,
    Ron=fill(1e-5*m/3, m),
    Goff=fill(1e-5*m/3, m))
  Modelica.Blocks.Sources.BooleanStep booleanStep(startTime=0)
  Modelica.Blocks.Routing.BooleanReplicator booleanReplicator(nout=m)
  Modelica.Mechanics.Rotational.Sources.TorqueStep torqueStep(
    offsetTorque=0,
    stepTorque=50,
    startTime=2)
initial equation
  // sum(smee.is) = 0;
  smee.is[1:2] = zeros(2);
  smee.ie = 0;
  //conditional damper cage currents are defined as fixed start values
equation
  connect(irRMS, smee.irRMS);
  connect(rotorDisplacementAngle.plug_n, smee.plug_sn)
  connect(rotorDisplacementAngle.plug_p, smee.plug_sp)
  connect(star.pin_n, ground.p)
  connect(star.plug_p, sineVoltage.plug_n)
  connect(terminalBox.plugSupply, currentRMSSensor.plug_n)
  connect(terminalBox.plug_sn, smee.plug_sn)
  connect(terminalBox.plug_sp, smee.plug_sp)
  connect(smee.flange, rotorDisplacementAngle.flange)
  connect(smee.flange, mechanicalSensor.flange_a)
  connect(sineVoltage.plug_p, switch.plug_p)
  connect(booleanReplicator.y, switch.control)
  connect(booleanStep.y, booleanReplicator.u)
  connect(groundExcitation.p, rampVoltage.n)
  connect(rampVoltage.n, smee.pin_en)
  connect(rampVoltage.p, smee.pin_ep)
  connect(mechanicalSensor.flange_b, torqueStep.flange)
  connect(switch.plug_n, electricalSensor.pc)
  connect(electricalSensor.nv, terminalBox.plug_sn)
  connect(electricalSensor.nc, currentRMSSensor.plug_p)
  connect(electricalSensor.pv, electricalSensor.pc)
end SMEE_DOL;


Electrical excited synchronous machine operating as generator.

within Modelica.Magnetic.FundamentalWave.Examples.BasicMachines.SynchronousMachines;
model SMEE_Generator
  "Electrical excited synchronous machine operating as generator"
  extends Modelica.Icons.Example;
  import Modelica.Constants.pi;
  constant Integer m=3 "Number of stator phases";
  parameter SI.Voltage VsNominal=100
    "Nominal RMS voltage per phase";
  parameter SI.Frequency fsNominal=smeeData.fsNominal "Nominal frequency";
  parameter SI.AngularVelocity w=
      Modelica.Units.Conversions.from_rpm(1499) "Nominal speed";
  parameter SI.Current Ie=19 "Excitation current";
  parameter SI.Current Ie0=10 "Initial excitation current";
  parameter SI.Angle gamma0(displayUnit="deg") = 0
    "Initial rotor displacement angle";
  parameter Integer p=2 "Number of pole pairs";
  parameter SI.Resistance Rs=0.03
    "Warm stator resistance per phase";
  parameter SI.Inductance Lssigma=0.1/(2*Modelica.Constants.pi
      *fsNominal) "Stator stray inductance per phase";
  parameter SI.Inductance Lmd=1.5/(2*Modelica.Constants.pi*
      fsNominal) "Main field inductance in d-axis";
  parameter SI.Inductance Lmq=1.5/(2*Modelica.Constants.pi*
      fsNominal) "Main field inductance in q-axis";
  parameter SI.Inductance Lrsigmad=0.05/(2*Modelica.Constants.pi
      *fsNominal)
    "Damper stray inductance (equivalent three-phase winding) d-axis";
  parameter SI.Inductance Lrsigmaq=Lrsigmad
    "Damper stray inductance (equivalent three-phase winding) q-axis";
  parameter SI.Resistance Rrd=0.04
    "Warm damper resistance (equivalent three-phase winding) d-axis";
  parameter SI.Resistance Rrq=Rrd
    "Warm damper resistance (equivalent three-phase winding) q-axis";
  Modelica.Electrical.Polyphase.Basic.Star star(final m=m)
  Modelica.Electrical.Analog.Basic.Ground ground
  Modelica.Electrical.Polyphase.Sources.SineVoltage sineVoltage(
    final m=m,
    final V=fill(VsNominal*sqrt(2), m),
    final f=fill(fsNominal, m))
  Modelica.Electrical.Machines.Sensors.ElectricalPowerSensor electricalPowerSensorM
  Modelica.Electrical.Machines.Sensors.ElectricalPowerSensor electricalPowerSensorE
  Modelica.Electrical.Machines.Utilities.TerminalBox terminalBoxM(
      terminalConnection="Y")
  Modelica.Electrical.Machines.Utilities.TerminalBox terminalBoxE(
      terminalConnection="Y")
  Magnetic.FundamentalWave.BasicMachines.SynchronousMachines.SM_ElectricalExcited
    smeeM(
    ratioCommonStatorLeakage=smeeData.ratioCommonStatorLeakage,
    phiMechanical(start=-(Modelica.Constants.pi + gamma0)/p, fixed=true),
    Jr=0.29,
    Js=0.29,
    p=2,
    fsNominal=smeeData.fsNominal,
    Rs=smeeData.Rs,
    TsRef=smeeData.TsRef,
    alpha20s(displayUnit="1/K") = smeeData.alpha20s,
    Lssigma=smeeData.Lssigma,
    Lmd=smeeData.Lmd,
    Lmq=smeeData.Lmq,
    useDamperCage=true,
    Lrsigmad=smeeData.Lrsigmad,
    Lrsigmaq=smeeData.Lrsigmaq,
    Rrd=smeeData.Rrd,
    Rrq=smeeData.Rrq,
    TrRef=smeeData.TrRef,
    alpha20r(displayUnit="1/K") = smeeData.alpha20r,
    VsNominal=smeeData.VsNominal,
    IeOpenCircuit=smeeData.IeOpenCircuit,
    Re=smeeData.Re,
    TeRef=smeeData.TeRef,
    alpha20e(displayUnit="1/K") = smeeData.alpha20e,
    sigmae=smeeData.sigmae,
    statorCoreParameters(VRef=100),
    strayLoadParameters(IRef=100),
    brushParameters(ILinear=0.01),
    ir(each fixed=true),
    TsOperational=293.15,
    effectiveStatorTurns=smeeData.effectiveStatorTurns,
    TrOperational=293.15,
    TeOperational=293.15)

  Modelica.Electrical.Machines.BasicMachines.SynchronousMachines.SM_ElectricalExcited
    smeeE(
    phiMechanical(start=-(Modelica.Constants.pi + gamma0)/p, fixed=true),
    p=2,
    fsNominal=smeeData.fsNominal,
    Rs=smeeData.Rs,
    TsRef=smeeData.TsRef,
    alpha20s(displayUnit="1/K") = smeeData.alpha20s,
    Lssigma=smeeData.Lssigma,
    Jr=0.29,
    Js=0.29,
    frictionParameters(PRef=0),
    statorCoreParameters(PRef=0, VRef=100),
    strayLoadParameters(PRef=0, IRef=100),
    Lmd=smeeData.Lmd,
    Lmq=smeeData.Lmq,
    useDamperCage=true,
    Lrsigmad=smeeData.Lrsigmad,
    Rrd=smeeData.Rrd,
    Rrq=smeeData.Rrq,
    alpha20r(displayUnit="1/K") = smeeData.alpha20r,
    VsNominal=smeeData.VsNominal,
    IeOpenCircuit=smeeData.IeOpenCircuit,
    Re=smeeData.Re,
    TeRef=smeeData.TeRef,
    alpha20e(displayUnit="1/K") = smeeData.alpha20e,
    sigmae=smeeData.sigmae,
    brushParameters(V=0, ILinear=0.01),
    Lrsigmaq=smeeData.Lrsigmaq,
    TrRef=smeeData.TrRef,
    TsOperational=293.15,
    ir(each fixed=true),
    TrOperational=293.15,
    TeOperational=293.15)

  Modelica.Electrical.Analog.Basic.Ground groundM
  Modelica.Electrical.Analog.Basic.Ground groundE
  Modelica.Electrical.Analog.Sources.RampCurrent rampCurrentM(
    duration=0.1,
    I=Ie - Ie0,
    offset=Ie0)
  Modelica.Electrical.Analog.Sources.RampCurrent rampCurrentE(
    duration=0.1,
    I=Ie - Ie0,
    offset=Ie0)
  Modelica.Electrical.Machines.Sensors.RotorDisplacementAngle rotorAngleM(
      p=p)
  Modelica.Electrical.Machines.Sensors.RotorDisplacementAngle rotorAngleE(
      p=p)
  Modelica.Electrical.Machines.Sensors.MechanicalPowerSensor
    mechanicalPowerSensorM
  Modelica.Electrical.Machines.Sensors.MechanicalPowerSensor
    mechanicalPowerSensorE
  Modelica.Mechanics.Rotational.Sources.ConstantSpeed constantSpeedM(
      final w_fixed=w, useSupport=false)
  Modelica.Mechanics.Rotational.Sources.ConstantSpeed constantSpeedE(
      final w_fixed=w, useSupport=false)
  parameter Modelica.Electrical.Machines.Utilities.SynchronousMachineData smeeData(
    SNominal=30e3,
    VsNominal=100,
    fsNominal=50,
    IeOpenCircuit=10,
    x0=0.1,
    xd=1.6,
    xq=1.6,
    xdTransient=0.1375,
    xdSubtransient=0.121428571,
    xqSubtransient=0.148387097,
    Ta=0.014171268,
    Td0Transient=0.261177343,
    Td0Subtransient=0.006963029,
    Tq0Subtransient=0.123345081,
    alpha20s(displayUnit="1/K") = Modelica.Electrical.Machines.Thermal.Constants.alpha20Zero,
    alpha20r(displayUnit="1/K") = Modelica.Electrical.Machines.Thermal.Constants.alpha20Zero,
    alpha20e(displayUnit="1/K") = Modelica.Electrical.Machines.Thermal.Constants.alpha20Zero,
    TsSpecification=293.15,
    TsRef=293.15,
    TrSpecification=293.15,
    TrRef=293.15,
    TeSpecification=293.15,
    TeRef=293.15) "Synchronous machine data"

  SI.Angle thetaM=rotorAngleM.rotorDisplacementAngle "Rotor displacement angle, FundamentalWave machine";
  SI.Angle thetaE=rotorAngleE.rotorDisplacementAngle "Rotor displacement angle, Electrical machine";

initial equation
  smeeE.is[1:2] = zeros(2);
  smeeM.is[1:2] = zeros(2);
  //conditional damper cage currents are defined as fixed start values
equation
  connect(rotorAngleE.plug_n, smeeE.plug_sn)
  connect(rotorAngleE.plug_p, smeeE.plug_sp)
  connect(rotorAngleE.flange, smeeE.flange)
  connect(star.pin_n, ground.p)
  connect(star.plug_p, sineVoltage.plug_n)
  connect(smeeE.flange, mechanicalPowerSensorE.flange_a)
  connect(mechanicalPowerSensorE.flange_b, constantSpeedE.flange)
  connect(rampCurrentE.p, groundE.p)
  connect(rampCurrentE.p, smeeE.pin_en)
  connect(rampCurrentE.n, smeeE.pin_ep)
  connect(smeeE.plug_sn, terminalBoxE.plug_sn)
  connect(smeeE.plug_sp, terminalBoxE.plug_sp)
  connect(rotorAngleM.plug_n, smeeM.plug_sn)
  connect(rotorAngleM.plug_p, smeeM.plug_sp)
  connect(rotorAngleM.flange, smeeM.flange)
  connect(smeeM.flange, mechanicalPowerSensorM.flange_a)
  connect(mechanicalPowerSensorM.flange_b, constantSpeedM.flange)
  connect(rampCurrentM.p, groundM.p)
  connect(rampCurrentM.p, smeeM.pin_en)
  connect(rampCurrentM.n, smeeM.pin_ep)
  connect(smeeM.plug_sn, terminalBoxM.plug_sn)
  connect(smeeM.plug_sp, terminalBoxM.plug_sp)
  connect(electricalPowerSensorM.plug_p, sineVoltage.plug_p)
  connect(electricalPowerSensorE.plug_p, sineVoltage.plug_p)
  connect(electricalPowerSensorM.plug_ni, terminalBoxM.plugSupply)
  connect(electricalPowerSensorE.plug_ni, terminalBoxE.plugSupply)
  connect(electricalPowerSensorE.plug_nv, star.plug_p)
  connect(electricalPowerSensorM.plug_nv, star.plug_p)
end SMEE_Generator;


Test example: ElectricalExcitedSynchronousMachine with voltage controller. An electrically excited synchronous generator is started with a speed ramp, then driven with constant speed.
Voltage is controlled, the set point depends on speed. After start-up the generator is loaded, the load is rejected.

within Modelica.Magnetic.FundamentalWave.Examples.BasicMachines.SynchronousMachines;
model SMEE_LoadDump
  "Test example: ElectricalExcitedSynchronousMachine with voltage controller"

  extends Modelica.Icons.Example;
  import Modelica.Constants.pi;
  constant Integer m=3 "Number of phases";
  parameter SI.AngularVelocity wNominal=2*pi*smeeData.fsNominal
      /smee.p "Nominal speed";
  parameter SI.Impedance ZNominal=3*smeeData.VsNominal^2/
      smeeData.SNominal "Nominal load impedance";
  parameter Real powerFactor(
    min=0,
    max=1) = 0.8 "Load power factor";
  parameter SI.Resistance RLoad=ZNominal*powerFactor
    "Load resistance";
  parameter SI.Inductance LLoad=ZNominal*sqrt(1 -
      powerFactor^2)/(2*pi*smeeData.fsNominal) "Load inductance";
  parameter SI.Voltage Ve0=smee.IeOpenCircuit*
      Modelica.Electrical.Machines.Thermal.convertResistance(
            smee.Re,
            smee.TeRef,
            smee.alpha20e,
            smee.TeOperational) "No load excitation voltage";
  parameter Real k=2*Ve0/smeeData.VsNominal "Voltage controller: gain";
  parameter SI.Time Ti=smeeData.Td0Transient/2
    "Voltage controller: integral time constant";
  output Real controlError=(setPointGain.y - voltageQuasiRMSSensor.V)/
      smeeData.VsNominal;
  Magnetic.FundamentalWave.BasicMachines.SynchronousMachines.SM_ElectricalExcited
    smee(
    fsNominal=smeeData.fsNominal,
    TsRef=smeeData.TsRef,
    ratioCommonStatorLeakage=smeeData.ratioCommonStatorLeakage,
    Lrsigmad=smeeData.Lrsigmad,
    Lrsigmaq=smeeData.Lrsigmaq,
    Rrd=smeeData.Rrd,
    Rrq=smeeData.Rrq,
    TrRef=smeeData.TrRef,
    VsNominal=smeeData.VsNominal,
    IeOpenCircuit=smeeData.IeOpenCircuit,
    Re=smeeData.Re,
    TeRef=smeeData.TeRef,
    sigmae=smeeData.sigmae,
    useDamperCage=true,
    p=2,
    Jr=0.29,
    Js=0.29,
    statorCoreParameters(VRef=100),
    strayLoadParameters(IRef=100),
    brushParameters(ILinear=0.01),
    Rs=smeeData.Rs*m/3,
    Lssigma=smeeData.Lssigma*m/3,
    Lmd=smeeData.Lmd*m/3,
    Lmq=smeeData.Lmq*m/3,
    TsOperational=293.15,
    alpha20s=smeeData.alpha20s,
    effectiveStatorTurns=smeeData.effectiveStatorTurns,
    alpha20r=smeeData.alpha20r,
    TrOperational=293.15,
    TeOperational=293.15,
    alpha20e=smeeData.alpha20e)
  parameter Modelica.Electrical.Machines.Utilities.SynchronousMachineData smeeData(
    SNominal=30e3,
    VsNominal=100,
    fsNominal=50,
    IeOpenCircuit=10,
    x0=0.1,
    xd=1.6,
    xq=1.6,
    xdTransient=0.1375,
    xdSubtransient=0.121428571,
    xqSubtransient=0.148387097,
    Ta=0.014171268,
    Td0Transient=0.261177343,
    Td0Subtransient=0.006963029,
    Tq0Subtransient=0.123345081,
    TsSpecification=293.15,
    TsRef=293.15,
    alpha20s(displayUnit="1/K") = Modelica.Electrical.Machines.Thermal.Constants.alpha20Zero,
    TrSpecification=293.15,
    TrRef=293.15,
    alpha20r(displayUnit="1/K") = Modelica.Electrical.Machines.Thermal.Constants.alpha20Zero,
    TeSpecification=293.15,
    TeRef=293.15,
    alpha20e(displayUnit="1/K") = Modelica.Electrical.Machines.Thermal.Constants.alpha20Zero)
    "Synchronous machine data"

  Modelica.Electrical.Machines.Utilities.TerminalBox terminalBox(
      terminalConnection="Y")
  Modelica.Electrical.Analog.Basic.Ground ground
  Modelica.Mechanics.Rotational.Sources.Speed speed
  Modelica.Blocks.Sources.Ramp speedRamp(height=wNominal, duration=1)
  Modelica.Mechanics.Rotational.Sensors.SpeedSensor speedSensor
  Modelica.Blocks.Math.Gain setPointGain(k=(smeeData.VsNominal/wNominal))
  Modelica.Electrical.Machines.Sensors.VoltageQuasiRMSSensor voltageQuasiRMSSensor(
      ToSpacePhasor1(y(each start=1E-3, each fixed=true)))
  Modelica.Blocks.Continuous.LimPID voltageController(
    controllerType=Modelica.Blocks.Types.SimpleController.PI,
    k=k,
    Ti=Ti,
    yMax=2.5*Ve0,
    yMin=0,
    initType=Modelica.Blocks.Types.Init.InitialState,
    Td=0.001)
  Modelica.Electrical.Analog.Sources.SignalVoltage excitationVoltage
  Modelica.Electrical.Analog.Basic.Ground groundExcitation
  Modelica.Electrical.Machines.Sensors.CurrentQuasiRMSSensor currentQuasiRMSSensor
  Modelica.Blocks.Sources.BooleanPulse loadControl(period=4, startTime=2)
  Modelica.Electrical.Polyphase.Ideal.CloserWithArc switch(
    m=m,
    Ron=fill(1e-5, m),
    Goff=fill(1e-5, m),
    V0=fill(30, m),
    dVdt=fill(10e3, m),
    Vmax=fill(60, m),
    closerWithArc(off(start=fill(true, m), fixed=fill(true, m))))
  Modelica.Electrical.Polyphase.Basic.Resistor loadResistor(m=m, R=fill(
        RLoad, m))
  Modelica.Electrical.Polyphase.Basic.Inductor loadInductor(m=m, L=fill(
        LLoad, m))
  Modelica.Electrical.Polyphase.Basic.Star star(m=m)
protected
  constant SI.MagneticFlux unitMagneticFlux=1
public
  Modelica.Blocks.Routing.BooleanReplicator booleanReplicator(nout=m)
initial equation
  smee.airGap.V_msr = Complex(0, 0);
  //conditional damper cage currents are defined as fixed start values
  smee.ie = 0;
equation
  connect(terminalBox.plug_sn, smee.plug_sn)
  connect(terminalBox.plug_sp, smee.plug_sp)
  connect(excitationVoltage.p, smee.pin_ep)
  connect(excitationVoltage.n, smee.pin_en)
  connect(excitationVoltage.n, groundExcitation.p)
  connect(voltageQuasiRMSSensor.plug_n, smee.plug_sn)
  connect(voltageQuasiRMSSensor.plug_p, smee.plug_sp)
  connect(terminalBox.plugSupply, currentQuasiRMSSensor.plug_n)
  connect(smee.flange, speed.flange)
  connect(speed.flange, speedSensor.flange)
  connect(speedRamp.y, speed.w_ref)
  connect(setPointGain.y, voltageController.u_s)
  connect(speedSensor.w, setPointGain.u)
  connect(voltageQuasiRMSSensor.V, voltageController.u_m)
  connect(voltageController.y, excitationVoltage.v)
  connect(loadInductor.plug_p, loadResistor.plug_n)
  connect(loadResistor.plug_p, switch.plug_n)
  connect(switch.plug_p, currentQuasiRMSSensor.plug_p)
  connect(star.plug_p, loadInductor.plug_n)
  connect(star.pin_n, ground.p)
  connect(loadControl.y, booleanReplicator.u)
  connect(booleanReplicator.y, switch.control)
end SMEE_LoadDump;


Test example: ElectricalExcitedSynchronousMachine with rectifier. An electrically excited synchronous generator is driven with constant speed.
Voltage is controlled, the set point depends on speed. The generator is loaded with a rectifier.

within Modelica.Magnetic.FundamentalWave.Examples.BasicMachines.SynchronousMachines;
model SMEE_Rectifier
  "Test example: ElectricalExcitedSynchronousMachine with rectifier"

  extends Modelica.Icons.Example;
  import Modelica.Constants.pi;
  constant Integer m=3 "Number of phases";
  parameter SI.AngularVelocity wNominal=2*pi*smeeData.fsNominal
      /smee.p "Nominal speed";
  parameter SI.Voltage VDC0=sqrt(2*3)*smeeData.VsNominal
    "No-load DC voltage";
  parameter SI.Resistance RLoad=VDC0^2/smeeData.SNominal
    "Load resistance";
  parameter SI.Voltage Ve0=smee.IeOpenCircuit*
      Modelica.Electrical.Machines.Thermal.convertResistance(
            smee.Re,
            smee.TeRef,
            smee.alpha20e,
            smee.TeOperational) "No load excitation voltage";
  parameter Real k=2*Ve0/smeeData.VsNominal "Voltage controller: gain";
  parameter SI.Time Ti=smeeData.Td0Transient/2
    "Voltage controller: integral time constant";
  Magnetic.FundamentalWave.BasicMachines.SynchronousMachines.SM_ElectricalExcited
    smee(
    fsNominal=smeeData.fsNominal,
    TsRef=smeeData.TsRef,
    ratioCommonStatorLeakage=smeeData.ratioCommonStatorLeakage,
    Lrsigmad=smeeData.Lrsigmad,
    Lrsigmaq=smeeData.Lrsigmaq,
    Rrd=smeeData.Rrd,
    Rrq=smeeData.Rrq,
    TrRef=smeeData.TrRef,
    VsNominal=smeeData.VsNominal,
    IeOpenCircuit=smeeData.IeOpenCircuit,
    Re=smeeData.Re,
    TeRef=smeeData.TeRef,
    sigmae=smeeData.sigmae,
    useDamperCage=true,
    p=2,
    Jr=0.29,
    Js=0.29,
    statorCoreParameters(VRef=100),
    strayLoadParameters(IRef=100),
    brushParameters(ILinear=0.01),
    ir(each fixed=true),
    Rs=smeeData.Rs*m/3,
    Lssigma=smeeData.Lssigma*m/3,
    Lmd=smeeData.Lmd*m/3,
    Lmq=smeeData.Lmq*m/3,
    TsOperational=293.15,
    alpha20s=smeeData.alpha20s,
    effectiveStatorTurns=smeeData.effectiveStatorTurns,
    alpha20r=smeeData.alpha20r,
    TrOperational=293.15,
    TeOperational=293.15,
    alpha20e=smeeData.alpha20e)
  parameter Modelica.Electrical.Machines.Utilities.SynchronousMachineData smeeData(
    SNominal=30e3,
    VsNominal=100,
    fsNominal=50,
    IeOpenCircuit=10,
    x0=0.1,
    xd=1.6,
    xq=1.6,
    xdTransient=0.1375,
    xdSubtransient=0.121428571,
    xqSubtransient=0.148387097,
    Ta=0.014171268,
    Td0Transient=0.261177343,
    Td0Subtransient=0.006963029,
    Tq0Subtransient=0.123345081,
    TsSpecification=293.15,
    TsRef=293.15,
    alpha20s(displayUnit="1/K") = Modelica.Electrical.Machines.Thermal.Constants.alpha20Zero,
    TrSpecification=293.15,
    TrRef=293.15,
    alpha20r(displayUnit="1/K") = Modelica.Electrical.Machines.Thermal.Constants.alpha20Zero,
    TeSpecification=293.15,
    TeRef=293.15,
    alpha20e(displayUnit="1/K") = Modelica.Electrical.Machines.Thermal.Constants.alpha20Zero)
    "Synchronous machine data"

  Modelica.Electrical.Machines.Utilities.TerminalBox terminalBox(
      terminalConnection="Y")
  Modelica.Electrical.Analog.Basic.Ground ground
  Modelica.Mechanics.Rotational.Sources.Speed speed
  Modelica.Blocks.Sources.Constant constantSpeed(k=wNominal)
  Modelica.Mechanics.Rotational.Sensors.SpeedSensor speedSensor
  Modelica.Blocks.Math.Gain setPointGain(k=(smeeData.VsNominal/wNominal)/
        unitMagneticFlux)
  Modelica.Blocks.Continuous.LimPID voltageController(
    controllerType=Modelica.Blocks.Types.SimpleController.PI,
    k=k,
    Ti=Ti,
    yMax=2.5*Ve0,
    yMin=0,
    initType=Modelica.Blocks.Types.Init.InitialState,
    Td=0.001)
  Modelica.Electrical.Analog.Sources.SignalVoltage excitationVoltage
  Modelica.Electrical.Analog.Basic.Ground groundExcitation
  Modelica.Electrical.Polyphase.Basic.Star star1(m=m)
  Modelica.Electrical.Polyphase.Ideal.IdealDiode idealDiode1(
    m=m,
    Ron=fill(1E-5, m),
    Goff=fill(1E-5, m),
    Vknee=fill(0, m))
  Modelica.Electrical.Polyphase.Ideal.IdealDiode idealDiode2(
    m=m,
    Ron=fill(1E-5, m),
    Goff=fill(1E-5, m),
    Vknee=fill(0, m))
  Modelica.Electrical.Polyphase.Basic.Star star2(m=m)
  Modelica.Electrical.Analog.Basic.Capacitor capacitor1(C=2*10E-6, v(
        fixed=true, start=0))
  Modelica.Electrical.Analog.Basic.Capacitor capacitor2(C=2*10E-6, v(
        fixed=true, start=0))
  Modelica.Electrical.Analog.Basic.Resistor resistor(R=RLoad)
  Modelica.Electrical.Analog.Sensors.VoltageSensor voltageSensor
  Modelica.Blocks.Continuous.Filter filter(
    analogFilter=Modelica.Blocks.Types.AnalogFilter.CriticalDamping,
    filterType=Modelica.Blocks.Types.FilterType.LowPass,
    order=2,
    f_cut=20,
    gain=1/sqrt(2*3),
    normalized=true)
protected
  constant SI.MagneticFlux unitMagneticFlux=1
initial equation
  smee.is[1:2] = zeros(2);
  //conditional damper cage currents are defined as fixed start values
  smee.ie = 0;
equation
  connect(terminalBox.plug_sn, smee.plug_sn)
  connect(terminalBox.plug_sp, smee.plug_sp)
  connect(excitationVoltage.p, smee.pin_ep)
  connect(excitationVoltage.n, smee.pin_en)
  connect(excitationVoltage.n, groundExcitation.p)
  connect(smee.flange, speed.flange)
  connect(speed.flange, speedSensor.flange)
  connect(constantSpeed.y, speed.w_ref)
  connect(setPointGain.y, voltageController.u_s)
  connect(speedSensor.w, setPointGain.u)
  connect(voltageController.y, excitationVoltage.v)
  connect(idealDiode1.plug_p, idealDiode2.plug_n)
  connect(idealDiode2.plug_p, star2.plug_p)
  connect(idealDiode1.plug_n, star1.plug_p)
  connect(capacitor2.n, star2.pin_n)
  connect(capacitor1.p, star1.pin_n)
  connect(capacitor1.n, capacitor2.p)
  connect(capacitor1.n, ground.p)
  connect(filter.y, voltageController.u_m)
  connect(voltageSensor.v, filter.u)
  connect(terminalBox.plugSupply, idealDiode2.plug_n)
  connect(resistor.p, capacitor1.p)
  connect(resistor.n, capacitor2.n)
  connect(voltageSensor.n, capacitor2.n)
  connect(voltageSensor.p, capacitor1.p)
end SMEE_Rectifier;


Test example: PermanentMagnetSynchronousMachine acting as brake. A synchronous machine with permanent magnets starts braking from nominal speed by feeding a diode bridge,
which in turn feeds a braking resistor.
Since induced voltage is reduced proportional to falling speed, the braking resistance is set proportional
to speed to achieve constant current and torque.

within Modelica.Magnetic.FundamentalWave.Examples.BasicMachines.SynchronousMachines;
model SMPM_Braking
  "Test example: PermanentMagnetSynchronousMachine acting as brake"
  extends Modelica.Icons.Example;
  import Modelica.Constants.pi;
  constant Integer m=3 "Number of phases";
  constant Real unitK( unit="rad/(s.Ohm)")=1
  parameter SI.Resistance R=1 "Nominal braking resistance";
  parameter SI.AngularVelocity wNominal=2*pi*smpmData.fsNominal/smpmData.p
    "Nominal speed";
  parameter SI.Inertia JLoad=0.29
    "Load's moment of inertia";
  Magnetic.FundamentalWave.BasicMachines.SynchronousMachines.SM_PermanentMagnet
    smpm(
    ratioCommonStatorLeakage=smpmData.ratioCommonStatorLeakage,
    phiMechanical(start=0, fixed=true),
    useSupport=false,
    useThermalPort=false,
    p=smpmData.p,
    fsNominal=smpmData.fsNominal,
    TsRef=smpmData.TsRef,
    Jr=smpmData.Jr,
    Js=smpmData.Js,
    frictionParameters=smpmData.frictionParameters,
    statorCoreParameters=smpmData.statorCoreParameters,
    strayLoadParameters=smpmData.strayLoadParameters,
    VsOpenCircuit=smpmData.VsOpenCircuit,
    useDamperCage=smpmData.useDamperCage,
    Lrsigmad=smpmData.Lrsigmad,
    Lrsigmaq=smpmData.Lrsigmaq,
    Rrd=smpmData.Rrd,
    Rrq=smpmData.Rrq,
    TrRef=smpmData.TrRef,
    permanentMagnetLossParameters=smpmData.permanentMagnetLossParameters,
    wMechanical(start=wNominal, fixed=true),
    Rs=smpmData.Rs*m/3,
    Lssigma=smpmData.Lssigma*m/3,
    Lszero=smpmData.Lszero*m/3,
    Lmd=smpmData.Lmd*m/3,
    Lmq=smpmData.Lmq*m/3,
    TsOperational=293.15,
    alpha20s=smpmData.alpha20s,
    effectiveStatorTurns=smpmData.effectiveStatorTurns,
    alpha20r=smpmData.alpha20r,
    TrOperational=293.15)

  Modelica.Electrical.Analog.Basic.Ground ground
  Modelica.Electrical.Machines.Utilities.TerminalBox terminalBox(
      terminalConnection="Y")
  Modelica.Mechanics.Rotational.Components.Inertia inertiaLoad(J=JLoad)
  Modelica.Mechanics.Rotational.Sensors.SpeedSensor speedSensor
  parameter
    Modelica.Electrical.Machines.Utilities.ParameterRecords.SM_PermanentMagnetData
    smpmData(useDamperCage=false) "Synchronous machine data"
  Modelica.Electrical.Machines.Sensors.CurrentQuasiRMSSensor currentQuasiRMSSensor
  Modelica.Electrical.PowerConverters.ACDC.DiodeBridge2mPulse diodeBridge2mPulse(m=m)
  Modelica.Electrical.Analog.Basic.VariableResistor variableResistor
  Modelica.Blocks.Math.Gain gain(k=R/wNominal)
  Modelica.Blocks.Nonlinear.Limiter limiter(uMin=0.1, uMax=10)
  Modelica.Blocks.Math.Gain ac2dc(k=pi^2/8)
  Modelica.Electrical.Polyphase.Basic.Star starM(final m=m)
  Modelica.Electrical.Machines.Sensors.VoltageQuasiRMSSensor voltageQuasiRMSSensor
  Modelica.Electrical.Analog.Basic.Resistor grounding(R=1e6)
initial equation
  smpm.is[1:2] = zeros(2);
  sum(smpm.is) = 0;

equation
  connect(terminalBox.plug_sn, smpm.plug_sn)
  connect(terminalBox.plug_sp, smpm.plug_sp)
  connect(currentQuasiRMSSensor.plug_n, terminalBox.plugSupply)
  connect(diodeBridge2mPulse.ac, currentQuasiRMSSensor.plug_p)
  connect(variableResistor.p, diodeBridge2mPulse.dc_p)
  connect(variableResistor.n, diodeBridge2mPulse.dc_n)
  connect(smpm.flange, inertiaLoad.flange_a)
  connect(gain.u, speedSensor.w)
  connect(limiter.u, gain.y)
  connect(limiter.y, ac2dc.u)
  connect(ac2dc.y, variableResistor.R)
  connect(starM.plug_p, voltageQuasiRMSSensor.plug_n)
  connect(voltageQuasiRMSSensor.plug_p, currentQuasiRMSSensor.plug_n)
  connect(smpm.flange, speedSensor.flange)
  connect(terminalBox.starpoint, starM.pin_n)
  connect(ground.p, variableResistor.n)
  connect(ground.p, grounding.n)
  connect(starM.pin_n, grounding.p)
end SMPM_Braking;


Test example: PermanentMagnetSynchronousMachine fed by current source. A synchronous machine with permanent magnets accelerates a quadratic speed dependent load from standstill.
The rms values of d- and q-current in rotor fixed coordinate system are converted to three-phase currents,
and fed to the machine. The result shows that the torque is influenced by the q-current,
whereas the stator voltage is influenced by the d-current.

within Modelica.Magnetic.FundamentalWave.Examples.BasicMachines.SynchronousMachines;
model SMPM_CurrentSource
  "Test example: PermanentMagnetSynchronousMachine fed by current source"
  extends Modelica.Icons.Example;
  import Modelica.Constants.pi;
  constant Integer m=3 "Number of phases";
  parameter SI.Current Idq[2]={-53.5, 84.6}
    "Desired d- and q-current";
  parameter SI.AngularVelocity wNominal=2*pi*smpmData.fsNominal/smpmData.p
    "Nominal speed";
  parameter SI.Torque TLoad=181.4 "Nominal load torque";
  parameter SI.Inertia JLoad=0.29
    "Load's moment of inertia";
  Magnetic.FundamentalWave.BasicMachines.SynchronousMachines.SM_PermanentMagnet
    smpm(
    p=smpmData.p,
    fsNominal=smpmData.fsNominal,
    TsRef=smpmData.TsRef,
    Jr=smpmData.Jr,
    Js=smpmData.Js,
    ratioCommonStatorLeakage=smpmData.ratioCommonStatorLeakage,
    frictionParameters=smpmData.frictionParameters,
    phiMechanical(fixed=true),
    wMechanical(fixed=true),
    statorCoreParameters=smpmData.statorCoreParameters,
    strayLoadParameters=smpmData.strayLoadParameters,
    VsOpenCircuit=smpmData.VsOpenCircuit,
    useDamperCage=smpmData.useDamperCage,
    TrRef=smpmData.TrRef,
    permanentMagnetLossParameters=smpmData.permanentMagnetLossParameters,
    Rs=smpmData.Rs*m/3,
    Lssigma=smpmData.Lssigma*m/3,
    Lszero=smpmData.Lszero*m/3,
    Lmd=smpmData.Lmd*m/3,
    Lmq=smpmData.Lmq*m/3,
    Lrsigmad=smpmData.Lrsigmad,
    Lrsigmaq=smpmData.Lrsigmaq,
    Rrd=smpmData.Rrd,
    Rrq=smpmData.Rrq,
    TsOperational=293.15,
    alpha20s=smpmData.alpha20s,
    effectiveStatorTurns=smpmData.effectiveStatorTurns,
    alpha20r=smpmData.alpha20r,
    TrOperational=293.15)
  Modelica.Electrical.Polyphase.Sources.SignalCurrent signalCurrent(
      final m=m)
  Modelica.Electrical.Polyphase.Basic.Star star(final m=m)
  Modelica.Electrical.Analog.Basic.Ground ground
  Modelica.Electrical.Machines.Utilities.DQToThreePhase dqToThreePhase(p=smpm.p)
  Modelica.Blocks.Sources.Constant iq(k=Idq[2])
  Modelica.Blocks.Sources.Constant id(k=Idq[1])
  Modelica.Electrical.Machines.Sensors.VoltageQuasiRMSSensor voltageQuasiRMSSensor
  Modelica.Electrical.Polyphase.Basic.Star starM(final m=m)
  Modelica.Electrical.Analog.Basic.Ground groundM
  Modelica.Electrical.Machines.Utilities.TerminalBox terminalBox(
      terminalConnection="Y")
  Modelica.Electrical.Machines.Sensors.RotorDisplacementAngle rotorDisplacementAngle(p=smpm.p)
  Modelica.Mechanics.Rotational.Sensors.AngleSensor angleSensor
  Modelica.Mechanics.Rotational.Sensors.TorqueSensor torqueSensor
  Modelica.Mechanics.Rotational.Sensors.SpeedSensor speedSensor
  Modelica.Mechanics.Rotational.Components.Inertia inertiaLoad(J=JLoad)
  Modelica.Mechanics.Rotational.Sources.QuadraticSpeedDependentTorque quadraticSpeedDependentTorque(
      tau_nominal=-TLoad, w_nominal(displayUnit="rad/s") = wNominal)
  parameter
    Modelica.Electrical.Machines.Utilities.ParameterRecords.SM_PermanentMagnetData
    smpmData(useDamperCage=false) "Synchronous machine data"
  Modelica.Electrical.Machines.Sensors.CurrentQuasiRMSSensor currentQuasiRMSSensor
  SI.Angle theta=rotorDisplacementAngle.rotorDisplacementAngle "Rotor displacement angle, FundamentalWave machine";
equation
  connect(star.pin_n, ground.p)
  connect(rotorDisplacementAngle.plug_n, smpm.plug_sn)
  connect(rotorDisplacementAngle.plug_p, smpm.plug_sp)
  connect(terminalBox.plug_sn, smpm.plug_sn)
  connect(terminalBox.plug_sp, smpm.plug_sp)
  connect(smpm.flange, rotorDisplacementAngle.flange)
  connect(signalCurrent.plug_p, star.plug_p)
  connect(angleSensor.flange, rotorDisplacementAngle.flange)
  connect(angleSensor.phi, dqToThreePhase.phi)
  connect(groundM.p, terminalBox.starpoint)
  connect(smpm.flange, torqueSensor.flange_a)
  connect(voltageQuasiRMSSensor.plug_p, terminalBox.plugSupply)
  connect(starM.plug_p, voltageQuasiRMSSensor.plug_n)
  connect(starM.pin_n, groundM.p)
  connect(dqToThreePhase.y, signalCurrent.i)
  connect(speedSensor.flange, smpm.flange)
  connect(quadraticSpeedDependentTorque.flange, inertiaLoad.flange_b)
  connect(torqueSensor.flange_b, inertiaLoad.flange_a)
  connect(signalCurrent.plug_n, currentQuasiRMSSensor.plug_p)
  connect(currentQuasiRMSSensor.plug_n, voltageQuasiRMSSensor.plug_p)
  connect(id.y, dqToThreePhase.d)
  connect(iq.y, dqToThreePhase.q)
end SMPM_CurrentSource;


Starting of permanent magnet synchronous machine with inverter.

within Modelica.Magnetic.FundamentalWave.Examples.BasicMachines.SynchronousMachines;
model SMPM_Inverter
  "Starting of permanent magnet synchronous machine with inverter"
  extends Modelica.Icons.Example;
  constant Integer m=3 "Number of phases";
  parameter SI.Voltage VsNominal=100
    "Nominal RMS voltage per phase";
  parameter SI.Frequency fsNominal=smpmData.fsNominal "Nominal frequency";
  parameter SI.Frequency fKnee=50
    "Knee frequency of V/f curve";
  parameter SI.Time tRamp=1 "Frequency ramp";
  parameter SI.Torque T_Load=181.4 "Nominal load torque";
  parameter SI.Time tStep=1.2 "Time of load torque step";
  parameter SI.Inertia J_Load=0.29 "Load inertia";
  Modelica.Electrical.Analog.Basic.Ground ground
  Modelica.Electrical.Polyphase.Basic.Star star(final m=m)
  Modelica.Electrical.Polyphase.Sources.SignalVoltage signalVoltage(
      final m=m)
  Modelica.Blocks.Sources.Ramp ramp(height=fKnee, duration=tRamp)
  Modelica.Electrical.Machines.Utilities.VfController vfController(
    final m=m,
    VNominal=VsNominal,
    fNominal=fsNominal,
    BasePhase=+Modelica.Constants.pi/2)
  Modelica.Electrical.Polyphase.Sensors.CurrentQuasiRMSSensor currentRMSsensorM
  Modelica.Electrical.Machines.Sensors.CurrentQuasiRMSSensor
    currentRMSsensorE
  Modelica.Electrical.Machines.Utilities.TerminalBox terminalBoxM(
      terminalConnection="Y")
  Modelica.Electrical.Machines.Utilities.TerminalBox terminalBoxE(
      terminalConnection="Y")
  Magnetic.FundamentalWave.BasicMachines.SynchronousMachines.SM_PermanentMagnet
    smpmM(
    Jr=smpmData.Jr,
    Js=smpmData.Js,
    p=smpmData.p,
    fsNominal=smpmData.fsNominal,
    Rs=smpmData.Rs,
    TsRef=smpmData.TsRef,
    alpha20s(displayUnit="1/K") = smpmData.alpha20s,
    Lssigma=smpmData.Lssigma,
    ratioCommonStatorLeakage=smpmData.ratioCommonStatorLeakage,
    Lszero=smpmData.Lszero,
    phiMechanical(fixed=true),
    wMechanical(fixed=true),
    Lmd=smpmData.Lmd,
    Lmq=smpmData.Lmq,
    useDamperCage=smpmData.useDamperCage,
    Lrsigmad=smpmData.Lrsigmad,
    Lrsigmaq=smpmData.Lrsigmaq,
    Rrd=smpmData.Rrd,
    Rrq=smpmData.Rrq,
    TrRef=smpmData.TrRef,
    alpha20r(displayUnit="1/K") = smpmData.alpha20r,
    VsOpenCircuit=smpmData.VsOpenCircuit,
    frictionParameters=smpmData.frictionParameters,
    statorCoreParameters=smpmData.statorCoreParameters,
    strayLoadParameters=smpmData.strayLoadParameters,
    permanentMagnetLossParameters=smpmData.permanentMagnetLossParameters,
    ir(each fixed=true),
    TsOperational=293.15,
    effectiveStatorTurns=smpmData.effectiveStatorTurns,
    TrOperational=293.15)

  Modelica.Electrical.Machines.BasicMachines.SynchronousMachines.SM_PermanentMagnet
    smpmE(
    p=smpmData.p,
    fsNominal=smpmData.fsNominal,
    Rs=smpmData.Rs,
    TsRef=smpmData.TsRef,
    alpha20s(displayUnit="1/K") = smpmData.alpha20s,
    Lszero=smpmData.Lszero,
    Lssigma=smpmData.Lssigma,
    Jr=smpmData.Jr,
    Js=smpmData.Js,
    frictionParameters=smpmData.frictionParameters,
    phiMechanical(fixed=true),
    wMechanical(fixed=true),
    statorCoreParameters=smpmData.statorCoreParameters,
    strayLoadParameters=smpmData.strayLoadParameters,
    VsOpenCircuit=smpmData.VsOpenCircuit,
    Lmd=smpmData.Lmd,
    Lmq=smpmData.Lmq,
    useDamperCage=smpmData.useDamperCage,
    Lrsigmad=smpmData.Lrsigmad,
    Lrsigmaq=smpmData.Lrsigmaq,
    Rrd=smpmData.Rrd,
    Rrq=smpmData.Rrq,
    TrRef=smpmData.TrRef,
    alpha20r(displayUnit="1/K") = smpmData.alpha20r,
    permanentMagnetLossParameters=smpmData.permanentMagnetLossParameters,
    TsOperational=293.15,
    ir(each fixed=true),
    TrOperational=293.15)

  Modelica.Electrical.Machines.Sensors.RotorDisplacementAngle rotorAngleM(
      p=smpmM.p)
  Modelica.Electrical.Machines.Sensors.RotorDisplacementAngle rotorAngleE(
      p=smpmE.p)
  Modelica.Mechanics.Rotational.Components.Inertia loadInertiaM(J=J_Load)
  Modelica.Mechanics.Rotational.Components.Inertia loadInertiaE(J=J_Load)
  Modelica.Mechanics.Rotational.Sources.TorqueStep torqueStepM(
    startTime=tStep,
    stepTorque=-T_Load,
    useSupport=false,
    offsetTorque=0)
  Modelica.Mechanics.Rotational.Sources.TorqueStep torqueStepE(
    startTime=tStep,
    stepTorque=-T_Load,
    useSupport=false,
    offsetTorque=0)
  parameter
    Modelica.Electrical.Machines.Utilities.ParameterRecords.SM_PermanentMagnetData
    smpmData "Synchronous machine data"
  SI.Angle thetaM=rotorAngleM.rotorDisplacementAngle "Rotor displacement angle, FundamentalWave machine";
  SI.Angle thetaE=rotorAngleE.rotorDisplacementAngle "Rotor displacement angle, Electrical machine";
initial equation
  smpmE.is[1:2] = zeros(2);
  smpmM.is[1:2] = zeros(2);
  //conditional damper cage currents are defined as fixed start values
equation
  connect(signalVoltage.plug_n, star.plug_p)
  connect(star.pin_n, ground.p)
  connect(ramp.y, vfController.u)
  connect(vfController.y, signalVoltage.v)
  connect(loadInertiaM.flange_b, torqueStepM.flange)
  connect(signalVoltage.plug_p, currentRMSsensorM.plug_p)
  connect(rotorAngleM.plug_n, smpmM.plug_sn)
  connect(rotorAngleM.plug_p, smpmM.plug_sp)
  connect(rotorAngleM.flange, smpmM.flange)
  connect(smpmM.flange, loadInertiaM.flange_a)
  connect(terminalBoxM.plug_sn, smpmM.plug_sn)
  connect(terminalBoxM.plug_sp, smpmM.plug_sp)
  connect(terminalBoxM.plugSupply, currentRMSsensorM.plug_n)
  connect(loadInertiaE.flange_b, torqueStepE.flange)
  connect(rotorAngleE.plug_n, smpmE.plug_sn)
  connect(rotorAngleE.plug_p, smpmE.plug_sp)
  connect(rotorAngleE.flange, smpmE.flange)
  connect(smpmE.flange, loadInertiaE.flange_a)
  connect(terminalBoxE.plug_sn, smpmE.plug_sn)
  connect(terminalBoxE.plug_sp, smpmE.plug_sp)
  connect(currentRMSsensorE.plug_n, terminalBoxE.plugSupply)
  connect(currentRMSsensorE.plug_p, signalVoltage.plug_p)
end SMPM_Inverter;


Test example: PermanentMagnetSynchronousMachine fed by FOC. A synchronous machine with permanent magnets accelerates a quadratic speed dependent load from standstill.
The rms values of d- and q-current in rotor fixed coordinate system are controlled by the voltageController,
and the output voltages fed to the machine. The result shows that the torque is influenced by the q-current,
whereas the stator voltage is influenced by the d-current.

within Modelica.Magnetic.FundamentalWave.Examples.BasicMachines.SynchronousMachines;
model SMPM_VoltageSource
  "Test example: PermanentMagnetSynchronousMachine fed by FOC"
  extends Modelica.Icons.Example;
  import Modelica.Constants.pi;
  constant Integer m=3 "Number of phases";
  parameter SI.Current Idq[2]={-53.5, 84.6}
    "Desired d- and q-current";
  parameter SI.AngularVelocity wNominal=2*pi*smpmData.fsNominal/smpmData.p
    "Nominal speed";
  parameter SI.Torque TLoad=181.4 "Nominal load torque";
  parameter SI.Inertia JLoad=0.29
    "Load's moment of inertia";
  Magnetic.FundamentalWave.BasicMachines.SynchronousMachines.SM_PermanentMagnet
    smpm(
    ratioCommonStatorLeakage=smpmData.ratioCommonStatorLeakage,
    phiMechanical(start=0, fixed=true),
    wMechanical(start=0, fixed=true),
    useSupport=false,
    useThermalPort=false,
    p=smpmData.p,
    fsNominal=smpmData.fsNominal,
    TsRef=smpmData.TsRef,
    Jr=smpmData.Jr,
    Js=smpmData.Js,
    frictionParameters=smpmData.frictionParameters,
    statorCoreParameters=smpmData.statorCoreParameters,
    strayLoadParameters=smpmData.strayLoadParameters,
    VsOpenCircuit=smpmData.VsOpenCircuit,
    useDamperCage=smpmData.useDamperCage,
    Lrsigmad=smpmData.Lrsigmad,
    Lrsigmaq=smpmData.Lrsigmaq,
    Rrd=smpmData.Rrd,
    Rrq=smpmData.Rrq,
    TrRef=smpmData.TrRef,
    permanentMagnetLossParameters=smpmData.permanentMagnetLossParameters,
    Rs=smpmData.Rs*m/3,
    Lssigma=smpmData.Lssigma*m/3,
    Lszero=smpmData.Lszero*m/3,
    Lmd=smpmData.Lmd*m/3,
    Lmq=smpmData.Lmq*m/3,
    TsOperational=293.15,
    alpha20s=smpmData.alpha20s,
    effectiveStatorTurns=smpmData.effectiveStatorTurns,
    alpha20r=smpmData.alpha20r,
    TrOperational=293.15)

  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.Blocks.Sources.Constant iq(k=Idq[2])
  Modelica.Blocks.Sources.Constant id(k=Idq[1])
  Modelica.Electrical.Machines.Utilities.TerminalBox terminalBox(
      terminalConnection="Y")
  Modelica.Mechanics.Rotational.Sensors.AngleSensor angleSensor
  Modelica.Mechanics.Rotational.Components.Inertia inertiaLoad(J=JLoad)
  Modelica.Mechanics.Rotational.Sources.QuadraticSpeedDependentTorque
    quadraticSpeedDependentTorque(            tau_nominal=-TLoad,
      w_nominal(displayUnit="rad/s") = wNominal)
  Modelica.Electrical.Polyphase.Sensors.CurrentSensor currentSensor(m=m)
  Modelica.Electrical.Machines.Utilities.DQCurrentController currentController(
    p=smpm.p,
    Ld=smpm.Lssigma + smpm.Lmd,
    Lq=smpm.Lssigma + smpm.Lmq,
    Rs=Modelica.Electrical.Machines.Thermal.convertResistance(
        smpm.Rs,
        smpm.TsRef,
        smpm.alpha20s,
        smpm.TsOperational),
    fsNominal=smpm.fsNominal,
    VsOpenCircuit=smpm.VsOpenCircuit)
  Modelica.Mechanics.Rotational.Sensors.TorqueSensor torqueSensor
  Modelica.Mechanics.Rotational.Sensors.SpeedSensor speedSensor
  Modelica.Electrical.Machines.Sensors.RotorDisplacementAngle rotorDisplacementAngle(p=smpm.p)
  Modelica.Electrical.Analog.Basic.Ground groundM
  Modelica.Electrical.Polyphase.Basic.Star starM(final m=m)
  Modelica.Electrical.Machines.Sensors.VoltageQuasiRMSSensor voltageQuasiRMSSensor
  parameter
    Modelica.Electrical.Machines.Utilities.ParameterRecords.SM_PermanentMagnetData
    smpmData(useDamperCage=false) "Synchronous machine data"
  Modelica.Electrical.Machines.Sensors.CurrentQuasiRMSSensor currentQuasiRMSSensor
  SI.Angle theta=rotorDisplacementAngle.rotorDisplacementAngle "Rotor displacement angle, FundamentalWave machine";

initial equation
  smpm.is[1:2] = zeros(2);

equation
  connect(star.pin_n, ground.p)
  connect(terminalBox.plug_sn, smpm.plug_sn)
  connect(terminalBox.plug_sp, smpm.plug_sp)
  connect(quadraticSpeedDependentTorque.flange, inertiaLoad.flange_b)
  connect(smpm.flange, angleSensor.flange)
  connect(star.plug_p, signalVoltage.plug_n)
  connect(currentSensor.plug_n, terminalBox.plugSupply)
  connect(id.y, currentController.id)
  connect(iq.y, currentController.iq)
  connect(angleSensor.phi,currentController. phi)
  connect(currentController.y, signalVoltage.v)
  connect(currentSensor.i,currentController. iActual)
  connect(inertiaLoad.flange_a, torqueSensor.flange_b)
  connect(torqueSensor.flange_a, smpm.flange)
  connect(speedSensor.flange, smpm.flange)
  connect(rotorDisplacementAngle.flange, smpm.flange)
  connect(rotorDisplacementAngle.plug_p, smpm.plug_sp)
  connect(rotorDisplacementAngle.plug_n, smpm.plug_sn)
  connect(voltageQuasiRMSSensor.plug_p, currentSensor.plug_n)
  connect(starM.plug_p, voltageQuasiRMSSensor.plug_n)
  connect(groundM.p, starM.pin_n)
  connect(currentQuasiRMSSensor.plug_n, currentSensor.plug_p)
  connect(signalVoltage.plug_p, currentQuasiRMSSensor.plug_p)
end SMPM_VoltageSource;


Starting of synchronous reluctance machine with inverter.

within Modelica.Magnetic.FundamentalWave.Examples.BasicMachines.SynchronousMachines;
model SMR_Inverter
  "Starting of synchronous reluctance machine with inverter"
  extends Modelica.Icons.Example;
  constant Integer m=3 "Number of stator phases";
  parameter SI.Voltage VsNominal=100
    "Nominal RMS voltage per phase";
  parameter SI.Frequency fsNominal=smrData.fsNominal "Nominal frequency";
  parameter SI.Frequency fKnee=50
    "Knee frequency of V/f curve";
  parameter SI.Time tRamp=1 "Frequency ramp";
  parameter SI.Torque T_Load=46 "Nominal load torque";
  parameter SI.Time tStep=1.2 "Time of load torque step";
  parameter SI.Inertia J_Load=0.29 "Load inertia";
  SI.Angle thetaM=rotorAngleM.rotorDisplacementAngle "Rotor displacement angle, FundamentalWave machine";
  SI.Angle thetaE=rotorAngleE.rotorDisplacementAngle "Rotor displacement angle, Electrical machine";

  Modelica.Electrical.Analog.Basic.Ground ground
  Modelica.Electrical.Polyphase.Basic.Star star(final m=m)
  Modelica.Electrical.Polyphase.Sources.SignalVoltage signalVoltage(
      final m=m)
  Modelica.Blocks.Sources.Ramp ramp(height=fKnee, duration=tRamp)
  Modelica.Electrical.Machines.Utilities.VfController vfController(
    final m=m,
    VNominal=VsNominal,
    fNominal=fsNominal)
  Modelica.Electrical.Polyphase.Sensors.CurrentQuasiRMSSensor currentRMSsensorM
  Modelica.Electrical.Machines.Sensors.CurrentQuasiRMSSensor
    currentRMSsensorE
  Modelica.Electrical.Machines.Utilities.TerminalBox terminalBoxM(
      terminalConnection="Y")
  Modelica.Electrical.Machines.Utilities.TerminalBox terminalBoxE(
      terminalConnection="Y")
  Magnetic.FundamentalWave.BasicMachines.SynchronousMachines.SM_ReluctanceRotor
    smrM(
    Jr=smrData.Jr,
    Js=smrData.Js,
    p=smrData.p,
    fsNominal=smrData.fsNominal,
    Rs=smrData.Rs,
    TsRef=smrData.TsRef,
    alpha20s(displayUnit="1/K") = smrData.alpha20s,
    Lssigma=smrData.Lssigma,
    ratioCommonStatorLeakage=smrData.ratioCommonStatorLeakage,
    Lszero=smrData.Lszero,
    frictionParameters=smrData.frictionParameters,
    statorCoreParameters=smrData.statorCoreParameters,
    strayLoadParameters=smrData.strayLoadParameters,
    phiMechanical(fixed=true),
    wMechanical(fixed=true),
    Lmd=smrData.Lmd,
    Lmq=smrData.Lmq,
    useDamperCage=smrData.useDamperCage,
    Lrsigmad=smrData.Lrsigmad,
    Lrsigmaq=smrData.Lrsigmaq,
    Rrd=smrData.Rrd,
    Rrq=smrData.Rrq,
    TrRef=smrData.TrRef,
    alpha20r(displayUnit="1/K") = smrData.alpha20r,
    ir(each fixed=true),
    TsOperational=293.15,
    effectiveStatorTurns=smrData.effectiveStatorTurns,
    TrOperational=293.15)
  Modelica.Electrical.Machines.BasicMachines.SynchronousMachines.SM_ReluctanceRotor
    smrE(
    p=smrData.p,
    fsNominal=smrData.fsNominal,
    Rs=smrData.Rs,
    TsRef=smrData.TsRef,
    alpha20s(displayUnit="1/K") = smrData.alpha20s,
    Lszero=smrData.Lszero,
    Lssigma=smrData.Lssigma,
    Jr=smrData.Jr,
    Js=smrData.Js,
    frictionParameters=smrData.frictionParameters,
    phiMechanical(fixed=true),
    wMechanical(fixed=true),
    statorCoreParameters=smrData.statorCoreParameters,
    strayLoadParameters=smrData.strayLoadParameters,
    Lmd=smrData.Lmd,
    Lmq=smrData.Lmq,
    useDamperCage=smrData.useDamperCage,
    Lrsigmad=smrData.Lrsigmad,
    Lrsigmaq=smrData.Lrsigmaq,
    Rrd=smrData.Rrd,
    Rrq=smrData.Rrq,
    TrRef=smrData.TrRef,
    alpha20r(displayUnit="1/K") = smrData.alpha20r,
    TsOperational=293.15,
    ir(each fixed=true),
    TrOperational=293.15)
  Modelica.Electrical.Machines.Sensors.RotorDisplacementAngle rotorAngleM(
      p=smrM.p)
  Modelica.Electrical.Machines.Sensors.RotorDisplacementAngle rotorAngleE(
      p=smrE.p)
  Modelica.Mechanics.Rotational.Components.Inertia loadInertiaM(J=J_Load)
  Modelica.Mechanics.Rotational.Components.Inertia loadInertiaE(J=J_Load)
  Modelica.Mechanics.Rotational.Sources.TorqueStep torqueStepM(
    startTime=tStep,
    stepTorque=-T_Load,
    useSupport=false,
    offsetTorque=0)
  Modelica.Mechanics.Rotational.Sources.TorqueStep torqueStepE(
    startTime=tStep,
    stepTorque=-T_Load,
    useSupport=false,
    offsetTorque=0)
  parameter
    Modelica.Electrical.Machines.Utilities.ParameterRecords.SM_ReluctanceRotorData
    smrData "Synchronous machine data"
initial equation
  smrE.is[1:2] = zeros(2);
  smrM.is[1:2] = zeros(2);
  //conditional damper cage currents are defined as fixed start values
equation
  connect(signalVoltage.plug_n, star.plug_p)
  connect(star.pin_n, ground.p)
  connect(smrE.flange, loadInertiaE.flange_a)
  connect(ramp.y, vfController.u)
  connect(vfController.y, signalVoltage.v)
  connect(loadInertiaE.flange_b, torqueStepE.flange)
  connect(smrE.plug_sn, rotorAngleE.plug_n)
  connect(smrE.plug_sp, rotorAngleE.plug_p)
  connect(smrE.flange, rotorAngleE.flange)
  connect(terminalBoxE.plug_sp, smrE.plug_sp)
  connect(terminalBoxE.plug_sn, smrE.plug_sn)
  connect(terminalBoxE.plugSupply, currentRMSsensorE.plug_n)
  connect(smrM.flange, loadInertiaM.flange_a)
  connect(loadInertiaM.flange_b, torqueStepM.flange)
  connect(smrM.plug_sn, rotorAngleM.plug_n)
  connect(smrM.plug_sp, rotorAngleM.plug_p)
  connect(smrM.flange, rotorAngleM.flange)
  connect(terminalBoxM.plug_sp, smrM.plug_sp)
  connect(terminalBoxM.plug_sn, smrM.plug_sn)
  connect(currentRMSsensorM.plug_n, terminalBoxM.plugSupply)
  connect(signalVoltage.plug_p, currentRMSsensorM.plug_p)
  connect(signalVoltage.plug_p, currentRMSsensorE.plug_p)
end SMR_Inverter;


within Modelica.Magnetic.FundamentalWave.Examples.BasicMachines.SynchronousMachines;
package ComparisonPolyphase "Compare polyphase machines with three-phase machines"
  extends Modelica.Icons.ExamplesPackage;
end ComparisonPolyphase;


Electrical excited polyphase synchronous machine operating as generator.

within Modelica.Magnetic.FundamentalWave.Examples.BasicMachines.SynchronousMachines.ComparisonPolyphase;
model SMEE_Generator_Polyphase
  "Electrical excited polyphase synchronous machine operating as generator"

  extends Modelica.Icons.Example;
  import Modelica.Constants.pi;
  constant Integer m3=3 "Number of stator phases of three-phase system";
  parameter Integer m=5 "Number of stator phases"
  parameter SI.Voltage VsNominal=100
    "Nominal RMS voltage per phase";
  parameter SI.Frequency fsNominal=smeeData.fsNominal "Nominal frequency";
  parameter SI.AngularVelocity w=
      Modelica.Units.Conversions.from_rpm(1499) "Nominal speed";
  parameter SI.Current Ie=19 "Excitation current";
  parameter SI.Current Ie0=10 "Initial excitation current";
  parameter SI.Angle gamma0(displayUnit="deg") = 0
    "Initial rotor displacement angle";
  parameter Integer p=2 "Number of pole pairs";
  parameter SI.Resistance Rs=0.03
    "Warm stator resistance per phase";
  parameter SI.Inductance Lssigma=0.1/(2*Modelica.Constants.pi
      *fsNominal) "Stator stray inductance per phase";
  parameter SI.Inductance Lmd=1.5/(2*Modelica.Constants.pi*
      fsNominal) "Main field inductance in d-axis";
  parameter SI.Inductance Lmq=1.5/(2*Modelica.Constants.pi*
      fsNominal) "Main field inductance in q-axis";
  parameter SI.Inductance Lrsigmad=0.05/(2*Modelica.Constants.pi
      *fsNominal)
    "Damper stray inductance (equivalent three-phase winding) d-axis";
  parameter SI.Inductance Lrsigmaq=Lrsigmad
    "Damper stray inductance (equivalent three-phase winding) q-axis";
  parameter SI.Resistance Rrd=0.04
    "Warm damper resistance (equivalent three-phase winding) d-axis";
  parameter SI.Resistance Rrq=Rrd
    "Warm damper resistance (equivalent three-phase winding) q-axis";
  Modelica.Electrical.Polyphase.Basic.Star star3(final m=m3)
  Modelica.Electrical.Analog.Basic.Ground ground3
  Modelica.Electrical.Polyphase.Sources.SineVoltage sineVoltage3(
    final m=m3,
    final V=fill(VsNominal*sqrt(2), m3),
    phase=-Modelica.Electrical.Polyphase.Functions.symmetricOrientation(
        m3),
    final f=fill(fsNominal, m3))
  Modelica.Electrical.Polyphase.Sensors.PowerSensor
    electricalPowerSensorM(m=m)
  Modelica.Electrical.Machines.Sensors.ElectricalPowerSensor electricalPowerSensor3
  Modelica.Electrical.Machines.Utilities.TerminalBox terminalBoxM(
      terminalConnection="Y", m=m)
  Modelica.Electrical.Machines.Utilities.TerminalBox terminalBox3(
      terminalConnection="Y", m=m3)
  Magnetic.FundamentalWave.BasicMachines.SynchronousMachines.SM_ElectricalExcited
    smeeM(
    ratioCommonStatorLeakage=smeeData.ratioCommonStatorLeakage,
    phiMechanical(start=-(Modelica.Constants.pi + gamma0)/p, fixed=true),
    Jr=0.29,
    Js=0.29,
    p=2,
    fsNominal=smeeData.fsNominal,
    TsRef=smeeData.TsRef,
    alpha20s(displayUnit="1/K") = smeeData.alpha20s,
    useDamperCage=true,
    Lrsigmad=smeeData.Lrsigmad,
    Lrsigmaq=smeeData.Lrsigmaq,
    Rrd=smeeData.Rrd,
    Rrq=smeeData.Rrq,
    TrRef=smeeData.TrRef,
    alpha20r(displayUnit="1/K") = smeeData.alpha20r,
    VsNominal=smeeData.VsNominal,
    IeOpenCircuit=smeeData.IeOpenCircuit,
    Re=smeeData.Re,
    TeRef=smeeData.TeRef,
    alpha20e(displayUnit="1/K") = smeeData.alpha20e,
    m=m,
    Rs=smeeData.Rs*m/3,
    Lssigma=smeeData.Lssigma*m/3,
    Lmd=smeeData.Lmd*m/3,
    Lmq=smeeData.Lmq*m/3,
    statorCoreParameters(VRef=100),
    strayLoadParameters(IRef=100),
    brushParameters(ILinear=0.01),
    ir(each fixed=true),
    effectiveStatorTurns=smeeData.effectiveStatorTurns,
    TsOperational=293.15,
    TrOperational=293.15,
    TeOperational=293.15,
    sigmae=smeeData.sigmae*m/3)

  Magnetic.FundamentalWave.BasicMachines.SynchronousMachines.SM_ElectricalExcited
    smee3(
    ratioCommonStatorLeakage=smeeData.ratioCommonStatorLeakage,
    phiMechanical(start=-(Modelica.Constants.pi + gamma0)/p, fixed=true),
    p=2,
    fsNominal=smeeData.fsNominal,
    Rs=smeeData.Rs,
    TsRef=smeeData.TsRef,
    alpha20s(displayUnit="1/K") = smeeData.alpha20s,
    Lssigma=smeeData.Lssigma,
    Jr=0.29,
    Js=0.29,
    frictionParameters(PRef=0),
    statorCoreParameters(PRef=0, VRef=100),
    strayLoadParameters(PRef=0, IRef=100),
    Lmd=smeeData.Lmd,
    Lmq=smeeData.Lmq,
    useDamperCage=true,
    Lrsigmad=smeeData.Lrsigmad,
    Rrd=smeeData.Rrd,
    Rrq=smeeData.Rrq,
    alpha20r(displayUnit="1/K") = smeeData.alpha20r,
    VsNominal=smeeData.VsNominal,
    IeOpenCircuit=smeeData.IeOpenCircuit,
    Re=smeeData.Re,
    TeRef=smeeData.TeRef,
    alpha20e(displayUnit="1/K") = smeeData.alpha20e,
    sigmae=smeeData.sigmae,
    brushParameters(V=0, ILinear=0.01),
    Lrsigmaq=smeeData.Lrsigmaq,
    TrRef=smeeData.TrRef,
    m=m3,
    ir(each fixed=true),
    TsOperational=293.15,
    effectiveStatorTurns=smeeData.effectiveStatorTurns,
    TrOperational=293.15,
    TeOperational=293.15)

  Modelica.Electrical.Analog.Basic.Ground groundRM
  Modelica.Electrical.Analog.Basic.Ground groundR3
  Modelica.Electrical.Analog.Sources.RampCurrent rampCurrentM(
    duration=0.1,
    I=Ie - Ie0,
    offset=Ie0)
  Modelica.Electrical.Analog.Sources.RampCurrent rampCurrent3(
    duration=0.1,
    I=Ie - Ie0,
    offset=Ie0)
  Modelica.Electrical.Machines.Sensors.RotorDisplacementAngle rotorAngle3(
     p=p)
  Modelica.Electrical.Machines.Sensors.MechanicalPowerSensor
    mechanicalPowerSensorM
  Modelica.Electrical.Machines.Sensors.MechanicalPowerSensor
    mechanicalPowerSensor3
  Modelica.Mechanics.Rotational.Sources.ConstantSpeed constantSpeedM(
      final w_fixed=w, useSupport=false)
  Modelica.Mechanics.Rotational.Sources.ConstantSpeed constantSpeed3(
      final w_fixed=w, useSupport=false)
  parameter Modelica.Electrical.Machines.Utilities.SynchronousMachineData smeeData(
    SNominal=30e3,
    VsNominal=100,
    fsNominal=50,
    IeOpenCircuit=10,
    x0=0.1,
    xd=1.6,
    xq=1.6,
    xdTransient=0.1375,
    xdSubtransient=0.121428571,
    xqSubtransient=0.148387097,
    Ta=0.014171268,
    Td0Transient=0.261177343,
    Td0Subtransient=0.006963029,
    Tq0Subtransient=0.123345081,
    alpha20s(displayUnit="1/K") = Modelica.Electrical.Machines.Thermal.Constants.alpha20Zero,
    alpha20r(displayUnit="1/K") = Modelica.Electrical.Machines.Thermal.Constants.alpha20Zero,
    alpha20e(displayUnit="1/K") = Modelica.Electrical.Machines.Thermal.Constants.alpha20Zero,
    TsSpecification=293.15,
    TsRef=293.15,
    TrSpecification=293.15,
    TrRef=293.15,
    TeSpecification=293.15,
    TeRef=293.15) "Synchronous machine data"

  Modelica.Electrical.Polyphase.Sensors.CurrentQuasiRMSSensor
    currentRMSsensorM(m=m)
  Modelica.Electrical.Machines.Sensors.CurrentQuasiRMSSensor
    currentRMSsensor3
  Modelica.Blocks.Math.Gain gain(k=(m/m3))
  Modelica.Blocks.Math.Feedback feedback
  Modelica.Electrical.Polyphase.Basic.Star starM(final m=m)
  Modelica.Electrical.Analog.Basic.Ground groundM
  Modelica.Electrical.Polyphase.Sources.SineVoltage sineVoltageM(
    final V=fill(VsNominal*sqrt(2), m),
    final f=fill(fsNominal, m),
    final m=m,
    phase=-Modelica.Electrical.Polyphase.Functions.symmetricOrientation(
        m))
initial equation
  smee3.is[1:2] = zeros(2);
  smeeM.is[1:2] = zeros(2);
  //conditional damper cage currents are defined as fixed start values
equation
  connect(rotorAngle3.plug_n, smee3.plug_sn)
  connect(rotorAngle3.plug_p, smee3.plug_sp)
  connect(rotorAngle3.flange, smee3.flange)
  connect(star3.pin_n, ground3.p)
  connect(star3.plug_p, sineVoltage3.plug_n)
  connect(smee3.flange, mechanicalPowerSensor3.flange_a)
  connect(mechanicalPowerSensor3.flange_b, constantSpeed3.flange)
  connect(rampCurrent3.p, groundR3.p)
  connect(rampCurrent3.p, smee3.pin_en)
  connect(rampCurrent3.n, smee3.pin_ep)
  connect(smee3.plug_sn, terminalBox3.plug_sn)
  connect(smee3.plug_sp, terminalBox3.plug_sp)
  connect(smeeM.flange, mechanicalPowerSensorM.flange_a)
  connect(mechanicalPowerSensorM.flange_b, constantSpeedM.flange)
  connect(rampCurrentM.p, groundRM.p)
  connect(rampCurrentM.p, smeeM.pin_en)
  connect(rampCurrentM.n, smeeM.pin_ep)
  connect(smeeM.plug_sn, terminalBoxM.plug_sn)
  connect(smeeM.plug_sp, terminalBoxM.plug_sp)
  connect(electricalPowerSensor3.plug_p, sineVoltage3.plug_p)
  connect(electricalPowerSensor3.plug_nv, star3.plug_p)
  connect(gain.y, feedback.u2)
  connect(electricalPowerSensor3.plug_ni, currentRMSsensor3.plug_p)
  connect(currentRMSsensor3.plug_n, terminalBox3.plugSupply)
  connect(currentRMSsensor3.I, feedback.u1)
  connect(terminalBoxM.plugSupply, currentRMSsensorM.plug_n)
  connect(currentRMSsensorM.I, gain.u)
  connect(starM.pin_n, groundM.p)
  connect(starM.plug_p, sineVoltageM.plug_n)
  connect(sineVoltageM.plug_p, electricalPowerSensorM.pc)
  connect(electricalPowerSensorM.pc, electricalPowerSensorM.pv)
  connect(electricalPowerSensorM.nc, currentRMSsensorM.plug_p)
  connect(electricalPowerSensorM.nv, starM.plug_p)
end SMEE_Generator_Polyphase;


Starting of polyphase permanent magnet synchronous machine with inverter.

within Modelica.Magnetic.FundamentalWave.Examples.BasicMachines.SynchronousMachines.ComparisonPolyphase;
model SMPM_Inverter_Polyphase
  "Starting of polyphase permanent magnet synchronous machine with inverter"

  import Modelica.Constants.pi;
  extends Modelica.Icons.Example;
  constant Integer m3=3 "Number of stator phases of three-phase system";
  parameter Integer m=5 "Number of stator phases"
  parameter SI.Voltage VsNominal=100
    "Nominal RMS voltage per phase";
  parameter SI.Frequency fsNominal=smpmData3.fsNominal "Nominal frequency";
  parameter SI.Frequency fKnee=50
    "Knee frequency of V/f curve";
  parameter SI.Time tRamp=1 "Frequency ramp";
  parameter SI.Torque T_Load=181.4 "Nominal load torque";
  parameter SI.Time tStep=1.2 "Time of load torque step";
  parameter SI.Inertia J_Load=0.29 "Load inertia";
  Modelica.Electrical.Analog.Basic.Ground ground3
  Modelica.Electrical.Polyphase.Basic.Star star3(final m=m3)
  Modelica.Electrical.Polyphase.Sources.SignalVoltage signalVoltage3(
      final m=m3)
  Modelica.Blocks.Sources.Ramp ramp(height=fKnee, duration=tRamp)
  Modelica.Electrical.Machines.Utilities.VfController vfController3(
    VNominal=VsNominal,
    fNominal=fsNominal,
    BasePhase=+Modelica.Constants.pi/2,
    final m=m3,
    orientation=-
        Modelica.Electrical.Polyphase.Functions.symmetricOrientation(m3))
  Modelica.Electrical.Polyphase.Sensors.CurrentQuasiRMSSensor
    currentRMSsensorM(m=m)
  Modelica.Electrical.Machines.Sensors.CurrentQuasiRMSSensor
    currentRMSsensor3
  Modelica.Electrical.Machines.Utilities.TerminalBox terminalBoxM(
      terminalConnection="Y", m=m)
  Modelica.Electrical.Machines.Utilities.TerminalBox terminalBox3(
      terminalConnection="Y", m=m3)
  Magnetic.FundamentalWave.BasicMachines.SynchronousMachines.SM_PermanentMagnet
    smpmM(
    Jr=smpmDataM.Jr,
    Js=smpmData3.Js,
    p=smpmDataM.p,
    fsNominal=smpmDataM.fsNominal,
    TsRef=smpmDataM.TsRef,
    alpha20s(displayUnit="1/K") = smpmDataM.alpha20s,
    ratioCommonStatorLeakage=smpmDataM.ratioCommonStatorLeakage,
    phiMechanical(fixed=true),
    wMechanical(fixed=true),
    useDamperCage=smpmData3.useDamperCage,
    Lrsigmad=smpmData3.Lrsigmad,
    Lrsigmaq=smpmData3.Lrsigmaq,
    Rrd=smpmData3.Rrd,
    Rrq=smpmData3.Rrq,
    TrRef=smpmData3.TrRef,
    alpha20r(displayUnit="1/K") = smpmData3.alpha20r,
    VsOpenCircuit=smpmDataM.VsOpenCircuit,
    frictionParameters=smpmDataM.frictionParameters,
    statorCoreParameters=smpmDataM.statorCoreParameters,
    strayLoadParameters=smpmDataM.strayLoadParameters,
    permanentMagnetLossParameters=smpmDataM.permanentMagnetLossParameters,
    m=m,
    Rs=smpmDataM.Rs,
    Lssigma=smpmDataM.Lssigma,
    Lszero=smpmDataM.Lszero,
    Lmd=smpmDataM.Lmd,
    Lmq=smpmDataM.Lmq,
    ir(each fixed=true),
    TsOperational=293.15,
    effectiveStatorTurns=smpmDataM.effectiveStatorTurns,
    TrOperational=293.15)

  Magnetic.FundamentalWave.BasicMachines.SynchronousMachines.SM_PermanentMagnet
    smpm3(
    p=smpmData3.p,
    fsNominal=smpmData3.fsNominal,
    Rs=smpmData3.Rs,
    TsRef=smpmData3.TsRef,
    alpha20s(displayUnit="1/K") = smpmData3.alpha20s,
    ratioCommonStatorLeakage=smpmData3.ratioCommonStatorLeakage,
    Lszero=smpmData3.Lszero,
    Lssigma=smpmData3.Lssigma,
    Jr=smpmData3.Jr,
    Js=smpmData3.Js,
    frictionParameters=smpmData3.frictionParameters,
    phiMechanical(fixed=true),
    wMechanical(fixed=true),
    statorCoreParameters=smpmData3.statorCoreParameters,
    strayLoadParameters=smpmData3.strayLoadParameters,
    VsOpenCircuit=smpmData3.VsOpenCircuit,
    Lmd=smpmData3.Lmd,
    Lmq=smpmData3.Lmq,
    useDamperCage=smpmData3.useDamperCage,
    Lrsigmad=smpmData3.Lrsigmad,
    Lrsigmaq=smpmData3.Lrsigmaq,
    Rrd=smpmData3.Rrd,
    Rrq=smpmData3.Rrq,
    TrRef=smpmData3.TrRef,
    alpha20r(displayUnit="1/K") = smpmData3.alpha20r,
    permanentMagnetLossParameters=smpmData3.permanentMagnetLossParameters,
    m=m3,
    ir(each fixed=true),
    TsOperational=293.15,
    effectiveStatorTurns=smpmData3.effectiveStatorTurns,
    TrOperational=293.15)

  Modelica.Electrical.Machines.Sensors.RotorDisplacementAngle rotorAngle3(
     p=smpm3.p)
  Modelica.Mechanics.Rotational.Components.Inertia loadInertiaM(J=J_Load)
  Modelica.Mechanics.Rotational.Components.Inertia loadInertia3(J=J_Load)
  Modelica.Mechanics.Rotational.Sources.TorqueStep torqueStepM(
    startTime=tStep,
    stepTorque=-T_Load,
    useSupport=false,
    offsetTorque=0)
  Modelica.Mechanics.Rotational.Sources.TorqueStep torqueStep3(
    startTime=tStep,
    stepTorque=-T_Load,
    useSupport=false,
    offsetTorque=0)
  parameter
    Modelica.Electrical.Machines.Utilities.ParameterRecords.SM_PermanentMagnetData
    smpmData3(m=m3)
              "Synchronous machine data of three phase machine"
  Modelica.Electrical.Polyphase.Sources.SignalVoltage signalVoltageM(
      final m=m)
  Modelica.Electrical.Polyphase.Basic.Star starM(final m=m)
  Modelica.Electrical.Analog.Basic.Ground groundM
  Modelica.Electrical.Machines.Utilities.VfController vfController(
    VNominal=VsNominal,
    fNominal=fsNominal,
    BasePhase=+Modelica.Constants.pi/2,
    final m=m,
    orientation=-
        Modelica.Electrical.Polyphase.Functions.symmetricOrientation(m))
  Modelica.Blocks.Math.Feedback feedback
  Modelica.Blocks.Math.Gain gain(k=(m/m3))
  parameter
    Electrical.Machines.Utilities.ParameterRecords.SM_PermanentMagnetData smpmDataM(
    m=m,
    Rs=0.03*m/3,
    Lszero=0.1/(2*pi*fsNominal)*m/3,
    Lssigma=0.1/(2*pi*fsNominal)*m/3,
    statorCoreParameters(m=m),
    Lmd=0.3/(2*pi*fsNominal)*m/3,
    Lmq=0.3/(2*pi*fsNominal)*m/3,
    Lrsigmad=0.05/(2*pi*fsNominal)*m/3,
    Lrsigmaq=0.05/(2*pi*fsNominal)*m/3,
    Rrd=0.04*m/3,
    Rrq=0.04*m/3) "Synchronous machine data of an m-phase machine"
initial equation
  smpm3.is[1:2] = zeros(2);
  smpmM.is[1:2] = zeros(2);
  //conditional damper cage currents are defined as fixed start values
equation
  connect(signalVoltage3.plug_n, star3.plug_p)
  connect(star3.pin_n, ground3.p)
  connect(ramp.y, vfController3.u)
  connect(vfController3.y, signalVoltage3.v)
  connect(loadInertiaM.flange_b, torqueStepM.flange)
  connect(smpmM.flange, loadInertiaM.flange_a)
  connect(terminalBoxM.plug_sn, smpmM.plug_sn)
  connect(terminalBoxM.plug_sp, smpmM.plug_sp)
  connect(terminalBoxM.plugSupply, currentRMSsensorM.plug_n)
  connect(loadInertia3.flange_b, torqueStep3.flange)
  connect(rotorAngle3.plug_n, smpm3.plug_sn)
  connect(rotorAngle3.plug_p, smpm3.plug_sp)
  connect(rotorAngle3.flange, smpm3.flange)
  connect(smpm3.flange, loadInertia3.flange_a)
  connect(terminalBox3.plug_sn, smpm3.plug_sn)
  connect(terminalBox3.plug_sp, smpm3.plug_sp)
  connect(currentRMSsensor3.plug_n, terminalBox3.plugSupply)
  connect(signalVoltage3.plug_p, currentRMSsensor3.plug_p)
  connect(signalVoltageM.plug_n, starM.plug_p)
  connect(starM.pin_n, groundM.p)
  connect(vfController.y, signalVoltageM.v)
  connect(vfController.u, ramp.y)
  connect(signalVoltageM.plug_p, currentRMSsensorM.plug_p)
  connect(currentRMSsensor3.I, feedback.u1)
  connect(gain.y, feedback.u2)
  connect(gain.u, currentRMSsensorM.I)
end SMPM_Inverter_Polyphase;