Skip to content

Commit

Permalink
Remove unused code (modelica#3622) (modelica#3623)
Browse files Browse the repository at this point in the history
* remove unused code modelica#3622

* Keep protected parameters in blocks and models, not in functions

* Add alternative implementation in FromSpacePhasor.mo

Add alternative implementation comment and revert comment removal for those implementation

* add alternative implementation comment in Rotator.mo

Add alternative implementation comment and revert comment removal for those implementation

* Add alternative implementation comment in ToSpacePhasor.mo

Add alternative implementation comment and revert comment removal for those implementation

* add alternative implementation comment in Rotator.mo

Add alternative implementation comment and revert comment removal for those implementation

* add alternative implementation comment in SpacePhasor.mo

Add alternative implementation comment and revert comment removal for those implementation

---------

Co-authored-by: Christian Kral <dr.christian.kral@gmail.com>
Co-authored-by: arunkumar-narasimhan <124154466+arunkumar-narasimhan@users.noreply.github.com>
  • Loading branch information
3 people committed Jan 18, 2024
1 parent ceae187 commit 5fe4ebd
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public
annotation (Placement(transformation(extent={{-140,-60},{-100,-100}})));
equation
y = fill(zero, m) + InverseTransformation*u;
// Alternative equivalent implementation:
//m*zero = sum(y);
//u = TransformationMatrix *y;
annotation (Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,
Expand Down
2 changes: 2 additions & 0 deletions Modelica/Electrical/Machines/SpacePhasors/Blocks/Rotator.mo
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ block Rotator "Rotates space phasor"
protected
Real RotationMatrix[2, 2]={{+cos(-angle),-sin(-angle)},{+sin(-angle),+
cos(-angle)}};
// Alternative equivalent implementation;
//Real InverseRotator[2,2] = {{+cos(+angle),-sin(+angle)},{+sin(+angle),+cos(+angle)}};
public
Modelica.Blocks.Interfaces.RealInput angle(unit="rad") annotation (Placement(
Expand All @@ -13,6 +14,7 @@ public
rotation=90)));
equation
y = RotationMatrix*u;
// Alternative equivalent implementation;
//u = InverseRotator*y;
annotation (Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,
-100},{100,100}}), graphics={Line(points={{0,0},{0,80},{-10,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public
equation
m*zero = sum(u);
y = TransformationMatrix*u;
// Alternative equivalent implementation;
//u = fill(zero,m) + InverseTransformation*y;
annotation (
Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ model Rotator "Rotates space phasor"
protected
Real RotationMatrix[2, 2]={{+cos(-angle),-sin(-angle)},{+sin(-angle),+
cos(-angle)}};
// Alternative equivalent implementation:
//Real InverseRotator[2,2] = {{+cos(+angle),-sin(+angle)},{+sin(+angle),+cos(+angle)}};
public
Machines.Interfaces.SpacePhasor spacePhasor_a
Expand All @@ -17,8 +18,10 @@ public
rotation=90)));
equation
spacePhasor_b.v_ = RotationMatrix*spacePhasor_a.v_;
// Alternative equivalent implementation:
//spacePhasor_a.v_ = InverseRotator*spacePhasor_b.v_;
spacePhasor_b.i_ + RotationMatrix*spacePhasor_a.i_ = zeros(2);
// Alternative equivalent implementation:
//spacePhasor_a.i_ + InverseRotator*spacePhasor_b.i_ = zeros(2);
annotation (Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,
-100},{100,100}}), graphics={
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ model SpacePhasor
SI.Voltage v[m] "Instantaneous phase voltages";
SI.Current i[m] "Instantaneous phase currents";
protected
parameter Real TransformationMatrix[2, m]=2/m*{{cos(+(k - 1)/m*2*pi)
for k in 1:m},{+sin(+(k - 1)/m*2*pi) for k in 1:m}};
parameter Real InverseTransformation[m, 2]={{cos(-(k - 1)/m*2*pi),-sin(
-(k - 1)/m*2*pi)} for k in 1:m};
parameter Real TransformationMatrix[2, m]=2/m*{{cos(+(k - 1)/m*2*pi)
for k in 1:m},{+sin(+(k - 1)/m*2*pi) for k in 1:m}};
public
Modelica.Electrical.Polyphase.Interfaces.PositivePlug plug_p(final m=m)
annotation (Placement(transformation(extent={{-110,90},{-90,110}})));
Expand All @@ -28,9 +28,11 @@ equation
i*turnsRatio = -plug_n.pin.i;
m*zero.v = sum(v);
spacePhasor.v_ = TransformationMatrix*v;
// Alternative equivalent implementation:
//v = fill(zero.v,m) + InverseTransformation*spacePhasor.v_;
-m*zero.i = sum(i);
-spacePhasor.i_ = TransformationMatrix*i;
// Alternative equivalent implementation:
//-i = fill(zero.i,m) + InverseTransformation*spacePhasor.i_;
ground.v = 0;
annotation (Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ function FromSpacePhasor
protected
parameter SI.Angle phi[m]=
Modelica.Electrical.Polyphase.Functions.symmetricOrientation(m);
parameter Real TransformationMatrix[2, m]=2/m*{+cos(+phi),+sin(+phi)};
parameter Real InverseTransformation[m, 2]={{+cos(-phi[k]),-sin(-phi[k])}
for k in 1:m};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ protected
parameter SI.Angle phi[m]=
Modelica.Electrical.Polyphase.Functions.symmetricOrientation(m);
parameter Real TransformationMatrix[2, m]=2/m*{+cos(+phi),+sin(+phi)};
parameter Real InverseTransformation[m, 2]={{+cos(-phi[k]),-sin(-phi[k])}
for k in 1:m};
algorithm
y := TransformationMatrix*x;
y0 := 1/m*sum(x);
Expand Down

0 comments on commit 5fe4ebd

Please sign in to comment.