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

within Modelica.Magnetic.QuasiStatic.FundamentalWave.Examples.BasicMachines.InductionMachines;
model IMC_Transformer "Induction machine with squirrel cage starting with transformer"
  import Modelica.Constants.pi;
  extends Modelica.Icons.Example;
  constant Integer m=3 "Number of phases";
  parameter SI.Voltage VNominal=100
    "Nominal RMS voltage per phase";
  parameter SI.Frequency fNominal=imc.fsNominal "Nominal frequency";
  parameter SI.Time tStart1=0.1 "Start time";
  parameter SI.Time tStart2=2.0
    "Start time of bypass transformer";
  parameter SI.Torque TLoad=161.4 "Nominal load torque";
  parameter SI.AngularVelocity wLoad(displayUnit="rev/min")=
       1440.45*2*Modelica.Constants.pi/60 "Nominal load speed";
  parameter SI.Inertia JLoad=0.29
    "Load's moment of inertia";
  Magnetic.QuasiStatic.FundamentalWave.BasicMachines.InductionMachines.IM_SquirrelCage
    imcQS(
    p=imcData.p,
    fsNominal=imcData.fsNominal,
    Rs=imcData.Rs,
    TsRef=imcData.TsRef,
    alpha20s(displayUnit="1/K") = imcData.alpha20s,
    Lssigma=imcData.Lssigma,
    Jr=imcData.Jr,
    Js=imcData.Js,
    frictionParameters=imcData.frictionParameters,
    wMechanical(fixed=true),
    gammar(fixed=true, start=pi/2),
    gamma(fixed=true, start=-pi/2),
    statorCoreParameters=imcData.statorCoreParameters,
    strayLoadParameters=imcData.strayLoadParameters,
    Lm=imcData.Lm,
    Lrsigma=imcData.Lrsigma,
    Rr=imcData.Rr,
    TrRef=imcData.TrRef,
    TsOperational=293.15,
    alpha20r=imcData.alpha20r,
    TrOperational=293.15)
  Modelica.Electrical.QuasiStatic.Polyphase.Sensors.CurrentQuasiRMSSensor iSensorQS(m=m)
  Modelica.Electrical.QuasiStatic.Polyphase.Sources.VoltageSource sineVoltageQS(
    final m=m,
    f=fNominal,
    V=fill(VNominal/sqrt(3), m))
  Modelica.Electrical.QuasiStatic.Polyphase.Basic.Star starQS(final m=m)
  Modelica.Electrical.QuasiStatic.SinglePhase.Basic.Ground groundQS
  Modelica.Blocks.Sources.BooleanStep booleanStep1QS[m](each startTime=tStart1)
  Modelica.Electrical.QuasiStatic.Polyphase.Ideal.IdealClosingSwitch idealCloserQS(
    final m=m,
    Ron=fill(1e-5, m),
    Goff=fill(1e-5, m))
  Modelica.Electrical.QuasiStatic.Machines.BasicMachines.Transformers.Yy.Yy00 transformerQS(
    n=transformerData.n,
    R1=transformerData.R1,
    L1sigma=transformerData.L1sigma,
    R2=transformerData.R2,
    L2sigma=transformerData.L2sigma,
    alpha20_1(displayUnit="1/K") = Modelica.Electrical.Machines.Thermal.Constants.alpha20Zero,
    alpha20_2(displayUnit="1/K") = Modelica.Electrical.Machines.Thermal.Constants.alpha20Zero,
    T1Ref=293.15,
    T2Ref=293.15,
    T1Operational=293.15,
    T2Operational=293.15)

  Modelica.Electrical.QuasiStatic.SinglePhase.Basic.Ground ground2QS
  parameter Modelica.Electrical.Machines.Utilities.TransformerData transformerData(
    f=fNominal,
    V1=VNominal,
    C1=Modelica.Utilities.Strings.substring(
        transformerQS.VectorGroup,
        1,
        1),
    V2=VNominal/sqrt(3),
    C2=Modelica.Utilities.Strings.substring(
        transformerQS.VectorGroup,
        2,
        2),
    SNominal=50E3,
    v_sc=0.06,
    P_sc=500) "Transformer data"
  Modelica.Blocks.Sources.BooleanStep booleanStep2QS[m](each startTime=tStart2)
  Modelica.Electrical.QuasiStatic.Polyphase.Ideal.IdealCommutingSwitch idealCommutingSwitchQS(
    final m=m,
    Ron=fill(1e-5, m),
    Goff=fill(50E-5, m))
  Modelica.Mechanics.Rotational.Components.Inertia loadInertiaQS(J=JLoad)
  Modelica.Mechanics.Rotational.Sources.QuadraticSpeedDependentTorque quadraticLoadTorqueQS(
    w_nominal=wLoad,
    TorqueDirection=false,
    tau_nominal=-TLoad,
    useSupport=false)
  Magnetic.QuasiStatic.FundamentalWave.Utilities.TerminalBox terminalBoxQS(
      terminalConnection="D", m=m)
  parameter Modelica.Electrical.Machines.Utilities.ParameterRecords.IM_SquirrelCageData imcData "Induction machine data"
  Magnetic.FundamentalWave.BasicMachines.InductionMachines.IM_SquirrelCage imc(
    p=imcData.p,
    fsNominal=imcData.fsNominal,
    TsRef=imcData.TsRef,
    alpha20s(displayUnit="1/K") = imcData.alpha20s,
    Jr=imcData.Jr,
    Js=imcData.Js,
    frictionParameters=imcData.frictionParameters,
    phiMechanical(fixed=true),
    wMechanical(fixed=true),
    statorCoreParameters=imcData.statorCoreParameters,
    strayLoadParameters=imcData.strayLoadParameters,
    TrRef=imcData.TrRef,
    Rs=imcData.Rs*m/3,
    Lssigma=imcData.Lssigma*m/3,
    Lszero=imcData.Lszero*m/3,
    Lm=imcData.Lm*m/3,
    Lrsigma=imcData.Lrsigma*m/3,
    Rr=imcData.Rr*m/3,
    m=m,
    TsOperational=293.15,
    effectiveStatorTurns=imcData.effectiveStatorTurns,
    alpha20r=imcData.alpha20r,
    TrOperational=293.15)
  Modelica.Electrical.Polyphase.Sensors.CurrentQuasiRMSSensor iSensor(m=m)
  Modelica.Electrical.Polyphase.Sources.SineVoltage sineVoltage(
    final m=m,
    f=fill(fNominal, m),
    V=fill(sqrt(2/3)*VNominal, m))
  Modelica.Electrical.Polyphase.Basic.Star star(final m=m)
  Modelica.Electrical.Analog.Basic.Ground ground
  Modelica.Blocks.Sources.BooleanStep booleanStep1[m](each startTime=
        tStart1)
  Modelica.Electrical.Polyphase.Ideal.IdealClosingSwitch idealCloser(
    final m=m,
    Ron=fill(1e-5, m),
    Goff=fill(1e-5, m))
  Modelica.Electrical.Machines.BasicMachines.Transformers.Yy.Yy00 transformer(
    n=transformerData.n,
    R1=transformerData.R1,
    L1sigma=transformerData.L1sigma,
    R2=transformerData.R2,
    L2sigma=transformerData.L2sigma,
    T1Ref=293.15,
    alpha20_1(displayUnit="1/K") = Modelica.Electrical.Machines.Thermal.Constants.alpha20Zero,
    T2Ref=293.15,
    alpha20_2(displayUnit="1/K") = Modelica.Electrical.Machines.Thermal.Constants.alpha20Zero,
    T1Operational=293.15,
    T2Operational=293.15)
  Modelica.Electrical.Analog.Basic.Ground ground2
  Modelica.Blocks.Sources.BooleanStep booleanStep2[m](each startTime=
        tStart2)
  Modelica.Electrical.Polyphase.Ideal.IdealCommutingSwitch
    idealCommutingSwitch(
    final m=m,
    Ron=fill(1e-5, m),
    Goff=fill(50E-5, m))
  Modelica.Mechanics.Rotational.Components.Inertia loadInertia(J=JLoad)
  Modelica.Mechanics.Rotational.Sources.QuadraticSpeedDependentTorque
    quadraticLoadTorque(
    w_nominal=wLoad,
    TorqueDirection=false,
    tau_nominal=-TLoad,
    useSupport=false)
  Modelica.Electrical.Machines.Utilities.TerminalBox terminalBox(terminalConnection="D")
initial equation
  sum(imc.is) = 0;
  imc.is[1:2] = zeros(2);
  imc.rotorCage.electroMagneticConverter.V_m = Complex(0, 0);
  transformer.i2[1:2] = zeros(2);
equation
  connect(starQS.pin_n, groundQS.pin)
  connect(terminalBoxQS.plug_sn, imcQS.plug_sn)
  connect(terminalBoxQS.plug_sp, imcQS.plug_sp)
  connect(loadInertiaQS.flange_b, quadraticLoadTorqueQS.flange)
  connect(imcQS.flange, loadInertiaQS.flange_a)
  connect(starQS.plug_p, sineVoltageQS.plug_n)
  connect(booleanStep2QS.y, idealCommutingSwitchQS.control)
  connect(transformerQS.starpoint2, ground2QS.pin)
  connect(idealCommutingSwitchQS.plug_p, terminalBoxQS.plugSupply)
  connect(transformerQS.plug2, idealCommutingSwitchQS.plug_n1)
  connect(sineVoltageQS.plug_p, iSensorQS.plug_p)
  connect(booleanStep1QS.y, idealCloserQS.control)
  connect(iSensorQS.plug_n, idealCloserQS.plug_p)
  connect(transformerQS.plug1, idealCloserQS.plug_n)
  connect(idealCloserQS.plug_n, idealCommutingSwitchQS.plug_n2)
  connect(star.pin_n,ground. p)
  connect(terminalBox.plug_sp, imc.plug_sp)
  connect(loadInertia.flange_b,quadraticLoadTorque. flange)
  connect(imc.flange, loadInertia.flange_a)
  connect(star.plug_p,sineVoltage. plug_n)
  connect(booleanStep2.y,idealCommutingSwitch. control)
  connect(transformer.starpoint2,ground2. p)
  connect(idealCommutingSwitch.plug_p, terminalBox.plugSupply)
  connect(transformer.plug2,idealCommutingSwitch. plug_n1)
  connect(sineVoltage.plug_p, iSensor.plug_p)
  connect(booleanStep1.y,idealCloser. control)
  connect(iSensor.plug_n, idealCloser.plug_p)
  connect(transformer.plug1,idealCloser. plug_n)
  connect(idealCloser.plug_n,idealCommutingSwitch. plug_n2)
  connect(terminalBox.plug_sn, imc.plug_sn)
end IMC_Transformer;


Induction machine with squirrel cage and losses.

within Modelica.Magnetic.QuasiStatic.FundamentalWave.Examples.BasicMachines.InductionMachines;
model IMC_withLosses "Induction machine with squirrel cage and losses"
  extends Modelica.Icons.Example;
  import Modelica.Constants.pi;
  import Modelica.Units.Conversions.from_rpm;
  import Modelica.Units.Conversions.to_rpm;
  import Modelica.Units.Conversions.from_degC;
  constant Integer m=3 "Number of phases";
  parameter SI.Power PNominal=18500 "Nominal output";
  parameter SI.Voltage VNominal=400 "Nominal RMS voltage";
  parameter SI.Current INominal=32.85 "Nominal RMS current";
  parameter Real pfNominal=0.898 "Nominal power factor";
  parameter SI.Power PsNominal=sqrt(3)*VNominal*INominal*pfNominal "Nominal stator power";
  parameter SI.Power lossNominal=PsNominal-PNominal "Nominal losses";
  parameter Real etaNominal=0.9049 "Nominal efficiency";
  parameter SI.Frequency fNominal=50 "Nominal frequency";
  parameter SI.AngularVelocity wNominal=from_rpm(1462.5)
    "Nominal speed";
  parameter SI.Torque TNominal=PNominal/wNominal
    "Nominal torque";
  parameter SI.Temperature TempNominal=from_degC(90)
    "Nominal temperature";
  SI.Power PelQS=electricalPowerSensorQS.apparentPower.re;
  SI.ReactivePower QelQS=electricalPowerSensorQS.apparentPower.im;
  SI.ApparentPower SelQS=sqrt(PelQS^2 + QelQS^2);
protected
  parameter Real Ptable[:]={1E-6,1845,3549,5325,7521,9372,11010,12930,
      14950,16360,18500,18560,20180,22170} "Table of measured power data";
  parameter Real Itable[:]={11.0,11.20,12.27,13.87,16.41,18.78,21.07,
      23.92,27.05,29.40,32.85,32.95,35.92,39.35} "Table of measured current data";
  parameter Real wtable[:]=from_rpm({1500,1496,1493,1490,1486,1482,1479,1475,1471,
      1467,1462,1462,1458,1453}) "Table of measured speed data";
  parameter Real ctable[:]={0.085,0.327,0.506,0.636,0.741,0.797,0.831,
      0.857,0.875,0.887,0.896,0.896,0.902,0.906} "Table of measured power factor data";
  parameter Real etable[:]={0,0.7250,0.8268,0.8698,0.8929,0.9028,0.9064,
      0.9088,0.9089,0.9070,0.9044,0.9043,0.9008,0.8972} "Table of measured efficiency data";
public
  output SI.Power PmechQS=powerSensorQS.power "Mechanical output";
  output SI.Power Ps_simQS=sqrt(3)*VNominal*I_simQS*pf_simQS "Simulated stator power";
  output SI.Power Ps_measQS=sqrt(3)*VNominal*I_measQS*pf_measQS "Simulated stator power";
  output SI.Power loss_simQS=Ps_simQS-PmechQS "Simulated total losses";
  output SI.Power loss_measQS=Ps_measQS-PmechQS "Measured total losses";
  output SI.Current I_simQS=currentQuasiRMSSensorQS.I "Simulated current";
  output SI.Current I_measQS=combiTable1DsQS.y[1] "Measured current";
  output SI.AngularVelocity w_simQS(displayUnit="rev/min") = imcQS.wMechanical "Simulated speed";
  output SI.AngularVelocity w_measQS(displayUnit="rev/min")=combiTable1DsQS.y[2] "Measured speed";
  output Real pf_simQS=if noEvent(SelQS > Modelica.Constants.small) then PelQS/SelQS else 0 "Simulated power factor";
  output Real pf_measQS=combiTable1DsQS.y[3] "Measured power factor";
  output Real eff_simQS=if noEvent(abs(PelQS) > Modelica.Constants.small) then PmechQS/PelQS else 0 "Simulated efficiency";
  output Real eff_measQS=combiTable1DsQS.y[4] "Measured efficiency";

  Magnetic.QuasiStatic.FundamentalWave.BasicMachines.InductionMachines.IM_SquirrelCage
    imcQS(
    p=imcData.p,
    fsNominal=imcData.fsNominal,
    TsRef=imcData.TsRef,
    alpha20s(displayUnit="1/K") = imcData.alpha20s,
    Jr=imcData.Jr,
    Js=imcData.Js,
    frictionParameters=imcData.frictionParameters,
    statorCoreParameters=imcData.statorCoreParameters,
    strayLoadParameters=imcData.strayLoadParameters,
    TrRef=imcData.TrRef,
    TsOperational=TempNominal,
    TrOperational=TempNominal,
    wMechanical(fixed=true, start=2*pi*imcData.fsNominal/imcData.p),
    gammar(fixed=true, start=pi/2),
    gamma(fixed=true, start=-pi/2),
    Rs=imcData.Rs*m/3,
    Lssigma=imcData.Lssigma*m/3,
    Lm=imcData.Lm*m/3,
    Lrsigma=imcData.Lrsigma*m/3,
    Rr=imcData.Rr*m/3,
    m=m,
    effectiveStatorTurns=imcData.effectiveStatorTurns,
    alpha20r=imcData.alpha20r)
  Utilities.MultiTerminalBox terminalBoxQS(terminalConnection="D", m=m)
  Modelica.Electrical.QuasiStatic.Polyphase.Sensors.PowerSensor electricalPowerSensorQS(m=m)
  Modelica.Electrical.QuasiStatic.Polyphase.Sensors.CurrentQuasiRMSSensor currentQuasiRMSSensorQS(m=m)
  Modelica.Electrical.QuasiStatic.Polyphase.Sources.VoltageSource sineVoltageQS(
    final m=m,
    f=fNominal,
    V=fill(VNominal/sqrt(3), m))
  Modelica.Electrical.QuasiStatic.Polyphase.Basic.Star starQS(final m=m)
  Modelica.Electrical.QuasiStatic.SinglePhase.Basic.Ground groundQS
  Modelica.Mechanics.Rotational.Sensors.PowerSensor powerSensorQS
  Modelica.Mechanics.Rotational.Components.Inertia loadInertiaQS(J=imcData.Jr)
  Modelica.Mechanics.Rotational.Sources.Torque torqueQS
  Modelica.Blocks.Math.Gain gainQS(k=-1)
  Modelica.Blocks.Continuous.PI PIQS(
    k=0.01,
    T=0.01,
    initType=Modelica.Blocks.Types.Init.InitialState)
  Modelica.Blocks.Math.Feedback feedbackQS
  Modelica.Blocks.Sources.Ramp rampQS(
    height=1.2*PNominal,
    offset=0,
    startTime=4.5,
    duration=5.5)
  Modelica.Blocks.Tables.CombiTable1Ds combiTable1DsQS(table={{Ptable[j],Itable[j],wtable[j],ctable[j],etable[j]} for j in 1:size(Ptable, 1)}, smoothness=Modelica.Blocks.Types.Smoothness.ContinuousDerivative)
  parameter
    Modelica.Electrical.Machines.Utilities.ParameterRecords.IM_SquirrelCageData
    imcData(
    statorCoreParameters(PRef=410, VRef=387.9),
    Jr=0.12,
    Rs=0.56,
    alpha20s(displayUnit="1/K") = Modelica.Electrical.Machines.Thermal.Constants.alpha20Copper,
    Lssigma=1.52/(2*pi*fNominal),
    frictionParameters(PRef=180, wRef=wNominal),
    strayLoadParameters(
      PRef=0.005*sqrt(3)*VNominal*INominal*pfNominal,
      IRef=INominal/sqrt(3),
      wRef=wNominal),
    Lm=66.4/(2*pi*fNominal),
    Lrsigma=2.31/(2*pi*fNominal),
    Rr=0.42,
    alpha20r(displayUnit="1/K") = Modelica.Electrical.Machines.Thermal.Constants.alpha20Aluminium)
    "Induction machine data"

equation
  connect(starQS.pin_n, groundQS.pin)
  connect(sineVoltageQS.plug_n, starQS.plug_p)
  connect(terminalBoxQS.plug_sn, imcQS.plug_sn)
  connect(terminalBoxQS.plug_sp, imcQS.plug_sp)

  connect(imcQS.flange, powerSensorQS.flange_a)
  connect(powerSensorQS.flange_b, loadInertiaQS.flange_a)
  connect(torqueQS.flange, loadInertiaQS.flange_b)
  connect(sineVoltageQS.plug_p, currentQuasiRMSSensorQS.plug_p)
  connect(PIQS.y, gainQS.u)
  connect(currentQuasiRMSSensorQS.plug_n, electricalPowerSensorQS.currentP)
  connect(electricalPowerSensorQS.currentN, terminalBoxQS.plugSupply)
  connect(electricalPowerSensorQS.currentP, electricalPowerSensorQS.voltageP)
  connect(electricalPowerSensorQS.voltageN, starQS.plug_p)
  connect(powerSensorQS.power, combiTable1DsQS.u)
  connect(powerSensorQS.power, feedbackQS.u2)
  connect(gainQS.y, torqueQS.tau)
  connect(rampQS.y, feedbackQS.u1)
  connect(feedbackQS.y, PIQS.u)
end IMC_withLosses;


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

within Modelica.Magnetic.QuasiStatic.FundamentalWave.Examples.BasicMachines.InductionMachines;
model IMC_YD "Induction machine with squirrel cage starting Y-D"
  import Modelica.Constants.pi;
  extends Modelica.Icons.Example;
  constant Integer m=3 "Number of phases";
  parameter SI.Voltage VNominal=100
    "Nominal RMS voltage per phase";
  parameter SI.Frequency fNominal=imc.fsNominal "Nominal frequency";
  parameter SI.Time tStart1=0.1 "Start time";
  parameter SI.Time tStart2=2.0 "Start time from Y to D";
  parameter SI.Torque TLoad=161.4 "Nominal load torque";
  parameter SI.AngularVelocity wLoad(displayUnit="rev/min")=
       1440.45*2*Modelica.Constants.pi/60 "Nominal load speed";
  parameter SI.Inertia JLoad=0.29
    "Load's moment of inertia";
  Magnetic.QuasiStatic.FundamentalWave.BasicMachines.InductionMachines.IM_SquirrelCage
    imcQS(
    p=imcData.p,
    fsNominal=imcData.fsNominal,
    TsRef=imcData.TsRef,
    alpha20s(displayUnit="1/K") = imcData.alpha20s,
    Jr=imcData.Jr,
    Js=imcData.Js,
    frictionParameters=imcData.frictionParameters,
    wMechanical(fixed=true),
    gammar(fixed=true, start=pi/2),
    gamma(fixed=true, start=-pi/2),
    statorCoreParameters=imcData.statorCoreParameters,
    strayLoadParameters=imcData.strayLoadParameters,
    Lrsigma=imcData.Lrsigma,
    TrRef=imcData.TrRef,
    Rs=imcData.Rs*m/3,
    Lssigma=imcData.Lssigma*m/3,
    Lm=imcData.Lm*m/3,
    Rr=imcData.Rr*m/3,
    m=m,
    TsOperational=293.15,
    effectiveStatorTurns=imcData.effectiveStatorTurns,
    alpha20r=imcData.alpha20r,
    TrOperational=293.15)
  Modelica.Electrical.QuasiStatic.Polyphase.Sensors.CurrentQuasiRMSSensor currentQuasiRMSSensorQS(m=m)
  Modelica.Electrical.QuasiStatic.Polyphase.Sources.VoltageSource sineVoltageQS(
    final m=m,
    f=fNominal,
    V=fill(VNominal/sqrt(3), m))
  Modelica.Electrical.QuasiStatic.Polyphase.Basic.Star starQS(final m=m)
  Modelica.Electrical.QuasiStatic.SinglePhase.Basic.Ground groundQS
  Modelica.Blocks.Sources.BooleanStep booleanStepQS[m](each startTime=tStart1)
  Modelica.Electrical.QuasiStatic.Polyphase.Ideal.IdealClosingSwitch idealCloserQS(
    final m=m,
    Ron=fill(1e-5, m),
    Goff=fill(1e-5, m))
  Magnetic.QuasiStatic.FundamentalWave.Utilities.SwitchYD switchYDQS(final m=m)
  Modelica.Blocks.Sources.BooleanStep booleanStepYDQS[m](each startTime=tStart2)
  Modelica.Mechanics.Rotational.Components.Inertia loadInertiaQS(J=JLoad)
  Modelica.Mechanics.Rotational.Sources.QuadraticSpeedDependentTorque quadraticLoadTorqueQS(
    w_nominal=wLoad,
    TorqueDirection=false,
    tau_nominal=-TLoad,
    useSupport=false)
  parameter
    Modelica.Electrical.Machines.Utilities.ParameterRecords.IM_SquirrelCageData
    imcData "Induction machine data"

  Magnetic.FundamentalWave.BasicMachines.InductionMachines.IM_SquirrelCage imc(
    p=imcData.p,
    fsNominal=imcData.fsNominal,
    TsRef=imcData.TsRef,
    alpha20s(displayUnit="1/K") = imcData.alpha20s,
    Jr=imcData.Jr,
    Js=imcData.Js,
    frictionParameters=imcData.frictionParameters,
    phiMechanical(fixed=true),
    wMechanical(fixed=true),
    statorCoreParameters=imcData.statorCoreParameters,
    strayLoadParameters=imcData.strayLoadParameters,
    TrRef=imcData.TrRef,
    Rs=imcData.Rs*m/3,
    Lssigma=imcData.Lssigma*m/3,
    Lszero=imcData.Lszero*m/3,
    Lm=imcData.Lm*m/3,
    Lrsigma=imcData.Lrsigma*m/3,
    Rr=imcData.Rr*m/3,
    m=m,
    TsOperational=293.15,
    effectiveStatorTurns=imcData.effectiveStatorTurns,
    alpha20r=imcData.alpha20r,
    TrOperational=293.15)
  Modelica.Electrical.Machines.Sensors.CurrentQuasiRMSSensor
                                                    currentQuasiRMSSensor
  Modelica.Electrical.Polyphase.Sources.SineVoltage sineVoltage(
    final m=m,
    f=fill(fNominal, m),
    V=fill(sqrt(2/3)*VNominal, m))
  Modelica.Electrical.Polyphase.Basic.Star star(final m=m)
  Modelica.Electrical.Analog.Basic.Ground ground
  Modelica.Blocks.Sources.BooleanStep booleanStep[m](each startTime=
        tStart1)
  Modelica.Electrical.Polyphase.Ideal.IdealClosingSwitch idealCloser(
    final m=m,
    Ron=fill(1e-5, m),
    Goff=fill(1e-5, m))
  Modelica.Electrical.Machines.Utilities.SwitchYD
                                         switchYD(m=m)
  Modelica.Blocks.Sources.BooleanStep booleanStepYD[m](each startTime=
        tStart2)
  Modelica.Mechanics.Rotational.Components.Inertia loadInertia(J=JLoad)
  Modelica.Mechanics.Rotational.Sources.QuadraticSpeedDependentTorque
    quadraticLoadTorque(
    w_nominal=wLoad,
    TorqueDirection=false,
    tau_nominal=-TLoad,
    useSupport=false)
initial equation
  sum(imc.is) = 0;
  imc.is[1:2] = zeros(2);
  imc.rotorCage.electroMagneticConverter.V_m = Complex(0, 0);
equation
  connect(starQS.pin_n, groundQS.pin)
  connect(sineVoltageQS.plug_n, starQS.plug_p)
  connect(sineVoltageQS.plug_p, idealCloserQS.plug_p)
  connect(loadInertiaQS.flange_b, quadraticLoadTorqueQS.flange)
  connect(booleanStepQS.y, idealCloserQS.control)
  connect(booleanStepYDQS.y, switchYDQS.control)
  connect(idealCloserQS.plug_n, currentQuasiRMSSensorQS.plug_p)
  connect(switchYDQS.plug_sn, imcQS.plug_sn)
  connect(switchYDQS.plug_sp, imcQS.plug_sp)
  connect(switchYDQS.plugSupply, currentQuasiRMSSensorQS.plug_n)
  connect(imcQS.flange, loadInertiaQS.flange_a)
  connect(star.pin_n,ground. p)
  connect(sineVoltage.plug_n,star. plug_p)
  connect(sineVoltage.plug_p,idealCloser. plug_p)
  connect(loadInertia.flange_b,quadraticLoadTorque. flange)
  connect(booleanStep.y,idealCloser. control)
  connect(booleanStepYD.y,switchYD. control)
  connect(idealCloser.plug_n,currentQuasiRMSSensor. plug_p)
  connect(switchYD.plug_sn, imc.plug_sn)
  connect(switchYD.plug_sp, imc.plug_sp)
  connect(switchYD.plugSupply,currentQuasiRMSSensor. plug_n)
  connect(imc.flange, loadInertia.flange_a)
end IMC_YD;


Characteristic curves of induction machine with slip rings. This examples allows the investigation of characteristic curves of quasi-static polyphase induction machines with slip ring rotor
as a function of rotor speed.

within Modelica.Magnetic.QuasiStatic.FundamentalWave.Examples.BasicMachines.InductionMachines;
model IMS_Characteristics "Characteristic curves of induction machine with slip rings"
  extends Modelica.Icons.Example;
  import Modelica.Constants.pi;
  parameter Integer m=3 "Number of stator phases"
  parameter Integer mr=3 "Number of rotor phases"
  parameter SI.Voltage VsNominal=100
    "Nominal RMS voltage per phase";
  parameter SI.Frequency fNominal=imsData.fsNominal "Nominal frequency";
  parameter SI.Resistance Rr=0.16/imsData.turnsRatio^2 "Starting resistance";
  parameter Integer p=imsData.p "Number of pole pairs";
  parameter SI.AngularVelocity w_Load(displayUnit="rev/min")=
       Modelica.Units.Conversions.from_rpm(1440.45)
    "Nominal load speed";
  Real speedPerUnit = p*imsQS.wMechanical/(2*pi*fNominal) "Per unit speed";
  Real slip = 1-speedPerUnit "Slip";
  output SI.Current Iqs=iSensorQS.I "QS RMS current";
  Utilities.MultiTerminalBox terminalBoxQS(m=m, terminalConnection="Y")
  FundamentalWave.BasicMachines.InductionMachines.IM_SlipRing imsQS(
    p=imsData.p,
    fsNominal=imsData.fsNominal,
    TsRef=imsData.TsRef,
    alpha20s(displayUnit="1/K") = imsData.alpha20s,
    Jr=imsData.Jr,
    Js=imsData.Js,
    frictionParameters=imsData.frictionParameters,
    statorCoreParameters=imsData.statorCoreParameters,
    strayLoadParameters=imsData.strayLoadParameters,
    TrRef=imsData.TrRef,
    alpha20r(displayUnit="1/K") = imsData.alpha20r,
    useTurnsRatio=imsData.useTurnsRatio,
    VsNominal=imsData.VsNominal,
    VrLockedRotor=imsData.VrLockedRotor,
    rotorCoreParameters=imsData.rotorCoreParameters,
    Rs=imsData.Rs*m/3,
    Lssigma=imsData.Lssigma*m/3,
    Lm=imsData.Lm*m/3,
    gammar(fixed=true, start=pi/2),
    TurnsRatio=imsData.turnsRatio,
    Lrsigma=imsData.Lrsigma*mr/3,
    Rr=imsData.Rr*mr/3,
    mr=mr,
    m=m,
    TsOperational=566.3,
    effectiveStatorTurns=imsData.effectiveStatorTurns,
    TrOperational=566.3)
  parameter
    Modelica.Electrical.Machines.Utilities.ParameterRecords.IM_SlipRingData
    imsData "Induction machine data"
  Modelica.Electrical.QuasiStatic.Polyphase.Sources.VoltageSource vSourceQS(
    m=m,
    phi=-Modelica.Electrical.Polyphase.Functions.symmetricOrientation(m),
    f=fNominal,
    V=fill(VsNominal, m))
  Modelica.Electrical.QuasiStatic.Polyphase.Basic.Star starQS(m=m)
  Modelica.Electrical.QuasiStatic.SinglePhase.Basic.Ground groundQS
  Modelica.Electrical.QuasiStatic.Polyphase.Sensors.PowerSensor pSensorQS(m=m)
  Modelica.Electrical.QuasiStatic.Polyphase.Sensors.CurrentQuasiRMSSensor iSensorQS(m=m)
  Modelica.Electrical.QuasiStatic.Polyphase.Basic.Star
    starMachineQS(m=
        Modelica.Electrical.Polyphase.Functions.numberOfSymmetricBaseSystems(
                                                                    m))
  Modelica.Electrical.QuasiStatic.SinglePhase.Basic.Ground
    groundMachineQS

  Modelica.Mechanics.Rotational.Sources.Speed speed(exact=true)
  Modelica.Blocks.Sources.Ramp ramp(
    height=3*2*pi*fNominal/p,
    duration=1,
    offset=-2*pi*fNominal/p)
  Modelica.Electrical.QuasiStatic.SinglePhase.Basic.Ground groundRotorQS
  Modelica.Electrical.QuasiStatic.Polyphase.Basic.Star starRotorQS(m=mr)
  Modelica.Electrical.QuasiStatic.Polyphase.Basic.Resistor resistor(m=mr, R_ref
      =fill(Rr, mr))
equation
  connect(terminalBoxQS.plug_sn, imsQS.plug_sn)
  connect(terminalBoxQS.plug_sp, imsQS.plug_sp)
  connect(groundQS.pin, starQS.pin_n)
  connect(starQS.plug_p, vSourceQS.plug_n)
  connect(pSensorQS.currentN, iSensorQS.plug_p)
  connect(pSensorQS.voltageP, pSensorQS.currentP)
  connect(pSensorQS.voltageN, starQS.plug_p)
  connect(iSensorQS.plug_n, terminalBoxQS.plugSupply)
  connect(starMachineQS.pin_n, groundMachineQS.pin)
  connect(starMachineQS.plug_p, terminalBoxQS.starpoint)
  connect(vSourceQS.plug_p, pSensorQS.currentP)
  connect(ramp.y,speed. w_ref)
  connect(imsQS.flange, speed.flange)
  connect(starRotorQS.pin_n, groundRotorQS.pin)
  connect(resistor.plug_n, imsQS.plug_rn)
  connect(imsQS.plug_rp, resistor.plug_p)
  connect(starRotorQS.plug_p, resistor.plug_n)
end IMS_Characteristics;


Starting of induction machine with slip rings. This example compares a time transient and a quasi-static model of a polyphase induction machine.
At start time tOn a transient and a quasi-static polyphase voltage source are connected to 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.QuasiStatic.FundamentalWave.Examples.BasicMachines.InductionMachines;
model IMS_Start "Starting of induction machine with slip rings"
  extends Modelica.Icons.Example;
  import Modelica.Constants.pi;
  parameter Integer m=3 "Number of stator phases"
  parameter Integer mr=3 "Number of rotor phases"
  parameter SI.Voltage VsNominal=100
    "Nominal RMS voltage per phase";
  parameter SI.Frequency fNominal=ims.fsNominal "Nominal frequency";
  parameter SI.Time tOn=0.1 "Start time of machine";
  parameter SI.Resistance RStart=0.16/imsData.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";
  output SI.Current Itr=currentQuasiRMSSensor.I
    "Transient RMS current";
  output SI.Current Iqs=currentQuasiRMSSensorQS.I
    "QS RMS current";
  Modelica.Electrical.Analog.Basic.Ground ground
  Modelica.Electrical.Polyphase.Basic.Star star(final m=m)
  Modelica.Electrical.Polyphase.Sources.SineVoltage sineVoltage(
    final m=m,
    f=fill(fNominal, m),
    V=fill(sqrt(2.0)*VsNominal, m))
  Modelica.Electrical.Polyphase.Ideal.IdealClosingSwitch idealCloser(
    final m=m,
    Ron=fill(1e-5*m/3, m),
    Goff=fill(1e-5*3/m, m))
  Modelica.Blocks.Sources.BooleanStep booleanStep[m](each startTime=tOn)
  Modelica.Electrical.Polyphase.Sensors.CurrentQuasiRMSSensor currentQuasiRMSSensor(m=m)
  Modelica.Electrical.Machines.Utilities.MultiTerminalBox terminalBoxM(m=m,
      terminalConnection="Y")
  Utilities.MultiTerminalBox terminalBoxQS(m=m, terminalConnection="Y")
  Magnetic.FundamentalWave.BasicMachines.InductionMachines.IM_SlipRing ims(
    Jr=imsData.Jr,
    Js=imsData.Js,
    p=imsData.p,
    fsNominal=imsData.fsNominal,
    TsRef=imsData.TsRef,
    alpha20s(displayUnit="1/K") = imsData.alpha20s,
    frictionParameters=imsData.frictionParameters,
    statorCoreParameters=imsData.statorCoreParameters,
    strayLoadParameters=imsData.strayLoadParameters,
    phiMechanical(fixed=true),
    wMechanical(fixed=true),
    TrRef=imsData.TrRef,
    alpha20r(displayUnit="1/K") = imsData.alpha20r,
    useTurnsRatio=imsData.useTurnsRatio,
    VsNominal=imsData.VsNominal,
    VrLockedRotor=imsData.VrLockedRotor,
    rotorCoreParameters=imsData.rotorCoreParameters,
    TurnsRatio=imsData.turnsRatio,
    Rs=imsData.Rs*m/3,
    Lssigma=imsData.Lssigma*m/3,
    Lszero=imsData.Lszero*m/3,
    Lm=imsData.Lm*m/3,
    Lrsigma=imsData.Lrsigma*mr/3,
    Lrzero=imsData.Lrzero*mr/3,
    Rr=imsData.Rr*mr/3,
    mr=mr,
    m=m,
    TsOperational=293.15,
    effectiveStatorTurns=imsData.effectiveStatorTurns,
    TrOperational=293.15)
  FundamentalWave.BasicMachines.InductionMachines.IM_SlipRing imsQS(
    p=imsData.p,
    fsNominal=imsData.fsNominal,
    TsRef=imsData.TsRef,
    alpha20s(displayUnit="1/K") = imsData.alpha20s,
    Jr=imsData.Jr,
    Js=imsData.Js,
    frictionParameters=imsData.frictionParameters,
    statorCoreParameters=imsData.statorCoreParameters,
    strayLoadParameters=imsData.strayLoadParameters,
    TrRef=imsData.TrRef,
    alpha20r(displayUnit="1/K") = imsData.alpha20r,
    useTurnsRatio=imsData.useTurnsRatio,
    VsNominal=imsData.VsNominal,
    VrLockedRotor=imsData.VrLockedRotor,
    rotorCoreParameters=imsData.rotorCoreParameters,
    Rs=imsData.Rs*m/3,
    Lssigma=imsData.Lssigma*m/3,
    Lm=imsData.Lm*m/3,
    gammar(fixed=true, start=pi/2),
    gamma(fixed=true, start=-pi/2),
    wMechanical(fixed=true),
    TurnsRatio=imsData.turnsRatio,
    Lrsigma=imsData.Lrsigma*mr/3,
    Rr=imsData.Rr*mr/3,
    mr=mr,
    m=m,
    TsOperational=566.3,
    effectiveStatorTurns=imsData.effectiveStatorTurns,
    TrOperational=566.3)
  Modelica.Electrical.Machines.Utilities.SwitchedRheostat rheostatM(
    tStart=tRheostat,
    m=mr,
    RStart=RStart*mr/3)
  FundamentalWave.Utilities.SwitchedRheostat rheostatQS(
    tStart=tRheostat,
    RStart=RStart*mr/3,
    m=mr)
  Modelica.Mechanics.Rotational.Components.Inertia loadInertia(J=J_Load)
  Modelica.Mechanics.Rotational.Components.Inertia loadInertiaQS(J=J_Load)
  Modelica.Mechanics.Rotational.Sources.QuadraticSpeedDependentTorque
    quadraticLoadTorque(
    tau_nominal=-T_Load,
    TorqueDirection=false,
    useSupport=false,
    w_nominal=w_Load)
  Modelica.Mechanics.Rotational.Sources.QuadraticSpeedDependentTorque quadraticLoadTorqueQS(
    tau_nominal=-T_Load,
    TorqueDirection=false,
    useSupport=false,
    w_nominal=w_Load)
  parameter
    Modelica.Electrical.Machines.Utilities.ParameterRecords.IM_SlipRingData
    imsData "Induction machine data"
  Modelica.Electrical.QuasiStatic.Polyphase.Sources.VoltageSource
    voltageSourceQS(
    m=m,
    phi=-Modelica.Electrical.Polyphase.Functions.symmetricOrientation(
        m),
    f=fNominal,
    V=fill(VsNominal, m))
  Modelica.Electrical.QuasiStatic.Polyphase.Basic.Star starQS(m=m)
  Modelica.Electrical.QuasiStatic.SinglePhase.Basic.Ground groundQS
  Modelica.Electrical.QuasiStatic.Polyphase.Sensors.PowerSensor
    powerSensorQS(m=m)
  Modelica.Electrical.QuasiStatic.Polyphase.Sensors.CurrentQuasiRMSSensor currentQuasiRMSSensorQS(m=m)
  Modelica.Electrical.QuasiStatic.Polyphase.Ideal.IdealClosingSwitch
    idealCloserQS(
    final m=m,
    Ron=fill(1e-5*m/3, m),
    Goff=fill(1e-5*3/m, m))
  Modelica.Blocks.Sources.BooleanStep booleanStepQS[m](each startTime=
        tOn, each startValue=false)
  Modelica.Electrical.Polyphase.Sensors.PowerSensor powerSensor(m=m)
  Modelica.Electrical.QuasiStatic.Polyphase.Basic.Star
    starMachineQS(m=
        Modelica.Electrical.Polyphase.Functions.numberOfSymmetricBaseSystems(
                                                                    m))
  Modelica.Electrical.QuasiStatic.SinglePhase.Basic.Ground
    groundMachineQS
  Modelica.Electrical.Polyphase.Basic.Star starMachine(final m=
        Modelica.Electrical.Polyphase.Functions.numberOfSymmetricBaseSystems(m))
  Modelica.Electrical.Analog.Basic.Ground groundMachine
initial equation
  sum(ims.is) = 0;
  ims.is[1:2] = zeros(2);
  sum(ims.ir) = 0;
  ims.ir[1:2] = zeros(2);

equation
  connect(star.pin_n, ground.p)
  connect(sineVoltage.plug_n, star.plug_p)
  connect(loadInertiaQS.flange_b, quadraticLoadTorqueQS.flange)
  connect(imsQS.flange, loadInertiaQS.flange_a)
  connect(booleanStep.y, idealCloser.control)
  connect(terminalBoxQS.plug_sn, imsQS.plug_sn)
  connect(terminalBoxQS.plug_sp, imsQS.plug_sp)
  connect(loadInertia.flange_b, quadraticLoadTorque.flange)
  connect(ims.flange, loadInertia.flange_a)
  connect(terminalBoxM.plug_sp, ims.plug_sp)
  connect(terminalBoxM.plug_sn, ims.plug_sn)
  connect(currentQuasiRMSSensor.plug_n, terminalBoxM.plugSupply)
  connect(rheostatM.plug_p, ims.plug_rp)
  connect(rheostatM.plug_n, ims.plug_rn)
  connect(idealCloser.plug_p, sineVoltage.plug_p)
  connect(imsQS.plug_rp, rheostatQS.plug_p)
  connect(rheostatQS.plug_n, imsQS.plug_rn)
  connect(groundQS.pin, starQS.pin_n)
  connect(starQS.plug_p, voltageSourceQS.plug_n)
  connect(powerSensorQS.currentN, currentQuasiRMSSensorQS.plug_p)
  connect(powerSensorQS.voltageP, powerSensorQS.currentP)
  connect(powerSensorQS.voltageN, starQS.plug_p)
  connect(booleanStepQS.y, idealCloserQS.control)
  connect(idealCloserQS.plug_p, voltageSourceQS.plug_p)
  connect(idealCloserQS.plug_n, powerSensorQS.currentP)
  connect(idealCloser.plug_n, powerSensor.pc)
  connect(powerSensor.pc, powerSensor.pv)
  connect(powerSensor.nv, star.plug_p)
  connect(powerSensor.nc, currentQuasiRMSSensor.plug_p)
  connect(currentQuasiRMSSensorQS.plug_n, terminalBoxQS.plugSupply)
  connect(starMachineQS.pin_n, groundMachineQS.pin)
  connect(starMachineQS.plug_p, terminalBoxQS.starpoint)
  connect(groundMachine.p,starMachine. pin_n)
  connect(terminalBoxM.starpoint, starMachine.plug_p)
end IMS_Start;


Induction machine examples

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


Synchronous machine examples

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


Electrical excited synchronous machine operating as generator. This example compares a time transient and a quasi-static model of a electrically excited synchronous machine.
The electrically excited synchronous generators are connected to the grid and driven with constant speed.
Since speed is slightly smaller than synchronous speed corresponding to mains frequency,
rotor angle is very slowly increased. This allows to see several characteristics dependent on rotor angle.

within Modelica.Magnetic.QuasiStatic.FundamentalWave.Examples.BasicMachines.SynchronousMachines;
model SMEE_Generator
  "Electrical excited synchronous machine operating as generator"
  extends Modelica.Icons.Example;
  import Modelica.Constants.pi;
  parameter 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";
  SI.Angle thetaQS=rotorAngleQS.rotorDisplacementAngle "Rotor displacement angle, quasi-static";
  SI.Angle theta=rotorAngle.rotorDisplacementAngle "Rotor displacement angle, transient";

  output SI.Power Ptr=powerSensor.power "Transient power";
  output SI.Power Pqs=powerSensorQS.apparentPower.re "QS power";
  Modelica.Electrical.Polyphase.Basic.Star star(final m=m)
  Modelica.Electrical.Analog.Basic.Ground grounde
  Modelica.Electrical.Polyphase.Sources.SineVoltage sineVoltage(
    final m=m,
    final V=fill(VsNominal*sqrt(2), m),
    final f=fill(fsNominal, m))
  Modelica.Electrical.Polyphase.Sensors.PowerSensor powerSensor(m=m)
  Modelica.Electrical.Machines.Utilities.MultiTerminalBox terminalBoxM(
      terminalConnection="Y", m=m)
  Magnetic.FundamentalWave.BasicMachines.SynchronousMachines.SM_ElectricalExcited
    smee(
    phiMechanical(start=-(Modelica.Constants.pi + gamma0)/smee.p, fixed=true),
    Jr=0.29,
    Js=0.29,
    p=2,
    fsNominal=smeeData.fsNominal,
    TsRef=smeeData.TsRef,
    alpha20s(displayUnit="1/K") = smeeData.alpha20s,
    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,
    statorCoreParameters(VRef=100),
    strayLoadParameters(IRef=100),
    brushParameters(ILinear=0.01),
    ir(each fixed=true),
    useDamperCage=false,
    m=m,
    frictionParameters(PRef=0),
    Rs=smeeData.Rs*m/3,
    Lssigma=smeeData.Lssigma*m/3,
    Lmd=smeeData.Lmd*m/3,
    Lmq=smeeData.Lmq*m/3,
    effectiveStatorTurns=smeeData.effectiveStatorTurns,
    TsOperational=293.15,
    TrOperational=293.15,
    TeOperational=293.15,
    sigmae=smeeData.sigmae*m/3)
  FundamentalWave.BasicMachines.SynchronousMachines.SM_ElectricalExcited
    smeeQS(
    p=2,
    fsNominal=smeeData.fsNominal,
    TsRef=smeeData.TsRef,
    alpha20s(displayUnit="1/K") = smeeData.alpha20s,
    Jr=0.29,
    Js=0.29,
    frictionParameters(PRef=0),
    statorCoreParameters(PRef=0, VRef=100),
    strayLoadParameters(PRef=0, IRef=100),
    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,
    brushParameters(V=0, ILinear=0.01),
    Lrsigmaq=smeeData.Lrsigmaq,
    TrRef=smeeData.TrRef,
    useDamperCage=false,
    m=m,
    gammar(fixed=true, start=pi/2),
    gamma(fixed=true, start=-pi/2),
    Rs=smeeData.Rs*m/3,
    Lssigma=smeeData.Lssigma*m/3,
    Lmd=smeeData.Lmd*m/3,
    Lmq=smeeData.Lmq*m/3,
    TsOperational=293.15,
    effectiveStatorTurns=smeeData.effectiveStatorTurns,
    TrOperational=293.15,
    TeOperational=293.15)
  Modelica.Electrical.Analog.Basic.Ground groundr
  Modelica.Electrical.Analog.Basic.Ground groundrQS
  Modelica.Electrical.Analog.Sources.RampCurrent rampCurrent(
    duration=0.1,
    I=Ie - Ie0,
    offset=Ie0)
  Modelica.Electrical.Analog.Sources.RampCurrent rampCurrentQS(
    duration=0.1,
    I=Ie - Ie0,
    offset=Ie0)
  Modelica.Electrical.Machines.Sensors.MechanicalPowerSensor
    mechanicalPowerSensor
  Modelica.Electrical.Machines.Sensors.MechanicalPowerSensor
    mechanicalPowerSensorQS
  Modelica.Mechanics.Rotational.Sources.ConstantSpeed constantSpeed(
      final w_fixed=w, useSupport=false)
  Modelica.Mechanics.Rotational.Sources.ConstantSpeed constantSpeedQS(
      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,
    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,
    xq=1.1,
    TsSpecification=293.15,
    TsRef=293.15,
    TrSpecification=293.15,
    TrRef=293.15,
    TeSpecification=293.15,
    TeRef=293.15) "Synchronous machine data"

  Modelica.Electrical.QuasiStatic.Polyphase.Sources.VoltageSource
    voltageSourceQS(
    m=m,
    phi=-Modelica.Electrical.Polyphase.Functions.symmetricOrientation(
        m),
    V=fill(VsNominal, m),
    f=fsNominal)
  Modelica.Electrical.QuasiStatic.Polyphase.Basic.Star starQS(m=m)
  Modelica.Electrical.QuasiStatic.SinglePhase.Basic.Ground
    groundeQS
  Modelica.Electrical.QuasiStatic.Polyphase.Sensors.PowerSensor
    powerSensorQS(m=m)
  Utilities.MultiTerminalBox terminalBoxQS(m=m, terminalConnection="Y")
  Modelica.Electrical.QuasiStatic.Polyphase.Basic.Star
    starMachineQS(m=
        Modelica.Electrical.Polyphase.Functions.numberOfSymmetricBaseSystems(
                                                                    m))
  Modelica.Electrical.QuasiStatic.SinglePhase.Basic.Ground
    groundMachineQS
  Modelica.Electrical.Machines.Sensors.RotorDisplacementAngle rotorAngle(m=m, p=
        smee.p)
  Sensors.RotorDisplacementAngle rotorAngleQS(m=m, p=smeeQS.p)
  Modelica.Electrical.Analog.Basic.Ground groundMachine
  Modelica.Electrical.Polyphase.Basic.Star starMachine(final m=
        Modelica.Electrical.Polyphase.Functions.numberOfSymmetricBaseSystems(m))
initial equation
  sum(smee.is) = 0;
  smee.is[1:2] = zeros(2);

equation
  connect(star.pin_n, grounde.p)
  connect(star.plug_p, sineVoltage.plug_n)
  connect(mechanicalPowerSensorQS.flange_b, constantSpeedQS.flange)
  connect(rampCurrentQS.p, groundrQS.p)
  connect(rampCurrentQS.p, smeeQS.pin_en)
  connect(rampCurrentQS.n, smeeQS.pin_ep)
  connect(smee.flange, mechanicalPowerSensor.flange_a)
  connect(mechanicalPowerSensor.flange_b, constantSpeed.flange)
  connect(rampCurrent.p, groundr.p)
  connect(rampCurrent.p, smee.pin_en)
  connect(rampCurrent.n, smee.pin_ep)
  connect(smee.plug_sn, terminalBoxM.plug_sn)
  connect(smee.plug_sp, terminalBoxM.plug_sp)
  connect(groundeQS.pin, starQS.pin_n)
  connect(starQS.plug_p, voltageSourceQS.plug_n)
  connect(voltageSourceQS.plug_p, powerSensorQS.currentP)
  connect(powerSensorQS.voltageP, powerSensorQS.currentP)
  connect(powerSensorQS.voltageN, starQS.plug_p)
  connect(sineVoltage.plug_p, powerSensor.pc)
  connect(powerSensor.pc, powerSensor.pv)
  connect(powerSensor.nv, star.plug_p)
  connect(powerSensor.nc, terminalBoxM.plugSupply)
  connect(terminalBoxQS.plug_sn, smeeQS.plug_sn)
  connect(terminalBoxQS.plug_sp, smeeQS.plug_sp)
  connect(powerSensorQS.currentN, terminalBoxQS.plugSupply)
  connect(starMachineQS.pin_n, groundMachineQS.pin)
  connect(starMachineQS.plug_p, terminalBoxQS.starpoint)
  connect(smee.flange, rotorAngle.flange)
  connect(rotorAngle.plug_p, smee.plug_sp)
  connect(smee.plug_sn, rotorAngle.plug_n)
  connect(terminalBoxQS.plug_sp, rotorAngleQS.plug_p)
  connect(rotorAngleQS.plug_n, terminalBoxQS.plug_sn)
  connect(smeeQS.flange, rotorAngleQS.flange)
  connect(smeeQS.flange, mechanicalPowerSensorQS.flange_a)
  connect(starMachine.pin_n,groundMachine. p)
  connect(starMachine.plug_p, terminalBoxM.starpoint)
end SMEE_Generator;


Test example: PermanentMagnetSynchronousMachine fed by current source. This example compares a time transient and a quasi-static model of a permanent magnet synchronous machine. The machines are fed by a current source. The current components are oriented at the magnetic field orientation and transformed to the stator fixed reference frame. This way the machines are operated at constant torque. The machines start to accelerate from standstill.

within Modelica.Magnetic.QuasiStatic.FundamentalWave.Examples.BasicMachines.SynchronousMachines;
model SMPM_CurrentSource
  "Test example: PermanentMagnetSynchronousMachine fed by current source"
  extends Modelica.Icons.Example;
  import Modelica.Constants.pi;
  parameter Integer m=3 "Number of phases"
  parameter SI.Voltage VNominal=100
    "Nominal RMS voltage per phase";
  parameter SI.Frequency fNominal=smpmData.fsNominal "Nominal frequency";
  parameter SI.Frequency f=50 "Actual frequency";
  parameter SI.Time tRamp=1 "Frequency ramp";
  parameter SI.Torque TLoad=181.4 "Nominal load torque";
  parameter SI.Time tStep=1.2 "Time of load torque step";
  parameter SI.Inertia JLoad=0.29
    "Load's moment of inertia";
  SI.Angle thetaQS=rotorAngleQS.rotorDisplacementAngle "Rotor displacement angle, quasi-static";
  SI.Angle theta=rotorAngle.rotorDisplacementAngle "Rotor displacement angle, transient";

  Magnetic.FundamentalWave.BasicMachines.SynchronousMachines.SM_PermanentMagnet
    smpm(
    p=smpmData.p,
    fsNominal=smpmData.fsNominal,
    Rs=smpmData.Rs,
    TsRef=smpmData.TsRef,
    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,
    permanentMagnetLossParameters=smpmData.permanentMagnetLossParameters,
    m=m,
    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, m=m)
  Modelica.Blocks.Sources.Constant iq(k=84.6*3/m)
  Modelica.Blocks.Sources.Constant id(k=-53.5*3/m)
  Modelica.Electrical.Polyphase.Sensors.VoltageQuasiRMSSensor
    voltageQuasiRMSSensor(m=m)
  Modelica.Electrical.Polyphase.Basic.Star starM(final m=m)
  Modelica.Electrical.Analog.Basic.Ground groundM
  Modelica.Electrical.Machines.Utilities.MultiTerminalBox terminalBox(
      terminalConnection="Y", m=m)
  Modelica.Electrical.Machines.Sensors.RotorDisplacementAngle rotorAngle(m=m, p=smpmData.p)
  Modelica.Mechanics.Rotational.Sensors.AngleSensor angleSensor
  Modelica.Mechanics.Rotational.Components.Inertia inertiaLoad(J=0.29)
  Modelica.Mechanics.Rotational.Sources.QuadraticSpeedDependentTorque
    quadraticSpeedDependentTorque(tau_nominal=-181.4, w_nominal(
        displayUnit="rpm") = 157.07963267949)
  parameter
    Modelica.Electrical.Machines.Utilities.ParameterRecords.SM_PermanentMagnetData
    smpmData(useDamperCage=false) "Synchronous machine data"
  Modelica.Electrical.Polyphase.Sensors.CurrentQuasiRMSSensor currentRMSsensor(m=m)
  Magnetic.QuasiStatic.FundamentalWave.BasicMachines.SynchronousMachines.SM_PermanentMagnet
    smpmQS(
    p=smpmData.p,
    fsNominal=smpmData.fsNominal,
    Rs=smpmData.Rs,
    TsRef=smpmData.TsRef,
    Lssigma=smpmData.Lssigma,
    Jr=smpmData.Jr,
    Js=smpmData.Js,
    frictionParameters=smpmData.frictionParameters,
    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,
    permanentMagnetLossParameters=smpmData.permanentMagnetLossParameters,
    phiMechanical(fixed=true, start=0),
    m=m,
    TsOperational=293.15,
    alpha20s=smpmData.alpha20s,
    effectiveStatorTurns=smpmData.effectiveStatorTurns,
    alpha20r=smpmData.alpha20r,
    TrOperational=293.15)

  Modelica.Mechanics.Rotational.Components.Inertia inertiaLoadQS(J=0.29)
  Modelica.Mechanics.Rotational.Sources.QuadraticSpeedDependentTorque
    quadraticSpeedDependentTorqueQS(tau_nominal=-181.4, w_nominal(
        displayUnit="rpm") = 157.07963267949)
  Modelica.Electrical.QuasiStatic.Polyphase.Basic.Star
    starMachineQS(m=
        Modelica.Electrical.Polyphase.Functions.numberOfSymmetricBaseSystems(
                                                                    m))
  Modelica.Electrical.QuasiStatic.SinglePhase.Basic.Ground
    groundMQS
  Magnetic.QuasiStatic.FundamentalWave.Utilities.MultiTerminalBox terminalBoxQS(
      terminalConnection="Y", m=m)
  Magnetic.QuasiStatic.FundamentalWave.Utilities.CurrentController dqToThreePhaseQS(m=m, p=
        smpmQS.p)
  Modelica.Mechanics.Rotational.Sensors.AngleSensor angleSensorQS
  Modelica.Electrical.QuasiStatic.Polyphase.Sources.ReferenceCurrentSource referenceCurrentSourceQS(m=m)
  Modelica.Electrical.QuasiStatic.Polyphase.Basic.Star starQS(m=m)
  Modelica.Electrical.QuasiStatic.SinglePhase.Basic.Ground
    groundeQS
  Modelica.Electrical.QuasiStatic.Polyphase.Basic.Resistor resistorQS(m=m, R_ref=fill(1e5, m))
  Sensors.RotorDisplacementAngle rotorAngleQS(m=m, p=smpmData.p)
  Modelica.Electrical.QuasiStatic.Polyphase.Sensors.CurrentQuasiRMSSensor currentRMSSensorQS(m=m)
  Modelica.Electrical.QuasiStatic.Polyphase.Sensors.VoltageQuasiRMSSensor voltageQuasiRMSSensorQS(m=m)
  Modelica.Electrical.QuasiStatic.Polyphase.Basic.Star starMQS(m=m)
  Modelica.Electrical.Polyphase.Basic.Star starMachine(final m=
        Modelica.Electrical.Polyphase.Functions.numberOfSymmetricBaseSystems(m))
equation
  connect(star.pin_n, ground.p)
  connect(rotorAngle.plug_n, smpm.plug_sn)
  connect(rotorAngle.plug_p, smpm.plug_sp)
  connect(terminalBox.plug_sn, smpm.plug_sn)
  connect(terminalBox.plug_sp, smpm.plug_sp)
  connect(smpm.flange, rotorAngle.flange)
  connect(signalCurrent.plug_p, star.plug_p)
  connect(angleSensor.flange, rotorAngle.flange)
  connect(voltageQuasiRMSSensor.plug_p, terminalBox.plugSupply)
  connect(starM.plug_p, voltageQuasiRMSSensor.plug_n)
  connect(starM.pin_n, groundM.p)
  connect(quadraticSpeedDependentTorque.flange, inertiaLoad.flange_b)
  connect(signalCurrent.plug_n, currentRMSsensor.plug_p)
  connect(currentRMSsensor.plug_n, voltageQuasiRMSSensor.plug_p)
  connect(smpm.flange, inertiaLoad.flange_a)
  connect(quadraticSpeedDependentTorqueQS.flange, inertiaLoadQS.flange_b)
  connect(starMachineQS.plug_p, terminalBoxQS.starpoint)
  connect(groundMQS.pin, starMachineQS.pin_n)
  connect(terminalBoxQS.plug_sn, smpmQS.plug_sn)
  connect(terminalBoxQS.plug_sp, smpmQS.plug_sp)
  connect(dqToThreePhaseQS.I, referenceCurrentSourceQS.I)
  connect(referenceCurrentSourceQS.plug_p, starQS.plug_p)
  connect(starQS.pin_n, groundeQS.pin)
  connect(angleSensorQS.flange, smpmQS.flange)
  connect(referenceCurrentSourceQS.plug_p, resistorQS.plug_p)
  connect(resistorQS.plug_n, referenceCurrentSourceQS.plug_n)
  connect(dqToThreePhase.y, signalCurrent.i)
  connect(dqToThreePhaseQS.gamma, referenceCurrentSourceQS.gamma)
  connect(angleSensorQS.phi, dqToThreePhaseQS.phi)
  connect(angleSensor.phi, dqToThreePhase.phi)
  connect(smpmQS.flange, rotorAngleQS.flange)
  connect(terminalBoxQS.plug_sp, rotorAngleQS.plug_p)
  connect(terminalBoxQS.plugSupply, currentRMSSensorQS.plug_n)
  connect(currentRMSSensorQS.plug_p, referenceCurrentSourceQS.plug_n)
  connect(inertiaLoadQS.flange_a, smpmQS.flange)
  connect(rotorAngleQS.plug_n, terminalBoxQS.plug_sn)
  connect(voltageQuasiRMSSensorQS.plug_n, currentRMSSensorQS.plug_n)
  connect(starMQS.pin_n, starMachineQS.pin_n)
  connect(starMQS.plug_p, voltageQuasiRMSSensorQS.plug_p)
  connect(starMachine.plug_p, terminalBox.starpoint)
  connect(starMachine.pin_n, groundM.p)
  connect(id.y, dqToThreePhaseQS.id_rms)
  connect(id.y, dqToThreePhase.d)
  connect(iq.y, dqToThreePhaseQS.iq_rms)
  connect(iq.y, dqToThreePhase.q)
end SMPM_CurrentSource;


Test example: Investigate field weakening of a PermanentMagnetSynchronousMachine. This example demonstrates idealized field weakening of a quasistatic permanent magnet synchronous machine.

within Modelica.Magnetic.QuasiStatic.FundamentalWave.Examples.BasicMachines.SynchronousMachines;
model SMPM_FieldWeakening
  "Test example: Investigate field weakening of a PermanentMagnetSynchronousMachine"
  extends Modelica.Icons.Example;
  import Modelica.Constants.pi;
  constant Integer m=3 "Number of phases";
  parameter SI.Voltage VNominal=100 "Nominal RMS voltage per phase";
  parameter SI.Current INominal=150 "Nominal RMS current per phase";
  parameter SI.AngularVelocity wNominal=2*pi*smpmData.fsNominal/smpmData.p "Nominal speed";
  parameter
    Modelica.Electrical.Machines.Utilities.ParameterRecords.SM_PermanentMagnetData
    smpmData(useDamperCage=false, VsOpenCircuit=80)
                                  "Synchronous machine data"
  Magnetic.QuasiStatic.FundamentalWave.BasicMachines.SynchronousMachines.SM_PermanentMagnet
    smpm(
    p=smpmData.p,
    fsNominal=smpmData.fsNominal,
    Rs=smpmData.Rs,
    TsRef=smpmData.TsRef,
    Lssigma=smpmData.Lssigma,
    Jr=0,
    Js=smpmData.Js,
    frictionParameters=smpmData.frictionParameters,
    wMechanical(fixed=false),
    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,
    permanentMagnetLossParameters=smpmData.permanentMagnetLossParameters,
    phiMechanical(fixed=true, start=0),
    m=m,
    TsOperational=293.15,
    alpha20s=smpmData.alpha20s,
    effectiveStatorTurns=smpmData.effectiveStatorTurns,
    alpha20r=smpmData.alpha20r,
    TrOperational=293.15,
    stator(electroMagneticConverter(port_p(Phi(re(start=0), im(start=0))))))
  Modelica.Electrical.QuasiStatic.SinglePhase.Basic.Ground groundM
  Modelica.Magnetic.QuasiStatic.FundamentalWave.Utilities.TerminalBox terminalBox(
      terminalConnection="Y", m=m)
  Magnetic.QuasiStatic.FundamentalWave.Utilities.CurrentController dqToThreePhase(m=m, p=
        smpm.p)
  Modelica.Mechanics.Rotational.Sensors.AngleSensor angleSensorQS
  Modelica.Electrical.QuasiStatic.Polyphase.Sources.ReferenceCurrentSource referenceCurrentSource(m=m)
  Modelica.Electrical.QuasiStatic.Polyphase.Basic.Star starS(m=m)
  Modelica.Electrical.QuasiStatic.SinglePhase.Basic.Ground
    groundeQS
  Modelica.Electrical.QuasiStatic.Polyphase.Basic.Resistor resistorS(m=m, R_ref=fill(1e5, m),
    i(re(each start=0), im(each start=0)))
  Modelica.Electrical.QuasiStatic.Polyphase.Sensors.VoltageQuasiRMSSensor voltageQuasiRMSSensorQS(m=m)
  Mechanics.Rotational.Sources.Speed speedSource(exact=true, phi(fixed=false))
  ExampleUtilities.FieldWeakeningController fieldWeakeningController(VNominal=
        VNominal, IMax=INominal)
  Blocks.Math.Gain gainCurrent(k=INominal)
  Blocks.Math.Gain gainSpeed(k=wNominal)
  Blocks.Sources.Ramp     iqRef(
    height=1,
    duration=0.5,
    offset=0,
    startTime=0)
  Blocks.Sources.Ramp speed(
    height=4,
    duration=2,
    offset=0,
    startTime=0.5)
equation
  connect(starS.pin_n, groundeQS.pin)
  connect(terminalBox.plug_sn, smpm.plug_sn)
  connect(terminalBox.plug_sp, smpm.plug_sp)
  connect(terminalBox.plug_sn, voltageQuasiRMSSensorQS.plug_n)
  connect(voltageQuasiRMSSensorQS.plug_p, terminalBox.plug_sp)
  connect(dqToThreePhase.I, referenceCurrentSource.I)
  connect(dqToThreePhase.gamma, referenceCurrentSource.gamma)
  connect(referenceCurrentSource.plug_p, resistorS.plug_p)
  connect(resistorS.plug_p, starS.plug_p)
  connect(smpm.flange, angleSensorQS.flange)
  connect(angleSensorQS.phi, dqToThreePhase.phi)
  connect(angleSensorQS.flange, speedSource.flange)
  connect(fieldWeakeningController.id, dqToThreePhase.id_rms)
  connect(fieldWeakeningController.iq, dqToThreePhase.iq_rms)
  connect(gainCurrent.y, fieldWeakeningController.iqRef)
  connect(terminalBox.plugSupply, referenceCurrentSource.plug_n)
  connect(voltageQuasiRMSSensorQS.V, fieldWeakeningController.vs)
  connect(gainSpeed.y, speedSource.w_ref)
  connect(iqRef.y, gainCurrent.u)
  connect(speed.y, gainSpeed.u)
  connect(terminalBox.starpoint, groundM.pin)
  connect(referenceCurrentSource.plug_n, resistorS.plug_n)
end SMPM_FieldWeakening;


Permanent magnet synchronous machine operated at mains with step torque load. This example compares a time transient and a quasi-static model of a permanent magnet synchronous machine. The machines start with zero load and synchronous speed. At time tStep the machines are loaded with nominal torque.

within Modelica.Magnetic.QuasiStatic.FundamentalWave.Examples.BasicMachines.SynchronousMachines;
model SMPM_Mains
  "Permanent magnet synchronous machine operated at mains with step torque load"
  extends Modelica.Icons.Example;
  import Modelica.Constants.pi;
  parameter Integer m=3 "Number of phases"
  parameter SI.Frequency f=50 "Supply frequency";
  parameter SI.Voltage V=112.3 "Supply voltage";
  parameter SI.Torque T_Load=181.4 "Nominal load torque";
  parameter SI.Time tStep=0.5 "Time of load torque step";
  parameter SI.Inertia J_Load=0.29 "Load inertia";
  output SI.Current Itr=currentQuasiRMSSensor.I
    "Transient RMS current";
  output SI.Current Iqs=currentQuasiRMSSensorQS.I
    "QS RMS current";
  Modelica.Electrical.QuasiStatic.Polyphase.Sources.VoltageSource
    voltageSourceQS(
    m=m,
    f=f,
    V=fill(V, m),
    phi=-Modelica.Electrical.Polyphase.Functions.symmetricOrientation(
        m))
  Modelica.Electrical.QuasiStatic.Polyphase.Basic.Star starQS(m=m)
  Modelica.Electrical.QuasiStatic.SinglePhase.Basic.Ground groundQS
  Modelica.Electrical.QuasiStatic.Polyphase.Sensors.PowerSensor
    powerSensorQS(m=m)
  Modelica.Electrical.QuasiStatic.Polyphase.Sensors.CurrentQuasiRMSSensor currentQuasiRMSSensorQS(m=m)
  FundamentalWave.BasicMachines.SynchronousMachines.SM_PermanentMagnet
    smpmQS(
    m=m,
    Jr=smpmData.Jr,
    p=smpmData.p,
    fsNominal=smpmData.fsNominal,
    TsRef=smpmData.TsRef,
    frictionParameters=smpmData.frictionParameters,
    statorCoreParameters=smpmData.statorCoreParameters,
    strayLoadParameters=smpmData.strayLoadParameters,
    useDamperCage=smpmData.useDamperCage,
    Lrsigmad=smpmData.Lrsigmad,
    Lrsigmaq=smpmData.Lrsigmaq,
    Rrd=smpmData.Rrd,
    Rrq=smpmData.Rrq,
    TrRef=smpmData.TrRef,
    VsOpenCircuit=smpmData.VsOpenCircuit,
    permanentMagnetLossParameters=smpmData.permanentMagnetLossParameters,
    wMechanical(fixed=true, start=2*pi*smpmData.fsNominal/smpmData.p),
    Rs=smpmData.Rs*m/3,
    Lssigma=smpmData.Lssigma*m/3,
    Lmd=smpmData.Lmd*m/3,
    Lmq=smpmData.Lmq*m/3,
    useSupport=false,
    Js=smpmData.Js,
    gammar(start=pi/2, fixed=true),
    gamma(start=-pi/2, fixed=true),
    TsOperational=293.15,
    alpha20s=smpmData.alpha20s,
    effectiveStatorTurns=smpmData.effectiveStatorTurns,
    alpha20r=smpmData.alpha20r,
    TrOperational=293.15)

  Modelica.Mechanics.Rotational.Components.Inertia loadInertiaMQS(J=
        J_Load)
  Modelica.Mechanics.Rotational.Sources.TorqueStep torqueStepMQS(
    startTime=tStep,
    stepTorque=-T_Load,
    useSupport=false,
    offsetTorque=0)
  parameter
    Modelica.Electrical.Machines.Utilities.ParameterRecords.SM_PermanentMagnetData
    smpmData(useDamperCage=true) "Synchronous machine data"
  Modelica.Electrical.QuasiStatic.SinglePhase.Basic.Ground
    groundMachineQS
  Modelica.Electrical.QuasiStatic.Polyphase.Basic.Star
    starMachineQS(m=
        Modelica.Electrical.Polyphase.Functions.numberOfSymmetricBaseSystems(
                                                                    m))
  Utilities.MultiTerminalBox terminalBoxQS(m=m, terminalConnection="Y")
  Modelica.Electrical.Polyphase.Sources.CosineVoltage voltageSource(
    m=m,
    f=fill(f, m),
    V=fill(sqrt(2)*V, m))
  Modelica.Electrical.Polyphase.Basic.Star star(m=m)
  Modelica.Electrical.Analog.Basic.Ground ground
  Modelica.Electrical.Polyphase.Sensors.PowerSensor powerSensor(m=m)
  Modelica.Electrical.Polyphase.Sensors.CurrentQuasiRMSSensor currentQuasiRMSSensor(m=m)
  Magnetic.FundamentalWave.BasicMachines.SynchronousMachines.SM_PermanentMagnet
    smpm(
    m=m,
    Jr=smpmData.Jr,
    p=smpmData.p,
    fsNominal=smpmData.fsNominal,
    TsRef=smpmData.TsRef,
    frictionParameters=smpmData.frictionParameters,
    statorCoreParameters=smpmData.statorCoreParameters,
    strayLoadParameters=smpmData.strayLoadParameters,
    useDamperCage=smpmData.useDamperCage,
    Lrsigmad=smpmData.Lrsigmad,
    Lrsigmaq=smpmData.Lrsigmaq,
    Rrd=smpmData.Rrd,
    Rrq=smpmData.Rrq,
    TrRef=smpmData.TrRef,
    VsOpenCircuit=smpmData.VsOpenCircuit,
    permanentMagnetLossParameters=smpmData.permanentMagnetLossParameters,
    wMechanical(fixed=true, start=2*pi*smpmData.fsNominal/smpmData.p),
    Rs=smpmData.Rs*m/3,
    Lssigma=smpmData.Lssigma*m/3,
    Lmd=smpmData.Lmd*m/3,
    Lmq=smpmData.Lmq*m/3,
    useSupport=false,
    Js=smpmData.Jr,
    phiMechanical(start=0, fixed=true),
    ir(each fixed=true, start=zeros(2)),
    TsOperational=293.15,
    alpha20s=smpmData.alpha20s,
    effectiveStatorTurns=smpmData.effectiveStatorTurns,
    alpha20r=smpmData.alpha20r,
    TrOperational=293.15)

  Modelica.Mechanics.Rotational.Components.Inertia loadInertiaM(J=
        J_Load)
  Modelica.Mechanics.Rotational.Sources.TorqueStep torqueStepM(
    startTime=tStep,
    stepTorque=-T_Load,
    useSupport=false,
    offsetTorque=0)
  Modelica.Electrical.Analog.Basic.Ground groundMachine
  Modelica.Electrical.Machines.Utilities.MultiTerminalBox terminalBox(m=m,
      terminalConnection="Y")
  Modelica.Electrical.Polyphase.Basic.Star starMachine(final m=
        Modelica.Electrical.Polyphase.Functions.numberOfSymmetricBaseSystems(m))
initial equation
  sum(smpm.is)=0;
  smpm.is[1:2]=zeros(2);

equation
  connect(groundQS.pin, starQS.pin_n)
  connect(starQS.plug_p, voltageSourceQS.plug_n)
  connect(voltageSourceQS.plug_p, powerSensorQS.currentP)
  connect(powerSensorQS.currentN, currentQuasiRMSSensorQS.plug_p)
  connect(powerSensorQS.voltageP, powerSensorQS.currentP)
  connect(powerSensorQS.voltageN, starQS.plug_p)
  connect(loadInertiaMQS.flange_b, torqueStepMQS.flange)
  connect(smpmQS.flange, loadInertiaMQS.flange_a)
  connect(terminalBoxQS.plug_sn, smpmQS.plug_sn)
  connect(terminalBoxQS.plug_sp, smpmQS.plug_sp)
  connect(starMachineQS.plug_p, terminalBoxQS.starpoint)
  connect(currentQuasiRMSSensorQS.plug_n, terminalBoxQS.plugSupply)
  connect(starMachineQS.pin_n, groundMachineQS.pin)
  connect(loadInertiaM.flange_b, torqueStepM.flange)
  connect(smpm.flange, loadInertiaM.flange_a)
  connect(terminalBox.plug_sn, smpm.plug_sn)
  connect(terminalBox.plug_sp, smpm.plug_sp)
  connect(terminalBox.plugSupply, currentQuasiRMSSensor.plug_n)
  connect(currentQuasiRMSSensor.plug_p, powerSensor.nc)
  connect(powerSensor.pc, voltageSource.plug_p)
  connect(powerSensor.pv, powerSensor.pc)
  connect(voltageSource.plug_n, star.plug_p)
  connect(star.pin_n, ground.p)
  connect(powerSensor.nv, star.plug_p)
  connect(terminalBox.starpoint, starMachine.plug_p)
  connect(starMachine.pin_n, groundMachine.p)
end SMPM_Mains;


Test example: PermanentMagnetSynchronousMachine, investigating maximum torque per Amps. This example investigates the maximum torque per amps (MTPA) of a quasi-static permanent magnet synchronous machine.
The machines is operated at constant speed. The current magnitude is kept constant and the current angle is
rotated from 0 to 360 degrees with the simulation period of one second.

within Modelica.Magnetic.QuasiStatic.FundamentalWave.Examples.BasicMachines.SynchronousMachines;
model SMPM_MTPA "Test example: PermanentMagnetSynchronousMachine, investigating maximum torque per Amps"
  extends Modelica.Icons.Example;
  import Modelica.Constants.pi;
  parameter Integer m=3 "Number of phases"
  parameter SI.Voltage VNominal=100 "Nominal RMS voltage per phase";
  parameter SI.Frequency fNominal=50 "Nominal frequency";
  parameter SI.Frequency f=50 "Actual frequency";
  parameter SI.Time tRamp=1 "Frequency ramp";
  parameter SI.Torque TLoad=181.4 "Nominal load torque";
  parameter SI.Time tStep=1.2 "Time of load torque step";
  parameter SI.Inertia JLoad=0.29 "Load's moment of inertia";
  parameter SI.AngularVelocity wNominal = 2*pi*fNominal/smpmData.p "Nominal angular velocity";
  parameter Boolean positiveRange = false "Use positive range of angles, if true";
  output SI.Angle theta=rotorAngleQS.rotorDisplacementAngle "Rotor displacement angle, quasi-static";
  output SI.Angle phi_i = Modelica.Math.wrapAngle(smpmQS.arg_is[1],positiveRange) "Angle of current";
  output SI.Angle phi_v = Modelica.Math.wrapAngle(smpmQS.arg_vs[1],positiveRange) "Angle of voltage";
  output SI.Angle phi = Modelica.Math.wrapAngle(phi_v-phi_i,positiveRange) "Angle between voltage and current";
  output SI.Angle epsilon = Modelica.Math.wrapAngle(phi-theta,positiveRange) "Current angle";

  parameter
    Modelica.Electrical.Machines.Utilities.ParameterRecords.SM_PermanentMagnetData
    smpmData(useDamperCage=false, effectiveStatorTurns=64,
    fsNominal=fNominal,
    Lmd=0.1/(2*pi*fNominal),
    Lmq=0.3/(2*pi*fNominal),
    TsRef=373.15) "Synchronous machine data"
  Magnetic.QuasiStatic.FundamentalWave.BasicMachines.SynchronousMachines.SM_PermanentMagnet
    smpmQS(
    p=smpmData.p,
    fsNominal=smpmData.fsNominal,
    Rs=smpmData.Rs,
    TsRef=smpmData.TsRef,
    Lssigma=smpmData.Lssigma,
    Jr=smpmData.Jr,
    Js=smpmData.Js,
    frictionParameters=smpmData.frictionParameters,
    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,
    permanentMagnetLossParameters=smpmData.permanentMagnetLossParameters,
    phiMechanical(fixed=true, start=0),
    m=m,
    effectiveStatorTurns=smpmData.effectiveStatorTurns,
    TsOperational=373.15,
    alpha20s=smpmData.alpha20s,
    alpha20r=smpmData.alpha20r,
    TrOperational=373.15)

  Modelica.Mechanics.Rotational.Sources.ConstantSpeed
    quadraticSpeedDependentTorqueQS(w_fixed=wNominal)
  Modelica.Electrical.QuasiStatic.Polyphase.Basic.Star
    starMachineQS(m=
        Modelica.Electrical.Polyphase.Functions.numberOfSymmetricBaseSystems(
                                                                     m))
  Modelica.Electrical.QuasiStatic.SinglePhase.Basic.Ground
    groundMQS
  Magnetic.QuasiStatic.FundamentalWave.Utilities.MultiTerminalBox terminalBoxQS(
      terminalConnection="Y", m=m)
  Magnetic.QuasiStatic.FundamentalWave.Utilities.CurrentController currentControllerQS(m=m, p=
        smpmQS.p)
  Modelica.Mechanics.Rotational.Sensors.AngleSensor angleSensorQS
  Modelica.Electrical.QuasiStatic.Polyphase.Sources.ReferenceCurrentSource referenceCurrentSourceQS(m=m)
  Modelica.Electrical.QuasiStatic.Polyphase.Basic.Star starQS(m=m)
  Modelica.Electrical.QuasiStatic.SinglePhase.Basic.Ground
    groundeQS
  Modelica.Electrical.QuasiStatic.Polyphase.Basic.Resistor resistorQS(m=m, R_ref=fill(1e5, m))
  Magnetic.QuasiStatic.FundamentalWave.Sensors.RotorDisplacementAngle rotorAngleQS(
    m=m,
    p=smpmData.p,
    positiveRange=positiveRange)
  Modelica.Electrical.QuasiStatic.Polyphase.Sensors.CurrentQuasiRMSSensor currentRMSSensorQS(m=m)
  Modelica.Electrical.QuasiStatic.Polyphase.Sensors.VoltageQuasiRMSSensor voltageQuasiRMSSensorQS(m=m)
  Modelica.Electrical.QuasiStatic.Polyphase.Basic.Star starMQS(m=m)
  Modelica.ComplexBlocks.Sources.ComplexRotatingPhasor rotSource(magnitude=100, w=2*pi)
  Modelica.ComplexBlocks.ComplexMath.ComplexToReal toReal
equation
  connect(starMachineQS.plug_p, terminalBoxQS.starpoint)
  connect(groundMQS.pin, starMachineQS.pin_n)
  connect(terminalBoxQS.plug_sn, smpmQS.plug_sn)
  connect(terminalBoxQS.plug_sp, smpmQS.plug_sp)
  connect(currentControllerQS.I, referenceCurrentSourceQS.I)
  connect(referenceCurrentSourceQS.plug_p, starQS.plug_p)
  connect(starQS.pin_n, groundeQS.pin)
  connect(angleSensorQS.flange, smpmQS.flange)
  connect(referenceCurrentSourceQS.plug_p, resistorQS.plug_p)
  connect(resistorQS.plug_n, referenceCurrentSourceQS.plug_n)
  connect(currentControllerQS.gamma, referenceCurrentSourceQS.gamma)
  connect(angleSensorQS.phi, currentControllerQS.phi)
  connect(smpmQS.flange, rotorAngleQS.flange)
  connect(terminalBoxQS.plug_sp, rotorAngleQS.plug_p)
  connect(terminalBoxQS.plugSupply, currentRMSSensorQS.plug_n)
  connect(currentRMSSensorQS.plug_p, referenceCurrentSourceQS.plug_n)
  connect(rotorAngleQS.plug_n, terminalBoxQS.plug_sn)
  connect(voltageQuasiRMSSensorQS.plug_n, currentRMSSensorQS.plug_n)
  connect(starMQS.pin_n, starMachineQS.pin_n)
  connect(starMQS.plug_p, voltageQuasiRMSSensorQS.plug_p)
  connect(quadraticSpeedDependentTorqueQS.flange, rotorAngleQS.flange)
  connect(toReal.u, rotSource.y)
  connect(toReal.re, currentControllerQS.id_rms)
  connect(currentControllerQS.iq_rms, toReal.im)
end SMPM_MTPA;


Test example: PermanentMagnetSynchronousMachine with inverter. This example compares a time transient and a quasi-static model of a permanent magnet synchronous machine.
The machines are operated at constant mechanical angular velocity.

within Modelica.Magnetic.QuasiStatic.FundamentalWave.Examples.BasicMachines.SynchronousMachines;
model SMPM_OpenCircuit
  "Test example: PermanentMagnetSynchronousMachine with inverter"
  extends Modelica.Icons.Example;
  import Modelica.Constants.pi;
  parameter Integer m=3 "Number of phases"
  output SI.Voltage Vtr=potentialSensor.phi[1]
    "Transient voltage";
  output SI.Voltage Vqs=potentialSensorQS.abs_v[1]
    "QS voltage";
  FundamentalWave.BasicMachines.SynchronousMachines.SM_PermanentMagnet
    smpmQS(
    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,
    phiMechanical(start=0),
    m=m,
    Rs=smpmData.Rs*m/3,
    Lssigma=smpmData.Lssigma*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.Mechanics.Rotational.Sources.ConstantSpeed constantSpeed(
    useSupport=false,
    w_fixed(displayUnit="rad/s") = 2*pi*smpmData.fsNominal/smpmData.p,
    phi(start=0, fixed=true))
  parameter
    Modelica.Electrical.Machines.Utilities.ParameterRecords.SM_PermanentMagnetData
    smpmData(useDamperCage=false) "Synchronous machine data"
  Modelica.Electrical.QuasiStatic.Polyphase.Basic.Star starQS(m=m)
  Modelica.Electrical.QuasiStatic.SinglePhase.Basic.Ground groundQS
  Modelica.Electrical.QuasiStatic.Polyphase.Sensors.PotentialSensor
    potentialSensorQS(m=m)
  Magnetic.FundamentalWave.BasicMachines.SynchronousMachines.SM_PermanentMagnet
    smpm(
    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,
    m=m,
    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.Basic.Star star(m=m)
  Modelica.Electrical.Analog.Basic.Ground ground
  Modelica.Electrical.Polyphase.Sensors.PotentialSensor
    potentialSensor(m=m)
  Modelica.Electrical.QuasiStatic.Polyphase.Basic.Resistor
    resistorQS(m=m, R_ref=fill(1e6*m/3, m))
equation
  connect(starQS.plug_p, smpmQS.plug_sn)
  connect(groundQS.pin, starQS.pin_n)
  connect(potentialSensorQS.plug_p, smpmQS.plug_sp)
  connect(constantSpeed.flange, smpm.flange)
  connect(constantSpeed.flange, smpmQS.flange)
  connect(ground.p, star.pin_n)
  connect(star.plug_p, smpm.plug_sn)
  connect(potentialSensor.plug_p, smpm.plug_sp)
  connect(resistorQS.plug_p, smpmQS.plug_sn)
  connect(resistorQS.plug_n, smpmQS.plug_sp)
end SMPM_OpenCircuit;


Test example: Synchronous reluctance machine fed by current source. This example compares a time transient and a quasi-static model of a synchronous reluctance machine.
The machines are fed by a current source. The current components are oriented at the magnetic field
orientation and transformed to the stator fixed reference frame. This way the machines are operated at constant torque.
The machines start to accelerate from standstill.

within Modelica.Magnetic.QuasiStatic.FundamentalWave.Examples.BasicMachines.SynchronousMachines;
model SMR_CurrentSource
  "Test example: Synchronous reluctance machine fed by current source"
  extends Modelica.Icons.Example;
  import Modelica.Constants.pi;
  parameter Integer m=3 "Number of phases"
  parameter SI.Voltage VNominal=100
    "Nominal RMS voltage per phase";
  parameter SI.Frequency fNominal=smrData.fsNominal "Nominal frequency";
  parameter SI.Frequency f=50 "Actual frequency";
  parameter SI.Time tRamp=1 "Frequency ramp";
  parameter SI.Torque TLoad=181.4 "Nominal load torque";
  parameter SI.Time tStep=1.2 "Time of load torque step";
  parameter SI.Inertia JLoad=0.29
    "Load's moment of inertia";
  SI.Angle thetaQS=rotorAngleQS.rotorDisplacementAngle "Rotor displacement angle, quasi-static";
  SI.Angle theta=rotorDisplacementAngle.rotorDisplacementAngle "Rotor displacement angle, transient";

  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=smr.p, m=m)
  Modelica.Blocks.Sources.Constant iq(k=84.6*3/m)
  Modelica.Blocks.Sources.Constant id(k=53.5*3/m)
  Modelica.Electrical.Polyphase.Sensors.VoltageQuasiRMSSensor
    voltageQuasiRMSSensor(m=m)
  Modelica.Electrical.Polyphase.Basic.Star starM(final m=m)
  Modelica.Electrical.Analog.Basic.Ground groundM
  Modelica.Electrical.Machines.Utilities.MultiTerminalBox terminalBox(
      terminalConnection="Y", m=m)
  Modelica.Electrical.Machines.Sensors.RotorDisplacementAngle
    rotorDisplacementAngle(p=smr.p, m=m)
  Modelica.Mechanics.Rotational.Sensors.AngleSensor angleSensor
  Modelica.Mechanics.Rotational.Components.Inertia inertiaLoad(J=0.29)
  Modelica.Mechanics.Rotational.Sources.QuadraticSpeedDependentTorque
    quadraticSpeedDependentTorque(
    tau_nominal=-181.4,
    w_nominal(displayUnit="rpm") = 157.07963267949,
    TorqueDirection=false)
  Modelica.Electrical.Polyphase.Sensors.CurrentQuasiRMSSensor currentRMSsensor(m=m)
  Modelica.Mechanics.Rotational.Components.Inertia inertiaLoadQS(J=0.29)
  Modelica.Mechanics.Rotational.Sources.QuadraticSpeedDependentTorque
    quadraticSpeedDependentTorqueQS(
    tau_nominal=-181.4,
    w_nominal(displayUnit="rpm") = 157.07963267949,
    TorqueDirection=false)
  Modelica.Electrical.QuasiStatic.Polyphase.Basic.Star
    starMachineQS(m=
        Modelica.Electrical.Polyphase.Functions.numberOfSymmetricBaseSystems(
                                                                    m))
  Modelica.Electrical.QuasiStatic.SinglePhase.Basic.Ground
    groundMQS
  Utilities.MultiTerminalBox terminalBoxQS(terminalConnection="Y", m=m)
  FundamentalWave.Utilities.CurrentController dqToThreePhaseQS(m=m, p=
        smrQS.p)
  Modelica.Mechanics.Rotational.Sensors.AngleSensor angleSensorQS
  Modelica.Electrical.QuasiStatic.Polyphase.Sources.ReferenceCurrentSource referenceCurrentSource(m=m)
  Modelica.Electrical.QuasiStatic.Polyphase.Basic.Star starQS(m=m)
  Modelica.Electrical.QuasiStatic.SinglePhase.Basic.Ground
    groundeQS
  Modelica.Electrical.QuasiStatic.Polyphase.Basic.Resistor resistorQS(m=m, R_ref=fill(1e5, m))
  parameter
    Modelica.Electrical.Machines.Utilities.ParameterRecords.SM_ReluctanceRotorData
    smrData(useDamperCage=false) "Synchronous machine data"
  FundamentalWave.BasicMachines.SynchronousMachines.SM_ReluctanceRotor
    smrQS(
    p=smrData.p,
    fsNominal=smrData.fsNominal,
    TsRef=smrData.TsRef,
    alpha20s(displayUnit="1/K") = smrData.alpha20s,
    Jr=smrData.Jr,
    Js=smrData.Js,
    frictionParameters=smrData.frictionParameters,
    statorCoreParameters=smrData.statorCoreParameters,
    strayLoadParameters=smrData.strayLoadParameters,
    Lrsigmad=smrData.Lrsigmad,
    Lrsigmaq=smrData.Lrsigmaq,
    Rrd=smrData.Rrd,
    Rrq=smrData.Rrq,
    TrRef=smrData.TrRef,
    alpha20r(displayUnit="1/K") = smrData.alpha20r,
    Rs=smrData.Rs*m/3,
    Lssigma=smrData.Lssigma*m/3,
    Lmd=smrData.Lmd*m/3,
    Lmq=smrData.Lmq*m/3,
    m=m,
    gammar(start=pi/2),
    gamma(start=-pi/2),
    useDamperCage=smrData.useDamperCage,
    wMechanical(start=0, fixed=true),
    phiMechanical(start=0, fixed=true),
    effectiveStatorTurns=smrData.effectiveStatorTurns,
    TsOperational=293.15,
    TrOperational=293.15)
  Magnetic.FundamentalWave.BasicMachines.SynchronousMachines.SM_ReluctanceRotor
    smr(
    Jr=smrData.Jr,
    Js=smrData.Js,
    p=smrData.p,
    fsNominal=smrData.fsNominal,
    TsRef=smrData.TsRef,
    alpha20s(displayUnit="1/K") = smrData.alpha20s,
    frictionParameters=smrData.frictionParameters,
    statorCoreParameters=smrData.statorCoreParameters,
    strayLoadParameters=smrData.strayLoadParameters,
    phiMechanical(fixed=true),
    wMechanical(fixed=true),
    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),
    m=m,
    Rs=smrData.Rs*m/3,
    Lssigma=smrData.Lssigma*m/3,
    Lszero=smrData.Lszero*m/3,
    Lmd=smrData.Lmd*m/3,
    Lmq=smrData.Lmq*m/3,
    useDamperCage=smrData.useDamperCage,
    TsOperational=293.15,
    effectiveStatorTurns=smrData.effectiveStatorTurns,
    TrOperational=293.15)
  Sensors.RotorDisplacementAngle rotorAngleQS(m=m, p=smrQS.p)
  Modelica.Electrical.QuasiStatic.Polyphase.Sensors.CurrentQuasiRMSSensor currentRMSSensorQS(m=m)
  Modelica.Electrical.QuasiStatic.Polyphase.Sensors.VoltageQuasiRMSSensor voltageQuasiRMSSensorQS(m=m)
  Modelica.Electrical.QuasiStatic.Polyphase.Basic.Star starMQS(m=m)
  Modelica.Electrical.Polyphase.Basic.Star starMachine(final m=
        Modelica.Electrical.Polyphase.Functions.numberOfSymmetricBaseSystems(m))
equation
  connect(star.pin_n, ground.p)
  connect(signalCurrent.plug_p, star.plug_p)
  connect(angleSensor.flange, rotorDisplacementAngle.flange)
  connect(voltageQuasiRMSSensor.plug_p, terminalBox.plugSupply)
  connect(starM.plug_p, voltageQuasiRMSSensor.plug_n)
  connect(starM.pin_n, groundM.p)
  connect(quadraticSpeedDependentTorque.flange, inertiaLoad.flange_b)
  connect(signalCurrent.plug_n, currentRMSsensor.plug_p)
  connect(currentRMSsensor.plug_n, voltageQuasiRMSSensor.plug_p)
  connect(quadraticSpeedDependentTorqueQS.flange, inertiaLoadQS.flange_b)
  connect(starMachineQS.plug_p, terminalBoxQS.starpoint)
  connect(groundMQS.pin, starMachineQS.pin_n)
  connect(dqToThreePhaseQS.I, referenceCurrentSource.I)
  connect(referenceCurrentSource.plug_p, starQS.plug_p)
  connect(starQS.pin_n, groundeQS.pin)
  connect(referenceCurrentSource.plug_p, resistorQS.plug_p)
  connect(resistorQS.plug_n, referenceCurrentSource.plug_n)
  connect(terminalBoxQS.plug_sn, smrQS.plug_sn)
  connect(terminalBoxQS.plug_sp, smrQS.plug_sp)
  connect(angleSensorQS.flange, smrQS.flange)
  connect(terminalBox.plug_sn, smr.plug_sn)
  connect(terminalBox.plug_sp, smr.plug_sp)
  connect(smr.flange, rotorDisplacementAngle.flange)
  connect(rotorDisplacementAngle.plug_p, terminalBox.plug_sp)
  connect(terminalBox.plug_sn, rotorDisplacementAngle.plug_n)
  connect(rotorDisplacementAngle.flange, inertiaLoad.flange_a)
  connect(smrQS.flange, rotorAngleQS.flange)
  connect(smrQS.plug_sp, rotorAngleQS.plug_p)
  connect(smrQS.plug_sn, rotorAngleQS.plug_n)
  connect(inertiaLoadQS.flange_a, smrQS.flange)
  connect(currentRMSSensorQS.plug_p, referenceCurrentSource.plug_n)
  connect(currentRMSSensorQS.plug_n, terminalBoxQS.plugSupply)
  connect(id.y, dqToThreePhaseQS.id_rms)
  connect(id.y, dqToThreePhase.d)
  connect(iq.y, dqToThreePhaseQS.iq_rms)
  connect(iq.y, dqToThreePhase.q)
  connect(angleSensor.phi, dqToThreePhase.phi)
  connect(dqToThreePhase.y, signalCurrent.i)
  connect(dqToThreePhaseQS.gamma, referenceCurrentSource.gamma)
  connect(angleSensorQS.phi, dqToThreePhaseQS.phi)
  connect(starMQS.plug_p, voltageQuasiRMSSensorQS.plug_p)
  connect(voltageQuasiRMSSensorQS.plug_n, currentRMSSensorQS.plug_n)
  connect(starMQS.pin_n, groundMQS.pin)
  connect(starMachine.pin_n, groundM.p)
  connect(starMachine.plug_p, terminalBox.starpoint)
end SMR_CurrentSource;


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

within Modelica.Magnetic.QuasiStatic.FundamentalWave.Examples.Components;
model EddyCurrentLosses
  "Comparison of equivalent circuits of eddy current loss models"
  extends Modelica.Icons.Example;
  constant Integer m=3 "Number of phases";
  // ## Original value R = 0.1 Ohm
  parameter SI.Resistance R=0.1 "Resistance";
  parameter SI.Conductance Gc=0.0001 "Loss conductance";
  parameter SI.Reluctance R_m=1
    "Reluctance of the magnetic circuit";
  parameter Real N=1 "Number of turns";
  output SI.Power lossPower_e=sum(loss_e.conductor.LossPower);
  output SI.Power lossPower_m=loss_m.lossPower;
  Modelica.Electrical.QuasiStatic.SinglePhase.Basic.Ground ground_e
  Modelica.Electrical.QuasiStatic.SinglePhase.Basic.Ground ground_m
  Modelica.Electrical.QuasiStatic.Polyphase.Basic.Star star_e(m=m)
  Modelica.Electrical.QuasiStatic.Polyphase.Basic.Star star_m(m=m)
  Modelica.Electrical.QuasiStatic.Polyphase.Sources.VoltageSource
    sineVoltage_e(
    m=m,
    f=1,
    phi=-Modelica.Electrical.Polyphase.Functions.symmetricOrientation(m),
    V=fill(1/sqrt(2), m),
    gamma(fixed=true, start=0))

  Modelica.Electrical.QuasiStatic.Polyphase.Sources.VoltageSource
    sineVoltage_m(
    m=m,
    f=1,
    phi=-Modelica.Electrical.Polyphase.Functions.symmetricOrientation(m),
    V=fill(1/sqrt(2), m),
    gamma(fixed=true, start=0))

  Modelica.Electrical.QuasiStatic.Polyphase.Basic.Resistor
    resistor_e(m=m, R_ref=fill(R*m/3, m))
  Modelica.Electrical.QuasiStatic.Polyphase.Basic.Resistor
    resistor_m(m=m, R_ref=fill(R*m/3, m))
  Modelica.Electrical.QuasiStatic.Polyphase.Sensors.PowerSensor
    powerb_e(m=m)
  Modelica.Electrical.QuasiStatic.Polyphase.Sensors.PowerSensor
    powerb_m(m=m)
  Modelica.Electrical.QuasiStatic.Polyphase.Basic.Conductor loss_e(m=
       m,G_ref=fill(Gc*3/m, m))
  Magnetic.QuasiStatic.FundamentalWave.Components.PolyphaseElectroMagneticConverter
    converter_e(effectiveTurns=N)
  Magnetic.QuasiStatic.FundamentalWave.Components.PolyphaseElectroMagneticConverter
    converter_m(effectiveTurns=N)
  Magnetic.QuasiStatic.FundamentalWave.Components.EddyCurrent loss_m(G=m*N^2*Gc
        /2)
  Magnetic.QuasiStatic.FundamentalWave.Components.Reluctance reluctance_e(R_m(d=R_m,
        q=R_m))
  Magnetic.QuasiStatic.FundamentalWave.Components.Reluctance reluctance_m(R_m(d=R_m,
        q=R_m))
  Magnetic.QuasiStatic.FundamentalWave.Components.Ground mground_e
  Magnetic.QuasiStatic.FundamentalWave.Components.Ground mground_m
equation
  connect(sineVoltage_e.plug_n, converter_e.plug_n)
  connect(sineVoltage_e.plug_n, star_e.plug_p)
  connect(converter_e.port_p, reluctance_e.port_p)
  connect(converter_e.port_n, reluctance_e.port_n)
  connect(converter_e.port_n, mground_e.port_p)
  connect(resistor_e.plug_p, sineVoltage_e.plug_p)
  connect(loss_e.plug_n, sineVoltage_e.plug_n)
  connect(loss_e.plug_p, converter_e.plug_p)
  connect(resistor_e.plug_n, powerb_e.currentP)
  connect(powerb_e.currentN, converter_e.plug_p)
  connect(star_e.pin_n, ground_e.pin)
  connect(powerb_e.currentP, powerb_e.voltageP)
  connect(powerb_e.voltageN, sineVoltage_e.plug_n)
  connect(sineVoltage_m.plug_n, star_m.plug_p)
  connect(sineVoltage_m.plug_n, converter_m.plug_n)
  connect(converter_m.port_n, reluctance_m.port_n)
  connect(converter_m.port_p, loss_m.port_p)
  connect(loss_m.port_n, reluctance_m.port_p)
  connect(converter_m.port_n, mground_m.port_p)
  connect(sineVoltage_m.plug_p, resistor_m.plug_p)
  connect(resistor_m.plug_n, powerb_m.currentP)
  connect(powerb_m.currentN, converter_m.plug_p)
  connect(star_m.pin_n, ground_m.pin)
  connect(powerb_m.currentP, powerb_m.voltageP)
  connect(powerb_m.voltageN, sineVoltage_m.plug_n)
end EddyCurrentLosses;


within Modelica.Magnetic.QuasiStatic.FundamentalWave.Examples;
package Components "Examples for testing quasi-static fundamental wave components"
  extends Modelica.Icons.ExamplesPackage;

end Components;


Polyphase inductance. This example compares a quasi static electric polyphase inductor with an equivalent quasi static fundamental wave reluctance circuit.
The phase inductance L and the magnetic fundamental wave reluctance R_m are related by:

within Modelica.Magnetic.QuasiStatic.FundamentalWave.Examples.Components;
model PolyphaseInductance "Polyphase inductance"
  extends Modelica.Icons.Example;
  parameter Integer m=5 "Number of phases"
  parameter SI.Frequency f=1 "Supply frequency";
  parameter SI.Voltage VRMS=100 "RMS supply voltage";
  parameter SI.Resistance R=1E-5 "Resistance";
  parameter SI.Inductance L=1 "Load inductance";
  parameter Real effectiveTurns=5 "Effective number of turns";
  // Symmetrical polyphase magnetic reluctance
  final parameter SI.Reluctance R_m=m*effectiveTurns^2/2/L
    "Equivalent magnetic reluctance";
  output SI.ComplexCurrent Ie=resistor_e.i[1]
    "Current of electric representation";
  output SI.ComplexCurrent Im=resistor_m.i[1]
    "Current of magnetic representation";
  Modelica.Electrical.QuasiStatic.SinglePhase.Basic.Ground ground_e
  Modelica.Electrical.QuasiStatic.SinglePhase.Basic.Ground ground_m
  Modelica.Electrical.QuasiStatic.Polyphase.Basic.Star star_e(m=m)
  Modelica.Electrical.QuasiStatic.Polyphase.Basic.Star star_m(m=m)
  Modelica.Electrical.QuasiStatic.Polyphase.Sources.VoltageSource
    voltageSource_e(
    m=m,
    f=f,
    phi=-Modelica.Electrical.Polyphase.Functions.symmetricOrientation(m),
    V=fill(VRMS, m),
    gamma(fixed=true, start=0))

  Modelica.Electrical.QuasiStatic.Polyphase.Sources.VoltageSource
    voltageSource_m(
    m=m,
    f=f,
    phi=-Modelica.Electrical.Polyphase.Functions.symmetricOrientation(m),
    V=fill(VRMS, m),
    gamma(fixed=true, start=0))

  Modelica.Electrical.QuasiStatic.Polyphase.Basic.Resistor
    resistor_e(m=m, R_ref=fill(R*m/3, m))
  Modelica.Electrical.QuasiStatic.Polyphase.Basic.Resistor
    resistor_m(m=m, R_ref=fill(R*m/3, m))
  Modelica.Electrical.QuasiStatic.Polyphase.Basic.Inductor
    inductor_e(m=m, L=fill(L, m))
  Magnetic.QuasiStatic.FundamentalWave.Components.PolyphaseElectroMagneticConverter
    converter_m(m=m, effectiveTurns=effectiveTurns)
  Magnetic.QuasiStatic.FundamentalWave.Components.Reluctance reluctance_m(R_m(d=R_m,
        q=R_m))
  Magnetic.QuasiStatic.FundamentalWave.Components.Ground groundM_m
equation
  connect(star_e.pin_n, ground_e.pin)
  connect(star_e.plug_p, voltageSource_e.plug_n)
  connect(voltageSource_e.plug_n, inductor_e.plug_n)
  connect(converter_m.port_p, reluctance_m.port_p)
  connect(converter_m.port_n, reluctance_m.port_n)
  connect(converter_m.port_n, groundM_m.port_p)
  connect(voltageSource_m.plug_n, star_m.plug_p)
  connect(star_m.pin_n, ground_m.pin)
  connect(voltageSource_m.plug_n, converter_m.plug_n)
  connect(voltageSource_e.plug_p, resistor_e.plug_p)
  connect(resistor_e.plug_n, inductor_e.plug_p)
  connect(voltageSource_m.plug_p, resistor_m.plug_p)
  connect(resistor_m.plug_n, converter_m.plug_p)
end PolyphaseInductance;


Filed weakening for a QS SMPM. Controls id to keep the voltage vs ≤ VNominal, limiting first iq to keep is ≤ IMax if possible.

within Modelica.Magnetic.QuasiStatic.FundamentalWave.Examples.ExampleUtilities;
block FieldWeakeningController "Filed weakening for a QS SMPM"
  extends Blocks.Icons.Block;
  parameter Modelica.Units.SI.Voltage VNominal "Nominal rms voltage per phase";
  parameter Modelica.Units.SI.Current IMax "Maximum rms current per phase";
  parameter Real kp=1 "Proportional gain of field weakening controller";
  parameter Modelica.Units.SI.Time Ti=1e-6 "Integral time constant of field weakening controller";
  Blocks.Interfaces.RealInput iqRef
  Blocks.Interfaces.RealInput vs "Stator voltage magnitude"
  Blocks.Interfaces.RealOutput is "Stator current magnitude"
  Blocks.Interfaces.RealOutput id "Stator direct axis current"
  Blocks.Interfaces.RealOutput iq "Stator quadrature axis current"
  Blocks.Sources.Constant vRef(k=VNominal)
  Blocks.Continuous.LimPID  PID(
    controllerType=Modelica.Blocks.Types.SimpleController.PI,
    k=kp,
    Ti=Ti,
    yMax=0,
    yMin=-IMax)
  Blocks.Math.RectangularToPolar rectangularToPolar
  Modelica.Magnetic.QuasiStatic.FundamentalWave.Examples.ExampleUtilities.SpacePhasorLimiter
    spacePhasorLimiter(yMax=IMax)
equation
  connect(vRef.y, PID.u_s)
  connect(PID.y, id)
  connect(PID.y, rectangularToPolar.u_re)
  connect(rectangularToPolar.y_abs, is)
  connect(vs, PID.u_m)
  connect(spacePhasorLimiter.y, iq)
  connect(PID.y, spacePhasorLimiter.u1)
  connect(spacePhasorLimiter.y, rectangularToPolar.u_im)
  connect(spacePhasorLimiter.u2, iqRef)
end FieldWeakeningController;


Utilities for Examples

within Modelica.Magnetic.QuasiStatic.FundamentalWave.Examples;
package ExampleUtilities "Utilities for Examples"
extends Icons.UtilitiesPackage;

end ExampleUtilities;


Limit space phasor. Limit the real part u2 of a space phasor if necessary to keep the length lower than yMax keeping u1 unchanged.
If u1 is greater than yMax, this cannot be satisfied even with u2 = 0.

within Modelica.Magnetic.QuasiStatic.FundamentalWave.Examples.ExampleUtilities;
block SpacePhasorLimiter "Limit space phasor"
  extends Modelica.Blocks.Interfaces.SI2SO;
  parameter Modelica.Units.SI.Current yMax "Maximum output";
equation
  y = sign(u2)*min(abs(u2), sqrt(yMax^2 - min(yMax, abs(u1))^2));
end SpacePhasorLimiter;


Interfaces

within Modelica.Magnetic.QuasiStatic.FundamentalWave;
package Interfaces "Interfaces"
  extends Modelica.Icons.InterfacesPackage;
end Interfaces;


Elementary partial two port for textual programming. The partial two port elementary model extends from the partial two port model and adds one equation considering the balance of flow variables, port_p.Phi + port_n.Phi = Complex(0,0). Additionally, a variable for magnetic potential difference of the two magnetic ports, V_m, and the flux into the positive port, Phi, are defined.

within Modelica.Magnetic.QuasiStatic.FundamentalWave.Interfaces;
partial model TwoPort "Elementary partial two port for textual programming"
  extends Magnetic.QuasiStatic.FundamentalWave.Interfaces.TwoPortExtended;

equation
  // Local flux balance
  port_p.Phi + port_n.Phi = Complex(0, 0);
end TwoPort;


Partial two port for graphical programming. The partial two port model consists of a positive and a negative magnetic port. The reference angles of the two ports are set equal and connected through Connections.branch.

within Modelica.Magnetic.QuasiStatic.FundamentalWave.Interfaces;
partial model TwoPortElementary "Partial two port for graphical programming"
  SI.AngularVelocity omega=der(port_p.reference.gamma)
    "Reference angular velocity (= der(port_p.reference.gamma))";
  FundamentalWave.Interfaces.PositiveMagneticPort port_p
    "Positive quasi-static magnetic port of fundamental wave machines"
  FundamentalWave.Interfaces.NegativeMagneticPort port_n
    "Negative quasi-static magnetic port of fundamental wave machines"
equation
  Connections.branch(port_p.reference, port_n.reference);
  port_p.reference.gamma = port_n.reference.gamma;
end TwoPortElementary;


Partial two port for graphical programming with additional variables. The partial two port model consists of a positive and a negative magnetic port. The reference angles of the two ports are set equal and connected through Connections.branch.

within Modelica.Magnetic.QuasiStatic.FundamentalWave.Interfaces;
partial model TwoPortExtended "Partial two port for graphical programming with additional variables"
  extends Magnetic.QuasiStatic.FundamentalWave.Interfaces.TwoPortElementary;

  SI.ComplexMagneticPotentialDifference V_m = port_p.V_m - port_n.V_m
    "Complex magnetic potential difference";
  SI.MagneticPotentialDifference abs_V_m = Modelica.ComplexMath.abs(V_m)
    "Magnitude of complex magnetic potential difference";
  SI.Angle arg_V_m = Modelica.ComplexMath.arg(V_m)
    "Argument of complex magnetic potential difference";
  SI.ComplexMagneticFlux Phi = port_p.Phi
    "Complex magnetic flux";
  SI.MagneticFlux abs_Phi = Modelica.ComplexMath.abs(Phi)
    "Magnitude of complex magnetic flux";
  SI.Angle arg_Phi = Modelica.ComplexMath.arg(Phi)
    "Argument of complex magnetic flux";
end TwoPortExtended;


Loss models

within Modelica.Magnetic.QuasiStatic.FundamentalWave;
package Losses "Loss models"
  extends Modelica.Icons.Package;
end Losses;


Model of permanent magnet losses dependent on current and speed. Permanent magnet losses are modeled dependent on current and speed.

within Modelica.Magnetic.QuasiStatic.FundamentalWave.Losses;
model PermanentMagnetLosses
  "Model of permanent magnet losses dependent on current and speed"
  extends Modelica.Electrical.Machines.Interfaces.FlangeSupport;
  import Modelica.Electrical.QuasiStatic.Polyphase.Functions.quasiRMS;
  parameter Integer m(min=1) = 3 "Number of phases"
  parameter
    Modelica.Electrical.Machines.Losses.PermanentMagnetLossParameters
    permanentMagnetLossParameters "Permanent magnet loss parameters";
  extends
    Modelica.Thermal.HeatTransfer.Interfaces.PartialElementaryConditionalHeatPortWithoutT(
      useHeatPort=false);
  input SI.ComplexCurrent is[m]
    "Instantaneous stator currents";
  SI.Current iRMS=quasiRMS(is);
equation
  if (permanentMagnetLossParameters.PRef <= 0) then
    tau = 0;
  else
    tau = -permanentMagnetLossParameters.tauRef*(permanentMagnetLossParameters.c + (1 - permanentMagnetLossParameters.c)*
      (iRMS/permanentMagnetLossParameters.IRef)^permanentMagnetLossParameters.power_I)*
      sign(w)*(abs(w)/permanentMagnetLossParameters.wRef)^permanentMagnetLossParameters.power_w;
  end if;
  lossPower = -tau*w;
end PermanentMagnetLosses;


Model of stray load losses dependent on current and speed. Stray load losses are modeled similar to standards EN 60034-2 and IEEE 512, i.e., they are dependent on square of current,
but without scaling them to zero at no-load current.

within Modelica.Magnetic.QuasiStatic.FundamentalWave.Losses;
model StrayLoad "Model of stray load losses dependent on current and speed"
  extends Modelica.Electrical.QuasiStatic.Polyphase.Interfaces.OnePort;
  extends Modelica.Electrical.Machines.Interfaces.FlangeSupport;
  import Modelica.Electrical.QuasiStatic.Polyphase.Functions.quasiRMS;
  parameter Modelica.Electrical.Machines.Losses.StrayLoadParameters
    strayLoadParameters "Stray load loss parameters";
  extends
    Modelica.Thermal.HeatTransfer.Interfaces.PartialElementaryConditionalHeatPortWithoutT(
      useHeatPort=false);
  SI.Current iRMS=quasiRMS(i);
equation
  v = {Complex(0, 0) for k in 1:m};
  if (strayLoadParameters.PRef <= 0) then
    tau = 0;
  else
    tau = -strayLoadParameters.tauRef*(iRMS/strayLoadParameters.IRef)^2*
      sign(w)*(abs(w)/strayLoadParameters.wRef)^strayLoadParameters.power_w;
  end if;
  lossPower = -tau*w;
end StrayLoad;


Sensor to measure magnetic flux. Sensor for magnetic flux.

within Modelica.Magnetic.QuasiStatic.FundamentalWave.Sensors;
model MagneticFluxSensor "Sensor to measure magnetic flux"
  extends Modelica.Icons.RoundSensor;
  extends Interfaces.TwoPortElementary;
  SI.ComplexMagneticPotentialDifference V_m
    "Complex magnetic potential difference";
  Modelica.ComplexBlocks.Interfaces.ComplexOutput Phi
    "Complex magnetic flux from por_ p to port_n as output signal"
 SI.MagneticFlux abs_Phi=Modelica.ComplexMath.abs(Phi)
    "Magnitude of complex magnetic flux";
  SI.Angle arg_Phi=Modelica.ComplexMath.arg(Phi)
    "Argument of complex magnetic flux";

equation
  // Flux into positive port
  port_p.V_m - port_n.V_m = V_m;
  // Magnetomotive force
  port_p.Phi = Phi;
  // Local flux balance
  port_p.Phi + port_n.Phi = Complex(0, 0);
  // No magnetic potential difference at sensor
  V_m = Complex(0, 0);
end MagneticFluxSensor;


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

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