Extends from Modelica.Icons.Library (Icon for library).
| Name | Description |
|---|---|
| Conversion: three phase -> space phasor | |
| Conversion: space phasor -> three phase | |
| Rotates space phasor | |
| Converts a space phasor to polar coordinates | |
| Converts a space phasor from polar coordinates |
Modelica.Electrical.Machines.SpacePhasors.Functions.ToSpacePhasor
Extends from Modelica.Icons.Function (Icon for a function).
| Type | Name | Default | Description |
|---|---|---|---|
| Real | x[3] |
| Type | Name | Description |
|---|---|---|
| Real | y[2] | |
| Real | y0 |
function ToSpacePhasor "Conversion: three phase -> space phasor"
extends Modelica.Icons.Function;
constant Integer m=3 "number of phases";
constant Real pi=Modelica.Constants.pi;
input Real x[3];
output Real y[2];
output Real y0;
algorithm
y := zeros(2);
for k in 1:m loop
y := y + 2/m*{+cos((k - 1)/m*2*pi), +sin(+(k - 1)/m*2*pi)}*x[k];
end for;
y0 := 1/m*sum(x);
end ToSpacePhasor;
Modelica.Electrical.Machines.SpacePhasors.Functions.FromSpacePhasor
Extends from Modelica.Icons.Function (Icon for a function).
| Type | Name | Default | Description |
|---|---|---|---|
| Real | x[2] | ||
| Real | x0 |
| Type | Name | Description |
|---|---|---|
| Real | y[3] |
function FromSpacePhasor "Conversion: space phasor -> three phase"
extends Modelica.Icons.Function;
constant Integer m=3 "number of phases";
constant Real pi=Modelica.Constants.pi;
input Real x[2];
input Real x0;
output Real y[3];
algorithm
for k in 1:m loop
y[k] := x0 + {cos(-(k - 1)/m*2*pi),-sin(-(k - 1)/m*2*pi)}*x;
end for;
end FromSpacePhasor;
Modelica.Electrical.Machines.SpacePhasors.Functions.Rotator
Extends from Modelica.Icons.Function (Icon for a function).
| Type | Name | Default | Description |
|---|---|---|---|
| Real | x[2] | ||
| Angle | angle | [rad] |
| Type | Name | Description |
|---|---|---|
| Real | y[2] |
function Rotator "Rotates space phasor"
extends Modelica.Icons.Function;
input Real x[2];
input Modelica.SIunits.Angle angle;
output Real y[2];
protected
Real RotationMatrix[2,2] = {{+cos(-angle),-sin(-angle)},{+sin(-angle),+cos(-angle)}};
algorithm
y := RotationMatrix*x;
end Rotator;
Modelica.Electrical.Machines.SpacePhasors.Functions.ToPolar
Extends from Modelica.Icons.Function (Icon for a function).
| Type | Name | Default | Description |
|---|---|---|---|
| Real | x[2] |
| Type | Name | Description |
|---|---|---|
| Real | absolute | |
| Angle | angle | [rad] |
function ToPolar "Converts a space phasor to polar coordinates"
extends Modelica.Icons.Function;
constant Real small=Modelica.Constants.small;
input Real x[2];
output Real absolute;
output Modelica.SIunits.Angle angle;
algorithm
absolute := sqrt(x[1]^2 + x[2]^2);
angle := if absolute <= small then 0 else Modelica.Math.atan2(x[2], x[1]);
/*
if absolute <= small then
angle := 0;
else
if x[2] >= 0 then
angle := Modelica.Math.acos(x[1]/absolute);
else
angle := -Modelica.Math.acos(x[1]/absolute);
end if;
end if;
*/
end ToPolar;
Modelica.Electrical.Machines.SpacePhasors.Functions.FromPolar
Extends from Modelica.Icons.Function (Icon for a function).
| Type | Name | Default | Description |
|---|---|---|---|
| Real | absolute | ||
| Angle | angle | [rad] |
| Type | Name | Description |
|---|---|---|
| Real | x[2] |
function FromPolar "Converts a space phasor from polar coordinates"
extends Modelica.Icons.Function;
constant Real pi=Modelica.Constants.pi;
constant Real small=Modelica.Constants.small;
input Real absolute;
input Modelica.SIunits.Angle angle;
output Real x[2];
algorithm
x := absolute*{cos(angle),sin(angle)};
end FromPolar;