Skip to content

Commit

Permalink
Alternative implementation of complex sum
Browse files Browse the repository at this point in the history
  • Loading branch information
christiankral committed Oct 29, 2017
1 parent 8a1c4cf commit 98cc538
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Modelica/Electrical/QuasiStationary/MultiPhase.mo
Expand Up @@ -2497,7 +2497,10 @@ This function propagates the input phasor to m output phasors with <a href=\"mod
Electrical.MultiPhase.Functions.symmetricOrientation(m);
Complex c;
equation
c = sqrt(2)/m*'sum'({u[k]*exp(j*phi[k]) for k in 1:m});
// c = sqrt(2)/m*'sum'({u[k]*exp(j*phi[k]) for k in 1:m});
// Alternative implementation due to https://trac.openmodelica.org/OpenModelica/ticket/4496
c.re = sqrt(2)/m*sum(u[k].re*cos(phi[k])-u[k].im*sin(phi[k]) for k in 1:m);
c.im = sqrt(2)/m*sum(u[k].re*sin(phi[k])+u[k].im*cos(phi[k]) for k in 1:m);
y = {c.re,c.im};
annotation (
Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{
Expand Down Expand Up @@ -2532,6 +2535,9 @@ Transformation of m phase values (voltages or currents) to space phasor.
</html>"));
end ToSpacePhasor;




This comment has been minimized.

Copy link
@tbeu

tbeu Oct 31, 2017

Contributor

Why 3 more blank lines?

This comment has been minimized.

Copy link
@christiankral

christiankral Oct 31, 2017

Author Contributor

The blank lines are not intentionally added and thus removed in 3b44ccd and b5b7d40.

block FromSpacePhasor "Conversion: space phasor -> m phase"
extends Modelica.Blocks.Icons.Block;
import Modelica.ComplexMath.j;
Expand Down

0 comments on commit 98cc538

Please sign in to comment.