Transformer Dz4.

within Modelica.Electrical.Machines.BasicMachines.Transformers.Dz;
model Dz04 "Transformer Dz4"
  extends Machines.Interfaces.PartialBasicTransformer(final VectorGroup="Dz04");
  Modelica.Electrical.Polyphase.Basic.Star star2(final m=m)
  Modelica.Electrical.Analog.Interfaces.NegativePin starpoint2
  Modelica.Electrical.Polyphase.Basic.Delta Rot21(final m=m)
  Modelica.Electrical.Polyphase.Basic.Delta Delta1(final m=m)
equation
  connect(star2.pin_n, starpoint2)
  connect(r1.plug_p, Delta1.plug_p)
  connect(l1sigma.plug_n, core.plug_p1)
  connect(Delta1.plug_n, core.plug_n1)
  connect(core.plug_p2, Rot21.plug_n)
  connect(core.plug_p3, Rot21.plug_p)
  connect(l2sigma.plug_n, core.plug_n2)
  connect(core.plug_n3, star2.plug_p)
end Dz04;


Transformer Dz6.

within Modelica.Electrical.Machines.BasicMachines.Transformers.Dz;
model Dz06 "Transformer Dz6"
  extends Machines.Interfaces.PartialBasicTransformer(final VectorGroup="Dz06");
  Modelica.Electrical.Polyphase.Basic.Star star2(final m=m)
  Modelica.Electrical.Analog.Interfaces.NegativePin starpoint2
  Modelica.Electrical.Polyphase.Basic.Delta Rot21(final m=m)
  Modelica.Electrical.Polyphase.Basic.Delta Delta1(final m=m)
equation
  connect(star2.pin_n, starpoint2)
  connect(r1.plug_p, Delta1.plug_p)
  connect(l1sigma.plug_n, core.plug_p1)
  connect(Delta1.plug_n, core.plug_n1)
  connect(core.plug_p2, Rot21.plug_p)
  connect(core.plug_p3, Rot21.plug_n)
  connect(core.plug_n3, star2.plug_p)
  connect(l2sigma.plug_n, core.plug_n2)
end Dz06;


Transformer Dz8.

within Modelica.Electrical.Machines.BasicMachines.Transformers.Dz;
model Dz08 "Transformer Dz8"
  extends Machines.Interfaces.PartialBasicTransformer(final VectorGroup="Dz08");
  Modelica.Electrical.Polyphase.Basic.Star star2(final m=m)
  Modelica.Electrical.Analog.Interfaces.NegativePin starpoint2
  Modelica.Electrical.Polyphase.Basic.Delta Rot21(final m=m)
  Modelica.Electrical.Polyphase.Basic.Delta Rot22(final m=m)
  Modelica.Electrical.Polyphase.Basic.Delta Delta1(final m=m)
equation
  connect(star2.pin_n, starpoint2)
  connect(r1.plug_p, Delta1.plug_p)
  connect(l1sigma.plug_n, core.plug_p1)
  connect(Delta1.plug_n, core.plug_n1)
  connect(core.plug_p2, Rot21.plug_n)
  connect(core.plug_p3, Rot21.plug_p)
  connect(core.plug_n3, star2.plug_p)
  connect(l2sigma.plug_n, Rot22.plug_n)
  connect(Rot22.plug_p, core.plug_n2)
end Dz08;


Transformer Dz10.

within Modelica.Electrical.Machines.BasicMachines.Transformers.Dz;
model Dz10 "Transformer Dz10"
  extends Machines.Interfaces.PartialBasicTransformer(final VectorGroup="Dz10");
  Modelica.Electrical.Polyphase.Basic.Star star2(final m=m)
  Modelica.Electrical.Analog.Interfaces.NegativePin starpoint2
  Modelica.Electrical.Polyphase.Basic.Delta Rot21(final m=m)
  Modelica.Electrical.Polyphase.Basic.Delta Rot22(final m=m)
  Modelica.Electrical.Polyphase.Basic.Delta Delta1(final m=m)
equation
  connect(star2.pin_n, starpoint2)
  connect(r1.plug_p, Delta1.plug_p)
  connect(l1sigma.plug_n, core.plug_p1)
  connect(Delta1.plug_n, core.plug_n1)
  connect(core.plug_p2, Rot21.plug_p)
  connect(core.plug_p3, Rot21.plug_n)
  connect(core.plug_n3, star2.plug_p)
  connect(l2sigma.plug_n, Rot22.plug_n)
  connect(Rot22.plug_p, core.plug_n2)
end Dz10;


within Modelica.Electrical.Machines.BasicMachines.Transformers;
package Dz "Transformers: primary D / secondary zig-zag"
  extends Modelica.Icons.VariantsPackage;
end Dz;


Transformers: primary Y / secondary d

within Modelica.Electrical.Machines.BasicMachines.Transformers;
package Yd "Transformers: primary Y / secondary d"
  extends Modelica.Icons.VariantsPackage;
end Yd;


Transformer Yd1.

within Modelica.Electrical.Machines.BasicMachines.Transformers.Yd;
model Yd01 "Transformer Yd1"
  extends Machines.Interfaces.PartialBasicTransformer(final VectorGroup="Yd01");
  Modelica.Electrical.Polyphase.Basic.Star star1(final m=m)
  Modelica.Electrical.Analog.Interfaces.NegativePin starpoint1
  Modelica.Electrical.Polyphase.Basic.Delta Delta2(final m=m)
equation
  connect(star1.pin_n, starpoint1)
  connect(Delta2.plug_p, r2.plug_p)
  connect(l1sigma.plug_n, core.plug_p1)
  connect(core.plug_n1, star1.plug_p)
  connect(core.plug_n2, core.plug_p3)
  connect(core.plug_n3, Delta2.plug_n)
  connect(core.plug_p2, l2sigma.plug_n)
end Yd01;


Transformer Yd3.

within Modelica.Electrical.Machines.BasicMachines.Transformers.Yd;
model Yd03 "Transformer Yd3"
  extends Machines.Interfaces.PartialBasicTransformer(final VectorGroup="Yd03");
  Modelica.Electrical.Polyphase.Basic.Star star1(final m=m)
  Modelica.Electrical.Analog.Interfaces.NegativePin starpoint1
  Modelica.Electrical.Polyphase.Basic.Delta Delta2(final m=m)
  Modelica.Electrical.Polyphase.Basic.Delta Rot2(final m=m)
equation
  connect(star1.pin_n, starpoint1)
  connect(Delta2.plug_n, r2.plug_p)
  connect(l2sigma.plug_n, Rot2.plug_p)
  connect(l1sigma.plug_n, core.plug_p1)
  connect(core.plug_n1, star1.plug_p)
  connect(core.plug_n2, core.plug_p3)
  connect(core.plug_p2, Delta2.plug_p)
  connect(core.plug_n3, Rot2.plug_n)
end Yd03;


Transformer Yd5.

within Modelica.Electrical.Machines.BasicMachines.Transformers.Yd;
model Yd05 "Transformer Yd5"
  extends Machines.Interfaces.PartialBasicTransformer(final VectorGroup="Yd05");
  Modelica.Electrical.Polyphase.Basic.Star star1(final m=m)
  Modelica.Electrical.Analog.Interfaces.NegativePin starpoint1
  Modelica.Electrical.Polyphase.Basic.Delta Delta2(final m=m)
equation
  connect(star1.pin_n, starpoint1)
  connect(Delta2.plug_n, r2.plug_p)
  connect(l1sigma.plug_n, core.plug_p1)
  connect(core.plug_n1, star1.plug_p)
  connect(core.plug_n2, core.plug_p3)
  connect(core.plug_n3, l2sigma.plug_n)
  connect(core.plug_p2, Delta2.plug_p)
end Yd05;


Transformer Yd7.

within Modelica.Electrical.Machines.BasicMachines.Transformers.Yd;
model Yd07 "Transformer Yd7"
  extends Machines.Interfaces.PartialBasicTransformer(final VectorGroup="Yd07");
  Modelica.Electrical.Polyphase.Basic.Star star1(final m=m)
  Modelica.Electrical.Analog.Interfaces.NegativePin starpoint1
  Modelica.Electrical.Polyphase.Basic.Delta Delta2(final m=m)
equation
  connect(star1.pin_n, starpoint1)
  connect(Delta2.plug_p, r2.plug_p)
  connect(l1sigma.plug_n, core.plug_p1)
  connect(core.plug_n1, star1.plug_p)
  connect(core.plug_n2, core.plug_p3)
  connect(core.plug_p2, Delta2.plug_n)
  connect(l2sigma.plug_n, core.plug_n3)
end Yd07;


Transformer Yd9.

within Modelica.Electrical.Machines.BasicMachines.Transformers.Yd;
model Yd09 "Transformer Yd9"
  extends Machines.Interfaces.PartialBasicTransformer(final VectorGroup="Yd09");
  Modelica.Electrical.Polyphase.Basic.Star star1(final m=m)
  Modelica.Electrical.Analog.Interfaces.NegativePin starpoint1
  Modelica.Electrical.Polyphase.Basic.Delta Delta2(final m=m)
  Modelica.Electrical.Polyphase.Basic.Delta Rot2(final m=m)
equation
  connect(star1.pin_n, starpoint1)
  connect(Rot2.plug_p, l2sigma.plug_n)
  connect(Delta2.plug_n, r2.plug_p)
  connect(l1sigma.plug_n, core.plug_p1)
  connect(core.plug_n1, star1.plug_p)
  connect(core.plug_n2, core.plug_p3)
  connect(core.plug_p2, Rot2.plug_n)
  connect(core.plug_n3, Delta2.plug_p)
end Yd09;


Transformer Yd11.

within Modelica.Electrical.Machines.BasicMachines.Transformers.Yd;
model Yd11 "Transformer Yd11"
  extends Machines.Interfaces.PartialBasicTransformer(final VectorGroup="Yd11");
  Modelica.Electrical.Polyphase.Basic.Star star1(final m=m)
  Modelica.Electrical.Analog.Interfaces.NegativePin starpoint1
  Modelica.Electrical.Polyphase.Basic.Delta Delta2(final m=m)
equation
  connect(star1.pin_n, starpoint1)
  connect(Delta2.plug_n, r2.plug_p)
  connect(l1sigma.plug_n, core.plug_p1)
  connect(core.plug_n1, star1.plug_p)
  connect(core.plug_n2, core.plug_p3)
  connect(core.plug_n3, Delta2.plug_p)
  connect(core.plug_p2, l2sigma.plug_n)
end Yd11;


Transformers: primary Y / secondary y

within Modelica.Electrical.Machines.BasicMachines.Transformers;
package Yy "Transformers: primary Y / secondary y"
  extends Modelica.Icons.VariantsPackage;
end Yy;


Transformer Yy0.

within Modelica.Electrical.Machines.BasicMachines.Transformers.Yy;
model Yy00 "Transformer Yy0"
  extends Machines.Interfaces.PartialBasicTransformer(final VectorGroup="Yy00");
  Modelica.Electrical.Polyphase.Basic.Star star1(final m=m)
  Modelica.Electrical.Analog.Interfaces.NegativePin starpoint1
  Modelica.Electrical.Polyphase.Basic.Star star2(final m=m)
  Modelica.Electrical.Analog.Interfaces.NegativePin starpoint2
equation
  connect(star1.pin_n, starpoint1)
  connect(star2.pin_n, starpoint2)
  connect(l1sigma.plug_n, core.plug_p1)
  connect(core.plug_n1, star1.plug_p)
  connect(core.plug_n2, core.plug_p3)
  connect(core.plug_p2, l2sigma.plug_n)
  connect(core.plug_n3, star2.plug_p)
end Yy00;


Transformer Yy2.

within Modelica.Electrical.Machines.BasicMachines.Transformers.Yy;
model Yy02 "Transformer Yy2"
  extends Machines.Interfaces.PartialBasicTransformer(final VectorGroup="Yy02");
  Modelica.Electrical.Polyphase.Basic.Star star1(final m=m)
  Modelica.Electrical.Analog.Interfaces.NegativePin starpoint1
  Modelica.Electrical.Polyphase.Basic.Star star2(final m=m)
  Modelica.Electrical.Analog.Interfaces.NegativePin starpoint2
  Modelica.Electrical.Polyphase.Basic.Delta Rot2(final m=m)
equation
  connect(star1.pin_n, starpoint1)
  connect(star2.pin_n, starpoint2)
  connect(l2sigma.plug_n, Rot2.plug_p)
  connect(l1sigma.plug_n, core.plug_p1)
  connect(core.plug_n2, core.plug_p3)
  connect(core.plug_n1, star1.plug_p)
  connect(core.plug_n3, Rot2.plug_n)
  connect(core.plug_p2, star2.plug_p)
end Yy02;


Transformer Yy4.

within Modelica.Electrical.Machines.BasicMachines.Transformers.Yy;
model Yy04 "Transformer Yy4"
  extends Machines.Interfaces.PartialBasicTransformer(final VectorGroup="Yy04");
  Modelica.Electrical.Polyphase.Basic.Star star1(final m=m)
  Modelica.Electrical.Analog.Interfaces.NegativePin starpoint1
  Modelica.Electrical.Polyphase.Basic.Star star2(final m=m)
  Modelica.Electrical.Analog.Interfaces.NegativePin starpoint2
  Modelica.Electrical.Polyphase.Basic.Delta Rot2(final m=m)
equation
  connect(star1.pin_n, starpoint1)
  connect(star2.pin_n, starpoint2)
  connect(Rot2.plug_n, l2sigma.plug_n)
  connect(l1sigma.plug_n, core.plug_p1)
  connect(core.plug_n1, star1.plug_p)
  connect(core.plug_n2, core.plug_p3)
  connect(core.plug_p2, Rot2.plug_p)
  connect(core.plug_n3, star2.plug_p)
end Yy04;


Transformer Yy6.

within Modelica.Electrical.Machines.BasicMachines.Transformers.Yy;
model Yy06 "Transformer Yy6"
  extends Machines.Interfaces.PartialBasicTransformer(final VectorGroup="Yy06");
  Modelica.Electrical.Polyphase.Basic.Star star1(final m=m)
  Modelica.Electrical.Analog.Interfaces.NegativePin starpoint1
  Modelica.Electrical.Polyphase.Basic.Star star2(final m=m)
  Modelica.Electrical.Analog.Interfaces.NegativePin starpoint2
equation
  connect(star1.pin_n, starpoint1)
  connect(star2.pin_n, starpoint2)
  connect(l1sigma.plug_n, core.plug_p1)
  connect(core.plug_n1, star1.plug_p)
  connect(core.plug_n2, core.plug_p3)
  connect(l2sigma.plug_n, core.plug_n3)
  connect(core.plug_p2, star2.plug_p)
end Yy06;


Transformer Yy8.

within Modelica.Electrical.Machines.BasicMachines.Transformers.Yy;
model Yy08 "Transformer Yy8"
  extends Machines.Interfaces.PartialBasicTransformer(final VectorGroup="Yy08");
  Modelica.Electrical.Polyphase.Basic.Star star1(final m=m)
  Modelica.Electrical.Analog.Interfaces.NegativePin starpoint1
  Modelica.Electrical.Polyphase.Basic.Star star2(final m=m)
  Modelica.Electrical.Analog.Interfaces.NegativePin starpoint2
  Modelica.Electrical.Polyphase.Basic.Delta Rot2(final m=m)
equation
  connect(star1.pin_n, starpoint1)
  connect(star2.pin_n, starpoint2)
  connect(Rot2.plug_p, l2sigma.plug_n)
  connect(l1sigma.plug_n, core.plug_p1)
  connect(core.plug_n1, star1.plug_p)
  connect(core.plug_n2, core.plug_p3)
  connect(core.plug_p2, Rot2.plug_n)
  connect(core.plug_n3, star2.plug_p)
end Yy08;


Transformer Yy10.

within Modelica.Electrical.Machines.BasicMachines.Transformers.Yy;
model Yy10 "Transformer Yy10"
  extends Machines.Interfaces.PartialBasicTransformer(final VectorGroup="Yy10");
  Modelica.Electrical.Polyphase.Basic.Star star1(final m=m)
  Modelica.Electrical.Analog.Interfaces.NegativePin starpoint1
  Modelica.Electrical.Polyphase.Basic.Star star2(final m=m)
  Modelica.Electrical.Analog.Interfaces.NegativePin starpoint2
  Modelica.Electrical.Polyphase.Basic.Delta Rot2(final m=m)
equation
  connect(star1.pin_n, starpoint1)
  connect(star2.pin_n, starpoint2)
  connect(l2sigma.plug_n, Rot2.plug_n)
  connect(l1sigma.plug_n, core.plug_p1)
  connect(core.plug_n1, star1.plug_p)
  connect(core.plug_n2, core.plug_p3)
  connect(core.plug_n3, Rot2.plug_p)
  connect(core.plug_p2, star2.plug_p)
end Yy10;


within Modelica.Electrical.Machines.BasicMachines.Transformers;
package Yz "Transformers: primary Y / secondary zig-zag"
  extends Modelica.Icons.VariantsPackage;
end Yz;


Transformer Yz1.

within Modelica.Electrical.Machines.BasicMachines.Transformers.Yz;
model Yz01 "Transformer Yz1"
  extends Machines.Interfaces.PartialBasicTransformer(final VectorGroup="Yz01");
  Modelica.Electrical.Polyphase.Basic.Star star1(final m=m)
  Modelica.Electrical.Analog.Interfaces.NegativePin starpoint1
  Modelica.Electrical.Polyphase.Basic.Star star2(final m=m)
  Modelica.Electrical.Analog.Interfaces.NegativePin starpoint2
  Modelica.Electrical.Polyphase.Basic.Delta Rot21(final m=m)
  Modelica.Electrical.Polyphase.Basic.Delta Rot22(final m=m)
equation
  connect(star1.pin_n, starpoint1)
  connect(star2.pin_n, starpoint2)
  connect(l1sigma.plug_n, core.plug_p1)
  connect(core.plug_n1, star1.plug_p)
  connect(core.plug_p2, Rot21.plug_n)
  connect(core.plug_p3, Rot21.plug_p)
  connect(l2sigma.plug_n, Rot22.plug_p)
  connect(Rot22.plug_n, core.plug_n2)
  connect(core.plug_n3, star2.plug_p)
end Yz01;


Transformer Yz3.

within Modelica.Electrical.Machines.BasicMachines.Transformers.Yz;
model Yz03 "Transformer Yz3"
  extends Machines.Interfaces.PartialBasicTransformer(final VectorGroup="Yz03");
  Modelica.Electrical.Polyphase.Basic.Star star1(final m=m)
  Modelica.Electrical.Analog.Interfaces.NegativePin starpoint1
  Modelica.Electrical.Polyphase.Basic.Star star2(final m=m)
  Modelica.Electrical.Analog.Interfaces.NegativePin starpoint2
  Modelica.Electrical.Polyphase.Basic.Delta Rot21(final m=m)
  Modelica.Electrical.Polyphase.Basic.Delta Rot22(final m=m)
equation
  connect(star1.pin_n, starpoint1)
  connect(star2.pin_n, starpoint2)
  connect(l1sigma.plug_n, core.plug_p1)
  connect(core.plug_n1, star1.plug_p)
  connect(core.plug_p2, Rot21.plug_p)
  connect(core.plug_p3, Rot21.plug_n)
  connect(l2sigma.plug_n, Rot22.plug_p)
  connect(Rot22.plug_n, core.plug_n2)
  connect(core.plug_n3, star2.plug_p)
end Yz03;


Transformer Yz5.

within Modelica.Electrical.Machines.BasicMachines.Transformers.Yz;
model Yz05 "Transformer Yz5"
  extends Machines.Interfaces.PartialBasicTransformer(final VectorGroup="Yz05");
  Modelica.Electrical.Polyphase.Basic.Star star1(final m=m)
  Modelica.Electrical.Analog.Interfaces.NegativePin starpoint1
  Modelica.Electrical.Polyphase.Basic.Star star2(final m=m)
  Modelica.Electrical.Analog.Interfaces.NegativePin starpoint2
  Modelica.Electrical.Polyphase.Basic.Delta Rot21(final m=m)
equation
  connect(star1.pin_n, starpoint1)
  connect(star2.pin_n, starpoint2)
  connect(l1sigma.plug_n, core.plug_p1)
  connect(core.plug_n1, star1.plug_p)
  connect(core.plug_p2, Rot21.plug_n)
  connect(core.plug_p3, Rot21.plug_p)
  connect(core.plug_n3, star2.plug_p)
  connect(l2sigma.plug_n, core.plug_n2)
end Yz05;


Transformer Yz7.

within Modelica.Electrical.Machines.BasicMachines.Transformers.Yz;
model Yz07 "Transformer Yz7"
  extends Machines.Interfaces.PartialBasicTransformer(final VectorGroup="Yz07");
  Modelica.Electrical.Polyphase.Basic.Star star1(final m=m)
  Modelica.Electrical.Analog.Interfaces.NegativePin starpoint1
  Modelica.Electrical.Polyphase.Basic.Star star2(final m=m)
  Modelica.Electrical.Analog.Interfaces.NegativePin starpoint2
  Modelica.Electrical.Polyphase.Basic.Delta Rot21(final m=m)
equation
  connect(star1.pin_n, starpoint1)
  connect(star2.pin_n, starpoint2)
  connect(l1sigma.plug_n, core.plug_p1)
  connect(core.plug_n1, star1.plug_p)
  connect(core.plug_p2, Rot21.plug_p)
  connect(core.plug_p3, Rot21.plug_n)
  connect(l2sigma.plug_n, core.plug_n2)
  connect(core.plug_n3, star2.plug_p)
end Yz07;


Transformer Yz9.

within Modelica.Electrical.Machines.BasicMachines.Transformers.Yz;
model Yz09 "Transformer Yz9"
  extends Machines.Interfaces.PartialBasicTransformer(final VectorGroup="Yz09");
  Modelica.Electrical.Polyphase.Basic.Star star1(final m=m)
  Modelica.Electrical.Analog.Interfaces.NegativePin starpoint1
  Modelica.Electrical.Polyphase.Basic.Star star2(final m=m)
  Modelica.Electrical.Analog.Interfaces.NegativePin starpoint2
  Modelica.Electrical.Polyphase.Basic.Delta Rot21(final m=m)
  Modelica.Electrical.Polyphase.Basic.Delta Rot22(final m=m)
equation
  connect(star1.pin_n, starpoint1)
  connect(star2.pin_n, starpoint2)
  connect(l1sigma.plug_n, core.plug_p1)
  connect(core.plug_n1, star1.plug_p)
  connect(core.plug_p2, Rot21.plug_n)
  connect(core.plug_p3, Rot21.plug_p)
  connect(core.plug_n3, star2.plug_p)
  connect(l2sigma.plug_n, Rot22.plug_n)
  connect(Rot22.plug_p, core.plug_n2)
end Yz09;


Transformer Yz11.

within Modelica.Electrical.Machines.BasicMachines.Transformers.Yz;
model Yz11 "Transformer Yz11"
  extends Machines.Interfaces.PartialBasicTransformer(final VectorGroup="Yz11");
  Modelica.Electrical.Polyphase.Basic.Star star1(final m=m)
  Modelica.Electrical.Analog.Interfaces.NegativePin starpoint1
  Modelica.Electrical.Polyphase.Basic.Star star2(final m=m)
  Modelica.Electrical.Analog.Interfaces.NegativePin starpoint2
  Modelica.Electrical.Polyphase.Basic.Delta Rot21(final m=m)
  Modelica.Electrical.Polyphase.Basic.Delta Rot22(final m=m)
equation
  connect(star1.pin_n, starpoint1)
  connect(star2.pin_n, starpoint2)
  connect(l1sigma.plug_n, core.plug_p1)
  connect(core.plug_n1, star1.plug_p)
  connect(core.plug_p2, Rot21.plug_p)
  connect(core.plug_p3, Rot21.plug_n)
  connect(l2sigma.plug_n, Rot22.plug_n)
  connect(Rot22.plug_p, core.plug_n2)
  connect(core.plug_n3, star2.plug_p)
end Yz11;


Test examples

within Modelica.Electrical.Machines;
package Examples "Test examples"
  extends Modelica.Icons.ExamplesPackage;
end Examples;


Current controlled DC PM drive with H-bridge from battery. This model demonstrates how a current controller for a DC PM drive works.

within Modelica.Electrical.Machines.Examples.ControlledDCDrives;
model CurrentControlledDCPM
  "Current controlled DC PM drive with H-bridge from battery"
  extends Utilities.PartialControlledDCPM;
  Modelica.Mechanics.Rotational.Sources.QuadraticSpeedDependentTorque
    loadTorque(
    tau_nominal=-driveData.tauNominal,
    TorqueDirection=false,
    w_nominal=driveData.motorData.wNominal)
  Modelica.Blocks.Sources.Step step(
    offset=0,
    startTime=0.2,
    height=driveData.tauNominal)
equation
  connect(loadInertia.flange_b, loadTorque.flange)
  connect(step.y, tau2i.u)
end CurrentControlledDCPM;


Test examples of controlled DC drives

within Modelica.Electrical.Machines.Examples;
package ControlledDCDrives "Test examples of controlled DC drives"
  extends Modelica.Icons.ExamplesPackage;
end ControlledDCDrives;


Position controlled DC PM drive with H-bridge from battery. This model demonstrates how a position controller for a speed controlled DC PM drive works.

within Modelica.Electrical.Machines.Examples.ControlledDCDrives;
model PositionControlledDCPM
  "Position controlled DC PM drive with H-bridge from battery"
  extends Utilities.PartialControlledDCPM;
  Modelica.Mechanics.Rotational.Sources.TorqueStep loadTorque(
    stepTorque=-driveData.tauNominal,
    offsetTorque=0,
    startTime=2.3)
  Utilities.LimitedPI speedController(
    initType=Modelica.Blocks.Types.Init.InitialOutput,
    k=driveData.kpw,
    Ti=driveData.Tiw,
    constantLimits=true,
    yMax=driveData.tauMax)
  Utilities.LimitedPI positionController(
    constantLimits=true,
    k=driveData.kpP,
    useI=false,
    yMax=driveData.wMax,
    initType=Modelica.Blocks.Types.Init.SteadyState)
  Modelica.Mechanics.Rotational.Sensors.AngleSensor angleSensor
  Modelica.Blocks.Sources.KinematicPTP2 kinematicPTP(
    qd_max={driveData.wMax},
    qdd_max={driveData.aMax},
    q_end={200},
    startTime=0.2)
equation
  connect(positionController.y, speedController.u)
  connect(angleSensor.phi, positionController.u_m)
  connect(kinematicPTP.q[1], positionController.u)
  connect(speedSensor.flange, angleSensor.flange)
  connect(speedSensor.w, speedController.u_m)
  connect(loadInertia.flange_b, loadTorque.flange)
  connect(speedController.y, tau2i.u)
end PositionControlledDCPM;


Speed controlled DC PM drive with H-bridge from battery. This model demonstrates how a speed controller for a current controlled DC PM drive works.

within Modelica.Electrical.Machines.Examples.ControlledDCDrives;
model SpeedControlledDCPM
  "Speed controlled DC PM drive with H-bridge from battery"
  extends Utilities.PartialControlledDCPM;
  Modelica.Mechanics.Rotational.Sources.TorqueStep loadTorque(
    stepTorque=-driveData.tauNominal,
    offsetTorque=0,
    startTime=0.8)
  Utilities.LimitedPI speedController(
    initType=Modelica.Blocks.Types.Init.InitialOutput,
    k=driveData.kpw,
    Ti=driveData.Tiw,
    constantLimits=true,
    yMax=driveData.tauMax)
  Modelica.Blocks.Continuous.FirstOrder preFilter(
    k=1,
    T=driveData.Tfw,
    initType=Modelica.Blocks.Types.Init.InitialOutput)
  Modelica.Blocks.Sources.Step step(
    offset=0,
    height=driveData.motorData.wNominal,
    startTime=0.2)
  Modelica.Blocks.Nonlinear.SlewRateLimiter slewRateLimiter(initType=Modelica.Blocks.Types.Init.InitialOutput,
      Rising=driveData.aMax)
equation
  connect(step.y, preFilter.u)
  connect(loadInertia.flange_b, loadTorque.flange)
  connect(speedSensor.w, speedController.u_m)
  connect(speedController.y, tau2i.u)
  connect(step.y, slewRateLimiter.u)
  connect(speedController.u, preFilter.y)
end SpeedControlledDCPM;


DC-DC inverter. This is a model of a DC-DC inverter. The level of detail of the DC-DC inverter may be chosen from ideal averaging or switching.

within Modelica.Electrical.Machines.Examples.ControlledDCDrives.Utilities;
model DcdcInverter "DC-DC inverter"
  parameter Boolean useIdealInverter=true "Use ideal averaging inverter, otherwise switching inverter";
  parameter SI.Frequency fS "Switching frequency";
  parameter SI.Time Td=0.5/fS "Dead time";
  parameter SI.Time Tmf=2/fS "Measurement filter time constant";
  parameter SI.Voltage VMax "Maximum Voltage";
  parameter SI.Time Ti=1e-6 "Time constant of integral power controller"
  parameter SI.Resistance RonT=1e-05
    "Transistor closed resistance"
  parameter SI.Conductance GoffT=1e-05
    "Transistor opened conductance"
  parameter SI.Voltage VkneeT=0
    "Transistor threshold voltage"
  parameter SI.Resistance RonD=1e-05
    "Diode closed resistance"
  parameter SI.Conductance GoffD=1e-05
    "Diode opened conductance"
  parameter SI.Voltage VkneeD=0 "Diode threshold voltage"
  output SI.Power pDC=vDC*iDC "DC power (from battery)";
  output SI.Power pMot=vMot*iMot "Power to motor";
  Modelica.Electrical.Analog.Interfaces.PositivePin pin_pBat
  Modelica.Electrical.Analog.Interfaces.NegativePin pin_nBat
  Modelica.Electrical.Analog.Interfaces.PositivePin pin_pMot
  Modelica.Electrical.Analog.Interfaces.NegativePin pin_nMot

  Modelica.Blocks.Interfaces.RealInput vRef
  Modelica.Blocks.Interfaces.RealOutput vDC
  Modelica.Blocks.Interfaces.RealOutput iDC

  Modelica.Blocks.Interfaces.RealOutput vMot
  Modelica.Blocks.Interfaces.RealOutput iMot
  Modelica.Electrical.Analog.Sensors.VoltageSensor vDCSensor
  Modelica.Electrical.Analog.Sensors.CurrentSensor iMotSensor
  Modelica.Blocks.Nonlinear.VariableLimiter variableLimiter
  Modelica.Blocks.Math.Gain gain(k=-1)
  Modelica.Blocks.Continuous.FirstOrder vDCFilter(
    k=1,
    T=Tmf,
    initType=Modelica.Blocks.Types.Init.InitialOutput,
    y_start=VMax)
  Modelica.Blocks.Continuous.FirstOrder iMotFilter(
    k=1,
    T=Tmf,
    initType=Modelica.Blocks.Types.Init.InitialOutput,
    y_start=0)
  IdealDcDc idealDcDc(Td=Td, Ti=Ti) if useIdealInverter
  SwitchingDcDc switchingDcDc(
    fS=fS,
    VMax=VMax,
    RonT=RonT,
    GoffT=GoffT,
    VkneeT=VkneeT,
    RonD=RonD,
    GoffD=GoffD,
    VkneeD=VkneeD) if not useIdealInverter
  Modelica.Electrical.Analog.Sensors.CurrentSensor iDCSensor
  Modelica.Electrical.Analog.Sensors.VoltageSensor vMotSensor
  Modelica.Blocks.Continuous.FirstOrder vMotFilter(
    k=1,
    T=Tmf,
    initType=Modelica.Blocks.Types.Init.InitialOutput,
    y_start=0)
  Modelica.Blocks.Continuous.FirstOrder iDCFilter(
    k=1,
    T=Tmf,
    initType=Modelica.Blocks.Types.Init.InitialOutput,
    y_start=0)
equation
  connect(iMotSensor.p, pin_nMot)
  connect(vRef, variableLimiter.u)
  connect(gain.y, variableLimiter.limit2)
  connect(iMotSensor.i, iMotFilter.u)
  connect(iMotFilter.y, iMot)
  connect(vDCFilter.y, vDC)
  connect(vDCFilter.y, gain.u)
  connect(vDCFilter.y, variableLimiter.limit1)
  connect(variableLimiter.y, idealDcDc.vRef)
  connect(variableLimiter.y, switchingDcDc.vRef)
  connect(vDCFilter.y, switchingDcDc.vMax)
  connect(iDCSensor.p, pin_pBat)
  connect(iMotSensor.n, switchingDcDc.pin_nMot)
  connect(vMotFilter.y, vMot)
  connect(iDCSensor.i, iDCFilter.u)
  connect(iDCFilter.y, iDC)
  connect(idealDcDc.pin_pBat, iDCSensor.n)
  connect(pin_nBat, switchingDcDc.pin_nBat)
  connect(pin_nBat, idealDcDc.pin_nBat)
  connect(iDCSensor.n, switchingDcDc.pin_pBat)
  connect(iMotSensor.n, idealDcDc.pin_nMot)
  connect(idealDcDc.pin_pMot, pin_pMot)
  connect(pin_pMot, switchingDcDc.pin_pMot)
  connect(pin_nBat, vDCSensor.n)
  connect(pin_pBat, vDCSensor.p)
  connect(pin_nMot, vMotSensor.n)
  connect(pin_pMot, vMotSensor.p)
  connect(vMotFilter.u, vMotSensor.v)
  connect(vDCFilter.u, vDCSensor.v)
end DcdcInverter;


Ideal DC-DC inverter. This is a model of an ideal DC-DC inverter based on a power balance achieved by an integral controller.

within Modelica.Electrical.Machines.Examples.ControlledDCDrives.Utilities;
model IdealDcDc "Ideal DC-DC inverter"
  parameter SI.Time Td "Dead time";
  parameter SI.Time Ti=1e-6 "Time constant of integral power controller";
  Modelica.Electrical.Analog.Sources.SignalVoltage signalVoltage
  Modelica.Electrical.Analog.Sources.SignalCurrent signalCurrent
  Modelica.Electrical.Analog.Sensors.PowerSensor powerBat
  Modelica.Electrical.Analog.Sensors.PowerSensor powerMot
  Modelica.Blocks.Continuous.FirstOrder deadTime(
    k=1,
    initType=Modelica.Blocks.Types.Init.InitialOutput,
    y_start=0,
    T=Td)
  Modelica.Blocks.Math.Feedback feedback
  Modelica.Blocks.Continuous.Integrator powerController(
    initType=Modelica.Blocks.Types.Init.InitialOutput,
    y_start=0,
    k=1/Ti/unitVoltage)
  Modelica.Electrical.Analog.Basic.Ground groundMotor
  Modelica.Electrical.Analog.Interfaces.NegativePin pin_nBat
  Modelica.Electrical.Analog.Interfaces.PositivePin pin_pBat
  Modelica.Electrical.Analog.Interfaces.NegativePin pin_nMot
  Modelica.Electrical.Analog.Interfaces.PositivePin pin_pMot
  Modelica.Blocks.Interfaces.RealInput vRef
protected
  constant SI.Voltage unitVoltage=1
equation
  connect(signalCurrent.p, powerBat.nc)
  connect(powerBat.pv, powerBat.pc)
  connect(signalVoltage.p, powerMot.pc)
  connect(powerMot.pc, powerMot.pv)
  connect(powerBat.power, feedback.u2)
  connect(powerMot.power, feedback.u1)
  connect(feedback.y, powerController.u)
  connect(powerController.y, signalCurrent.i)
  connect(pin_nBat, signalCurrent.n)
  connect(pin_pBat, powerBat.pc)
  connect(pin_nBat, powerBat.nv)
  connect(pin_nMot, powerMot.nv)
  connect(pin_pMot, powerMot.nc)
  connect(pin_nMot, groundMotor.p)
  connect(deadTime.y, signalVoltage.v)
  connect(vRef, deadTime.u)
  connect(signalVoltage.n, pin_nMot)
end IdealDcDc;


Limited PI controller with anti-windup and feed-forward. Proportional - Integral - controller with optional feed-forward and limitation at the output.

within Modelica.Electrical.Machines.Examples.ControlledDCDrives.Utilities;
block LimitedPI
  "Limited PI controller with anti-windup and feed-forward"
  extends Modelica.Blocks.Interfaces.SISO;
  import Modelica.Blocks.Types.Init;
  import Modelica.Constants.inf;
  Modelica.Blocks.Interfaces.RealInput u_m "Connector of measured signal"
  Modelica.Blocks.Interfaces.RealInput feedForward if useFF
    "Connector of feed-forward signal"
  Modelica.Blocks.Interfaces.RealInput kFF if useFF and not useConstantKFF
    "Connector of feed-forward factor"
  Modelica.Blocks.Interfaces.RealInput yMaxVar if not constantLimits
    "Connector of yMax input signal"
  Modelica.Blocks.Interfaces.RealInput yMinVar if not constantLimits and not symmetricLimits
    "Connector of yMin input signal"
  output Real controlError = u - u_m
    "Control error (set point - measurement)";
  parameter Real k=1 "Gain";
  parameter Boolean useI=true "PI else P"
  parameter SI.Time Ti(min=Modelica.Constants.small)=1
    "Integral time constant (T>0 required)"
  parameter Boolean useFF=false "Use feed-forward?"
  parameter Boolean useConstantKFF=true "Use constant feed-forward factor?"
  parameter Real KFF=1 "Feed-forward gain"
  parameter Boolean constantLimits=true "Use constant limits?"
  parameter Boolean symmetricLimits=true "Use symmetric limits?"
  parameter Real yMax = inf "Upper limit of output"
  parameter Real yMin=-yMax "Lower limit of output"
  parameter Modelica.Blocks.Types.Init initType=Modelica.Blocks.Types.Init.NoInit
    "Type of initialization (1: no init, 2: steady state, 3: initial state, 4: initial output)"
  parameter Real x_start=0 "Initial or guess value of state"
  parameter Real y_start=0 "Initial value of output"
  Modelica.Blocks.Math.Feedback feedback

  Modelica.Blocks.Math.Add addAntiWindup(k1=1, k2=-1/k)
  Modelica.Blocks.Continuous.Integrator integrator(k=1/Ti, initType=Modelica.Blocks.Types.Init.NoInit) if useI
  Modelica.Blocks.Math.Add3 add3(
    k1=k,
    k2=k,
    k3=1)
  Modelica.Blocks.Nonlinear.VariableLimiter variableLimiter
  Modelica.Blocks.Math.Feedback addSat
  Modelica.Blocks.Math.Product product
protected
  Modelica.Blocks.Sources.Constant zeroI(k=0) if not useI
  Modelica.Blocks.Sources.Constant zeroFF(k=0) if not useFF
  Modelica.Blocks.Sources.Constant constantKFF(k=KFF) if not useFF or
    useConstantKFF
  Modelica.Blocks.Sources.Constant yMaxConst(k=yMax) if constantLimits
  Modelica.Blocks.Sources.Constant yMinConst(k=yMin) if constantLimits and not symmetricLimits
  Modelica.Blocks.Math.Gain gain(k=-1) if symmetricLimits

initial equation
  if initType == Init.SteadyState and useI then
    der(add3.u2) = 0;
  elseif initType == Init.InitialState and useI then
    add3.u2 = x_start;
  elseif initType == Init.InitialOutput then
    add3.y = y_start;
  end if;

equation
  connect(addAntiWindup.y, integrator.u)
  connect(integrator.y, add3.u2)
  connect(add3.y, variableLimiter.u)
  connect(variableLimiter.y, y)
  connect(add3.y, addSat.u1)
  connect(variableLimiter.y, addSat.u2)
  connect(add3.u2, zeroI.y)
  connect(u, feedback.u1)
  connect(feedback.y, add3.u1)
  connect(feedback.y, addAntiWindup.u1)
  connect(u_m, feedback.u2)
  connect(addSat.y, addAntiWindup.u2)
  connect(yMinVar, variableLimiter.limit2)
  connect(variableLimiter.limit2, yMinConst.y)
  connect(yMaxVar, variableLimiter.limit1)
  connect(variableLimiter.limit1, yMaxConst.y)
  connect(variableLimiter.limit2, gain.y)
  connect(variableLimiter.limit1, gain.u)
  connect(product.y, add3.u3)
  connect(feedForward, product.u1)
  connect(product.u1, zeroFF.y)
  connect(constantKFF.y, product.u2)
  connect(product.u2, kFF)
end LimitedPI;


Utilities for controlled drives

within Modelica.Electrical.Machines.Examples.ControlledDCDrives;
package Utilities "Utilities for controlled drives"
  extends Modelica.Icons.UtilitiesPackage;
end Utilities;


Partial controlled DC PM drive with H-bridge from battery. This is a partial model of a controlled DC PM drive.

within Modelica.Electrical.Machines.Examples.ControlledDCDrives.Utilities;
partial model PartialControlledDCPM
  "Partial controlled DC PM drive with H-bridge from battery"
  extends Modelica.Icons.Example;
  replaceable parameter DriveDataDCPM driveData constrainedby
    ControlledDCDrives.Utilities.DriveDataDCPM "DC machine data"
  Modelica.Mechanics.Rotational.Components.Inertia loadInertia(J=driveData.JL)
  Modelica.Mechanics.Rotational.Sensors.SpeedSensor speedSensor
  Modelica.Electrical.Machines.BasicMachines.DCMachines.DC_PermanentMagnet dcpm(
    TaOperational=driveData.motorData.TaNominal,
    VaNominal=driveData.motorData.VaNominal,
    IaNominal=driveData.motorData.IaNominal,
    wNominal=driveData.motorData.wNominal,
    TaNominal=driveData.motorData.TaNominal,
    Ra=driveData.motorData.Ra,
    TaRef=driveData.motorData.TaRef,
    La=driveData.motorData.La,
    Jr=driveData.motorData.Jr,
    frictionParameters=driveData.motorData.frictionParameters,
    phiMechanical(fixed=true),
    wMechanical(fixed=true),
    coreParameters=driveData.motorData.coreParameters,
    strayLoadParameters=driveData.motorData.strayLoadParameters,
    brushParameters=driveData.motorData.brushParameters,
    ia(fixed=true),
    Js=driveData.motorData.Js,
    alpha20a=driveData.motorData.alpha20a)
  DcdcInverter armatureInverter(
    fS=driveData.fS,
    Td=driveData.Td,
    Tmf=driveData.Tmf,
    VMax=driveData.VaMax)
  LimitedPI currentController(
    constantLimits=false,
    k=driveData.kpI,
    Ti=driveData.TiI,
    KFF=driveData.kPhi,
    initType=Modelica.Blocks.Types.Init.InitialOutput,
    useFF=true)
  Modelica.Blocks.Math.Gain tau2i(k=1/driveData.kPhi)
  Analog.Sources.ConstantVoltage constantVoltage(V=
        driveData.VBat)
  Analog.Basic.Resistor resistor(R=0.05*driveData.VBat/driveData.motorData.IaNominal)
  Analog.Basic.Ground ground
equation
  connect(dcpm.flange, loadInertia.flange_a)
  connect(speedSensor.flange, dcpm.flange)
  connect(armatureInverter.pin_nMot, dcpm.pin_an)
  connect(armatureInverter.pin_pMot, dcpm.pin_ap)
  connect(armatureInverter.vDC, currentController.yMaxVar)
  connect(armatureInverter.vRef, currentController.y)
  connect(armatureInverter.iMot, currentController.u_m)
  connect(speedSensor.w, currentController.feedForward)
  connect(tau2i.y, currentController.u)
  connect(ground.p, constantVoltage.n)
  connect(constantVoltage.n, armatureInverter.pin_nBat)
  connect(constantVoltage.p, resistor.p)
  connect(resistor.n, armatureInverter.pin_pBat)
end PartialControlledDCPM;


Switching DC-DC inverter. This is a model of a switching DC-DC inverter based on a H-bridge.

within Modelica.Electrical.Machines.Examples.ControlledDCDrives.Utilities;
model SwitchingDcDc "Switching DC-DC inverter"
  parameter SI.Frequency fS "Switching frequency";
  parameter SI.Voltage VMax "Maximum Voltage";
  parameter SI.Resistance RonT=1e-05
    "Transistor closed resistance";
  parameter SI.Conductance GoffT=1e-05
    "Transistor opened conductance";
  parameter SI.Voltage VkneeT=0
    "Transistor threshold voltage";
  parameter SI.Resistance RonD=1e-05
    "Diode closed resistance";
  parameter SI.Conductance GoffD=1e-05
    "Diode opened conductance";
  parameter SI.Voltage VkneeD=0 "Diode threshold voltage";
  Modelica.Electrical.PowerConverters.DCDC.Control.Voltage2DutyCycle
    adaptor(useConstantVoltageLimit=false, VLim=VMax)
  Modelica.Electrical.PowerConverters.DCDC.Control.SignalPWM pwm(
      useConstantDutyCycle=false, f=fS)
  Modelica.Electrical.PowerConverters.DCDC.HBridge dcdc(
    RonTransistor=RonT,
    GoffTransistor=GoffT,
    VkneeTransistor=VkneeT,
    RonDiode=RonD,
    GoffDiode=GoffD,
    VkneeDiode=VkneeD)
  Modelica.Electrical.Analog.Interfaces.NegativePin pin_nBat
  Modelica.Electrical.Analog.Interfaces.PositivePin pin_pBat
  Modelica.Electrical.Analog.Interfaces.PositivePin pin_pMot
  Modelica.Electrical.Analog.Interfaces.NegativePin pin_nMot
  Modelica.Blocks.Interfaces.RealInput vRef
  Modelica.Blocks.Interfaces.RealInput vMax
equation
  connect(adaptor.dutyCycle, pwm.dutyCycle)
  connect(pwm.fire, dcdc.fire_p)
  connect(pwm.notFire, dcdc.fire_n)
  connect(pin_nBat, dcdc.dc_n1)
  connect(pin_pBat, dcdc.dc_p1)
  connect(dcdc.dc_p2, pin_pMot)
  connect(pin_nMot, dcdc.dc_n2)
  connect(vRef, adaptor.v)
  connect(vMax, adaptor.vLim)
end SwitchingDcDc;


Test example: DC with electrical excitation starting with voltage ramp.

within Modelica.Electrical.Machines.Examples.DCMachines;
model DCEE_Start
  "Test example: DC with electrical excitation starting with voltage ramp"
  extends Modelica.Icons.Example;
  parameter SI.Voltage Va=100 "Actual armature voltage";
  parameter SI.Time tStart=0.2
    "Start of armature voltage ramp";
  parameter SI.Time tRamp=0.8 "Armature voltage ramp";
  parameter SI.Voltage Ve=100 "Actual excitation voltage";
  parameter SI.Torque TLoad=63.66 "Nominal load torque";
  parameter SI.Time tStep=1.5 "Time of load torque step";
  parameter SI.Inertia JLoad=0.15
    "Load's moment of inertia";
  Machines.BasicMachines.DCMachines.DC_ElectricalExcited dcee(
    VaNominal=dceeData.VaNominal,
    IaNominal=dceeData.IaNominal,
    wNominal=dceeData.wNominal,
    TaNominal=dceeData.TaNominal,
    Ra=dceeData.Ra,
    TaRef=dceeData.TaRef,
    La=dceeData.La,
    Jr=dceeData.Jr,
    useSupport=false,
    Js=dceeData.Js,
    frictionParameters=dceeData.frictionParameters,
    coreParameters=dceeData.coreParameters,
    strayLoadParameters=dceeData.strayLoadParameters,
    brushParameters=dceeData.brushParameters,
    IeNominal=dceeData.IeNominal,
    Re=dceeData.Re,
    TeRef=dceeData.TeRef,
    Le=dceeData.Le,
    sigmae=dceeData.sigmae,
    TaOperational=293.15,
    alpha20a=dceeData.alpha20a,
    phiMechanical(fixed=true),
    wMechanical(fixed=true),
    ia(fixed=true),
    alpha20e=dceeData.alpha20e,
    TeOperational=293.15,
    ie(fixed=true))
  Modelica.Blocks.Sources.Ramp ramp(
    duration=tRamp,
    height=Va,
    startTime=tStart)
  Modelica.Electrical.Analog.Sources.SignalVoltage signalVoltage
  Modelica.Electrical.Analog.Basic.Ground ground
  Modelica.Electrical.Analog.Sources.ConstantVoltage constantVoltage(V=Ve)
  Modelica.Electrical.Analog.Basic.Ground groundExcitation
  Modelica.Mechanics.Rotational.Components.Inertia loadInertia(J=JLoad)
  Modelica.Mechanics.Rotational.Sources.TorqueStep loadTorqueStep(
    startTime=tStep,
    stepTorque=-TLoad,
    useSupport=false,
    offsetTorque=0)
  parameter Utilities.ParameterRecords.DcElectricalExcitedData dceeData "DC machine data"
equation
  connect(ramp.y, signalVoltage.v)
  connect(signalVoltage.p, dcee.pin_ap)
  connect(signalVoltage.n, ground.p)
  connect(dcee.pin_an, ground.p)
  connect(constantVoltage.n, groundExcitation.p)
  connect(dcee.pin_ep, constantVoltage.p)
  connect(dcee.pin_en, constantVoltage.n)
  connect(loadInertia.flange_b, loadTorqueStep.flange)
  connect(dcee.flange, loadInertia.flange_a)
end DCEE_Start;


Test example: Cooling of a DCPM motor.

within Modelica.Electrical.Machines.Examples.DCMachines;
model DCPM_Cooling "Test example: Cooling of a DCPM motor"
  extends Modelica.Icons.Example;
  parameter SI.Voltage Va=100 "Actual armature voltage";
  parameter SI.Voltage Ve=100 "Actual excitation voltage";
  parameter SI.AngularVelocity w0=
      Modelica.Units.Conversions.from_rpm(1500) "No-load speed";
  parameter SI.Torque TLoad=63.66 "Nominal load torque";
  parameter SI.Inertia JLoad=0.15
    "Load's moment of inertia";
  parameter SI.Temperature TAmbient=293.15
    "Ambient temperature";
  parameter SI.HeatCapacity Ca=20
    "Armature's heat capacity";
  parameter SI.HeatCapacity Cc=50 "Core's heat capacity";
  final parameter SI.Power Losses=dcpm.Ra*dcpm.IaNominal^2
    "Nominal Losses";
  final parameter SI.Temperature T0=293.15
    "Reference temperature 20 degC";
  final parameter SI.TemperatureDifference dTCoolant=10
    "Coolant's temperature rise";
  final parameter SI.TemperatureDifference dTArmature=dcpm.TaNominal
       - T0 - dTCoolant/2 "Armature's temperature rise over coolant";
  parameter SI.ThermalConductance G_armature_core=2*Losses/
      dTArmature "Heat conductance armature - core";
  parameter SI.ThermalConductance G_core_cooling=2*Losses/
      dTArmature "Heat conductance core - cooling";
  parameter SI.VolumeFlowRate CoolantFlow=50 "Coolant flow";
  Machines.BasicMachines.DCMachines.DC_PermanentMagnet dcpm(
    wMechanical(start=w0, fixed=true),
    VaNominal=dcpmData.VaNominal,
    IaNominal=dcpmData.IaNominal,
    wNominal=dcpmData.wNominal,
    TaNominal=dcpmData.TaNominal,
    Ra=dcpmData.Ra,
    TaRef=dcpmData.TaRef,
    La=dcpmData.La,
    Jr=dcpmData.Jr,
    useSupport=false,
    Js=dcpmData.Js,
    frictionParameters=dcpmData.frictionParameters,
    coreParameters=dcpmData.coreParameters,
    strayLoadParameters=dcpmData.strayLoadParameters,
    brushParameters=dcpmData.brushParameters,
    phiMechanical(fixed=true),
    ia(fixed=true),
    TaOperational=293.15,
    alpha20a=dcpmData.alpha20a,
    useThermalPort=true) "DC machine data"
  Modelica.Electrical.Analog.Sources.ConstantVoltage armatureVoltage(V=Va)
  Modelica.Electrical.Analog.Basic.Ground groundArmature
  Modelica.Mechanics.Rotational.Components.Inertia loadInertia(J=JLoad)
  Modelica.Mechanics.Rotational.Sources.Torque loadTorque(useSupport=
        false)
  Modelica.Blocks.Sources.Pulse pulse(
    amplitude=-1.5*TLoad,
    offset=0,
    period=1)
  Modelica.Thermal.HeatTransfer.Components.HeatCapacitor armature(C=Ca, T(
        start=TAmbient, fixed=true))
  Modelica.Thermal.HeatTransfer.Components.ThermalConductor armatureCore(
      G=G_armature_core)
  Modelica.Thermal.HeatTransfer.Components.HeatCapacitor core(C=Cc, T(
        start=TAmbient, fixed=true))
  Modelica.Thermal.HeatTransfer.Components.ThermalConductor coreCooling(G=
       G_core_cooling)
  Modelica.Thermal.FluidHeatFlow.Sources.Ambient inlet(
      constantAmbientTemperature=TAmbient, constantAmbientPressure=0)
  Modelica.Thermal.FluidHeatFlow.Sources.VolumeFlow volumeFlow(
    T0=TAmbient,
    constantVolumeFlow=CoolantFlow,
    m=0)
  Modelica.Thermal.FluidHeatFlow.Components.Pipe cooling(
    tapT=0.5,
    T0=TAmbient,
    m=0,
    h_g=0,
    V_flowLaminar=0.1,
    dpLaminar(displayUnit="Pa") = 0.1,
    V_flowNominal=1,
    dpNominal(displayUnit="Pa") = 1,
    T0fixed=false,
    useHeatPort=true)
  Modelica.Thermal.FluidHeatFlow.Sources.Ambient outlet(
      constantAmbientTemperature=TAmbient, constantAmbientPressure=0)
  Modelica.Thermal.HeatTransfer.Sources.FixedTemperature fixedTemperature(
      T=TAmbient)
protected
  Machines.Interfaces.DCMachines.ThermalPortDCPM thermalPort
public
  parameter Utilities.ParameterRecords.DcPermanentMagnetData dcpmData(
    alpha20a(displayUnit="1/K")=Modelica.Electrical.Machines.Thermal.Constants.alpha20Copper,
    TaNominal=353.15,
    TaRef=353.15)

equation
  connect(loadInertia.flange_b, loadTorque.flange)
  connect(dcpm.flange, loadInertia.flange_a)
  connect(armatureVoltage.n, groundArmature.p)
  connect(armatureVoltage.p, dcpm.pin_ap)
  connect(armatureVoltage.n, dcpm.pin_an)
  connect(armature.port, armatureCore.port_a)
  connect(armatureCore.port_b, core.port)
  connect(core.port, coreCooling.port_a)
  connect(pulse.y, loadTorque.tau)
  connect(coreCooling.port_b, cooling.heatPort)
  connect(cooling.flowPort_b, outlet.flowPort)
  connect(inlet.flowPort, volumeFlow.flowPort_a)
  connect(volumeFlow.flowPort_b, cooling.flowPort_a)
  connect(armature.port, thermalPort.heatPortArmature)
  connect(core.port, thermalPort.heatPortCore)
  connect(fixedTemperature.port, thermalPort.heatPortStrayLoad)
  connect(fixedTemperature.port, thermalPort.heatPortFriction)
  connect(fixedTemperature.port, thermalPort.heatPortBrush)
  connect(fixedTemperature.port, thermalPort.heatPortPermanentMagnet)
  connect(dcpm.thermalPort, thermalPort)
end DCPM_Cooling;


Test example: DC with permanent magnet starting with current controller.

within Modelica.Electrical.Machines.Examples.DCMachines;
model DCPM_CurrentControlled
  "Test example: DC with permanent magnet starting with current controller"
  extends Modelica.Icons.Example;
  parameter SI.Torque TLoad=ViNominal*dcpmData.IaNominal/dcpmData.wNominal "Nominal load torque";
  parameter SI.AngularVelocity wLoad=dcpmData.wNominal "Nominal load torque";
  parameter SI.Inertia JLoad=dcpmData.Jr "Load's moment of inertia";
  parameter SI.Resistance Ra=Modelica.Electrical.Machines.Thermal.convertResistance(
    dcpmData.Ra,
    dcpmData.TaRef,
    dcpmData.alpha20a,
    dcpmData.TaNominal) "Warm armature resistance";
  parameter SI.Voltage ViNominal=dcpmData.VaNominal - Ra*dcpmData.IaNominal "Nominal induced voltage";
  parameter SI.Time Ta=dcpmData.La/Ra "Armature time constant";
  parameter SI.Time Ts=1e-3 "Dead time of inverter";
  parameter SI.Resistance k=Ra*Ta/(2*Ts) "Current controller proportional gain";
  parameter SI.Time Ti=Ta "Current controller integral time constant";
  parameter SI.MagneticFlux kPhi=ViNominal/dcpmData.wNominal "Voltage constant";
  Machines.BasicMachines.DCMachines.DC_PermanentMagnet dcpm(
    VaNominal=dcpmData.VaNominal,
    IaNominal=dcpmData.IaNominal,
    wNominal=dcpmData.wNominal,
    TaNominal=dcpmData.TaNominal,
    Ra=dcpmData.Ra,
    TaRef=dcpmData.TaRef,
    La=dcpmData.La,
    Jr=dcpmData.Jr,
    useSupport=false,
    Js=dcpmData.Js,
    frictionParameters=dcpmData.frictionParameters,
    coreParameters=dcpmData.coreParameters,
    strayLoadParameters=dcpmData.strayLoadParameters,
    brushParameters=dcpmData.brushParameters,
    TaOperational=293.15,
    alpha20a=dcpmData.alpha20a,
    phiMechanical(fixed=true),
    wMechanical(fixed=true),
    ia(fixed=true))
  Blocks.Sources.Step          step(
    height=dcpmData.IaNominal,
    offset=0,
    startTime=0.1)
  Modelica.Electrical.Analog.Sources.SignalVoltage signalVoltage
  Modelica.Electrical.Analog.Basic.Ground ground
  Modelica.Mechanics.Rotational.Components.Inertia loadInertia(J=JLoad)
  Mechanics.Rotational.Sources.QuadraticSpeedDependentTorque loadTorque(
    useSupport=false,
    tau_nominal=-TLoad,
    TorqueDirection=false,
    w_nominal=wLoad)
  parameter Utilities.ParameterRecords.DcPermanentMagnetData dcpmData "DC machine data"
  Analog.Sensors.CurrentSensor currentSensor
  Mechanics.Rotational.Sensors.SpeedSensor speedSensor
  Blocks.Continuous.FirstOrder firstOrder(
    k=1,
    T=Ts,
    initType=Modelica.Blocks.Types.Init.InitialOutput,
    y_start=0)
  Blocks.Continuous.LimPID PID(withFeedForward=true, initType=Modelica.Blocks.Types.Init.InitialOutput,
    controllerType=Modelica.Blocks.Types.SimpleController.PI,
    k=k,
    Ti=Ti,
    yMax=dcpmData.VaNominal,
    kFF=kPhi)
equation
  connect(signalVoltage.n, ground.p)
  connect(loadInertia.flange_b, loadTorque.flange)
  connect(dcpm.flange, loadInertia.flange_a)
  connect(dcpm.pin_an, ground.p)
  connect(signalVoltage.p, currentSensor.p)
  connect(currentSensor.n, dcpm.pin_ap)
  connect(dcpm.flange, speedSensor.flange)
  connect(firstOrder.y, signalVoltage.v)
  connect(PID.y, firstOrder.u)
  connect(step.y, PID.u_s)
  connect(currentSensor.i, PID.u_m)
  connect(speedSensor.w, PID.u_ff)
end DCPM_CurrentControlled;


Test example: drive with 2 permanent magnet DC machines. This example demonstrates how to use a coupling
to implement a drive consisting if two permanent magnet DC machines.
Note that dcpm1 is turning in positive direction, whereas dcpm2 is turning in the opposite direction.
Therefore, the armature of dcpm2 is connected reversed to the source.

within Modelica.Electrical.Machines.Examples.DCMachines;
model DCPM_Drive
  "Test example: drive with 2 permanent magnet DC machines"
  extends Modelica.Icons.Example;
  parameter Utilities.ParameterRecords.DcPermanentMagnetData dcpmData "DC machine data"
  Machines.BasicMachines.DCMachines.DC_PermanentMagnet dcpm1(
    VaNominal=dcpmData.VaNominal,
    IaNominal=dcpmData.IaNominal,
    wNominal=dcpmData.wNominal,
    TaNominal=dcpmData.TaNominal,
    Ra=dcpmData.Ra,
    TaRef=dcpmData.TaRef,
    La=dcpmData.La,
    Jr=dcpmData.Jr,
    useSupport=false,
    Js=dcpmData.Js,
    frictionParameters=dcpmData.frictionParameters,
    coreParameters=dcpmData.coreParameters,
    strayLoadParameters=dcpmData.strayLoadParameters,
    brushParameters=dcpmData.brushParameters,
    TaOperational=293.15,
    alpha20a=dcpmData.alpha20a,
    phiMechanical(fixed=true),
    wMechanical(fixed=true),
    ia(fixed=true))
  BasicMachines.DCMachines.DC_PermanentMagnet dcpm2(
    VaNominal=dcpmData.VaNominal,
    IaNominal=dcpmData.IaNominal,
    wNominal=dcpmData.wNominal,
    TaNominal=dcpmData.TaNominal,
    Ra=dcpmData.Ra,
    TaRef=dcpmData.TaRef,
    La=dcpmData.La,
    Jr=dcpmData.Jr,
    useSupport=false,
    Js=dcpmData.Js,
    frictionParameters=dcpmData.frictionParameters,
    coreParameters=dcpmData.coreParameters,
    strayLoadParameters=dcpmData.strayLoadParameters,
    brushParameters=dcpmData.brushParameters,
    TaOperational=293.15,
    alpha20a=dcpmData.alpha20a,
    phiMechanical(fixed=false),
    wMechanical(fixed=false),
    ia(fixed=true))
  Mechanics.Rotational.Components.Coupling coupling
  ControlledDCDrives.Utilities.DcdcInverter dcdcInverter1(fS=1000, VMax=
        dcpmData.VaNominal)
  ControlledDCDrives.Utilities.DcdcInverter dcdcInverter2(fS=1000, VMax=
        dcpmData.VaNominal)
  Modelica.Blocks.Sources.Ramp ramp1(
    duration=0.5,
    height=0.5*dcpmData.VaNominal,
    offset=0,
    startTime=0.25)
  Blocks.Sources.Ramp ramp2(
    duration=0.5,
    height=0.1*dcpmData.VaNominal,
    offset=0.5*dcpmData.VaNominal,
    startTime=1.25)
  Analog.Ideal.IdealClosingSwitch switch
  Blocks.Sources.BooleanStep booleanStep(startTime=1)
  Analog.Sensors.MultiSensor multiSensor
  Analog.Sources.ConstantVoltage constantVoltage(V=dcpmData.VaNominal)
  Analog.Basic.Resistor resistor(R=0.05*dcpmData.VaNominal/1000)
  Analog.Basic.Ground ground
equation
  connect(dcpm1.flange, coupling.flange_a)
  connect(dcpm2.flange, coupling.flange_b)
  connect(booleanStep.y, switch.control)
  connect(ramp2.y, dcdcInverter2.vRef)
  connect(dcdcInverter1.vRef, ramp1.y)
  connect(dcpm1.pin_ap, dcdcInverter1.pin_pMot)
  connect(dcdcInverter1.pin_nMot, dcpm1.pin_an)
  connect(switch.n, dcpm2.pin_ap)
  connect(switch.p, dcdcInverter2.pin_nMot)
  connect(dcdcInverter2.pin_pMot, dcpm2.pin_an)
  connect(multiSensor.nc, dcdcInverter2.pin_pBat)
  connect(multiSensor.nc, dcdcInverter1.pin_pBat)
  connect(multiSensor.pc, multiSensor.pv)
  connect(ground.p, constantVoltage.n)
  connect(constantVoltage.p, resistor.p)
  connect(dcdcInverter1.pin_nBat, constantVoltage.n)
  connect(dcdcInverter2.pin_nBat, constantVoltage.n)
  connect(multiSensor.pc, resistor.n)
  connect(multiSensor.nv, constantVoltage.n)
end DCPM_Drive;


Test example: Compare DCPM motors transient - quasi-static.

within Modelica.Electrical.Machines.Examples.DCMachines;
model DCPM_QuasiStatic
  "Test example: Compare DCPM motors transient - quasi-static"
  extends Modelica.Icons.Example;
  parameter SI.Voltage Va=100 "Actual armature voltage";
  parameter SI.Voltage Ve=100 "Actual excitation voltage";
  parameter SI.AngularVelocity w0=
      Modelica.Units.Conversions.from_rpm(1500) "No-load speed";
  parameter SI.Torque TLoad=63.66 "Nominal load torque";
  parameter SI.Inertia JLoad=0.15
    "Load's moment of inertia";
  Machines.BasicMachines.DCMachines.DC_PermanentMagnet dcpm1(
    VaNominal=dcpmData.VaNominal,
    IaNominal=dcpmData.IaNominal,
    wNominal=dcpmData.wNominal,
    TaNominal=dcpmData.TaNominal,
    Ra=dcpmData.Ra,
    TaRef=dcpmData.TaRef,
    La=dcpmData.La,
    Jr=dcpmData.Jr,
    useSupport=false,
    Js=dcpmData.Js,
    frictionParameters=dcpmData.frictionParameters,
    coreParameters=dcpmData.coreParameters,
    strayLoadParameters=dcpmData.strayLoadParameters,
    brushParameters=dcpmData.brushParameters,
    phiMechanical(fixed=true),
    ia(fixed=true),
    TaOperational=293.15,
    alpha20a=dcpmData.alpha20a,
    wMechanical(fixed=true, start=w0))
  Modelica.Electrical.Analog.Sources.ConstantVoltage armatureVoltage(V=Va)
  Modelica.Electrical.Analog.Basic.Ground groundArmature
  Modelica.Mechanics.Rotational.Components.Inertia loadInertia1(J=JLoad)
  Modelica.Mechanics.Rotational.Sources.Torque loadTorque1(useSupport=
        false)
  Modelica.Blocks.Sources.Pulse pulse(
    amplitude=-1.5*TLoad,
    offset=0,
    period=1)
  Machines.BasicMachines.QuasiStaticDCMachines.DC_PermanentMagnet dcpm2(
    VaNominal=dcpmData.VaNominal,
    IaNominal=dcpmData.IaNominal,
    wNominal=dcpmData.wNominal,
    TaNominal=dcpmData.TaNominal,
    Ra=dcpmData.Ra,
    TaRef=dcpmData.TaRef,
    La=dcpmData.La,
    Jr=dcpmData.Jr,
    useSupport=false,
    Js=dcpmData.Js,
    frictionParameters=dcpmData.frictionParameters,
    coreParameters=dcpmData.coreParameters,
    strayLoadParameters=dcpmData.strayLoadParameters,
    brushParameters=dcpmData.brushParameters,
    phiMechanical(fixed=true),
    wMechanical(fixed=true, start=w0),
    TaOperational=293.15,
    alpha20a=dcpmData.alpha20a)
  Modelica.Mechanics.Rotational.Components.Inertia loadInertia2(J=JLoad)
  Modelica.Mechanics.Rotational.Sources.Torque loadTorque2(useSupport=
        false)
  parameter Utilities.ParameterRecords.DcPermanentMagnetData dcpmData "DC machine data"
equation
  connect(loadInertia1.flange_b, loadTorque1.flange)
  connect(dcpm1.flange, loadInertia1.flange_a)
  connect(armatureVoltage.n, groundArmature.p)
  connect(armatureVoltage.p, dcpm1.pin_ap)
  connect(armatureVoltage.n, dcpm1.pin_an)
  connect(pulse.y, loadTorque1.tau)
  connect(loadInertia2.flange_b, loadTorque2.flange)
  connect(dcpm2.flange, loadInertia2.flange_a)
  connect(pulse.y, loadTorque2.tau)
  connect(armatureVoltage.p, dcpm2.pin_ap)
  connect(armatureVoltage.n, dcpm2.pin_an)
end DCPM_QuasiStatic;


Test example: DC with permanent magnet starting with voltage ramp.

within Modelica.Electrical.Machines.Examples.DCMachines;
model DCPM_Start
  "Test example: DC with permanent magnet starting with voltage ramp"
  extends Modelica.Icons.Example;
  parameter SI.Voltage Va=100 "Actual armature voltage";
  parameter SI.Time tStart=0.2
    "Start of armature voltage ramp";
  parameter SI.Time tRamp=0.8 "Armature voltage ramp";
  parameter SI.Torque TLoad=63.66 "Nominal load torque";
  parameter SI.Time tStep=1.5 "Time of load torque step";
  parameter SI.Inertia JLoad=0.15
    "Load's moment of inertia";
  Machines.BasicMachines.DCMachines.DC_PermanentMagnet dcpm(
    VaNominal=dcpmData.VaNominal,
    IaNominal=dcpmData.IaNominal,
    wNominal=dcpmData.wNominal,
    TaNominal=dcpmData.TaNominal,
    Ra=dcpmData.Ra,
    TaRef=dcpmData.TaRef,
    La=dcpmData.La,
    Jr=dcpmData.Jr,
    useSupport=false,
    Js=dcpmData.Js,
    frictionParameters=dcpmData.frictionParameters,
    coreParameters=dcpmData.coreParameters,
    strayLoadParameters=dcpmData.strayLoadParameters,
    brushParameters=dcpmData.brushParameters,
    TaOperational=293.15,
    alpha20a=dcpmData.alpha20a,
    phiMechanical(fixed=true),
    wMechanical(fixed=true),
    ia(fixed=true))
  Modelica.Blocks.Sources.Ramp ramp(
    duration=tRamp,
    height=Va,
    startTime=tStart)
  Modelica.Electrical.Analog.Sources.SignalVoltage signalVoltage
  Modelica.Electrical.Analog.Basic.Ground ground
  Modelica.Mechanics.Rotational.Components.Inertia loadInertia(J=JLoad)
  Modelica.Mechanics.Rotational.Sources.TorqueStep loadTorqueStep(
    startTime=tStep,
    stepTorque=-TLoad,
    useSupport=false,
    offsetTorque=0)
  parameter Utilities.ParameterRecords.DcPermanentMagnetData dcpmData "DC machine data"
equation
  connect(ramp.y, signalVoltage.v)
  connect(signalVoltage.p, dcpm.pin_ap)
  connect(signalVoltage.n, ground.p)
  connect(dcpm.pin_an, signalVoltage.n)
  connect(loadInertia.flange_b, loadTorqueStep.flange)
  connect(dcpm.flange, loadInertia.flange_a)
end DCPM_Start;


Test example: Investigate temperature dependency of a DCPM motor.

within Modelica.Electrical.Machines.Examples.DCMachines;
model DCPM_Temperature
  "Test example: Investigate temperature dependency of a DCPM motor"
  extends Modelica.Icons.Example;
  parameter SI.Voltage Va=100 "Actual armature voltage";
  parameter SI.Voltage Ve=100 "Actual excitation voltage";
  parameter SI.AngularVelocity w0=
      Modelica.Units.Conversions.from_rpm(1500) "No-load speed";
  parameter SI.Torque TLoad=63.66 "Nominal load torque";
  parameter SI.Inertia JLoad=0.15
    "Load's moment of inertia";
  Machines.BasicMachines.DCMachines.DC_PermanentMagnet dcpm(
    wMechanical(start=w0, fixed=true),
    VaNominal=dcpmData.VaNominal,
    IaNominal=dcpmData.IaNominal,
    wNominal=dcpmData.wNominal,
    TaNominal=dcpmData.TaNominal,
    Ra=dcpmData.Ra,
    TaRef=dcpmData.TaRef,
    La=dcpmData.La,
    Jr=dcpmData.Jr,
    useSupport=false,
    Js=dcpmData.Js,
    frictionParameters=dcpmData.frictionParameters,
    coreParameters=dcpmData.coreParameters,
    strayLoadParameters=dcpmData.strayLoadParameters,
    brushParameters=dcpmData.brushParameters,
    phiMechanical(fixed=true),
    ia(fixed=true),
    TaOperational=293.15,
    alpha20a=dcpmData.alpha20a,
    useThermalPort=true)
  Modelica.Electrical.Analog.Sources.ConstantVoltage armatureVoltage(V=Va)
  Modelica.Electrical.Analog.Basic.Ground groundArmature
  Modelica.Mechanics.Rotational.Components.Inertia loadInertia(J=JLoad)
  Modelica.Mechanics.Rotational.Sources.TorqueStep loadTorque(
    useSupport=false,
    stepTorque=-TLoad,
    offsetTorque=0,
    startTime=0.1)
  Machines.Thermal.DCMachines.ThermalAmbientDCPM thermalAmbientDCPM(
    useTemperatureInputs=true,
    Ta=293.15,
    Tpm=293.15)
  Modelica.Blocks.Sources.Exponentials exponential(
    offset=293.15,
    outMax=60,
    riseTime=3600,
    riseTimeConst=0.5,
    fallTimeConst=0.5,
    startTime=0.1)
  Modelica.Blocks.Sources.Constant const(k=293.15)
  parameter Utilities.ParameterRecords.DcPermanentMagnetData dcpmData(
    alpha20a(displayUnit="1/K")=Modelica.Electrical.Machines.Thermal.Constants.alpha20Copper,
    TaNominal=353.15,
    TaRef=353.15) "DC machine data"

equation
  connect(loadInertia.flange_b, loadTorque.flange)
  connect(dcpm.flange, loadInertia.flange_a)
  connect(armatureVoltage.n, groundArmature.p)
  connect(armatureVoltage.p, dcpm.pin_ap)
  connect(armatureVoltage.n, dcpm.pin_an)
  connect(exponential.y, thermalAmbientDCPM.TArmature)
  connect(const.y, thermalAmbientDCPM.TPermanentMagnet)
  connect(dcpm.thermalPort, thermalAmbientDCPM.thermalPort)
end DCPM_Temperature;


Test example: Investigate influence of losses on DCPM motor performance.

within Modelica.Electrical.Machines.Examples.DCMachines;
model DCPM_withLosses
  "Test example: Investigate influence of losses on DCPM motor performance"
  extends Modelica.Icons.Example;
  import Modelica.Constants.pi;
  parameter SI.Voltage Va=100 "Actual armature voltage";
  parameter SI.Time tStart=0.2
    "Start of armature voltage ramp";
  parameter SI.Time tRamp=0.8 "Armature voltage ramp";
  parameter SI.Torque TLoad1=63.66 "Nominal load torque";
  parameter SI.AngularVelocity wLoad1=1425*2*pi/60
    "Nominal load speed";
  parameter SI.Torque TLoad2=61.30 "Nominal load torque";
  parameter SI.AngularVelocity wLoad2=1417.5*2*pi/60
    "Nominal load speed";
  parameter SI.Inertia JLoad=0.15
    "Load's moment of inertia";
  Machines.BasicMachines.DCMachines.DC_PermanentMagnet dcpm1(
    VaNominal=dcpmData1.VaNominal,
    IaNominal=dcpmData1.IaNominal,
    wNominal=dcpmData1.wNominal,
    TaNominal=dcpmData1.TaNominal,
    Ra=dcpmData1.Ra,
    TaRef=dcpmData1.TaRef,
    La=dcpmData1.La,
    Jr=dcpmData1.Jr,
    useSupport=false,
    Js=dcpmData1.Js,
    frictionParameters=dcpmData1.frictionParameters,
    coreParameters=dcpmData1.coreParameters,
    strayLoadParameters=dcpmData1.strayLoadParameters,
    brushParameters=dcpmData1.brushParameters,
    TaOperational=293.15,
    alpha20a=dcpmData1.alpha20a,
    phiMechanical(fixed=true),
    wMechanical(fixed=true),
    ia(fixed=true))
  Modelica.Blocks.Sources.Ramp ramp(
    duration=tRamp,
    height=Va,
    startTime=tStart)
  Modelica.Electrical.Analog.Sources.SignalVoltage signalVoltage
  Modelica.Electrical.Analog.Basic.Ground ground
  Modelica.Mechanics.Rotational.Components.Inertia loadInertia1(J=JLoad)
  Modelica.Mechanics.Rotational.Sources.QuadraticSpeedDependentTorque
    loadTorque1(
    useSupport=false,
    tau_nominal=-TLoad1,
    TorqueDirection=false,
    w_nominal=wLoad1)
  Machines.BasicMachines.DCMachines.DC_PermanentMagnet dcpm2(
    VaNominal=dcpmData2.VaNominal,
    IaNominal=dcpmData2.IaNominal,
    wNominal=dcpmData2.wNominal,
    TaNominal=dcpmData2.TaNominal,
    Ra=dcpmData2.Ra,
    TaRef=dcpmData2.TaRef,
    La=dcpmData2.La,
    Jr=dcpmData2.Jr,
    useSupport=false,
    Js=dcpmData2.Js,
    frictionParameters=dcpmData2.frictionParameters,
    coreParameters=dcpmData2.coreParameters,
    strayLoadParameters=dcpmData2.strayLoadParameters,
    brushParameters=dcpmData2.brushParameters,
    alpha20a=dcpmData2.alpha20a,
    phiMechanical(fixed=true),
    wMechanical(fixed=true),
    ia(fixed=true),
    TaOperational=368.15,
    core(v(start=0)))
  Modelica.Mechanics.Rotational.Components.Inertia loadInertia2(J=JLoad)
  Modelica.Mechanics.Rotational.Sources.QuadraticSpeedDependentTorque
    loadTorque2(
    useSupport=false,
    tau_nominal=-TLoad2,
    TorqueDirection=false,
    w_nominal=wLoad2)
  parameter Utilities.ParameterRecords.DcPermanentMagnetData dcpmData1 "Data of DC machine 1"
  parameter Utilities.ParameterRecords.DcPermanentMagnetData dcpmData2(
    Ra=0.03864,
    alpha20a(displayUnit="1/K")=Modelica.Electrical.Machines.Thermal.Constants.alpha20Copper,
    wNominal=148.44025288212,
    TaNominal=368.15,
    frictionParameters(PRef=100),
    coreParameters(PRef=200),
    strayLoadParameters(PRef=50),
    brushParameters(V=0.5)) "Data of DC machine 2"

equation
  connect(ramp.y, signalVoltage.v)
  connect(signalVoltage.n, ground.p)
  connect(loadInertia1.flange_b, loadTorque1.flange)
  connect(dcpm1.flange, loadInertia1.flange_a)
  connect(loadInertia2.flange_b, loadTorque2.flange)
  connect(dcpm2.flange, loadInertia2.flange_a)
  connect(signalVoltage.p, dcpm1.pin_ap)
  connect(signalVoltage.p, dcpm2.pin_ap)
  connect(signalVoltage.n, dcpm1.pin_an)
  connect(signalVoltage.n, dcpm2.pin_an)
end DCPM_withLosses;


Test example: DC with serial excitation starting with voltage ramp.

within Modelica.Electrical.Machines.Examples.DCMachines;
model DCSE_SinglePhase
  "Test example: DC with serial excitation starting with voltage ramp"
  extends Modelica.Icons.Example;
  parameter SI.Voltage Va=100 "Actual armature voltage RMS";
  parameter SI.Time tStart=0.1 "Start of resistance ramp";
  parameter SI.Time tRamp=0.9 "Resistance ramp";
  parameter SI.Torque TLoad=63.66 "Nominal load torque";
  parameter SI.AngularVelocity wLoad(displayUnit="rev/min")=
       1410*2*Modelica.Constants.pi/60 "Nominal load speed";
  parameter SI.Inertia JLoad=0.15
    "Load's moment of inertia";
  Machines.BasicMachines.DCMachines.DC_SeriesExcited dcse(
    VaNominal=dcseData.VaNominal,
    IaNominal=dcseData.IaNominal,
    wNominal=dcseData.wNominal,
    TaNominal=dcseData.TaNominal,
    TeNominal=dcseData.TeNominal,
    Ra=dcseData.Ra,
    TaRef=dcseData.TaRef,
    La=dcseData.La,
    Jr=dcseData.Jr,
    useSupport=false,
    Js=dcseData.Js,
    frictionParameters=dcseData.frictionParameters,
    coreParameters=dcseData.coreParameters,
    strayLoadParameters=dcseData.strayLoadParameters,
    brushParameters=dcseData.brushParameters,
    Re=dcseData.Re,
    TeRef=dcseData.TeRef,
    Le=dcseData.Le,
    sigmae=dcseData.sigmae,
    TaOperational=293.15,
    alpha20a=dcseData.alpha20a,
    phiMechanical(fixed=true),
    wMechanical(fixed=true),
    ia(fixed=true),
    alpha20e=dcseData.alpha20e,
    TeOperational=293.15)
  Modelica.Blocks.Sources.Ramp ramp(
    duration=tRamp,
    startTime=tStart,
    height=-1,
    offset=1)
  Modelica.Electrical.Analog.Sources.SineVoltage constantVoltage(V=sqrt(2)
        *Va, f=50)
  Modelica.Electrical.Analog.Basic.Ground ground
  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.Analog.Basic.VariableResistor variableResistor
  parameter Utilities.ParameterRecords.DcSeriesExcitedData dcseData "DC machine data"
equation
  connect(constantVoltage.n, ground.p)
  connect(loadInertia.flange_b, quadraticLoadTorque.flange)
  connect(dcse.pin_an, dcse.pin_ep)
  connect(dcse.pin_en, constantVoltage.n)
  connect(dcse.flange, loadInertia.flange_a)
  connect(constantVoltage.p, variableResistor.p)
  connect(variableResistor.n, dcse.pin_ap)
  connect(ramp.y, variableResistor.R)
end DCSE_SinglePhase;


within Modelica.Electrical.Machines.Examples.DCMachines;
model DCSE_Start
  "Test example: DC with serial excitation starting with voltage ramp"
  extends Modelica.Icons.Example;
  parameter SI.Voltage Va=100 "Actual armature voltage";
  parameter SI.Time tStart=0.1 "Start of resistance ramp";
  parameter SI.Time tRamp=0.9 "Resistance ramp";
  parameter SI.Torque TLoad=63.66 "Nominal load torque";
  parameter SI.AngularVelocity wLoad(displayUnit="rev/min")=
       1410*2*Modelica.Constants.pi/60 "Nominal load speed";
  parameter SI.Inertia JLoad=0.15
    "Load's moment of inertia";
  Machines.BasicMachines.DCMachines.DC_SeriesExcited dcse(
    VaNominal=dcseData.VaNominal,
    IaNominal=dcseData.IaNominal,
    wNominal=dcseData.wNominal,
    TaNominal=dcseData.TaNominal,
    TeNominal=dcseData.TeNominal,
    Ra=dcseData.Ra,
    TaRef=dcseData.TaRef,
    La=dcseData.La,
    Jr=dcseData.Jr,
    useSupport=false,
    Js=dcseData.Js,
    frictionParameters=dcseData.frictionParameters,
    coreParameters=dcseData.coreParameters,
    strayLoadParameters=dcseData.strayLoadParameters,
    brushParameters=dcseData.brushParameters,
    Re=dcseData.Re,
    TeRef=dcseData.TeRef,
    Le=dcseData.Le,
    sigmae=dcseData.sigmae,
    TaOperational=293.15,
    alpha20a=dcseData.alpha20a,
    phiMechanical(fixed=true),
    wMechanical(fixed=true),
    ia(fixed=true),
    alpha20e=dcseData.alpha20e,
    TeOperational=293.15)
  Modelica.Blocks.Sources.Ramp ramp(
    duration=tRamp,
    startTime=tStart,
    height=-1,
    offset=1)
  Modelica.Electrical.Analog.Sources.ConstantVoltage constantVoltage(V=Va)
  Modelica.Electrical.Analog.Basic.Ground ground
  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.Analog.Basic.VariableResistor variableResistor
  parameter Utilities.ParameterRecords.DcSeriesExcitedData dcseData "DC machine data"
equation
  connect(constantVoltage.n, ground.p)
  connect(loadInertia.flange_b, quadraticLoadTorque.flange)
  connect(dcse.pin_an, dcse.pin_ep)
  connect(dcse.pin_en, constantVoltage.n)
  connect(dcse.flange, loadInertia.flange_a)
  connect(constantVoltage.p, variableResistor.p)
  connect(variableResistor.n, dcse.pin_ap)
  connect(ramp.y, variableResistor.R)
end DCSE_Start;


Test example: Compare torque-speed characteristic of DC motors. Test example: Compare characteristic of DC motors

The motors are started at nominal speed, then load is ramped down. Simulate for 6 seconds and plot dcxx.wMechanical (motor speed) versus dcxx.tauElectrical (motor torque).
Default machine parameters are used.

within Modelica.Electrical.Machines.Examples.DCMachines;
model DC_CompareCharacteristics
  "Test example: Compare torque-speed characteristic of DC motors"
  extends Modelica.Icons.Example;
  parameter SI.Voltage Va=100 "Actual armature voltage";
  parameter SI.Voltage Ve=100 "Actual excitation voltage";
  parameter SI.Torque TLoad=63.66 "Nominal load torque";
  parameter SI.Time tStart=0.5 "Start of load torque ramp";
  parameter SI.Time tRamp=5.0 "Load torque ramp";
  parameter SI.Inertia JLoad=0.15 "Load's moment of inertia";
  Modelica.Electrical.Analog.Sources.ConstantVoltage armatureVoltage(V=Va)
  Modelica.Electrical.Analog.Basic.Ground groundArmature
  Modelica.Electrical.Analog.Sources.ConstantVoltage excitationVoltage(V=Ve)
  Modelica.Electrical.Analog.Basic.Ground groundExcitation
  parameter Modelica.Electrical.Machines.Utilities.ParameterRecords.DcPermanentMagnetData
    dcpmData "Parameters of permanent magnet dc machine"
  Modelica.Electrical.Machines.BasicMachines.QuasiStaticDCMachines.DC_PermanentMagnet
    dcpm(
    TaOperational=dcpmData.TaNominal,
    VaNominal=dcpmData.VaNominal,
    IaNominal=dcpmData.IaNominal,
    wNominal=dcpmData.wNominal,
    TaNominal=dcpmData.TaNominal,
    Ra=dcpmData.Ra,
    TaRef=dcpmData.TaRef,
    alpha20a=dcpmData.alpha20a,
    La=dcpmData.La,
    Jr=dcpmData.Jr,
    Js=dcpmData.Js,
    frictionParameters=dcpmData.frictionParameters,
    phiMechanical(fixed=true, start=0),
    wMechanical(fixed=true, start=dcpmData.wNominal),
    coreParameters=dcpmData.coreParameters,
    strayLoadParameters=dcpmData.strayLoadParameters,
    brushParameters=dcpmData.brushParameters,
    ia(fixed=false, start=dcpmData.IaNominal))
  Modelica.Mechanics.Rotational.Components.Inertia loadInertia1(J=JLoad)
  Modelica.Mechanics.Rotational.Sources.Torque loadTorque1(useSupport=false)
  parameter Modelica.Electrical.Machines.Utilities.ParameterRecords.DcElectricalExcitedData
    dceeData "Parameters of electrical excited dc machine"
  Modelica.Electrical.Machines.BasicMachines.QuasiStaticDCMachines.DC_ElectricalExcited
    dcee(
    TaOperational=dceeData.TaNominal,
    VaNominal=dceeData.VaNominal,
    IaNominal=dceeData.IaNominal,
    wNominal=dceeData.wNominal,
    TaNominal=dceeData.TaNominal,
    Ra=dceeData.Ra,
    TaRef=dceeData.TaRef,
    alpha20a=dceeData.alpha20a,
    La=dceeData.La,
    Jr=dceeData.Jr,
    Js=dceeData.Js,
    frictionParameters=dceeData.frictionParameters,
    phiMechanical(fixed=true, start=0),
    wMechanical(start=dceeData.wNominal, fixed=true),
    coreParameters=dceeData.coreParameters,
    strayLoadParameters=dceeData.strayLoadParameters,
    brushParameters=dceeData.brushParameters,
    ia(fixed=false, start=dceeData.IaNominal),
    IeNominal=dceeData.IeNominal,
    Re=dceeData.Re,
    TeRef=dceeData.TeRef,
    alpha20e=dceeData.alpha20e,
    Le=dceeData.Le,
    sigmae=dceeData.sigmae,
    TeOperational=dceeData.TeRef,
    ie(start=dceeData.IeNominal, fixed=false))
  Modelica.Mechanics.Rotational.Components.Inertia loadInertia2(J=JLoad)
  Modelica.Mechanics.Rotational.Sources.Torque loadTorque2(useSupport=false)
  parameter Modelica.Electrical.Machines.Utilities.ParameterRecords.DcSeriesExcitedData
    dcseData "Parameters of series excited dc machine"
  Modelica.Electrical.Machines.BasicMachines.QuasiStaticDCMachines.DC_SeriesExcited
    dcse(
    TaOperational=dcseData.TaNominal,
    VaNominal=dcseData.VaNominal,
    IaNominal=dcseData.IaNominal,
    wNominal=dcseData.wNominal,
    TaNominal=dcseData.TaNominal,
    Ra=dcseData.Ra,
    TaRef=dcseData.TaRef,
    alpha20a=dcseData.alpha20a,
    La=dcseData.La,
    Jr=dcseData.Jr,
    Js=dcseData.Js,
    frictionParameters=dcseData.frictionParameters,
    phiMechanical(fixed=true, start=0),
    wMechanical(fixed=true, start=dcseData.wNominal),
    coreParameters=dcseData.coreParameters,
    strayLoadParameters=dcseData.strayLoadParameters,
    brushParameters=dcseData.brushParameters,
    ia(fixed=false, start=dcseData.IaNominal),
    Re=dcseData.Re,
    TeRef=dcseData.TeRef,
    alpha20e=dcseData.alpha20e,
    Le=dcseData.Le,
    sigmae=dcseData.sigmae,
    TeNominal=dcseData.TeNominal,
    TeOperational=dcseData.TeNominal)
  Modelica.Mechanics.Rotational.Components.Inertia loadInertia3(J=JLoad)
  Modelica.Mechanics.Rotational.Sources.Torque loadTorque3(useSupport=false)
  Modelica.Blocks.Sources.Ramp ramp(
    startTime=tStart,
    height=TLoad,
    duration=tRamp,
    offset=-TLoad)
  Blocks.Nonlinear.Limiter limiter(uMax=-0.1*TLoad, uMin=-2*TLoad)
equation
  connect(loadInertia1.flange_b, loadTorque1.flange)

  connect(armatureVoltage.n, groundArmature.p)
  connect(excitationVoltage.n, groundExcitation.p)
  connect(loadInertia2.flange_b,loadTorque2. flange)
  connect(loadInertia3.flange_b,loadTorque3. flange)
  connect(armatureVoltage.p, dcpm.pin_ap)
  connect(armatureVoltage.p, dcee.pin_ap)
  connect(armatureVoltage.p, dcse.pin_ap)
  connect(armatureVoltage.n, dcpm.pin_an)
  connect(armatureVoltage.n, dcee.pin_an)
  connect(armatureVoltage.n, dcse.pin_en)
  connect(dcse.pin_ep, dcse.pin_an)
  connect(excitationVoltage.p, dcee.pin_ep)
  connect(excitationVoltage.n, dcee.pin_en)
  connect(dcpm.flange, loadInertia1.flange_a)
  connect(dcee.flange, loadInertia2.flange_a)
  connect(dcse.flange, loadInertia3.flange_a)
  connect(ramp.y, loadTorque1.tau)
  connect(ramp.y, loadTorque2.tau)
  connect(ramp.y, limiter.u)
  connect(limiter.y, loadTorque3.tau)
end DC_CompareCharacteristics;


Test examples of DC machines

within Modelica.Electrical.Machines.Examples;
package DCMachines "Test examples of DC machines"
  extends Modelica.Icons.ExamplesPackage;
end DCMachines;


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

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

equation
  connect(signalVoltage.plug_n, star.plug_p)
  connect(star.pin_n, ground.p)
  connect(vfController.y, signalVoltage.v)
  connect(signalVoltage.plug_p, currentQuasiRMSSensor.plug_p)
  connect(terminalBox.plugSupply, currentQuasiRMSSensor.plug_n)
  connect(terminalBox.plug_sn, aimc.plug_sn)
  connect(terminalBox.plug_sp, aimc.plug_sp)
  connect(vfController.u, gain.y)
  connect(dutyCycle.y[1], gain.u)
  connect(aimc.flange, idealGearR2T.flangeR)
  connect(idealGearR2T.flangeT, mass.flange_a)
  connect(mass.flange_b, signForce.flange)
end IMC_Conveyor;


Induction machine with DC current braking. The stator windings of an induction machine are fed by a DC current, causing a stationary current space phasor.
Since the rotor is turning, voltage is induced in the rotor cage which in turn drives rotor currents.
This creates a braking torque.

within Modelica.Electrical.Machines.Examples.InductionMachines;
model IMC_DCBraking "Induction machine with DC current braking"
  extends Modelica.Icons.Example;
  import Modelica.Constants.pi;
  constant Integer m=3 "Number of phases";
  parameter SI.AngularVelocity w0(displayUnit="rev/min")=
    2*pi*imcData.fsNominal/imcData.p "Initial mechanical speed";
  parameter SI.Inertia JLoad=4*imcData.Jr
    "Load's moment of inertia";
  SI.Torque tauElectrical=imc.tauElectrical "Electrical torque";
  SI.Torque tauShaft=imc.tauShaft "Shaft torque";
  SI.AngularVelocity wMechanical(displayUnit="rev/min") = imc.wMechanical
    "Shaft speed";
  parameter Modelica.Electrical.Machines.Utilities.DcBrakeSettings settings(INominal=
        100, layout="D3")
  parameter
    Modelica.Electrical.Machines.Utilities.ParameterRecords.IM_SquirrelCageData
    imcData
  Modelica.Electrical.Machines.BasicMachines.InductionMachines.IM_SquirrelCage imc(
    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,
    Lszero=imcData.Lszero,
    frictionParameters=imcData.frictionParameters,
    phiMechanical(fixed=true, start=0),
    wMechanical(fixed=true, start=w0),
    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.Mechanics.Rotational.Components.Inertia loadInertia(J=JLoad)
  Modelica.Electrical.Machines.Utilities.TerminalBox terminalBox(m=m,
      terminalConnection=settings.terminalConnection)
  Modelica.Electrical.Polyphase.Basic.PlugToPin_p plugToPin1(m=m, k=1)
  Modelica.Electrical.Polyphase.Basic.PlugToPin_p plugToPin2(m=m, k=2)
  Modelica.Electrical.Polyphase.Basic.PlugToPin_p plugToPin3(m=m, k=3) if  settings.connect3
  Modelica.Electrical.Analog.Sources.ConstantCurrent
    constantCurrent(I=settings.Idc)
  Modelica.Electrical.Analog.Basic.Ground ground
initial equation
  if settings.layout=="Y3" then
    //imc.is[2]=settings.is[2];
    der(imc.is[2])=0;
    der(imc.idq_rs[1])=0;
    der(imc.idq_rs[2])=0;
  end if;
  if settings.layout=="Y2" then
    der(imc.idq_rs[1])=0;
    der(imc.idq_rs[2])=0;
  end if;
  if settings.layout=="D2" then
    //imc.is[2]=settings.is[2];
    der(imc.is[2])=0;
    der(imc.idq_rs[1])=0;
    der(imc.idq_rs[2])=0;
  end if;
  if settings.layout=="D3" then
    //der(imc.idq_ss[1])=0;
    //der(imc.idq_ss[2])=0;
    der(imc.is[1])=0;
    der(imc.is[2])=0;
    der(imc.idq_rs[1])=0;
    der(imc.idq_rs[2])=0;
  end if;
equation
  connect(imc.flange, loadInertia.flange_a)
  connect(plugToPin1.pin_p, constantCurrent.n)
  connect(plugToPin2.pin_p, constantCurrent.p)
  connect(constantCurrent.p, plugToPin3.pin_p)
  connect(plugToPin2.plug_p, plugToPin1.plug_p)
  connect(plugToPin2.plug_p, plugToPin3.plug_p)
  connect(terminalBox.plug_sn, imc.plug_sn)
  connect(terminalBox.plug_sp, imc.plug_sp)
  connect(plugToPin2.plug_p, terminalBox.plugSupply)
  connect(plugToPin2.pin_p, ground.p)
end IMC_DCBraking;


Test example: InductionMachineSquirrelCage direct-on-line. At start time tStart three-phase voltage is supplied to the induction machine with squirrel cage;
the machine starts from standstill, accelerating inertias against load torque quadratic dependent on speed,
finally reaching nominal speed.

within Modelica.Electrical.Machines.Examples.InductionMachines;
model IMC_DOL
  "Test example: InductionMachineSquirrelCage direct-on-line"
  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=50 "Nominal frequency";
  parameter SI.Time tStart1=0.1 "Start time";
  parameter SI.Torque TLoad=161.4 "Nominal load torque";
  parameter SI.AngularVelocity wLoad(displayUnit="rev/min")=
       1440.45*2*Modelica.Constants.pi/60 "Nominal load speed";
  parameter SI.Inertia JLoad=0.29
    "Load's moment of inertia";
  Machines.BasicMachines.InductionMachines.IM_SquirrelCage aimc(
    p=aimcData.p,
    fsNominal=aimcData.fsNominal,
    Rs=aimcData.Rs,
    TsRef=aimcData.TsRef,
    alpha20s(displayUnit="1/K") = aimcData.alpha20s,
    Lszero=aimcData.Lszero,
    Lssigma=aimcData.Lssigma,
    Jr=aimcData.Jr,
    Js=aimcData.Js,
    frictionParameters=aimcData.frictionParameters,
    phiMechanical(fixed=true),
    wMechanical(fixed=true),
    statorCoreParameters=aimcData.statorCoreParameters,
    strayLoadParameters=aimcData.strayLoadParameters,
    Lm=aimcData.Lm,
    Lrsigma=aimcData.Lrsigma,
    Rr=aimcData.Rr,
    TrRef=aimcData.TrRef,
    TsOperational=293.15,
    alpha20r=aimcData.alpha20r,
    TrOperational=293.15)
  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.Mechanics.Rotational.Components.Inertia loadInertia(J=JLoad)
  Modelica.Mechanics.Rotational.Sources.QuadraticSpeedDependentTorque
    quadraticLoadTorque(
    w_nominal=wLoad,
    TorqueDirection=false,
    tau_nominal=-TLoad,
    useSupport=false)
  Machines.Utilities.TerminalBox terminalBox(terminalConnection="D")
  parameter Utilities.ParameterRecords.IM_SquirrelCageData aimcData "Induction machine data"
initial equation
  aimc.is = zeros(3);
  aimc.ir = zeros(2);
equation
  connect(star.pin_n, ground.p)
  connect(sineVoltage.plug_n, star.plug_p)
  connect(sineVoltage.plug_p, idealCloser.plug_p)
  connect(booleanStep.y, idealCloser.control)
  connect(idealCloser.plug_n, currentQuasiRMSSensor.plug_p)
  connect(terminalBox.plug_sn, aimc.plug_sn)
  connect(terminalBox.plug_sp, aimc.plug_sp)
  connect(terminalBox.plugSupply, currentQuasiRMSSensor.plug_n)
  connect(loadInertia.flange_b, quadraticLoadTorque.flange)
  connect(aimc.flange, loadInertia.flange_a)
end IMC_DOL;


Test example: Steady-State Initialization of InductionMachineSquirrelCage. The induction machine with squirrel cage is initialized in steady-state at no-load;
at time tStart a load torque step is applied.

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


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

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


Test example: InductionMachineSquirrelCage inverter drive. This is a model of a complete inverter drive comprising:

within Modelica.Electrical.Machines.Examples.InductionMachines;
model IMC_InverterDrive
  "Test example: InductionMachineSquirrelCage inverter drive"
  extends Modelica.Icons.Example;
  import Modelica.Constants.pi;
  import Modelica.Electrical.Polyphase.Functions.factorY2DC;
  constant Integer m=3 "Number of phases";
  parameter SI.Voltage VNominal=400
    "Nominal RMS voltage per phase";
  parameter SI.Frequency fNominal=50 "Nominal frequency";
  parameter SI.Resistance RGrid=10e-3 "Grid choke resistance";
  parameter SI.Inductance LGrid=500e-6 "Grid choke inductance";
  parameter SI.Voltage VDC=factorY2DC(m)*VNominal/sqrt(3) "Theoretical DC voltage";
  parameter SI.Capacitance CDC=5e-3 "DC capacitor";
  parameter SI.Torque TLoad=161.4 "Nominal load torque";
  parameter SI.AngularVelocity wLoad=1440.45*2*pi/60 "Nominal load speed";
  parameter SI.Inertia JLoad=0.29 "Load's moment of inertia";
  Polyphase.Sources.SineVoltage sineVoltage(
    final m=m,
    final phase=-Modelica.Electrical.Polyphase.Functions.symmetricOrientation(m),
    final f=fill(fNominal, m),
    final offset=zeros(m),
    final startTime=zeros(m),
    final V=fill(VNominal*sqrt(2/3), m))
  Polyphase.Basic.Star star(m=m)
  Analog.Basic.Ground ground
  Sensors.CurrentQuasiRMSSensor gridCurrent
  Polyphase.Basic.Resistor resistor(
    final m=m,
    final R=fill(RGrid, m),
    final T_ref=fill(20, m),
    final alpha=zeros(m),
    final T=fill(20, m))
  Polyphase.Basic.Inductor inductor(m=m, final L=fill(LGrid, m))

  PowerConverters.ACDC.DiodeBridge2mPulse rectifier
  Analog.Basic.Capacitor capacitor(v(fixed=true, start=VDC), C=CDC)
  PowerConverters.DCAC.Polyphase2Level inverter
  Machines.Sensors.CurrentQuasiRMSSensor machineCurrent
  Machines.Utilities.TerminalBox terminalBox(terminalConnection="D")
  Machines.BasicMachines.InductionMachines.IM_SquirrelCage aimc(
    p=aimcData.p,
    fsNominal=aimcData.fsNominal,
    Rs=aimcData.Rs,
    TsRef=aimcData.TsRef,
    alpha20s(displayUnit="1/K") = aimcData.alpha20s,
    Lszero=aimcData.Lszero,
    Lssigma=aimcData.Lssigma,
    Jr=aimcData.Jr,
    Js=aimcData.Js,
    frictionParameters=aimcData.frictionParameters,
    phiMechanical(fixed=true),
    wMechanical(fixed=true),
    statorCoreParameters=aimcData.statorCoreParameters,
    strayLoadParameters=aimcData.strayLoadParameters,
    Lm=aimcData.Lm,
    Lrsigma=aimcData.Lrsigma,
    Rr=aimcData.Rr,
    TrRef=aimcData.TrRef,
    TsOperational=293.15,
    alpha20r=aimcData.alpha20r,
    TrOperational=293.15)
  parameter Utilities.ParameterRecords.IM_SquirrelCageData aimcData(
    Rs=0.03*16,
    Rr=0.04*16,
    Lssigma=3*(1 - sqrt(1 - 0.0667))/(2*pi*aimcData.fsNominal)*16,
    Lm=3*sqrt(1 - 0.0667)/(2*pi*aimcData.fsNominal)*16,
    Lrsigma=3*(1 - sqrt(1 - 0.0667))/(2*pi*aimcData.fsNominal)*16) "Induction machine data"
  Modelica.Mechanics.Rotational.Components.Inertia loadInertia(J=JLoad)
  Mechanics.Rotational.Sources.QuadraticSpeedDependentTorque loadTorque(
    useSupport=false, tau_nominal=-TLoad,
    TorqueDirection=false,
    w_nominal=wLoad)
  Modelica.Blocks.Sources.Ramp ramp(height=fNominal,
    startTime=0,
    duration=1.2)
  Machines.Utilities.VfController vfController(
    final m=m,
    VNominal=VNominal,
    fNominal=fNominal,
    EconomyMode=true)

  SpacePhasors.Blocks.ToSpacePhasor toSpacePhasor
  PowerConverters.DCAC.Control.PWM pwm(uMax=VDC, f=2000)
initial equation
  inductor.i[1:2] = zeros(2);
  aimc.is[1:3] = zeros(3);
  aimc.ir = zeros(2);
equation
  connect(loadTorque.flange, loadInertia.flange_b)
  connect(terminalBox.plugSupply, machineCurrent.plug_n)
  connect(terminalBox.plug_sn, aimc.plug_sn)
  connect(terminalBox.plug_sp, aimc.plug_sp)
  connect(aimc.flange, loadInertia.flange_a)
  connect(vfController.u, ramp.y)
  connect(toSpacePhasor.u, vfController.y)
  connect(pwm.u, toSpacePhasor.y)
  connect(inverter.fire_p, pwm.fire_p)
  connect(inverter.fire_n, pwm.fire_n)
  connect(inverter.ac, machineCurrent.plug_p)
  connect(capacitor.p, inverter.dc_p)
  connect(capacitor.n, inverter.dc_n)
  connect(rectifier.dc_p, capacitor.p)
  connect(rectifier.dc_n, capacitor.n)
  connect(sineVoltage.plug_n, star.plug_p)
  connect(star.pin_n, ground.p)
  connect(resistor.plug_n, inductor.plug_p)
  connect(inductor.plug_n, rectifier.ac)
  connect(resistor.plug_p, gridCurrent.plug_p)
  connect(gridCurrent.plug_n, sineVoltage.plug_p)
end IMC_InverterDrive;


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

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