Single-phase DC to AC converter. This is a single-phase two level inverter. The boolean signals fire_p and fire_n shall not be true at the same time to avoid DC bus short circuits. The inverter consists of two transistors and two anti parallel free wheeling diodes.

within Modelica.Electrical.PowerConverters.DCAC;
model SinglePhase2Level "Single-phase DC to AC converter"
  extends Modelica.Blocks.Icons.Block;
  parameter SI.Resistance RonTransistor=1e-05
    "Transistor closed resistance";
  parameter SI.Conductance GoffTransistor=1e-05
    "Transistor opened conductance";
  parameter SI.Voltage VkneeTransistor=0
    "Transistor threshold voltage";
  parameter SI.Resistance RonDiode=1e-05
    "Diode closed resistance";
  parameter SI.Conductance GoffDiode=1e-05
    "Diode opened conductance";
  parameter SI.Voltage VkneeDiode=0 "Diode threshold voltage";
  // parameter Boolean useEnable "Enables enable signal connector";
  extends PowerConverters.Interfaces.DCAC.DCtwoPin;
  extends PowerConverters.Interfaces.DCAC.ACpin;
  extends Modelica.Electrical.Analog.Interfaces.ConditionalHeatPort(final T=
       293.15);
  extends Interfaces.Enable.Enable2;
  Modelica.Electrical.Analog.Ideal.IdealGTOThyristor transistor_p(
    final Ron=RonTransistor,
    final Goff=GoffTransistor,
    final Vknee=VkneeTransistor,
    final useHeatPort=useHeatPort)
  Modelica.Electrical.Analog.Ideal.IdealDiode diode_p(
    final Ron=RonDiode,
    final Goff=GoffDiode,
    final Vknee=VkneeDiode,
    final useHeatPort=useHeatPort)
  Modelica.Electrical.Analog.Ideal.IdealGTOThyristor transistor_n(
    final Ron=RonTransistor,
    final Goff=GoffTransistor,
    final Vknee=VkneeTransistor,
    final useHeatPort=useHeatPort)
  Modelica.Electrical.Analog.Ideal.IdealDiode diode_n(
    final Ron=RonDiode,
    final Goff=GoffDiode,
    final Vknee=VkneeDiode,
    final useHeatPort=useHeatPort)
equation
  if not useHeatPort then
    LossPower = transistor_p.LossPower + diode_n.LossPower + transistor_n.LossPower
       + diode_n.LossPower;
  end if;
  connect(transistor_p.p, dc_p)
  connect(transistor_n.n, dc_n)
  connect(transistor_p.p, diode_p.n)
  connect(transistor_p.n, diode_p.p)
  connect(transistor_n.p, diode_n.n)
  connect(transistor_n.n, diode_n.p)
  connect(transistor_p.n, transistor_n.p)
  connect(ac, transistor_p.n)
  connect(transistor_p.heatPort, heatPort)
  connect(transistor_n.heatPort, heatPort)
  connect(diode_p.heatPort, heatPort)
  connect(diode_n.heatPort, heatPort)
  connect(andCondition_p.y, transistor_p.fire)
  connect(andCondition_n.y, transistor_n.fire)
end SinglePhase2Level;


Intersective PWM. The intersective PWM transforms the input space phasor <u>u</u> to the three-phase voltages,
and compares them with the reference signals.
As long as the phase voltage is greater than the corresponding reference signal, the corresponding fire signal is true.
The switching pattern of the negative fire signal is just the inverse of the positive fire signal.

within Modelica.Electrical.PowerConverters.DCAC.Control;
block IntersectivePWM "Intersective PWM"
  extends Modelica.Blocks.Icons.Block;
  import Modelica.Electrical.PowerConverters.Types.ReferenceType;
  constant Integer m=3 "Number of phases";
  parameter SI.Frequency f "Switching frequency";
  parameter SI.Time startTime=0 "Start time of PWM";
  parameter Real uMax "Maximum amplitude of signal";
  parameter PowerConverters.Types.ReferenceType refType=PowerConverters.Types.ReferenceType.Triangle3
    "Type of reference signal"
  Modelica.Blocks.Interfaces.RealInput u[2] "Reference space phasor"
  Modelica.Blocks.Interfaces.BooleanOutput fire_p[m] "Positive fire signal"
  Modelica.Blocks.Interfaces.BooleanOutput fire_n[m] "Negative fire signal"
  Modelica.Electrical.Machines.SpacePhasors.Blocks.FromSpacePhasor
    fromSpacePhasor(final m=m)
  Modelica.Blocks.Sources.Constant zero(final k=0)
  Modelica.Blocks.Sources.SawTooth sawTooth[m](
    each final nperiod=-1,
    each final amplitude=uMax,
    each final offset=-uMax/2,
    each final period=1/f,
    final startTime={startTime - 1.5 + (if refType == ReferenceType.Sawtooth1
         then 0 else k)/m for k in 0:m - 1}/f)
         if (refType==ReferenceType.Sawtooth1 or refType==ReferenceType.Sawtooth3)
  Modelica.Blocks.Sources.Trapezoid trapezoid[3](
    each final amplitude=uMax,
    each final width=0,
    each final nperiod=-1,
    each final offset=-uMax/2,
    each final rising=0.5/f,
    each final falling=0.5/f,
    each final period=1/f,
    final startTime={startTime - 1.25 + (if refType == ReferenceType.Triangle1
         then 0 else k)/m for k in 0:m - 1}/f)
         if (refType==ReferenceType.Triangle1 or refType==ReferenceType.Triangle3)
  Modelica.Blocks.Logical.GreaterEqual greaterEqual[m]
  Modelica.Blocks.Logical.Not negation[m]
  Modelica.Blocks.Logical.Switch switch1[m]
  Modelica.Blocks.Sources.Constant const[m](each k=-uMax)
  Modelica.Blocks.Sources.BooleanExpression booleanExpression(y=time >=
        startTime)
  Modelica.Blocks.Routing.BooleanReplicator booleanReplicator(nout=m)
equation
  connect(u, fromSpacePhasor.u)
  connect(zero.y, fromSpacePhasor.zero)
  connect(fromSpacePhasor.y, greaterEqual.u1)
  connect(greaterEqual.y, fire_p)
  connect(negation.y, fire_n)
  connect(greaterEqual.y, negation.u)
  connect(switch1.y, greaterEqual.u2)
  connect(sawTooth.y, switch1.u1)
  connect(trapezoid.y, switch1.u1)
  connect(const.y, switch1.u3)
  connect(booleanReplicator.y, switch1.u2)
  connect(booleanExpression.y, booleanReplicator.u)
end IntersectivePWM;


within Modelica.Electrical.PowerConverters.DCAC;
package Control "Control components for DC to AC converters"
  extends Modelica.Icons.Package;
end Control;


Pulse width modulation. Let the user choose the PWM type from:

within Modelica.Electrical.PowerConverters.DCAC.Control;
block PWM "Pulse width modulation"
  extends Modelica.Blocks.Icons.Block;
  constant Integer m=3 "Number of phases";
  parameter PowerConverters.Types.PWMType pwmType=PowerConverters.Types.PWMType.SVPWM
    "PWM Type"
  parameter SI.Frequency f "Switching frequency";
  parameter SI.Time startTime=0 "Start time of PWM";
  parameter Real uMax "Maximum amplitude of signal";
  parameter PowerConverters.Types.ReferenceType refType=PowerConverters.Types.ReferenceType.Triangle3
    "Type of reference signal"
  Modelica.Blocks.Interfaces.RealInput u[2] "Reference space phasor"
  Modelica.Blocks.Interfaces.BooleanOutput fire_p[m] "Positive fire signal"
  Modelica.Blocks.Interfaces.BooleanOutput fire_n[m] "Negative fire signal"
  PowerConverters.DCAC.Control.SVPWM svPWM(
    f=f,
    startTime=startTime,
    uMax=uMax) if pwmType == PowerConverters.Types.PWMType.SVPWM
  PowerConverters.DCAC.Control.IntersectivePWM intersectivePWM(
    f=f,
    startTime=startTime,
    uMax=uMax,
    refType=refType) if pwmType == PowerConverters.Types.PWMType.Intersective
equation
  connect(u, svPWM.u)
  connect(u, intersectivePWM.u)
  connect(svPWM.fire_p, fire_p)
  connect(intersectivePWM.fire_p, fire_p)
  connect(svPWM.fire_n, fire_n)
  connect(intersectivePWM.fire_n, fire_n)
end PWM;


Space vector pulse width modulation. For a three-phase system, 8 space vectors are available according to the following switching patterns:

within Modelica.Electrical.PowerConverters.DCAC.Control;
block SVPWM "Space vector pulse width modulation"
  parameter SI.Frequency f "Switching frequency";
  extends Modelica.Blocks.Interfaces.DiscreteBlock(final samplePeriod=1/f);
  import Modelica.Constants.small;
  import Modelica.Constants.eps;
  import Modelica.Constants.pi;
  import Modelica.Math.atan2;
  constant Integer m=3 "Number of phases";
  parameter Real uMax "Maximum length of space vector = half diagonal of hexagon";
  constant Boolean fire[6,m]=[true, false,false;
                              true, true, false;
                              false,true, false;
                              false,true, true;
                              false,false,true;
                              true, false,true] "Switching patterns";
  Modelica.Blocks.Interfaces.RealInput u[2] "Reference space phasor"
  Modelica.Blocks.Interfaces.BooleanOutput fire_p[m] "Positive fire signal"
  Modelica.Blocks.Interfaces.BooleanOutput fire_n[m] "Negative fire signal"
protected
  discrete Real uRef(start=0, fixed=true) "Length of reference vector";
  discrete SI.Angle phiRef(start=0, fixed=true) "Angle of reference vector within (-pi, +pi]";
  discrete SI.Angle phiPos(start=0, fixed=true) "Angle of reference vector within [0, 2*pi)";
  Integer ka(start=0, fixed=true), kb(start=0, fixed=true) "Switching patterns limiting the sector";
  discrete SI.Angle phiSec(start=0, fixed=true) "Angle of reference vector within sector within [0, pi/m)";
  discrete Real ta(start=0, fixed=true), tb(start=0, fixed=true), t0(start=1, fixed=true) "Relative time spans of vectors a, b, and 0";
  discrete SI.Time T0(start=startTime, fixed=true) "Start time of switching interval";
algorithm
  when sampleTrigger then
    //Limited relative reference signal
    uRef:=min(sqrt(u[1]^2 + u[2]^2)/(2/3*uMax), cos(pi/6));
    //Determine angle of reference signal within (-pi, +pi]
    phiRef:=if uRef < small then 0 else atan2(u[2], u[1]);
    //Shift angle to [0, 2*pi)
    // Note that phiRef is likely to be very close to zero, so the extra logic ensures that
    // we do not get values at 2*pi since that will look odd.
    phiPos:=max(0, phiRef + (if phiRef < -2*pi*Modelica.Constants.eps then 2*pi else 0));
    //Determine sector and neighbour sector
    ka:=min(integer(phiPos/(pi/m)), 2*m-1); // The min guards against roundoff
    kb:=mod(ka+1, 2*m);
    //Determine angle within sector in the range of [0, pi/m)
    phiSec:=phiPos - ka*pi/m;
    //Determine limited relative time spans
    //uRef*cos(phiSec)=tb*cos(pi/m) + ta;
    //uRef*sin(phiSec)=tb*sin(pi/m);
    tb:=min(uRef*sin(phiSec)/sin(pi/m), 1);
    ta:=min(uRef*cos(phiSec) - tb*cos(pi/m), 1);
    t0:=max(1 - ta - tb, 0);
    //Remember start time of switching interval
    T0:=time;
  end when;
equation
  //Distribute switching patterns t0/4 + ta/2 + tb/2 + t0/2 + tb/2 + ta/2 + t0/4
  if time<startTime then
    fire_p= fill(true, m);
  elseif time < T0 + samplePeriod * (t0/4) then
    fire_p= fill(false, m);
  elseif time < T0 + samplePeriod * (t0/4 + ta/2) then
    fire_p= fire[ka + 1, :];
  elseif time < T0 + samplePeriod * (t0/4 + ta/2 + tb/2) then
    fire_p= fire[kb + 1, :];
  elseif time < T0 + samplePeriod * (t0/4 + ta/2 + tb/2 + t0/2) then
    fire_p= fill(true, m);
  elseif time < T0 + samplePeriod * (t0/4 + ta/2 + tb/2 + t0/2 + tb/2) then
    fire_p= fire[kb + 1, :];
  elseif time < T0 + samplePeriod * (t0/4 + ta/2 + tb/2 + t0/2 + tb/2 + ta/2) then
    fire_p= fire[ka + 1, :];
  else
    fire_p= fill(false, m);
  end if;
  fire_n= not fire_p;
end SVPWM;


Bidirectional chopper. This is a bidirectional buck / boost - converter with 2 transistors and 2 freewheeling diodes.

within Modelica.Electrical.PowerConverters.DCDC;
model ChopperBuckBost "Bidirectional chopper"
  extends Modelica.Electrical.PowerConverters.Interfaces.DCDC.DCtwoPin1;
  extends Modelica.Electrical.PowerConverters.Interfaces.DCDC.DCtwoPin2;
  extends Modelica.Electrical.Analog.Interfaces.ConditionalHeatPort(final T=293.15);
  parameter Modelica.Units.SI.Resistance RonTransistor=1e-05
    "Transistor closed resistance";
  parameter Modelica.Units.SI.Conductance GoffTransistor=1e-05
    "Transistor opened conductance";
  parameter Modelica.Units.SI.Voltage VkneeTransistor=0
    "Transistor threshold voltage";
  parameter Modelica.Units.SI.Resistance RonDiode=1e-05
    "Diode closed resistance";
  parameter Modelica.Units.SI.Conductance GoffDiode=1e-05
    "Diode opened conductance";
  parameter Modelica.Units.SI.Voltage VkneeDiode=0
    "Diode threshold voltage";
  extends Modelica.Electrical.PowerConverters.Interfaces.Enable.Enable2;
  Modelica.Electrical.Analog.Ideal.IdealGTOThyristor transistorLS(
    useHeatPort=useHeatPort,
    Ron=RonTransistor,
    Goff=GoffTransistor,
    Vknee=VkneeTransistor) "Switching transistor low side"
  Modelica.Electrical.Analog.Ideal.IdealDiode diodeLS(
    useHeatPort=useHeatPort,
    Ron=RonDiode,
    Goff=GoffDiode,
    Vknee=VkneeDiode) "Free wheeling diode low side"
  Modelica.Electrical.Analog.Ideal.IdealGTOThyristor transistorHS(
    useHeatPort=useHeatPort,
    Ron=RonTransistor,
    Goff=GoffTransistor,
    Vknee=VkneeTransistor) "Switching transistor high side"
  Modelica.Electrical.Analog.Ideal.IdealDiode diodeHS(
    useHeatPort=useHeatPort,
    Ron=RonDiode,
    Goff=GoffDiode,
    Vknee=VkneeDiode) "Free wheeling diode high side"
equation
  if not useHeatPort then
    LossPower = diodeLS.LossPower + transistorLS.LossPower
              + diodeHS.LossPower + transistorHS.LossPower;
  end if;
  connect(transistorLS.p, diodeLS.n)
  connect(dc_n1, transistorLS.n)
  connect(transistorLS.n, diodeLS.p)
  connect(diodeHS.p, transistorHS.n)
  connect(diodeHS.n, transistorHS.p)
  connect(transistorHS.p, dc_p2)
  connect(dc_n1, dc_n2)
  connect(diodeLS.heatPort, heatPort)
  connect(transistorLS.heatPort, heatPort)
  connect(diodeHS.heatPort, heatPort)
  connect(transistorHS.heatPort, heatPort)
  connect(dc_p1, transistorLS.p)
  connect(transistorHS.n, dc_p1)
  connect(andCondition_n.y, transistorHS.fire)
  connect(andCondition_p.y, transistorLS.fire)
end ChopperBuckBost;


Step down chopper. This is a conventional step down chopper (buck converter) model. It consists of a transistor and free wheeling diode.

within Modelica.Electrical.PowerConverters.DCDC;
model ChopperStepDown "Step down chopper"
  import Modelica.Constants.pi;
  extends Icons.Converter;
  parameter SI.Resistance RonTransistor=1e-05
    "Transistor closed resistance";
  parameter SI.Conductance GoffTransistor=1e-05
    "Transistor opened conductance";
  parameter SI.Voltage VkneeTransistor=0
    "Transistor threshold voltage";
  parameter SI.Resistance RonDiode(final min=0) = 1e-05
    "Closed diode resistance";
  parameter SI.Conductance GoffDiode(final min=0) = 1e-05
    "Opened diode conductance";
  parameter SI.Voltage VkneeDiode(final min=0) = 0
    "Diode forward threshold voltage";
  extends PowerConverters.Interfaces.DCDC.DCtwoPin1;
  extends PowerConverters.Interfaces.DCDC.DCtwoPin2;
  extends Modelica.Electrical.Analog.Interfaces.ConditionalHeatPort(final T=
       293.15);
  extends Interfaces.Enable.Enable1;
  Modelica.Electrical.Analog.Ideal.IdealGTOThyristor transistor(
    useHeatPort=useHeatPort,
    Ron=RonTransistor,
    Goff=GoffTransistor,
    Vknee=VkneeTransistor) "Switching transistor"
  Modelica.Electrical.Analog.Ideal.IdealDiode diode(
    Ron=RonDiode,
    Goff=GoffDiode,
    Vknee=VkneeDiode,
    useHeatPort=useHeatPort) "Free wheeling diode"
equation
  if not useHeatPort then
    LossPower = diode.LossPower + transistor.LossPower;
  end if;
  connect(diode.n, transistor.n)
  connect(transistor.n, dc_p2)
  connect(transistor.heatPort, heatPort)
  connect(diode.heatPort, heatPort)
  connect(dc_p1, transistor.p)
  connect(dc_n1, diode.p)
  connect(dc_n1, dc_n2)
  connect(andCondition_p.y, transistor.fire)
end ChopperStepDown;


Step up chopper. This is a conventional step up chopper (boost converter) model. It consists of a transistor and free wheeling diode.

within Modelica.Electrical.PowerConverters.DCDC;
model ChopperStepUp "Step up chopper"
  import Modelica.Constants.pi;
  extends Icons.Converter;
  parameter SI.Resistance RonTransistor=1e-05
    "Transistor closed resistance";
  parameter SI.Conductance GoffTransistor=1e-05
    "Transistor opened conductance";
  parameter SI.Voltage VkneeTransistor=0
    "Transistor threshold voltage";
  parameter SI.Resistance RonDiode(final min=0) = 1e-05
    "Closed diode resistance";
  parameter SI.Conductance GoffDiode(final min=0) = 1e-05
    "Opened diode conductance";
  parameter SI.Voltage VkneeDiode(final min=0) = 0
    "Diode forward threshold voltage";
  extends PowerConverters.Interfaces.DCDC.DCtwoPin1;
  extends PowerConverters.Interfaces.DCDC.DCtwoPin2;
  extends Modelica.Electrical.Analog.Interfaces.ConditionalHeatPort(final T=
       293.15);
  extends Interfaces.Enable.Enable1;
  Modelica.Electrical.Analog.Ideal.IdealGTOThyristor transistor(
    useHeatPort=useHeatPort,
    Ron=RonTransistor,
    Goff=GoffTransistor,
    Vknee=VkneeTransistor) "Switching transistor"
  Modelica.Electrical.Analog.Ideal.IdealDiode diode(
    Ron=RonDiode,
    Goff=GoffDiode,
    Vknee=VkneeDiode,
    useHeatPort=useHeatPort) "Free wheeling diode"
equation
  if not useHeatPort then
    LossPower = diode.LossPower + transistor.LossPower;
  end if;
  connect(andCondition_p.y, transistor.fire)
  connect(dc_p1, transistor.p)
  connect(dc_n1, transistor.n)
  connect(dc_p1, diode.p)
  connect(diode.n, dc_p2)
  connect(dc_n1, dc_n2)
  connect(transistor.heatPort, heatPort)
  connect(heatPort, diode.heatPort)
end ChopperStepUp;


H bridge (four quadrant converter). The H bridge is a four quadrant DC/DC converter. It consists of two single-phase DC/AC converters which are controlled differently; see Fig. 1.

within Modelica.Electrical.PowerConverters.DCDC;
model HBridge "H bridge (four quadrant converter)"
  extends Icons.Converter;
  extends PowerConverters.Interfaces.DCDC.DCtwoPin1;
  extends PowerConverters.Interfaces.DCDC.DCtwoPin2;
  extends Modelica.Electrical.Analog.Interfaces.ConditionalHeatPort(final T=
       293.15);
  parameter SI.Resistance RonTransistor=1e-05
    "Transistor closed resistance";
  parameter SI.Conductance GoffTransistor=1e-05
    "Transistor opened conductance";
  parameter SI.Voltage VkneeTransistor=0
    "Transistor threshold voltage";
  parameter SI.Resistance RonDiode=1e-05
    "Diode closed resistance";
  parameter SI.Conductance GoffDiode=1e-05
    "Diode opened conductance";
  parameter SI.Voltage VkneeDiode=0 "Diode threshold voltage";
  extends Interfaces.Enable.Enable2;
  DCAC.SinglePhase2Level inverter_p(
    final RonTransistor=RonTransistor,
    final GoffTransistor=GoffTransistor,
    final VkneeTransistor=VkneeTransistor,
    final RonDiode=RonDiode,
    final GoffDiode=GoffDiode,
    final VkneeDiode=VkneeDiode,
    final useHeatPort=useHeatPort)
  DCAC.SinglePhase2Level inverter_n(
    final RonTransistor=RonTransistor,
    final GoffTransistor=GoffTransistor,
    final VkneeTransistor=VkneeTransistor,
    final RonDiode=RonDiode,
    final GoffDiode=GoffDiode,
    final VkneeDiode=VkneeDiode,
    final useHeatPort=useHeatPort)
  Modelica.Blocks.Interfaces.BooleanInput fire_p
    "Firing signals of positive potential leg"
  Modelica.Blocks.Interfaces.BooleanInput fire_n
    "Firing signals of negative potential leg"
  Blocks.Logical.Not not_p
  Blocks.Logical.Not not_n
equation
  if not useHeatPort then
    LossPower = inverter_p.LossPower + inverter_n.LossPower;
  end if;
  connect(inverter_n.heatPort, heatPort)
  connect(inverter_p.heatPort, heatPort)
  connect(dc_p1, inverter_p.dc_p)
  connect(dc_p1, inverter_n.dc_p)
  connect(dc_n1, inverter_n.dc_n)
  connect(dc_n1, inverter_p.dc_n)
  connect(inverter_p.ac, dc_p2)
  connect(inverter_n.ac, dc_n2)
  connect(andCondition_p.y, inverter_p.fire_p)
  connect(andCondition_n.y, inverter_n.fire_p)
  connect(not_p.y, inverter_p.fire_n)
  connect(andCondition_p.y, not_p.u)
  connect(andCondition_n.y, not_n.u)
  connect(not_n.y, inverter_n.fire_n)
end HBridge;


DC to DC converters

within Modelica.Electrical.PowerConverters;
package DCDC "DC to DC converters"
  extends Modelica.Icons.Package;
end DCDC;


within Modelica.Electrical.PowerConverters.DCDC;
package Control "Control components for DC to DC converters"
  extends Modelica.Icons.Package;
end Control;


Generates a pulse width modulated (PWM) boolean fire signal. This controller can be used both for DC/DC and AC/DC converters.
The signal input of the PWM controller is the duty cycle; the duty cycle is the ratio of the on time to the switching period.
The output firing signal is strictly determined by the actual duty cycle, indicated as d in Fig. 1.

within Modelica.Electrical.PowerConverters.DCDC.Control;
model SignalPWM
  "Generates a pulse width modulated (PWM) boolean fire signal"
  extends Icons.Control;
  import Modelica.Electrical.PowerConverters.Types.SingleReferenceType;
  parameter Boolean useConstantDutyCycle=true
    "Enables constant duty cycle";
  parameter Real constantDutyCycle=0 "Constant duty cycle"
  parameter SI.Frequency f=1000 "Switching frequency";
  parameter SingleReferenceType refType=Modelica.Electrical.PowerConverters.Types.SingleReferenceType.Sawtooth
    "Type of reference signal";
  parameter Boolean commonComparison=true "Common or separated comparison for fire_p and fire_n"
  parameter SI.Time startTime=0 "Start time";
  Modelica.Blocks.Interfaces.RealInput dutyCycle if not
    useConstantDutyCycle "Duty cycle"
  Modelica.Blocks.Interfaces.BooleanOutput fire "Firing PWM signal"
  Modelica.Blocks.Interfaces.BooleanOutput notFire "Firing PWM signal"
  Modelica.Blocks.Sources.Constant const(final k=constantDutyCycle) if
    useConstantDutyCycle
  Modelica.Blocks.Nonlinear.Limiter limiter(uMax=1, uMin=0)

  Modelica.Blocks.Discrete.ZeroOrderHold zeroOrderHold(final startTime=
        startTime, final samplePeriod=1/f)
  Modelica.Blocks.Sources.SawTooth sawtooth(
    final period=1/f,
    final amplitude=1,
    final nperiod=-1,
    final offset=0,
    final startTime=startTime) if refType==SingleReferenceType.Sawtooth
  Modelica.Blocks.Sources.Trapezoid triangle(
    rising=0.5/f,
    width=0,
    falling=0.5/f,
    final period=1/f,
    final amplitude=1,
    final nperiod=-1,
    final offset=0,
    final startTime=startTime) if refType==SingleReferenceType.Triangle
  Blocks.Logical.Greater greaterEqual_p
  Modelica.Blocks.Logical.Not inverse if commonComparison
  Blocks.Math.Add add(final k1=-1, final k2=+1) if
                         not commonComparison
  Blocks.Sources.Constant constOne(final k=1) if not commonComparison
  Blocks.Logical.Greater greaterEqual_n if not commonComparison
equation
  connect(const.y, limiter.u)
  connect(dutyCycle, limiter.u)
  connect(limiter.y, zeroOrderHold.u)
  connect(zeroOrderHold.y, add.u1)
  connect(constOne.y, add.u2)
  connect(zeroOrderHold.y, greaterEqual_p.u1)
  connect(add.y, greaterEqual_n.u1)
  connect(greaterEqual_p.y, fire)
  connect(greaterEqual_n.y, notFire)
  connect(greaterEqual_p.y, inverse.u)
  connect(inverse.y, notFire)
  connect(triangle.y, greaterEqual_p.u2)
  connect(triangle.y, greaterEqual_n.u2)
  connect(greaterEqual_n.u2, sawtooth.y)
  connect(greaterEqual_p.u2, sawtooth.y)
end SignalPWM;


Linearly transforms voltage to duty cycle. Transforms the input voltage signal into a duty cycle:

within Modelica.Electrical.PowerConverters.DCDC.Control;
block Voltage2DutyCycle "Linearly transforms voltage to duty cycle"
  parameter Boolean reciprocal = false
    "Enables reciprocal formula between voltage and duty cycle";
  parameter Boolean useBipolarVoltage = true
    "Enables bipolar input voltage range"
  parameter Boolean useConstantVoltageLimit=true
    "Enables constant voltage limit";
  parameter SI.Voltage VLim(final min=Modelica.Constants.small)
    "Voltage range limit mapped to dutyCycle = 1 resp. 0"
  Modelica.Blocks.Interfaces.RealInput v(unit = "V") "Voltage"
  Modelica.Blocks.Interfaces.RealOutput dutyCycle "Duty cycle"
  Modelica.Blocks.Interfaces.RealInput vLim(unit = "V") if not useConstantVoltageLimit
    "Voltage limit"
  Modelica.Blocks.Sources.Constant vLimConst(final k=VLim) if useConstantVoltageLimit
    "Constant voltage limit"
protected
  Modelica.Blocks.Interfaces.RealInput vLimInt(unit="V") "Internal voltage limit"
equation
  if not reciprocal then
    if not useBipolarVoltage then
      dutyCycle =max(min(v, vLimInt), 0)/vLimInt;
    else
      dutyCycle =(max(min(v, vLimInt), -vLimInt)/vLimInt + 1)/2;
    end if;
  else
    dutyCycle =1 - vLimInt/max(v, vLimInt);
  end if;
  connect(vLim, vLimInt)
  connect(vLimInt, vLimConst.y)
end Voltage2DutyCycle;


Partial model providing enable parameter and optional enable input. This model provides an internal enable signal derived either from a parameter or an optional signal input.
For useConstantEnable = true the internal signal internalEnable is equal to the parameter constantEnable.
For useConstantEnable = false the internal signal
internalEnable is equal to the external signal input enable.

within Modelica.Electrical.PowerConverters.Enable;
model EnableLogic
  "Partial model providing enable parameter and optional enable input"
  parameter Boolean useConstantEnable=true
    "Disable boolean input and use constantEnable, if true";
  parameter Boolean constantEnable=true
    "Constant enabling of firing signals"
  parameter Integer m(final min=1) = 3 "Number of phases"
  Modelica.Blocks.Sources.BooleanConstant enableConstantSource(final k=
        constantEnable) if useConstantEnable
    "Constant enable signal of fire and notFire"
  Modelica.Blocks.Interfaces.BooleanInput enable if not useConstantEnable
    "Enables fire and notFire"
  Modelica.Blocks.Routing.BooleanReplicator booleanReplicator(final nout=m)
  Modelica.Blocks.Interfaces.BooleanOutput internalEnable[m]
    "m replicated enable signals"
equation
  connect(internalEnable, booleanReplicator.y)
  connect(enable, booleanReplicator.u)
  connect(enableConstantSource.y, booleanReplicator.u)
end EnableLogic;


Enabling models

within Modelica.Electrical.PowerConverters;
package Enable "Enabling models"
  extends Modelica.Icons.Package;
end Enable;


Examples

within Modelica.Electrical.PowerConverters;
package Examples "Examples"
  extends Modelica.Icons.ExamplesPackage;
end Examples;


Dimmer with resistive load. This model demonstrates the behaviour of a dimmer with phase-angle control with resistive load.

within Modelica.Electrical.PowerConverters.Examples.ACAC;
model Dimmer_R "Dimmer with resistive load"
  extends PowerConverters.Examples.ACAC.ExampleTemplates.Dimmer(powerFactor=1);
  extends Modelica.Icons.Example;
  Modelica.Electrical.Analog.Basic.Resistor loadResistor(R=RLoad)
equation
  connect(ground.p, loadResistor.n)
  connect(loadResistor.p, multiSensor.nc)
end Dimmer_R;


Dimmer with resistive-inductive load. This model demonstrates the behaviour of a dimmer with phase-angle control with resistive-inductive load.
Note that due to the inductance the current is not zero at the points in time where zero-crossing of the voltage occurs,
and the triac stays conducting until the current becomes zero.

within Modelica.Electrical.PowerConverters.Examples.ACAC;
model Dimmer_RL "Dimmer with resistive-inductive load"
  extends PowerConverters.Examples.ACAC.ExampleTemplates.Dimmer(powerFactor=
        0.87);
  extends Modelica.Icons.Example;
  Modelica.Electrical.Analog.Basic.Resistor loadResistor(R=RLoad)
  Modelica.Electrical.Analog.Basic.Inductor loadInductor(i(start=0, fixed=true),
      L=LLoad)
equation
  connect(loadResistor.p, multiSensor.nc)
  connect(ground.p, loadInductor.n)
  connect(loadInductor.p, loadResistor.n)
end Dimmer_RL;


AC to AC converter examples

within Modelica.Electrical.PowerConverters.Examples;
package ACAC "AC to AC converter examples"
  extends Modelica.Icons.ExamplesPackage;
end ACAC;


Soft start of an induction machine. This model demonstrates a soft start of an induction machine:
Voltage ramp is started at 0.1 s and should ramp up to nominal voltage within 4s,
but current is limited to 2.5 times nominal current.
At 5.5 s a voltage ramp down within 3 s is required.

within Modelica.Electrical.PowerConverters.Examples.ACAC;
model SoftStarter "Soft start of an induction machine"
  extends Modelica.Icons.Example;
  import Modelica.Constants.pi;
  constant Integer m=3 "Number of phases";
  constant Real y2d=Modelica.Electrical.Polyphase.Functions.factorY2D(m);
  parameter SI.Voltage VNominal=100 "Nominal RMS voltage line to line";
  parameter SI.Current INominal=100*y2d "Nominal RMS current at the terminals";
  parameter SI.Frequency fNominal=aimcData.fsNominal "Nominal frequency";
  parameter SI.Inertia JLoad=aimcData.Jr "Load's moment of inertia";
  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";
  Modelica.Electrical.Polyphase.Sources.SineVoltage sineVoltage(
    final m=m,
    f=fill(fNominal, m),
    V=sqrt(2)*fill(VNominal, m)/y2d)
  Modelica.Electrical.Polyphase.Basic.Star star(final m=m)
  Modelica.Electrical.Analog.Basic.Ground ground
  Modelica.Electrical.Polyphase.Sensors.CurrentQuasiRMSSensor currentQuasiRMSSensor(m=m)
  PowerConverters.ACAC.PolyphaseTriac triac(final m=m, useHeatPort=false)
  Modelica.Electrical.Polyphase.Sensors.VoltageSensor voltageSensor(m=m)
  Modelica.Electrical.Polyphase.Basic.Star star1(m=m)
  Modelica.Electrical.Analog.Basic.Ground ground1
  PowerConverters.ACDC.Control.Signal2mPulse adaptor(
    m=m,
    useConstantFiringAngle=false,
    useFilter=false,
    f=fNominal)
  PowerConverters.ACAC.Control.VoltageToAngle voltageToAngle(VNominal=1,
      voltage2Angle=PowerConverters.Types.Voltage2AngleType.H01)
  Modelica.Electrical.Polyphase.Sensors.MultiSensor multiSensor(m=m)
  Modelica.Electrical.Polyphase.Basic.Star star2(m=m)
  Modelica.Electrical.Analog.Basic.Ground ground2
  Modelica.Blocks.Math.RootMeanSquare rootMeanSquare(f=fNominal)
  Modelica.Blocks.Math.Harmonic harmonic(f=fNominal,k=1)
  Modelica.Electrical.Machines.Utilities.MultiTerminalBox terminalBox(m=m,
      terminalConnection="D")
  Modelica.Magnetic.FundamentalWave.BasicMachines.InductionMachines.IM_SquirrelCage
    imc(
    m=m,
    p=aimcData.p,
    fsNominal=aimcData.fsNominal,
    Rs=aimcData.Rs*m/3,
    TsRef=aimcData.TsRef,
    alpha20s(displayUnit="1/K") = aimcData.alpha20s,
    effectiveStatorTurns=aimcData.effectiveStatorTurns,
    Lszero=aimcData.Lszero*m/3,
    Lssigma=aimcData.Lssigma*m/3,
    Jr=aimcData.Jr,
    Js=aimcData.Js,
    frictionParameters=aimcData.frictionParameters,
    phiMechanical(fixed=true),
    wMechanical(fixed=true),
    statorCoreParameters=aimcData.statorCoreParameters,
    strayLoadParameters=aimcData.strayLoadParameters,
    Lm=aimcData.Lm*m/3,
    Lrsigma=aimcData.Lrsigma*m/3,
    Rr=aimcData.Rr*m/3,
    TrRef=aimcData.TrRef,
    TsOperational=293.15,
    alpha20r=aimcData.alpha20r,
    TrOperational=293.15)
  parameter Modelica.Electrical.Machines.Utilities.ParameterRecords.IM_SquirrelCageData aimcData
  Modelica.Mechanics.Rotational.Components.Inertia loadInertia(J=JLoad)
  Modelica.Mechanics.Rotational.Sources.QuadraticSpeedDependentTorque
    quadraticLoadTorque(
    w_nominal=wLoad,
    TorqueDirection=false,
    tau_nominal=-TLoad,
    useSupport=false)
  PowerConverters.ACAC.Control.SoftStartControl softStartControl(
    tRampUp=4,
    vStart=0.3,
    iMax=2.5,
    iMin=2.4,
    INominal=INominal,
    tRampDown=3,
    vRef(fixed=true))
  Modelica.Blocks.Continuous.Filter filter(analogFilter=Modelica.Blocks.Types.AnalogFilter.CriticalDamping,
      f_cut=2*fNominal)
  Modelica.Blocks.Sources.BooleanTable booleanTable(table={0.1,5.5},
      startTime=0)
initial equation
  imc.is[1:3] = zeros(3);
  imc.ir[1:2] = zeros(2);
equation
  connect(ground.p, star.pin_n)
  connect(sineVoltage.plug_n, star.plug_p)
  connect(imc.flange, loadInertia.flange_a)
  connect(triac.plug_n, multiSensor.pc)
  connect(multiSensor.pc, multiSensor.pv)
  connect(multiSensor.nv,star2. plug_p)
  connect(terminalBox.plug_sn, imc.plug_sn)
  connect(terminalBox.plug_sp, imc.plug_sp)
  connect(triac.fire1, adaptor.fire_p)
  connect(triac.fire2, adaptor.fire_n)
  connect(voltageSensor.v, adaptor.v)
  connect(currentQuasiRMSSensor.plug_p, sineVoltage.plug_p)
  connect(currentQuasiRMSSensor.plug_n, triac.plug_p)
  connect(multiSensor.nc, terminalBox.plugSupply)
  connect(triac.plug_p, voltageSensor.plug_p)
  connect(voltageSensor.plug_n, star1.plug_p)
  connect(star1.pin_n, ground1.p)
  connect(star2.pin_n, ground2.p)
  connect(multiSensor.v[1], harmonic.u)
  connect(multiSensor.v[1], rootMeanSquare.u)
  connect(loadInertia.flange_b, quadraticLoadTorque.flange)
  connect(currentQuasiRMSSensor.I, filter.u)
  connect(voltageToAngle.firingAngle, adaptor.firingAngle)
  connect(filter.y, softStartControl.iRMS)
  connect(voltageToAngle.vRef, softStartControl.vRef)
  connect(booleanTable.y, softStartControl.start)
end SoftStarter;


Dimmer including control. Dimmer example template including supply and sensors; load is not yet included

within Modelica.Electrical.PowerConverters.Examples.ACAC.ExampleTemplates;
partial model Dimmer "Dimmer including control"
  extends Icons.ExampleTemplate;
  import Modelica.Constants.pi;
  parameter SI.Frequency f=50 "Source frequency";
  parameter SI.Voltage Vrms=110 "RMS source voltage";
  parameter SI.ApparentPower S=1000 "Load apparent power";
  parameter Real powerFactor(final min=0, final max=1)=0.87 "Load power factor";
  parameter SI.Impedance ZLoad=Vrms^2/S "Load impedance";
  parameter SI.Resistance RLoad=ZLoad*powerFactor "Load resistance";
  parameter SI.Inductance LLoad=ZLoad*sqrt(1 - powerFactor^2)/(2*pi*f) "Load inductance";
  Modelica.Electrical.Analog.Sources.SineVoltage sineVoltage(final V=sqrt(2)*
        Vrms, f=f)
  Modelica.Electrical.Analog.Basic.Ground ground
  PowerConverters.ACAC.SinglePhaseTriac triac(Ron=1e-9, Goff=1e-9)
  Modelica.Electrical.Analog.Sensors.VoltageSensor voltageSensor
  PowerConverters.ACDC.Control.Signal2mPulse adaptor(
    m=1,
    useConstantFiringAngle=false,
    f=f)
  Modelica.Electrical.Analog.Sensors.MultiSensor multiSensor
  PowerConverters.ACAC.Control.VoltageToAngle voltageToAngle(VNominal=1,
      voltage2Angle=PowerConverters.Types.Voltage2AngleType.RMS)
  Modelica.Blocks.Sources.Trapezoid trapezoid(
    amplitude=1,
    rising=2,
    width=2,
    falling=2,
    period=8,
    nperiod=1,
    offset=0,
    startTime=1)
  Modelica.Blocks.Math.Mean meanPower(f=f)
  Modelica.Blocks.Math.RootMeanSquare vRMS(f=f)
  Modelica.Blocks.Math.Harmonic vH01(f=f, k=1)
  Modelica.Blocks.Math.RootMeanSquare iRMS(f=f)
  Modelica.Blocks.Math.Harmonic iH01(f=f, k=1)
equation
  connect(sineVoltage.n, ground.p)
  connect(ground.p, voltageSensor.n)
  connect(voltageSensor.v, adaptor.v[1])
  connect(sineVoltage.p, triac.p)
  connect(triac.p, voltageSensor.p)
  connect(adaptor.fire_p[1], triac.fire1)
  connect(adaptor.fire_n[1], triac.fire2)
  connect(triac.n, multiSensor.pc)
  connect(multiSensor.pc, multiSensor.pv)
  connect(voltageToAngle.firingAngle, adaptor.firingAngle)
  connect(trapezoid.y, voltageToAngle.vRef)
  connect(multiSensor.power, meanPower.u)
  connect(ground.p, multiSensor.nv)
  connect(multiSensor.i, iRMS.u)
  connect(multiSensor.i, iH01.u)
  connect(multiSensor.v, vRMS.u)
  connect(multiSensor.v, vH01.u)
end Dimmer;


Templates of examples

within Modelica.Electrical.PowerConverters.Examples.ACAC;
package ExampleTemplates "Templates of examples"
  extends Modelica.Icons.Package;
end ExampleTemplates;


AC to DC converter examples

within Modelica.Electrical.PowerConverters.Examples;
package ACDC "AC to DC converter examples"
  extends Modelica.Icons.ExamplesPackage;
end ACDC;


Templates of examples

within Modelica.Electrical.PowerConverters.Examples.ACDC;
package ExampleTemplates "Templates of examples"
  extends Modelica.Icons.Package;
end ExampleTemplates;


Template of single pulse rectifier. Template of

single pulse rectifiers; load is not yet included.

within Modelica.Electrical.PowerConverters.Examples.ACDC.ExampleTemplates;
partial model Thyristor1Pulse "Template of single pulse rectifier"
  extends Icons.ExampleTemplate;
  import Modelica.Constants.pi;
  parameter SI.Voltage Vrms=110 "RMS supply voltage";
  parameter SI.Frequency f=50 "Frequency";

  Modelica.Electrical.Analog.Sensors.VoltageSensor voltagesensor
  Modelica.Electrical.Analog.Sources.SineVoltage sinevoltage(V=sqrt(2)*
        Vrms, f=f)
  Modelica.Electrical.Analog.Basic.Ground ground
  Modelica.Electrical.Analog.Sensors.CurrentSensor currentSensor
  Modelica.Blocks.Math.Mean meanVoltage(f=f)
  Modelica.Blocks.Math.RootMeanSquare rootMeanSquareVoltage(f=f)
  Modelica.Blocks.Math.Mean meanCurrent(f=f)
  PowerConverters.ACDC.Control.VoltageBridge2Pulse pulse2(f=f, useFilter=false)
  Modelica.Electrical.Analog.Ideal.IdealThyristor idealthyristor(off(
        fixed=true))
equation
  connect(meanCurrent.u, currentSensor.i)
  connect(ground.p, sinevoltage.n)
  connect(voltagesensor.v, meanVoltage.u)
  connect(voltagesensor.v, rootMeanSquareVoltage.u)
  connect(sinevoltage.p, idealthyristor.p)
  connect(ground.p, currentSensor.n)
  connect(pulse2.fire_p, idealthyristor.fire)
  connect(voltagesensor.n, currentSensor.p)
  connect(idealthyristor.n, voltagesensor.p)
  connect(sinevoltage.p, pulse2.ac_p)
  connect(sinevoltage.n, pulse2.ac_n)
end Thyristor1Pulse;


Template of 2*m pulse bridge thyristor rectifier. Template of

2*m pulse bridge rectifiers, where m is the number of phases; load is not yet included.

within Modelica.Electrical.PowerConverters.Examples.ACDC.ExampleTemplates;
partial model ThyristorBridge2mPulse
  "Template of 2*m pulse bridge thyristor rectifier"
  extends Icons.ExampleTemplate;
  import Modelica.Constants.pi;
  parameter Integer m(final min=3) = 3 "Number of phases"
  parameter SI.Voltage Vrms=110 "RMS supply voltage";
  parameter SI.Frequency f=50 "Frequency";

  Modelica.Electrical.Polyphase.Sources.SineVoltage sineVoltage(
    final m=m,
    V=fill(sqrt(2)*Vrms, m),
    phase=-
        Modelica.Electrical.Polyphase.Functions.symmetricOrientation(m),
    f=fill(f, m))
  PowerConverters.ACDC.ThyristorBridge2mPulse rectifier(final m=m)
  Modelica.Electrical.Analog.Sensors.VoltageSensor voltagesensor
  Modelica.Blocks.Math.Mean meanVoltage(f=2*m*f)
  Modelica.Blocks.Math.RootMeanSquare rootMeanSquareVoltage(f=2*m*f)
  Modelica.Electrical.Analog.Sensors.CurrentSensor currentSensor
  Modelica.Blocks.Math.Mean meanCurrent(f=2*m*f)
  PowerConverters.ACDC.Control.VoltageBridge2mPulse pulse2m(
    m=m,
    f=f,
    useFilter=false)
  Modelica.Electrical.Polyphase.Basic.MultiStarResistance
    multiStarResistance(final m=m)
  Modelica.Electrical.Analog.Basic.Ground ground
equation
  connect(meanCurrent.u, currentSensor.i)
  connect(voltagesensor.v, meanVoltage.u)
  connect(voltagesensor.v, rootMeanSquareVoltage.u)
  connect(sineVoltage.plug_p, rectifier.ac)
  connect(rectifier.dc_n, currentSensor.n)
  connect(rectifier.dc_p, voltagesensor.p)
  connect(currentSensor.p, voltagesensor.n)
  connect(pulse2m.fire_p, rectifier.fire_p)
  connect(pulse2m.fire_n, rectifier.fire_n)
  connect(pulse2m.ac, sineVoltage.plug_p)
  connect(sineVoltage.plug_n, multiStarResistance.plug)
  connect(multiStarResistance.pin, ground.p)
end ThyristorBridge2mPulse;


Template of two pulse Graetz thyristor bridge. Template of

two pulse bridge rectifiers; load is not yet included.

within Modelica.Electrical.PowerConverters.Examples.ACDC.ExampleTemplates;
partial model ThyristorBridge2Pulse
  "Template of two pulse Graetz thyristor bridge"
  extends Icons.ExampleTemplate;
  import Modelica.Constants.pi;
  parameter SI.Voltage Vrms=110 "RMS supply voltage";
  parameter SI.Frequency f=50 "Frequency";

  Modelica.Electrical.Analog.Basic.Ground ground
  Modelica.Electrical.Analog.Sources.SineVoltage sinevoltage(V=sqrt(2)*
        Vrms, f=f)
  PowerConverters.ACDC.ThyristorBridge2Pulse rectifier(useHeatPort=false,
      offStart_p1=true)
  Modelica.Electrical.Analog.Sensors.VoltageSensor voltagesensor
  Modelica.Blocks.Math.Mean meanVoltage(f=2*f)
  Modelica.Blocks.Math.RootMeanSquare rootMeanSquareVoltage(f=2*f)
  Modelica.Electrical.Analog.Sensors.CurrentSensor currentSensor
  Modelica.Blocks.Math.Mean meanCurrent(f=2*f)
  PowerConverters.ACDC.Control.VoltageBridge2Pulse pulse2(f=f, useFilter=false)
equation
  connect(meanCurrent.u, currentSensor.i)
  connect(ground.p, sinevoltage.n)
  connect(voltagesensor.v, meanVoltage.u)
  connect(voltagesensor.v, rootMeanSquareVoltage.u)
  connect(sinevoltage.p, rectifier.ac_p)
  connect(sinevoltage.n, rectifier.ac_n)
  connect(rectifier.dc_n, currentSensor.n)
  connect(rectifier.dc_p, voltagesensor.p)
  connect(voltagesensor.n, currentSensor.p)
  connect(pulse2.fire_p, rectifier.fire_p)
  connect(pulse2.fire_n, rectifier.fire_n)
  connect(pulse2.ac_p, rectifier.ac_p)
  connect(rectifier.ac_n, pulse2.ac_n)
end ThyristorBridge2Pulse;


Template of 2*m pulse thyristor rectifier with center tap. Template of

center tap 2*m pulse rectifiers, where m is the number of phases; load is not yet included.

within Modelica.Electrical.PowerConverters.Examples.ACDC.ExampleTemplates;
partial model ThyristorCenterTap2mPulse
  "Template of 2*m pulse thyristor rectifier with center tap"
  extends Icons.ExampleTemplate;
  import Modelica.Constants.pi;
  parameter Integer m(final min=3) = 3 "Number of phases"
  parameter SI.Voltage Vrms=110 "RMS supply voltage";
  parameter SI.Frequency f=50 "Frequency";

  Modelica.Electrical.Analog.Basic.Ground ground
  Modelica.Electrical.Polyphase.Basic.Star star(final m=m)
  Modelica.Electrical.Polyphase.Sources.SineVoltage sineVoltage_p(
    final m=m,
    V=fill(sqrt(2)*Vrms, m),
    phase=-
        Modelica.Electrical.Polyphase.Functions.symmetricOrientation(m),
    f=fill(f, m))
  PowerConverters.ACDC.ThyristorCenterTap2mPulse rectifier(final m=m)
  Modelica.Electrical.Analog.Sensors.VoltageSensor voltagesensor
  Modelica.Blocks.Math.Mean meanVoltage(f=2*m*f)
  Modelica.Blocks.Math.RootMeanSquare rootMeanSquareVoltage(f=2*m*f)
  Modelica.Electrical.Analog.Sensors.CurrentSensor currentSensor
  Modelica.Blocks.Math.Mean meanCurrent(f=2*m*f)
  PowerConverters.ACDC.Control.VoltageCenterTap2mPulse pulse2m(
    m=m,
    f=f,
    useFilter=false)
  Modelica.Electrical.Polyphase.Sources.SineVoltage sineVoltage_n(
    final m=m,
    V=fill(sqrt(2)*Vrms, m),
    phase=-
        Modelica.Electrical.Polyphase.Functions.symmetricOrientation(m),
    f=fill(f, m))
equation
  connect(star.pin_n, ground.p)
  connect(meanCurrent.u, currentSensor.i)
  connect(voltagesensor.v, meanVoltage.u)
  connect(voltagesensor.v, rootMeanSquareVoltage.u)
  connect(rectifier.dc_p, voltagesensor.p)
  connect(currentSensor.p, voltagesensor.n)
  connect(pulse2m.fire_p, rectifier.fire_p)
  connect(pulse2m.ac, sineVoltage_p.plug_p)
  connect(sineVoltage_p.plug_n, sineVoltage_n.plug_p)
  connect(sineVoltage_n.plug_n, rectifier.ac_n)
  connect(sineVoltage_p.plug_p, rectifier.ac_p)
  connect(star.plug_p, sineVoltage_p.plug_n)
  connect(star.pin_n, currentSensor.n)
  connect(pulse2m.fire_n, rectifier.fire_n)
end ThyristorCenterTap2mPulse;


Template of two pulse thyristor rectifier with center tap. Template of

center tap two pulse rectifiers; load is not yet included.

within Modelica.Electrical.PowerConverters.Examples.ACDC.ExampleTemplates;
partial model ThyristorCenterTap2Pulse
  "Template of two pulse thyristor rectifier with center tap"
  extends Icons.ExampleTemplate;
  import Modelica.Constants.pi;
  parameter SI.Voltage Vrms=110 "RMS supply voltage";
  parameter SI.Frequency f=50 "Frequency";

  Modelica.Electrical.Analog.Basic.Ground ground
  Modelica.Electrical.Analog.Sources.SineVoltage sinevoltage_n(V=sqrt(2)
        *Vrms,f=f)
  Modelica.Electrical.Analog.Sources.SineVoltage sinevoltage_p(V=sqrt(2)
        *Vrms,f=f)
  PowerConverters.ACDC.ThyristorCenterTap2Pulse rectifier
  Modelica.Electrical.Analog.Sensors.VoltageSensor voltagesensor
  Modelica.Blocks.Math.Mean meanVoltage(f=2*f)
  Modelica.Blocks.Math.RootMeanSquare rootMeanSquareVoltage(f=2*f)
  Modelica.Electrical.Analog.Sensors.CurrentSensor currentSensor
  Modelica.Blocks.Math.Mean meanCurrent(f=2*f)
  PowerConverters.ACDC.Control.VoltageBridge2Pulse pulse2(f=f, useFilter=false)
equation
  connect(meanCurrent.u, currentSensor.i)
  connect(voltagesensor.v, meanVoltage.u)
  connect(voltagesensor.v, rootMeanSquareVoltage.u)
  connect(sinevoltage_p.n, sinevoltage_n.p)
  connect(ground.p, sinevoltage_p.n)
  connect(sinevoltage_p.p, rectifier.ac_p)
  connect(sinevoltage_n.n, rectifier.ac_n)
  connect(ground.p, currentSensor.n)
  connect(currentSensor.p, voltagesensor.n)
  connect(voltagesensor.p, rectifier.dc_p)
  connect(pulse2.fire_p, rectifier.fire_p)
  connect(pulse2.fire_n, rectifier.fire_n)
  connect(rectifier.ac_n, pulse2.ac_n)
  connect(pulse2.ac_p, rectifier.ac_p)
end ThyristorCenterTap2Pulse;


Template of 2*m pulse rectifier with center tap. Template of

center tap m pulse rectifiers, where m is the number of phases; load is not yet included.

within Modelica.Electrical.PowerConverters.Examples.ACDC.ExampleTemplates;
partial model ThyristorCenterTapmPulse
  "Template of 2*m pulse rectifier with center tap"
  extends Icons.ExampleTemplate;
  import Modelica.Constants.pi;
  parameter Integer m(final min=3) = 3 "Number of phases"
  parameter SI.Voltage Vrms=110 "RMS supply voltage";
  parameter SI.Frequency f=50 "Frequency";

  Modelica.Electrical.Analog.Basic.Ground ground
  Modelica.Electrical.Polyphase.Basic.Star star(final m=m)
  Modelica.Electrical.Polyphase.Sources.SineVoltage sineVoltage_p(
    final m=m,
    V=fill(sqrt(2)*Vrms, m),
    phase=-
        Modelica.Electrical.Polyphase.Functions.symmetricOrientation(m),
    f=fill(f, m))
  PowerConverters.ACDC.ThyristorCenterTapmPulse rectifier(final m=m)
  Modelica.Electrical.Analog.Sensors.VoltageSensor voltagesensor
  Modelica.Blocks.Math.Mean meanVoltage(f=m*f)
  Modelica.Blocks.Math.RootMeanSquare rootMeanSquareVoltage(f=m*f)
  Modelica.Electrical.Analog.Sensors.CurrentSensor currentSensor
  Modelica.Blocks.Math.Mean meanCurrent(f=m*f)
  PowerConverters.ACDC.Control.VoltageBridge2mPulse pulsem(
    m=m,
    f=f,
    useFilter=false)
equation
  connect(star.pin_n, ground.p)
  connect(meanCurrent.u, currentSensor.i)
  connect(voltagesensor.v, meanVoltage.u)
  connect(voltagesensor.v, rootMeanSquareVoltage.u)
  connect(rectifier.dc_p, voltagesensor.p)
  connect(currentSensor.p, voltagesensor.n)
  connect(pulsem.fire_p, rectifier.fire_p)
  connect(pulsem.ac, sineVoltage_p.plug_p)
  connect(star.plug_p, sineVoltage_p.plug_n)
  connect(star.pin_n, currentSensor.n)
  connect(rectifier.ac, sineVoltage_p.plug_p)
end ThyristorCenterTapmPulse;


Single pulse rectifier

within Modelica.Electrical.PowerConverters.Examples.ACDC;
package Rectifier1Pulse "Single pulse rectifier"
  extends Modelica.Icons.ExamplesPackage;
end Rectifier1Pulse;


One pulse rectifier with resistive load and constant firing angle. This example demonstrates the operational behavior of a single-phase controlled rectifier with constant firing angle and resistive load.

within Modelica.Electrical.PowerConverters.Examples.ACDC.Rectifier1Pulse;
model Thyristor1Pulse_R
  "One pulse rectifier with resistive load and constant firing angle"
  extends ExampleTemplates.Thyristor1Pulse(pulse2(
      useConstantFiringAngle=true,
      f=f,
      constantFiringAngle=constantFiringAngle));
  extends Modelica.Icons.Example;
  import Modelica.Constants.pi;
  parameter SI.Angle constantFiringAngle=30*pi/180
    "Firing angle";
  parameter SI.Resistance R=20 "Load resistance";
  Modelica.Electrical.Analog.Basic.Resistor resistor(R=R)
equation
  connect(idealthyristor.n, resistor.p)
  connect(resistor.n, currentSensor.p)
end Thyristor1Pulse_R;


Control characteristic of one pulse rectifier with resistive load. This example demonstrates the operational behavior of a single-phase controlled rectifier with variable firing angle and resistive load. The average load voltage can be controlled by means of the firing angle.

within Modelica.Electrical.PowerConverters.Examples.ACDC.Rectifier1Pulse;
model Thyristor1Pulse_R_Characteristic
  "Control characteristic of one pulse rectifier with resistive load"
  extends ExampleTemplates.Thyristor1Pulse(pulse2(
        useConstantFiringAngle=false, f=f));
  extends Modelica.Icons.Example;
  import Modelica.Constants.pi;
  parameter SI.Resistance R=20 "Load resistance";
  Modelica.Electrical.Analog.Basic.Resistor resistor(R=R)
  Modelica.Blocks.Sources.Ramp ramp(height=pi, duration=10)
equation
  connect(resistor.n, currentSensor.p)
  connect(resistor.p, idealthyristor.n)
  connect(ramp.y, pulse2.firingAngle)
end Thyristor1Pulse_R_Characteristic;


2*m pulse diode rectifier bridge with resistive load. This example shows an uncontrolled 2*m pulse diode bridge rectifier with resistive load, where m is the number of phases.

within Modelica.Electrical.PowerConverters.Examples.ACDC.RectifierBridge2mPulse;
model DiodeBridge2mPulse
  "2*m pulse diode rectifier bridge with resistive load"
  extends Modelica.Icons.Example;
  import Modelica.Constants.pi;
  parameter Integer m(final min=3) = 3 "Number of phases"
  parameter SI.Voltage Vrms=110 "RMS supply voltage";
  parameter SI.Frequency f=50 "Frequency";
  parameter SI.Resistance R=20 "Load resistance";

  Modelica.Electrical.Polyphase.Sources.SineVoltage sineVoltage(
    final m=m,
    V=fill(sqrt(2)*Vrms, m),
    phase=-
        Modelica.Electrical.Polyphase.Functions.symmetricOrientation(m),
    f=fill(f, m))
  PowerConverters.ACDC.DiodeBridge2mPulse rectifier(final m=m)
  Modelica.Electrical.Analog.Sensors.VoltageSensor voltagesensor
  Modelica.Blocks.Math.Mean meanVoltage(f=2*m*f)
  Modelica.Blocks.Math.RootMeanSquare rootMeanSquareVoltage(f=2*m*f)
  Modelica.Electrical.Analog.Sensors.CurrentSensor currentSensor
  Modelica.Blocks.Math.Mean meanCurrent(f=2*m*f)
  Modelica.Electrical.Polyphase.Basic.MultiStarResistance
    multiStarResistance(final m=m)
  Modelica.Electrical.Analog.Basic.Ground ground
  Modelica.Electrical.Analog.Basic.Resistor resistor(R=R)
equation
  connect(meanCurrent.u, currentSensor.i)
  connect(voltagesensor.v, meanVoltage.u)
  connect(voltagesensor.v, rootMeanSquareVoltage.u)
  connect(sineVoltage.plug_p, rectifier.ac)
  connect(rectifier.dc_n, currentSensor.n)
  connect(rectifier.dc_p, voltagesensor.p)
  connect(currentSensor.p, voltagesensor.n)
  connect(sineVoltage.plug_n, multiStarResistance.plug)
  connect(multiStarResistance.pin, ground.p)
  connect(resistor.n, currentSensor.p)
  connect(resistor.p, rectifier.dc_p)
end DiodeBridge2mPulse;


2*m pulse half controlled rectifier bridge with resistive load. This example shows a half controlled 2*m pulse bridge rectifier with resistive load, where m is the number of phases. In case of resistive load the half controlled bridge shows the same output voltage as the
full controlled bridge.

within Modelica.Electrical.PowerConverters.Examples.ACDC.RectifierBridge2mPulse;
model HalfControlledBridge2mPulse
  "2*m pulse half controlled rectifier bridge with resistive load"
  extends Modelica.Icons.Example;
  import Modelica.Constants.pi;
  parameter Integer m(final min=3) = 3 "Number of phases"
  parameter SI.Voltage Vrms=110 "RMS supply voltage";
  parameter SI.Frequency f=50 "Frequency";
  parameter SI.Angle constantFiringAngle=30*pi/180
    "Firing angle";
  parameter SI.Resistance R=20 "Load resistance";

  Modelica.Electrical.Polyphase.Sources.SineVoltage sineVoltage(
    final m=m,
    V=fill(sqrt(2)*Vrms, m),
    phase=-
        Modelica.Electrical.Polyphase.Functions.symmetricOrientation(m),
    f=fill(f, m))
  PowerConverters.ACDC.HalfControlledBridge2mPulse rectifier(final m=m,
      offStart_p=fill(true, m))
  Modelica.Electrical.Analog.Sensors.VoltageSensor voltagesensor
  Modelica.Blocks.Math.Mean meanVoltage(f=2*m*f)
  Modelica.Blocks.Math.RootMeanSquare rootMeanSquareVoltage(f=2*m*f)
  Modelica.Electrical.Analog.Sensors.CurrentSensor currentSensor
  Modelica.Blocks.Math.Mean meanCurrent(f=2*m*f)
  PowerConverters.ACDC.Control.VoltageBridge2mPulse pulse2m(
    m=m,
    f=f,
    useFilter=false,
    constantFiringAngle=constantFiringAngle)
  Modelica.Electrical.Polyphase.Basic.MultiStarResistance
    multiStarResistance(final m=m)
  Modelica.Electrical.Analog.Basic.Ground ground
  Modelica.Electrical.Analog.Basic.Resistor resistor(R=R)
equation
  connect(meanCurrent.u, currentSensor.i)
  connect(voltagesensor.v, meanVoltage.u)
  connect(voltagesensor.v, rootMeanSquareVoltage.u)
  connect(sineVoltage.plug_p, rectifier.ac)
  connect(rectifier.dc_n, currentSensor.n)
  connect(rectifier.dc_p, voltagesensor.p)
  connect(currentSensor.p, voltagesensor.n)
  connect(pulse2m.fire_p, rectifier.fire_p)
  connect(pulse2m.ac, sineVoltage.plug_p)
  connect(sineVoltage.plug_n, multiStarResistance.plug)
  connect(multiStarResistance.pin, ground.p)
  connect(resistor.n, currentSensor.p)
  connect(resistor.p, rectifier.dc_p)
end HalfControlledBridge2mPulse;


2*m pulse rectifier bridge

within Modelica.Electrical.PowerConverters.Examples.ACDC;
package RectifierBridge2mPulse "2*m pulse rectifier bridge"
  extends Modelica.Icons.ExamplesPackage;
end RectifierBridge2mPulse;


2*m pulse thyristor bridge feeding a DC drive. In this example a PM excited DC machine is started with nominal torque at nominal speed. After 5 seconds, load torque is reduced to zero over a period of additional 10 seconds. At 15 seconds, the machine is operating at no load.

within Modelica.Electrical.PowerConverters.Examples.ACDC.RectifierBridge2mPulse;
model ThyristorBridge2mPulse_DC_Drive
  "2*m pulse thyristor bridge feeding a DC drive"
  extends Modelica.Icons.Example;
  import Modelica.Constants.pi;
  parameter Integer m(final min=3) = 3 "Number of phases"
  parameter SI.Voltage Vrms=dcpmData.VaNominal/
      Modelica.Electrical.Polyphase.Functions.factorY2DC(m)
    "RMS supply voltage";
  parameter SI.Frequency f=50 "Frequency";
  parameter SI.ApparentPower SMains=250E3
    "Mains short circuit apparent power";
  parameter Real lamdaMains=0.1 "Mains short circuit power factor";
  final parameter SI.Impedance ZMains=Vrms^2/SMains*m
    "Mains short circuit impedance";
  final parameter SI.Resistance RMains=ZMains*lamdaMains
    "Mains resistance"
  final parameter SI.Inductance LMains=ZMains*sqrt(1 -
      lamdaMains^2)/(2*pi*f) "Mains inductance"
  parameter SI.Inductance Ld=3*dcpmData.La
    "Smoothing inductance"
  final parameter SI.Torque tauNominal=dcpmData.ViNominal
      *dcpmData.IaNominal/dcpmData.wNominal "Nominal torque";
  output SI.AngularVelocity w(displayUnit="rpm") = dcpm.wMechanical;
  output SI.Torque tau=dcpm.tauShaft;
  Modelica.Electrical.Polyphase.Sources.SineVoltage sinevoltage(
    m=m,
    final V=fill(sqrt(2)*Vrms, m),
    f=fill(f, m))
  PowerConverters.ACDC.ThyristorBridge2mPulse rectifier(useHeatPort=false, m=m)
  Modelica.Electrical.Analog.Sensors.VoltageSensor voltagesensor
  Modelica.Blocks.Math.Mean meanVoltage(f=2*m*f)
  Modelica.Blocks.Math.RootMeanSquare rootMeanSquareVoltage(f=2*m*f)
  Modelica.Electrical.Analog.Sensors.CurrentSensor currentSensor
  Modelica.Blocks.Math.Mean meanCurrent(f=2*m*f)
  PowerConverters.ACDC.Control.VoltageBridge2mPulse pulse2(
    useConstantFiringAngle=false,
    useFilter=true,
    m=m)
  Modelica.Electrical.Analog.Basic.Inductor inductor(L=Ld)
  Modelica.Electrical.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,
    phiMechanical(fixed=true),
    wMechanical(fixed=true, start=dcpmData.wNominal),
    TaOperational=293.15,
    alpha20a=dcpmData.alpha20a,
    ia(start=0, fixed=true))
  parameter
    Modelica.Electrical.Machines.Utilities.ParameterRecords.DcPermanentMagnetData
    dcpmData "Data record of PM excited DC machine"
  Modelica.Mechanics.Rotational.Sources.Torque torque
  Modelica.Blocks.Sources.Ramp ramp(
    duration=10,
    startTime=5,
    height=tauNominal,
    offset=-tauNominal)
  Modelica.Blocks.Sources.Constant const(k=0)
  Modelica.Electrical.Polyphase.Basic.Resistor rMains(m=m, R=fill(
        RMains, m))
  Modelica.Electrical.Polyphase.Basic.Inductor lMains(m=m, L=fill(
        LMains, m))
  Modelica.Electrical.Polyphase.Basic.MultiStarResistance earthing(m=m)
  Modelica.Electrical.Analog.Basic.Ground ground
initial equation
  lMains.i[1:m - 1] = zeros(m - 1);

equation
  connect(meanCurrent.u, currentSensor.i)
  connect(voltagesensor.v, meanVoltage.u)
  connect(voltagesensor.v, rootMeanSquareVoltage.u)
  connect(rectifier.dc_n, currentSensor.n)
  connect(rectifier.dc_p, voltagesensor.p)
  connect(voltagesensor.n, currentSensor.p)
  connect(pulse2.fire_p, rectifier.fire_p)
  connect(pulse2.fire_n, rectifier.fire_n)
  connect(inductor.n, dcpm.pin_ap)
  connect(torque.flange, dcpm.flange)
  connect(ramp.y, torque.tau)
  connect(rectifier.dc_p, inductor.p)
  connect(currentSensor.p, dcpm.pin_an)
  connect(const.y, pulse2.firingAngle)
  connect(rMains.plug_p, sinevoltage.plug_p)
  connect(lMains.plug_p, rMains.plug_n)
  connect(lMains.plug_n, rectifier.ac)
  connect(rectifier.ac, pulse2.ac)
  connect(sinevoltage.plug_n, earthing.plug)
  connect(rectifier.dc_n, ground.p)
end ThyristorBridge2mPulse_DC_Drive;


2*m pulse thyristor rectifier bridge with resistive load. This example shows a full controlled 2*m pulse bridge rectifier with resistive load, where m is the number of phases. In case of resistive load the full controlled bridge shows the same output voltage as the
half controlled bridge.

within Modelica.Electrical.PowerConverters.Examples.ACDC.RectifierBridge2mPulse;
model ThyristorBridge2mPulse_R
  "2*m pulse thyristor rectifier bridge with resistive load"
  extends ExampleTemplates.ThyristorBridge2mPulse(pulse2m(
        constantFiringAngle=constantFiringAngle));
  extends Modelica.Icons.Example;
  import Modelica.Constants.pi;
  parameter SI.Angle constantFiringAngle=30*pi/180
    "Firing angle";
  parameter SI.Resistance R=20 "Load resistance";
  Modelica.Electrical.Analog.Basic.Resistor resistor(R=R)
equation
  connect(resistor.n, currentSensor.p)
  connect(resistor.p, rectifier.dc_p)
end ThyristorBridge2mPulse_R;


2*m pulse thyristor rectifier bridge with R-L load. This example shows a full controlled 2*m pulse bridge rectifier with R-L load, where m is the number of phases.

within Modelica.Electrical.PowerConverters.Examples.ACDC.RectifierBridge2mPulse;
model ThyristorBridge2mPulse_RL
  "2*m pulse thyristor rectifier bridge with R-L load"
  extends ExampleTemplates.ThyristorBridge2mPulse(pulse2m(
        constantFiringAngle=constantFiringAngle), rectifier(offStart_p=
          fill(true, m), offStart_n=fill(true, m)));
  extends Modelica.Icons.Example;
  import Modelica.Constants.pi;
  parameter SI.Angle constantFiringAngle=30*pi/180
    "Firing angle";
  parameter SI.Resistance R=20 "Load resistance";
  parameter SI.Inductance L=1 "Load resistance"
  Modelica.Electrical.Analog.Basic.Resistor resistor(R=R)
  Modelica.Electrical.Analog.Basic.Inductor inductor(L=L, i(start=0,
        fixed=true))
equation
  connect(resistor.n, inductor.p)
  connect(inductor.n, currentSensor.p)
  connect(resistor.p, rectifier.dc_p)
end ThyristorBridge2mPulse_RL;


2*m pulse thyristor rectifier bridge with R-L load and voltage. This example shows a full controlled 2*m pulse bridge rectifier with R-L load including DC voltage source, where m is the number of phases. The additional DC voltage source in this example enables negative average load voltages.

within Modelica.Electrical.PowerConverters.Examples.ACDC.RectifierBridge2mPulse;
model ThyristorBridge2mPulse_RLV
  "2*m pulse thyristor rectifier bridge with R-L load and voltage"
  extends ExampleTemplates.ThyristorBridge2mPulse(pulse2m(
        constantFiringAngle=constantFiringAngle));
  extends Modelica.Icons.Example;
  import Modelica.Constants.pi;
  parameter SI.Angle constantFiringAngle=30*pi/180
    "Firing angle";
  parameter SI.Resistance R=20 "Load resistance";
  parameter SI.Inductance L=1 "Load resistance"
  parameter SI.Voltage VDC=-260 "DC load offset voltage";
  Modelica.Electrical.Analog.Basic.Resistor resistor(R=R)
  Modelica.Electrical.Analog.Basic.Inductor inductor(L=L, i(start=0,
        fixed=true))
  Modelica.Electrical.Analog.Sources.ConstantVoltage constantVoltage(V=
        VDC)
equation
  connect(resistor.n, inductor.p)
  connect(inductor.n, constantVoltage.p)
  connect(constantVoltage.n, currentSensor.p)
  connect(resistor.p, rectifier.dc_p)
end ThyristorBridge2mPulse_RLV;


Characteristic of 2*m pulse thyristor rectifier bridge with R-L load and voltage. This example shows a full controlled 2*m pulse bridge rectifier with R-L load including DC voltage source, where m is the number of phases. The additional DC voltage source in this example enables negative average load voltages.

within Modelica.Electrical.PowerConverters.Examples.ACDC.RectifierBridge2mPulse;
model ThyristorBridge2mPulse_RLV_Characteristic
  "Characteristic of 2*m pulse thyristor rectifier bridge with R-L load and voltage"
  extends ExampleTemplates.ThyristorBridge2mPulse(pulse2m(
        useConstantFiringAngle=false));
  extends Modelica.Icons.Example;
  import Modelica.Constants.pi;
  parameter SI.Voltage Vdi0=
      Modelica.Electrical.Polyphase.Functions.factorY2DC(m)*Vrms
    "Ideal max. DC voltage";
  parameter SI.Resistance R=20 "Load resistance";
  parameter SI.Inductance L=1 "Load resistance"
  parameter SI.Voltage VDC=-260 "DC load offset voltage";
  Modelica.Electrical.Analog.Basic.Resistor resistor(R=R)
  Modelica.Electrical.Analog.Basic.Inductor inductor(L=L, i(fixed=true,
        start=0))
  Modelica.Electrical.Analog.Sources.ConstantVoltage constantVoltage(V=
        VDC)
  Modelica.Blocks.Sources.Ramp ramp(height=pi, duration=10)
equation
  connect(resistor.n, inductor.p)
  connect(inductor.n, constantVoltage.p)
  connect(currentSensor.p, constantVoltage.n)
  connect(ramp.y, pulse2m.firingAngle)
  connect(resistor.p, rectifier.dc_p)
end ThyristorBridge2mPulse_RLV_Characteristic;


Two pulse Graetz diode bridge with resistive load. This examples shows a two pulse uncontrolled bridge example with resistive load.

within Modelica.Electrical.PowerConverters.Examples.ACDC.RectifierBridge2Pulse;
model DiodeBridge2Pulse
  "Two pulse Graetz diode bridge with resistive load"
  extends Modelica.Icons.Example;
  import Modelica.Constants.pi;
  parameter SI.Voltage Vrms=110 "RMS supply voltage";
  parameter SI.Frequency f=50 "Frequency";
  parameter SI.Resistance R=20 "Load resistance";
  // parameter SI.Inductance L = 1 "Load resistance"
  // parameter SI.Voltage VDC=-120 "DC load offset voltage";
  Modelica.Electrical.Analog.Basic.Ground ground
  Modelica.Electrical.Analog.Sources.SineVoltage sinevoltage(V=sqrt(2)*
        Vrms, f=f)
  PowerConverters.ACDC.DiodeBridge2Pulse rectifier(useHeatPort=false)
  Modelica.Electrical.Analog.Sensors.VoltageSensor voltagesensor
  Modelica.Blocks.Math.Mean meanVoltage(f=2*f)
  Modelica.Blocks.Math.RootMeanSquare rootMeanSquareVoltage(f=2*f)
  Modelica.Electrical.Analog.Sensors.CurrentSensor currentSensor
  Modelica.Blocks.Math.Mean meanCurrent(f=2*f)
  Modelica.Electrical.Analog.Basic.Resistor resistor(R=R)
equation
  connect(meanCurrent.u, currentSensor.i)
  connect(ground.p, sinevoltage.n)
  connect(voltagesensor.v, meanVoltage.u)
  connect(voltagesensor.v, rootMeanSquareVoltage.u)
  connect(sinevoltage.p, rectifier.ac_p)
  connect(sinevoltage.n, rectifier.ac_n)
  connect(rectifier.dc_n, currentSensor.n)
  connect(rectifier.dc_p, voltagesensor.p)
  connect(voltagesensor.n, currentSensor.p)
  connect(resistor.n, currentSensor.p)
  connect(resistor.p, rectifier.dc_p)
end DiodeBridge2Pulse;


Two pulse Graetz half controlled bridge with resistive load. This examples shows a two pulse half controlled bridge example with resistive load. In case of resistive load the half controlled bridge shows the same output voltage as the
full controlled bridge.

within Modelica.Electrical.PowerConverters.Examples.ACDC.RectifierBridge2Pulse;
model HalfControlledBridge2Pulse
  "Two pulse Graetz half controlled bridge with resistive load"
  extends Modelica.Icons.Example;
  import Modelica.Constants.pi;
  parameter SI.Voltage Vrms=110 "RMS supply voltage";
  parameter SI.Frequency f=50 "Frequency";
  parameter SI.Angle constantFiringAngle=30*pi/180
    "Firing angle";
  parameter SI.Resistance R=20 "Load resistance";

  Modelica.Electrical.Analog.Basic.Ground ground
  Modelica.Electrical.Analog.Sources.SineVoltage sinevoltage(V=sqrt(2)*
        Vrms, f=f)
  PowerConverters.ACDC.HalfControlledBridge2Pulse rectifier(useHeatPort=false,
      offStart_p1=true)
  Modelica.Electrical.Analog.Sensors.VoltageSensor voltagesensor
  Modelica.Blocks.Math.Mean meanVoltage(f=2*f)
  Modelica.Blocks.Math.RootMeanSquare rootMeanSquareVoltage(f=2*f)
  Modelica.Electrical.Analog.Sensors.CurrentSensor currentSensor
  Modelica.Blocks.Math.Mean meanCurrent(f=2*f)
  PowerConverters.ACDC.Control.VoltageBridge2Pulse pulse2(
    f=f,
    useFilter=false,
    constantFiringAngle=constantFiringAngle)
  Modelica.Electrical.Analog.Basic.Resistor resistor(R=R)
equation
  connect(meanCurrent.u, currentSensor.i)
  connect(ground.p, sinevoltage.n)
  connect(voltagesensor.v, meanVoltage.u)
  connect(voltagesensor.v, rootMeanSquareVoltage.u)
  connect(sinevoltage.p, rectifier.ac_p)
  connect(sinevoltage.n, rectifier.ac_n)
  connect(rectifier.dc_n, currentSensor.n)
  connect(rectifier.dc_p, voltagesensor.p)
  connect(voltagesensor.n, currentSensor.p)
  connect(pulse2.fire_p, rectifier.fire_p)
  connect(pulse2.fire_n, rectifier.fire_n)
  connect(pulse2.ac_p, rectifier.ac_p)
  connect(rectifier.ac_n, pulse2.ac_n)
  connect(resistor.n, currentSensor.p)
  connect(resistor.p, rectifier.dc_p)
end HalfControlledBridge2Pulse;


Two pulse Graetz bridge

within Modelica.Electrical.PowerConverters.Examples.ACDC;
package RectifierBridge2Pulse "Two pulse Graetz bridge"
  extends Modelica.Icons.ExamplesPackage;
end RectifierBridge2Pulse;


Two pulse Graetz thyristor bridge feeding a DC drive. In this example a PM excited DC machine is started with nominal torque at nominal speed. After 5 seconds, load torque is reduced to zero over a period of additional 10 seconds. At 15 seconds, the machine is operating at no load.

within Modelica.Electrical.PowerConverters.Examples.ACDC.RectifierBridge2Pulse;
model ThyristorBridge2Pulse_DC_Drive
  "Two pulse Graetz thyristor bridge feeding a DC drive"
  extends Modelica.Icons.Example;
  import Modelica.Constants.pi;
  parameter SI.Voltage Vrms=dcpmData.VaNominal/(2/pi*sin(
      pi/2)*sqrt(2)) "RMS supply voltage";
  parameter SI.Frequency f=50 "Frequency";
  parameter SI.ApparentPower SMains=250E3
    "Mains short circuit apparent power";
  parameter Real lamdaMains=0.1 "Mains short circuit power factor";
  final parameter SI.Impedance ZMains=Vrms^2/SMains
    "Mains short circuit impedance";
  final parameter SI.Resistance RMains=ZMains*lamdaMains
    "Mains resistance"
  final parameter SI.Inductance LMains=ZMains*sqrt(1 - lamdaMains^2)/(2*pi*f)
    "Mains inductance"
  parameter SI.Inductance Ld=10*dcpmData.La
    "Smoothing inductance"
  final parameter SI.Torque tauNominal=dcpmData.ViNominal
      *dcpmData.IaNominal/dcpmData.wNominal "Nominal torque";
  output SI.AngularVelocity w(displayUnit="rpm") = dcpm.wMechanical "Angular velocity of drive";
  output SI.Torque tau=dcpm.tauShaft "Shaft torque of drive";
  Modelica.Electrical.Analog.Basic.Ground ground
  Modelica.Electrical.Analog.Sources.SineVoltage sinevoltage(V=sqrt(2)*
        Vrms, f=f)
  PowerConverters.ACDC.ThyristorBridge2Pulse rectifier(useHeatPort=false)
  Modelica.Electrical.Analog.Sensors.VoltageSensor voltagesensor
  Modelica.Blocks.Math.Mean meanVoltage(f=2*f)
  Modelica.Blocks.Math.RootMeanSquare rootMeanSquareVoltage(f=2*f)
  Modelica.Electrical.Analog.Sensors.CurrentSensor currentSensor
  Modelica.Blocks.Math.Mean meanCurrent(f=2*f)
  PowerConverters.ACDC.Control.VoltageBridge2Pulse pulse2(
      useConstantFiringAngle=false, useFilter=true)
  Modelica.Electrical.Analog.Basic.Inductor inductor(L=Ld)
  Modelica.Electrical.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,
    phiMechanical(fixed=true),
    wMechanical(fixed=true, start=dcpmData.wNominal),
    TaOperational=293.15,
    alpha20a=dcpmData.alpha20a,
    ia(start=0, fixed=true))
  parameter
    Modelica.Electrical.Machines.Utilities.ParameterRecords.DcPermanentMagnetData
    dcpmData "Data record of PM excited DC machine"
  Modelica.Mechanics.Rotational.Sources.Torque torque
  Modelica.Blocks.Sources.Ramp ramp(
    duration=10,
    startTime=5,
    height=tauNominal,
    offset=-tauNominal)
  Modelica.Blocks.Sources.Constant const(k=0)
  Modelica.Electrical.Analog.Basic.Resistor rMains(R=RMains)
  Modelica.Electrical.Analog.Basic.Inductor lMains(L=LMains)
initial equation
  lMains.i = 0;

equation
  connect(meanCurrent.u, currentSensor.i)
  connect(ground.p, sinevoltage.n)
  connect(voltagesensor.v, meanVoltage.u)
  connect(voltagesensor.v, rootMeanSquareVoltage.u)
  connect(sinevoltage.n, rectifier.ac_n)
  connect(rectifier.dc_n, currentSensor.n)
  connect(rectifier.dc_p, voltagesensor.p)
  connect(voltagesensor.n, currentSensor.p)
  connect(pulse2.fire_p, rectifier.fire_p)
  connect(pulse2.fire_n, rectifier.fire_n)
  connect(pulse2.ac_p, rectifier.ac_p)
  connect(rectifier.ac_n, pulse2.ac_n)
  connect(inductor.n, dcpm.pin_ap)
  connect(torque.flange, dcpm.flange)
  connect(ramp.y, torque.tau)
  connect(rectifier.dc_p, inductor.p)
  connect(currentSensor.p, dcpm.pin_an)
  connect(const.y, pulse2.firingAngle)
  connect(rMains.n, lMains.p)
  connect(rMains.p, sinevoltage.p)
  connect(rectifier.ac_p, lMains.n)
end ThyristorBridge2Pulse_DC_Drive;


Two pulse Graetz thyristor bridge rectifier with resistive load. This examples shows a two pulse full controlled bridge example with resistive load. In case of resistive load the full controlled bridge shows the same output voltage as the
half controlled bridge.

within Modelica.Electrical.PowerConverters.Examples.ACDC.RectifierBridge2Pulse;
model ThyristorBridge2Pulse_R
  "Two pulse Graetz thyristor bridge rectifier with resistive load"
  extends ExampleTemplates.ThyristorBridge2Pulse(pulse2(
        constantFiringAngle=constantFiringAngle));
  extends Modelica.Icons.Example;
  import Modelica.Constants.pi;
  parameter SI.Angle constantFiringAngle=30*pi/180
    "Firing angle";
  parameter SI.Resistance R=20 "Load resistance";
  Modelica.Electrical.Analog.Basic.Resistor resistor(R=R)
equation
  connect(resistor.n, currentSensor.p)
  connect(resistor.p, rectifier.dc_p)
end ThyristorBridge2Pulse_R;


Two pulse Graetz thyristor bridge rectifier with R-L load. This examples shows a two pulse full controlled bridge example with R-L load.

within Modelica.Electrical.PowerConverters.Examples.ACDC.RectifierBridge2Pulse;
model ThyristorBridge2Pulse_RL
  "Two pulse Graetz thyristor bridge rectifier with R-L load"
  extends ExampleTemplates.ThyristorBridge2Pulse(pulse2(
        constantFiringAngle=constantFiringAngle));
  extends Modelica.Icons.Example;
  import Modelica.Constants.pi;
  parameter SI.Angle constantFiringAngle=30*pi/180
    "Firing angle";
  parameter SI.Resistance R=20 "Load resistance";
  parameter SI.Inductance L=1 "Load resistance"
  Modelica.Electrical.Analog.Basic.Resistor resistor(R=R)
  Modelica.Electrical.Analog.Basic.Inductor inductor(L=L, i(fixed=true,
        start=0))
equation
  connect(resistor.n, inductor.p)
  connect(inductor.n, currentSensor.p)
  connect(resistor.p, rectifier.dc_p)
end ThyristorBridge2Pulse_RL;


Two pulse Graetz thyristor bridge rectifier with R-L load and voltage. This examples shows a two pulse full controlled bridge example with R-L load including DC voltage source. The additional DC voltage source in this example enables negative average load voltages.

within Modelica.Electrical.PowerConverters.Examples.ACDC.RectifierBridge2Pulse;
model ThyristorBridge2Pulse_RLV
  "Two pulse Graetz thyristor bridge rectifier with R-L load and voltage"
  extends ExampleTemplates.ThyristorBridge2Pulse(pulse2(
        constantFiringAngle=constantFiringAngle));
  extends Modelica.Icons.Example;
  import Modelica.Constants.pi;
  parameter SI.Angle constantFiringAngle=30*pi/180
    "Firing angle";
  parameter SI.Resistance R=20 "Load resistance";
  parameter SI.Inductance L=1 "Load resistance"
  parameter SI.Voltage VDC=-120 "DC load offset voltage";
  Modelica.Electrical.Analog.Basic.Resistor resistor(R=R)
  Modelica.Electrical.Analog.Basic.Inductor inductor(L=L, i(fixed=true,
        start=0))
  Modelica.Electrical.Analog.Sources.ConstantVoltage constantVoltage(V=
        VDC)
equation
  connect(resistor.n, inductor.p)
  connect(inductor.n, constantVoltage.p)
  connect(constantVoltage.n, currentSensor.p)
  connect(resistor.p, rectifier.dc_p)
end ThyristorBridge2Pulse_RLV;


Characteristic of two pulse Graetz thyristor bridge rectifier with R-L load and voltage. This examples shows a two pulse full controlled bridge example with R-L load including DC voltage source. The additional DC voltage source in this example enables negative average load voltages.

within Modelica.Electrical.PowerConverters.Examples.ACDC.RectifierBridge2Pulse;
model ThyristorBridge2Pulse_RLV_Characteristic
  "Characteristic of two pulse Graetz thyristor bridge rectifier with R-L load and voltage"
  extends ExampleTemplates.ThyristorBridge2Pulse(pulse2(
        useConstantFiringAngle=false));
  extends Modelica.Icons.Example;
  import Modelica.Constants.pi;
  parameter SI.Voltage Vdi0=2/pi*sin(pi/2)*sqrt(2)*Vrms
    "Ideal max. DC voltage";
  parameter SI.Resistance R=20 "Load resistance";
  parameter SI.Inductance L=1 "Load resistance"
  parameter SI.Voltage VDC=-120 "DC load offset voltage";
  Modelica.Electrical.Analog.Basic.Resistor resistor(R=R)
  Modelica.Electrical.Analog.Basic.Inductor inductor(L=L, i(fixed=true,
        start=0))
  Modelica.Electrical.Analog.Sources.ConstantVoltage constantVoltage(V=
        VDC)
  Modelica.Blocks.Sources.Ramp ramp(height=pi, duration=10)
equation
  connect(resistor.n, inductor.p)
  connect(inductor.n, constantVoltage.p)
  connect(constantVoltage.n, currentSensor.p)
  connect(ramp.y, pulse2.firingAngle)
  connect(resistor.p, rectifier.dc_p)
end ThyristorBridge2Pulse_RLV_Characteristic;


2*m pulse diode center tap rectifier with resistive load. This example shows an uncontrolled 2*m pulse center tap diode rectifier with resistive load, where m is the number of phases.

within Modelica.Electrical.PowerConverters.Examples.ACDC.RectifierCenterTap2mPulse;
model DiodeCenterTap2mPulse
  "2*m pulse diode center tap rectifier with resistive load"
  extends Modelica.Icons.Example;
  import Modelica.Constants.pi;
  parameter Integer m(final min=3) = 3 "Number of phases"
  parameter SI.Voltage Vrms=110 "RMS supply voltage";
  parameter SI.Frequency f=50 "Frequency";
  parameter SI.Resistance R=20 "Load resistance";

  Modelica.Electrical.Analog.Basic.Ground ground
  Modelica.Electrical.Polyphase.Basic.Star star(final m=m)
  Modelica.Electrical.Polyphase.Sources.SineVoltage sineVoltage_p(
    final m=m,
    V=fill(sqrt(2)*Vrms, m),
    phase=-
        Modelica.Electrical.Polyphase.Functions.symmetricOrientation(m),
    f=fill(f, m))
  PowerConverters.ACDC.DiodeCenterTap2mPulse rectifier(final m=m)
  Modelica.Electrical.Analog.Sensors.VoltageSensor voltagesensor
  Modelica.Blocks.Math.Mean meanVoltage(f=2*m*f)
  Modelica.Blocks.Math.RootMeanSquare rootMeanSquareVoltage(f=2*m*f)
  Modelica.Electrical.Analog.Sensors.CurrentSensor currentSensor
  Modelica.Blocks.Math.Mean meanCurrent(f=2*m*f)
  Modelica.Electrical.Polyphase.Sources.SineVoltage sineVoltage_n(
    final m=m,
    V=fill(sqrt(2)*Vrms, m),
    phase=-
        Modelica.Electrical.Polyphase.Functions.symmetricOrientation(m),
    f=fill(f, m))
  Modelica.Electrical.Analog.Basic.Resistor resistor(R=R)
equation
  connect(star.pin_n, ground.p)
  connect(meanCurrent.u, currentSensor.i)
  connect(voltagesensor.v, meanVoltage.u)
  connect(voltagesensor.v, rootMeanSquareVoltage.u)
  connect(rectifier.dc_p, voltagesensor.p)
  connect(currentSensor.p, voltagesensor.n)
  connect(sineVoltage_p.plug_n, sineVoltage_n.plug_p)
  connect(sineVoltage_n.plug_n, rectifier.ac_n)
  connect(sineVoltage_p.plug_p, rectifier.ac_p)
  connect(star.plug_p, sineVoltage_p.plug_n)
  connect(star.pin_n, currentSensor.n)
  connect(resistor.n, currentSensor.p)
  connect(resistor.p, rectifier.dc_p)
end DiodeCenterTap2mPulse;


2*m pulse rectifier with center tap

within Modelica.Electrical.PowerConverters.Examples.ACDC;
package RectifierCenterTap2mPulse "2*m pulse rectifier with center tap"
  extends Modelica.Icons.ExamplesPackage;
end RectifierCenterTap2mPulse;


2*m pulse thyristor center tap rectifier with resistive load. This example shows a controlled 2*m pulse center tap rectifier with resistive load, where m is the number of phases.

within Modelica.Electrical.PowerConverters.Examples.ACDC.RectifierCenterTap2mPulse;
model ThyristorCenterTap2mPulse_R
  "2*m pulse thyristor center tap rectifier with resistive load"
  extends ExampleTemplates.ThyristorCenterTap2mPulse(pulse2m(
        constantFiringAngle=constantFiringAngle));
  extends Modelica.Icons.Example;
  import Modelica.Constants.pi;
  parameter SI.Angle constantFiringAngle=30*pi/180
    "Firing angle";
  parameter SI.Resistance R=20 "Load resistance";
  Modelica.Electrical.Analog.Basic.Resistor resistor(R=R)
equation
  connect(resistor.n, currentSensor.p)
  connect(resistor.p, rectifier.dc_p)
end ThyristorCenterTap2mPulse_R;


2*m pulse thyristor rectifier with R-L load. This example shows a controlled 2*m pulse center tap rectifier with R-L load, where m is the number of phases.

within Modelica.Electrical.PowerConverters.Examples.ACDC.RectifierCenterTap2mPulse;
model ThyristorCenterTap2mPulse_RL
  "2*m pulse thyristor rectifier with R-L load"
  extends ExampleTemplates.ThyristorCenterTap2mPulse(pulse2m(
        constantFiringAngle=constantFiringAngle));
  extends Modelica.Icons.Example;
  import Modelica.Constants.pi;
  parameter SI.Angle constantFiringAngle=30*pi/180
    "Firing angle";
  parameter SI.Resistance R=20 "Load resistance";
  parameter SI.Inductance L=1 "Load resistance"
  Modelica.Electrical.Analog.Basic.Resistor resistor(R=R)
  Modelica.Electrical.Analog.Basic.Inductor inductor(L=L, i(fixed=true,
        start=0))
equation
  connect(resistor.n, inductor.p)
  connect(inductor.n, currentSensor.p)
  connect(resistor.p, rectifier.dc_p)
end ThyristorCenterTap2mPulse_RL;


2*m pulse thyristor center tap rectifier with R-L load and voltage. This example shows a controlled 2*m pulse center tap rectifier with R-L load including DC voltage source, where m is the number of phases. The additional DC voltage source in this example enables negative average load voltages.

within Modelica.Electrical.PowerConverters.Examples.ACDC.RectifierCenterTap2mPulse;
model ThyristorCenterTap2mPulse_RLV
  "2*m pulse thyristor center tap rectifier with R-L load and voltage"
  extends ExampleTemplates.ThyristorCenterTap2mPulse(pulse2m(
        constantFiringAngle=constantFiringAngle));
  extends Modelica.Icons.Example;
  import Modelica.Constants.pi;
  parameter SI.Angle constantFiringAngle=30*pi/180
    "Firing angle";
  parameter SI.Resistance R=20 "Load resistance";
  parameter SI.Inductance L=1 "Load resistance"
  parameter SI.Voltage VDC=-260 "DC load offset voltage";
  Modelica.Electrical.Analog.Basic.Resistor resistor(R=R)
  Modelica.Electrical.Analog.Basic.Inductor inductor(L=L, i(start=0,
        fixed=true))
  Modelica.Electrical.Analog.Sources.ConstantVoltage constantVoltage(V=
        VDC)
equation
  connect(resistor.n, inductor.p)
  connect(inductor.n, constantVoltage.p)
  connect(constantVoltage.n, currentSensor.p)
  connect(resistor.p, rectifier.dc_p)
end ThyristorCenterTap2mPulse_RLV;


Characteristic of 2*m pulse center tap thyristor rectifier with R-L load and voltage. This example shows a controlled 2*m pulse center tap rectifier with R-L load including DC voltage source, where m is the number of phases. The additional DC voltage source in this example enables negative average load voltages.

within Modelica.Electrical.PowerConverters.Examples.ACDC.RectifierCenterTap2mPulse;
model ThyristorCenterTap2mPulse_RLV_Characteristic
  "Characteristic of 2*m pulse center tap thyristor rectifier with R-L load and voltage"
  extends ExampleTemplates.ThyristorCenterTap2mPulse(pulse2m(
        useConstantFiringAngle=false));
  extends Modelica.Icons.Example;
  import Modelica.Constants.pi;
  parameter SI.Resistance R=20 "Load resistance";
  parameter SI.Inductance L=1 "Load resistance"
  parameter SI.Voltage VDC=-260 "DC load offset voltage";
  Modelica.Electrical.Analog.Basic.Resistor resistor(R=R)
  Modelica.Electrical.Analog.Basic.Inductor inductor(L=L, i(start=0,
        fixed=true))
  Modelica.Electrical.Analog.Sources.ConstantVoltage constantVoltage(V=
        VDC)
  Modelica.Blocks.Sources.Ramp ramp(height=pi, duration=10)
equation
  connect(resistor.n, inductor.p)
  connect(inductor.n, constantVoltage.p)
  connect(currentSensor.p, constantVoltage.n)
  connect(ramp.y, pulse2m.firingAngle)
  connect(resistor.p, rectifier.dc_p)
end ThyristorCenterTap2mPulse_RLV_Characteristic;


Two pulse diode rectifier with center tap with resistive load. This example shows an uncontrolled two pulse center tap diode rectifier with resistive load.

within Modelica.Electrical.PowerConverters.Examples.ACDC.RectifierCenterTap2Pulse;
model DiodeCenterTap2Pulse
  "Two pulse diode rectifier with center tap with resistive load"
  extends Modelica.Icons.Example;
  import Modelica.Constants.pi;
  parameter SI.Voltage Vrms=110 "RMS supply voltage";
  parameter SI.Frequency f=50 "Frequency";
  parameter SI.Resistance R=20 "Load resistance";

  Modelica.Electrical.Analog.Basic.Ground ground
  Modelica.Electrical.Analog.Sources.SineVoltage sinevoltage_n(V=sqrt(2)
        *Vrms,f=f)
  Modelica.Electrical.Analog.Sources.SineVoltage sinevoltage_p(V=sqrt(2)
        *Vrms,f=f)
  PowerConverters.ACDC.DiodeCenterTap2Pulse rectifier
  Modelica.Electrical.Analog.Sensors.VoltageSensor voltagesensor
  Modelica.Blocks.Math.Mean meanVoltage(f=2*f)
  Modelica.Blocks.Math.RootMeanSquare rootMeanSquareVoltage(f=2*f)
  Modelica.Electrical.Analog.Sensors.CurrentSensor currentSensor
  Modelica.Blocks.Math.Mean meanCurrent(f=2*f)
  Modelica.Electrical.Analog.Basic.Resistor resistor(R=R)
equation
  connect(meanCurrent.u, currentSensor.i)
  connect(voltagesensor.v, meanVoltage.u)
  connect(voltagesensor.v, rootMeanSquareVoltage.u)
  connect(sinevoltage_p.n, sinevoltage_n.p)
  connect(ground.p, sinevoltage_p.n)
  connect(sinevoltage_p.p, rectifier.ac_p)
  connect(sinevoltage_n.n, rectifier.ac_n)
  connect(ground.p, currentSensor.n)
  connect(currentSensor.p, voltagesensor.n)
  connect(voltagesensor.p, rectifier.dc_p)
  connect(resistor.n, currentSensor.p)
  connect(resistor.p, rectifier.dc_p)
end DiodeCenterTap2Pulse;


Center tap rectifier with two pulses

within Modelica.Electrical.PowerConverters.Examples.ACDC;
package RectifierCenterTap2Pulse "Center tap rectifier with two pulses"
  extends Modelica.Icons.ExamplesPackage;
end RectifierCenterTap2Pulse;


Two pulse thyristor rectifier with center tap and resistive load. This example shows a controlled center tap two pulse rectifier with resistive load.

within Modelica.Electrical.PowerConverters.Examples.ACDC.RectifierCenterTap2Pulse;
model ThyristorCenterTap2Pulse_R
  "Two pulse thyristor rectifier with center tap and resistive load"
  extends ExampleTemplates.ThyristorCenterTap2Pulse(pulse2(
        constantFiringAngle=constantFiringAngle));
  extends Modelica.Icons.Example;
  import Modelica.Constants.pi;
  parameter SI.Angle constantFiringAngle=30*pi/180
    "Firing angle";
  parameter SI.Resistance R=20 "Load resistance";
  Modelica.Electrical.Analog.Basic.Resistor resistor(R=R)
equation
  connect(resistor.n, currentSensor.p)
  connect(resistor.p, rectifier.dc_p)
end ThyristorCenterTap2Pulse_R;


Two pulse thyristor rectifier with center tap and R-L load. This example shows a controlled center tap two pulse rectifier with R-L load.

within Modelica.Electrical.PowerConverters.Examples.ACDC.RectifierCenterTap2Pulse;
model ThyristorCenterTap2Pulse_RL
  "Two pulse thyristor rectifier with center tap and R-L load"
  extends ExampleTemplates.ThyristorCenterTap2Pulse(pulse2(
        constantFiringAngle=constantFiringAngle));
  extends Modelica.Icons.Example;
  import Modelica.Constants.pi;
  parameter SI.Angle constantFiringAngle=30*pi/180
    "Firing angle";
  parameter SI.Resistance R=20 "Load resistance";
  parameter SI.Inductance L=1 "Load resistance"
  Modelica.Electrical.Analog.Basic.Resistor resistor(R=R)
  Modelica.Electrical.Analog.Basic.Inductor inductor(L=L, i(fixed=true,
        start=0))
equation
  connect(resistor.n, inductor.p)
  connect(inductor.n, currentSensor.p)
  connect(resistor.p, rectifier.dc_p)
end ThyristorCenterTap2Pulse_RL;


Two pulse thyristor rectifier with center tap and R-L load and voltage. This example shows a controlled center tap two pulse rectifier with R-L load including DC voltage source. The additional DC voltage source in this example enables negative average load voltages.

within Modelica.Electrical.PowerConverters.Examples.ACDC.RectifierCenterTap2Pulse;
model ThyristorCenterTap2Pulse_RLV
  "Two pulse thyristor rectifier with center tap and R-L load and voltage"
  extends ExampleTemplates.ThyristorCenterTap2Pulse(pulse2(
        constantFiringAngle=constantFiringAngle));
  extends Modelica.Icons.Example;
  import Modelica.Constants.pi;
  parameter SI.Angle constantFiringAngle=30*pi/180
    "Firing angle";
  parameter SI.Resistance R=20 "Load resistance";
  parameter SI.Inductance L=1 "Load resistance"
  parameter SI.Voltage VDC=-120 "DC load offset voltage";
  Modelica.Electrical.Analog.Basic.Resistor resistor(R=R)
  Modelica.Electrical.Analog.Basic.Inductor inductor(L=L, i(start=0,
        fixed=true))
  Modelica.Electrical.Analog.Sources.ConstantVoltage constantVoltage(V=
        VDC)
equation
  connect(resistor.n, inductor.p)
  connect(inductor.n, constantVoltage.p)
  connect(constantVoltage.n, currentSensor.p)
  connect(resistor.p, rectifier.dc_p)
end ThyristorCenterTap2Pulse_RLV;


Characteristic of two pulse thyristor rectifier with center tap and R-L load and voltage. This example shows a controlled center tap two pulse rectifier with R-L load including DC voltage source. The additional DC voltage source in this example enables negative average load voltages.

within Modelica.Electrical.PowerConverters.Examples.ACDC.RectifierCenterTap2Pulse;
model ThyristorCenterTap2Pulse_RLV_Characteristic
  "Characteristic of two pulse thyristor rectifier with center tap and R-L load and voltage"
  extends ExampleTemplates.ThyristorCenterTap2Pulse(pulse2(
        useConstantFiringAngle=false));
  extends Modelica.Icons.Example;
  import Modelica.Constants.pi;
  parameter SI.Resistance R=20 "Load resistance";
  parameter SI.Inductance L=1 "Load resistance"
  parameter SI.Voltage VDC=-120 "DC load offset voltage";
  Modelica.Electrical.Analog.Basic.Resistor resistor(R=R)
  Modelica.Electrical.Analog.Basic.Inductor inductor(L=L, i(fixed=true,
        start=0))
  Modelica.Electrical.Analog.Sources.ConstantVoltage constantVoltage(V=
        VDC)
  Modelica.Blocks.Sources.Ramp ramp(height=pi, duration=10)
equation
  connect(resistor.n, inductor.p)
  connect(inductor.n, constantVoltage.p)
  connect(constantVoltage.n, currentSensor.p)
  connect(ramp.y, pulse2.firingAngle)
  connect(resistor.p, rectifier.dc_p)
end ThyristorCenterTap2Pulse_RLV_Characteristic;


2*m pulse diode rectifier with center tap with resistive load. This example shows an uncontrolled m pulse center tap diode rectifier with resistive load, where m is the number of phases.

within Modelica.Electrical.PowerConverters.Examples.ACDC.RectifierCenterTapmPulse;
model DiodeCenterTapmPulse
  "2*m pulse diode rectifier with center tap with resistive load"
  extends Modelica.Icons.Example;
  import Modelica.Constants.pi;
  parameter Integer m(final min=3) = 3 "Number of phases"
  parameter SI.Voltage Vrms=110 "RMS supply voltage";
  parameter SI.Frequency f=50 "Frequency";
  parameter SI.Resistance R=20 "Load resistance";

  Modelica.Electrical.Analog.Basic.Ground ground
  Modelica.Electrical.Polyphase.Basic.Star star(final m=m)
  Modelica.Electrical.Polyphase.Sources.SineVoltage sineVoltage_p(
    final m=m,
    V=fill(sqrt(2)*Vrms, m),
    phase=-
        Modelica.Electrical.Polyphase.Functions.symmetricOrientation(m),
    f=fill(f, m))
  PowerConverters.ACDC.DiodeCenterTapmPulse rectifier(final m=m)
  Modelica.Electrical.Analog.Sensors.VoltageSensor voltagesensor
  Modelica.Blocks.Math.Mean meanVoltage(f=m*f)
  Modelica.Blocks.Math.RootMeanSquare rootMeanSquareVoltage(f=m*f)
  Modelica.Electrical.Analog.Sensors.CurrentSensor currentSensor
  Modelica.Blocks.Math.Mean meanCurrent(f=m*f)
  Modelica.Electrical.Analog.Basic.Resistor resistor(R=R)
equation
  connect(star.pin_n, ground.p)
  connect(meanCurrent.u, currentSensor.i)
  connect(voltagesensor.v, meanVoltage.u)
  connect(voltagesensor.v, rootMeanSquareVoltage.u)
  connect(rectifier.dc_p, voltagesensor.p)
  connect(currentSensor.p, voltagesensor.n)
  connect(star.plug_p, sineVoltage_p.plug_n)
  connect(star.pin_n, currentSensor.n)
  connect(rectifier.ac, sineVoltage_p.plug_p)
  connect(resistor.n, currentSensor.p)
  connect(rectifier.dc_p, resistor.p)
end DiodeCenterTapmPulse;


m pulse rectifier with center tap

within Modelica.Electrical.PowerConverters.Examples.ACDC;
package RectifierCenterTapmPulse "m pulse rectifier with center tap"
  extends Modelica.Icons.ExamplesPackage;
end RectifierCenterTapmPulse;


2*m pulse thyristor rectifier with center tap and resistive load. This example shows a controlled m pulse center tap rectifier with resistive load, where m is the number of phases.

within Modelica.Electrical.PowerConverters.Examples.ACDC.RectifierCenterTapmPulse;
model ThyristorCenterTapmPulse_R
  "2*m pulse thyristor rectifier with center tap and resistive load"
  extends ExampleTemplates.ThyristorCenterTapmPulse(pulsem(
        constantFiringAngle=constantFiringAngle));
  extends Modelica.Icons.Example;
  import Modelica.Constants.pi;
  parameter SI.Angle constantFiringAngle=30*pi/180
    "Firing angle";
  parameter SI.Resistance R=20 "Load resistance";
  Modelica.Electrical.Analog.Basic.Resistor resistor(R=R)
equation
  connect(resistor.n, currentSensor.p)
  connect(resistor.p, rectifier.dc_p)
end ThyristorCenterTapmPulse_R;


2*m pulse thyristor rectifier with center tap and R-L load. This example shows a controlled m pulse center tap rectifier with R-L load, where m is the number of phases.

within Modelica.Electrical.PowerConverters.Examples.ACDC.RectifierCenterTapmPulse;
model ThyristorCenterTapmPulse_RL
  "2*m pulse thyristor rectifier with center tap and R-L load"
  extends ExampleTemplates.ThyristorCenterTapmPulse(pulsem(
        constantFiringAngle=constantFiringAngle));
  extends Modelica.Icons.Example;
  import Modelica.Constants.pi;
  parameter SI.Angle constantFiringAngle=30*pi/180
    "Firing angle";
  parameter SI.Resistance R=20 "Load resistance";
  parameter SI.Inductance L=1 "Load resistance"
  Modelica.Electrical.Analog.Basic.Resistor resistor(R=R)
  Modelica.Electrical.Analog.Basic.Inductor inductor(L=L, i(fixed=true,
        start=0))
equation
  connect(resistor.n, inductor.p)
  connect(inductor.n, currentSensor.p)
  connect(resistor.p, rectifier.dc_p)
end ThyristorCenterTapmPulse_RL;


2*m pulse thyristor rectifier with center tap and R-L load and voltage. This example shows a controlled m pulse center tap rectifier with R-L load including DC voltage source, where m is the number of phases. The additional DC voltage source in this example enables negative average load voltages.

within Modelica.Electrical.PowerConverters.Examples.ACDC.RectifierCenterTapmPulse;
model ThyristorCenterTapmPulse_RLV
  "2*m pulse thyristor rectifier with center tap and R-L load and voltage"
  extends ExampleTemplates.ThyristorCenterTapmPulse(pulsem(
        constantFiringAngle=constantFiringAngle));
  extends Modelica.Icons.Example;
  import Modelica.Constants.pi;
  parameter SI.Angle constantFiringAngle=30*pi/180
    "Firing angle";
  parameter SI.Resistance R=20 "Load resistance";
  parameter SI.Inductance L=1 "Load resistance"
  parameter SI.Voltage VDC=-50 "DC load offset voltage";
  Modelica.Electrical.Analog.Basic.Resistor resistor(R=R)
  Modelica.Electrical.Analog.Basic.Inductor inductor(L=L, i(fixed=true,
        start=0))
  Modelica.Electrical.Analog.Sources.ConstantVoltage constantVoltage(V=
        VDC)
equation
  connect(resistor.n, inductor.p)
  connect(inductor.n, constantVoltage.p)
  connect(constantVoltage.n, currentSensor.p)
  connect(resistor.p, rectifier.dc_p)
end ThyristorCenterTapmPulse_RLV;


Characteristic of 2*m pulse thyristor rectifier with center tap and R-L load and voltage. This example shows a controlled m pulse center tap rectifier with R-L load including DC voltage source, where m is the number of phases. The additional DC voltage source in this example enables negative average load voltages.

within Modelica.Electrical.PowerConverters.Examples.ACDC.RectifierCenterTapmPulse;
model ThyristorCenterTapmPulse_RLV_Characteristic
  "Characteristic of 2*m pulse thyristor rectifier with center tap and R-L load and voltage"
  extends ExampleTemplates.ThyristorCenterTapmPulse(pulsem(
        useConstantFiringAngle=false));
  extends Modelica.Icons.Example;
  import Modelica.Constants.pi;
  parameter SI.Resistance R=20 "Load resistance";
  parameter SI.Inductance L=1 "Load resistance"
  parameter SI.Voltage VDC=-50 "DC load offset voltage";
  Modelica.Electrical.Analog.Basic.Resistor resistor(R=R)
  Modelica.Electrical.Analog.Basic.Inductor inductor(L=L, i(fixed=true,
        start=0))
  Modelica.Electrical.Analog.Sources.ConstantVoltage constantVoltage(V=
        VDC)
  Modelica.Blocks.Sources.Ramp ramp(height=pi, duration=10)
equation
  connect(resistor.n, inductor.p)
  connect(inductor.n, constantVoltage.p)
  connect(currentSensor.p, constantVoltage.n)
  connect(resistor.p, rectifier.dc_p)
  connect(ramp.y, pulsem.firingAngle)
end ThyristorCenterTapmPulse_RLV_Characteristic;


DC to AC converter examples

within Modelica.Electrical.PowerConverters.Examples;
package DCAC "DC to AC converter examples"
  extends Modelica.Icons.ExamplesPackage;
end DCAC;


Templates of examples

within Modelica.Electrical.PowerConverters.Examples.DCAC;
package ExampleTemplates "Templates of examples"
  extends Modelica.Icons.Package;
end ExampleTemplates;


Single-phase two level inverter including control. Single-phase two level example template including supply and sensors; load is not yet included.

within Modelica.Electrical.PowerConverters.Examples.DCAC.ExampleTemplates;
partial model SinglePhaseTwoLevel
  "Single-phase two level inverter including control"
  extends Icons.ExampleTemplate;
  parameter SI.Frequency f=1000 "Switching frequency";
  Modelica.Electrical.Analog.Sources.ConstantVoltage constantVoltage_n(
      V=50)
  PowerConverters.DCAC.SinglePhase2Level inverter(useHeatPort=false)
  Modelica.Electrical.Analog.Sensors.CurrentSensor currentSensor
  Modelica.Electrical.Analog.Sensors.VoltageSensor voltageSensor
  Modelica.Electrical.Analog.Basic.Ground ground
  PowerConverters.DCDC.Control.SignalPWM signalPWM(useConstantDutyCycle=false,
      f=f)
  Modelica.Electrical.Analog.Sources.ConstantVoltage constantVoltage_p(
      V=50)
  Modelica.Blocks.Sources.Sine sine(f=50)
  Modelica.Blocks.Math.Harmonic fundamentalWaveVoltage(f=f, k=1)
  Modelica.Blocks.Math.Harmonic fundamentalWaveCurrent(f=f, k=1)
equation
  connect(voltageSensor.n, currentSensor.p)
  connect(signalPWM.fire, inverter.fire_p)
  connect(constantVoltage_p.n, constantVoltage_n.p)
  connect(constantVoltage_p.p, inverter.dc_p)
  connect(constantVoltage_n.n, inverter.dc_n)
  connect(ground.p, constantVoltage_p.n)
  connect(currentSensor.n, ground.p)
  connect(voltageSensor.p, inverter.ac)
  connect(sine.y, signalPWM.dutyCycle)
  connect(inverter.fire_n, signalPWM.notFire)
  connect(currentSensor.i, fundamentalWaveCurrent.u)
  connect(voltageSensor.v, fundamentalWaveVoltage.u)
end SinglePhaseTwoLevel;


Polyphase two level inverter example

within Modelica.Electrical.PowerConverters.Examples.DCAC;
package PolyphaseTwoLevel "Polyphase two level inverter example"
  extends Modelica.Icons.ExamplesPackage;
end PolyphaseTwoLevel;