Harmoniques e t  PQS
Author: Daniel Mentrard

Z

Y

X

φ1
  

θ

λ

PERTES 
EN LIGNE  (D=0)

THD² =

Perte en ligne
supplementaire
 (D>0)

Pertes 
totales  

 Gain en ligne   
  (Q<0)

Qt

MONOPHASE 

S = 4898.97 (slider from -5 to 1000000, step 0.1)
Urms = 200
u1mesure = 199
Q = 2823.42 (slider from -100000 to 1000000, step 0.1)
E: {0.0, 0.0, Q}
P = 2828.42 (slider from -5 to 1000000, step 0.1)
D: sqrt(S * S - P * P - Q * Q)
J: {D, 0.0, Q}
D_2: {0.0, P, 0.0}
S_2 = Distance3D(D_2, J)
ieff: S_2 / Urms
S1 = Distance3D(D_2, E)
i1: S1 / u1mesure
ih1: sqrt(ieff^(2.0) - i1^(2.0))
C: {0.0, 0.0, 0.0}
s: P^(2.0) + Q^(2.0)
S1calcule: sqrt(s)
φ = Angle3D1(E, D_2, C)
cosphi: cos(φ)
U1v: S1calcule / i1
sinphi: Q / (U1v * i1)
ih: D / Urms
dcalc: S_2^(2.0) - P^(2.0) - Q^(2.0)
zElipse2 = Ellipse((-3.090024885449273, 3.904076721590685), (-3.090024885449273, 5.144076721590685), 0.65)
Z_1 = Point(zElipse2)
zElipse1 = Ellipse((-3.7229062381226776, 4.549785208213285), (-2.4829062381226774, 4.549785208213285), 0.65)
XY = Point(zElipse1)
G = Point3D(XY, Z_1, D_2)
N: {D, 0.0, 0.0}
R = Point3D(XY, Z_1, N)
g = Segment(R, G)
O1 = Midpoint(g)
U1 = Midpoint(R, O1)
uh2: (dcalc - (U1v * ih)^(2.0)) / ieff^(2.0)
uh: sqrt(uh2)
u1s: S1 / i1
P1 = Midpoint(G, O1)
Q1 = Midpoint(G, P1)
coslambda: P / S_2
thd2: -1.0 + cosphi^(2.0) / coslambda^(2.0)
thd: sqrt(thd2) * 100.0
Scalc: s + dcalc
Scalcule: sqrt(Scalc)
F = Point3D(XY, Z_1, C)
A1 = Midpoint(F, G)
B1 = Midpoint(A1, G)
S1_1 = Midpoint(A1, B1)
W1 = Midpoint(S1_1, A1)
H = Point3D(XY, Z_1, E)
V = Midpoint(H, G)
W = Midpoint(V, G)
J1 = Midpoint(V, W)
L1 = Midpoint(J1, W)
K = Point3D(XY, Z_1, J)
H1 = Midpoint(K, G)
I1 = Midpoint(H1, G)
K1 = Midpoint(H1, I1)
M1 = Midpoint(K1, I1)
θ = Angle3D1(N, D_2, C)
costheta: cos(θ)
γ = Angle3D1(J, D_2, E)
cosY: cos(γ)
zAngInc = Angle((-3.0, 6.0), (-3.0, 5.0), Z_1)
zZ: (0.0, 3.5 * cos(zAngInc))
O = (0, 0)
zAngRot = Angle((-2.0, 5.0), (-3.0, 5.0), XY)
zY: (3.5 * cos(zAngRot), 3.5 * sin(zAngRot) * sin(zAngInc))
zX: (3.5 * sin(zAngRot), -1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 3.5 * cos(zAngRot) * sin(zAngInc))
zSeg1 =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 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * cos(zAngRot) * sin(zAngInc))
zUnidadY: (cos(zAngRot), sin(zAngRot) * sin(zAngInc))
zUnidadZ: (0.0, cos(zAngInc))
zConstruccionP': (Element[P_1, 1.0] * sin(zAngRot) + Element[P_1, 2.0] * cos(zAngRot), -1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * Element[P_1, 1.0] * cos(zAngRot) * sin(zAngInc) + Element[P_1, 2.0] * sin(zAngRot) * sin(zAngInc) + Element[P_1, 3.0] * cos(zAngInc))
A: {0.0, 1.0, 0.0}
B: {0.0, 0.0, 1.0}
AngleAPB = Angle3D1(A, P_1, B)
DistanceAB = Distance3D(A, B)
u = Vector(G, F)
v = Vector(F, H)
w = Vector(G, H)
I: {-1.0, 0.0, 0.0}
Plan[XY, Z, A, B, P]_1, Plan[XY, Z, A, B, P]_2, Plan[XY, Z, A, B, P]_3 = Plan(XY, Z_1, D_2, C, I)
a = Segment(K, H)
z = Vector(G, K)
L = Midpoint(H, G)
T3: "S1 =" + S1
M = Midpoint(K, G)
T4: "S  =" + S
b = Segment(K, F)
T5: "S_1 = " + S1 + " VA"
T6: "S = " + S_2 + " VA"
T8: "Y = " + γ
T9: " Theta (θ)  =" + θ
f = Segment(K, R)
T = Midpoint(H, F)
U = Midpoint(K, H)
T10: " D=" + D
T12: " P  =" + P
pertesuppharmonique: (ieff^(2.0) - i1^(2.0)) * 100.0 / i1^(2.0)
T14: "" + pertesuppharmonique + "%"
C1 = Midpoint(W, B1)
D1 = Midpoint(W, G)
E1 = Midpoint(D1, W)
F1 = Midpoint(G, B1)
G1 = Midpoint(F1, B1)
h = Segment(E1, C1)
t = Segment(C1, B1)
N1 = Midpoint(H1, A1)
j = Segment(K1, N1)
R1 = Midpoint(Q1, P1)
V1 = Midpoint(U1, O1)
Z1 = Midpoint(O1, V1)
A2 = Midpoint(W1, Z1)
l = Segment(S1_1, A2)
m = Segment(A2, O1)
B2 = Midpoint(b)
text1: "cos Y  =" + cosY
text2: "cos θ  = " + costheta
λ = Angle3D1(J, D_2, C)
fd: coslambda / cosphi
text5: "cos  (λ)  =  " + coslambda
pertesreactives: 100.0 * (i1^(2.0) - (i1 * cosphi)^(2.0)) / (i1 * cosphi)^(2.0)
text7: pertesreactives + "%"
A_1 = Point(b)
B_1 = Point(f)
n = Segment(B_1, A_1)
k = Segment(N1, W1)
Dcalcule: sqrt(dcalc)
text15: "THDi =" + thd
text14: "I1=" + i1 + "A"
text16: "I eff =" + ieff + "A"
ueff: S_2 / ieff
text22: "D = " + Dcalcule + " VARH"
THDR: 100.0 * ih / ieff
text19: "THD-R = " + THDR
THDF: 100.0 * ih1 / i1
text20: "THD-F =   " + THDF
pertetotale: 100.0 * (ieff^(2.0) - (i1 * cosphi)^(2.0)) / (i1 * cosphi)^(2.0)
text10: pertetotale + "%"
text21: "  U1   =" + U1v + "V"
text23: "URMS = " + ueff + "V"
Zcharge: U1v^(2.0) / S1
text24: "
Zcharge =  " + Zcharge + "ohms"
hp: S1 / i1^(2.0)
T11: "Q1= " + Q
text25: "Uh =" + uh + "V"
thdu: 100.0 * uh / u1s
tanglambda: sqrt(1.0 - coslambda^(2.0)) / coslambda
coslambda1: cosY * cosphi
tanphi: sinphi / cosphi
tanphi2: tanphi^(2.0)
pertesreactives2: 100.0 * tanphi2
Zreel: Urms^(2.0) / S_2
text8: "facteur de
 deformation
   FD = " + fd
thdf: THDF / 100.0
thdu2: -1.0 + 1.0 / (fd^(2.0) * (1.0 + thdf^(2.0)))
text26: "THDU % =" + thdu + "%"
uh3: sqrt(Urms^(2.0) - U1v^(2.0))
text13: "100THDF ² =" + ((THDF / 100.0)^(2.0) * 100.0)
dcalculee: Urms * ih
atan(φ): atan(sinphi / cosphi)
phi: atan(sinphi / cosphi) * 180.0 / 3.141592653589793
atan(sinphi / cosphi): atan(sinphi / cosphi) * 180.0 / 3.141592653589793
text17: "Ih =" + ih + "A"
T7: "cosφ1 = " + cosphi
texte1: "sin φ1=" + sinphi
text11: "tan φ1 = " + tanphi
text28: "100tanφ1 ² =" + (100.0 * tanphi2)
text3: "FP =" + coslambda
T1: "φ1 = " + phi + "°"
text4: "λ  = " + λ
d2: ih * Urms

Tool: Point3D
Point3D[ XY, Z, Liste {Px, Py, Pz} ]
Input: XY, Z, P
Output: zConstruccionP'

zAngInc = Angle((-3.0, 6.0), (-3.0, 5.0), Z)
zAngRot = Angle((-2.0, 5.0), (-3.0, 5.0), XY)
P: {0.0, -3.0, -3.0}
zConstruccionP': (Element[P, 1.0] * sin(zAngRot) + Element[P, 2.0] * cos(zAngRot), -1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * 1.0 * Element[P, 1.0] * cos(zAngRot) * sin(zAngInc) + Element[P, 2.0] * sin(zAngRot) * sin(zAngInc) + Element[P, 3.0] * cos(zAngInc))

Tool: Distance3D
Distance3D[ Liste Point1, Liste Point2 ]
Input: A, B
Output: Distance3D

B: {0.0, 0.0, 1.0}
A: {0.0, 1.0, 0.0}
A1 = Element(A, 1.0)
A2 = Element(A, 2.0)
A3 = Element(A, 3.0)
B1 = Element(B, 1.0)
B2 = Element(B, 2.0)
B3 = Element(B, 3.0)
Distance3D: sqrt((B1 - A1)^(2.0) + (B2 - A2)^(2.0) + (B3 - A3)^(2.0))

Tool: Angle3D (command Angle3D1)
Angle3D[ Liste Point initial, Liste Point centre, Liste Point final]
Input: A, P, B
Output: ang

P: {0.0, 2828.42, 0.0}
A: {2833.416112769178, 0.0, 2823.42}
B: {0.0, 0.0, 0.0}
a: {Element[A, 1.0] - Element[P, 1.0], Element[A, 2.0] - Element[P, 2.0], Element[A, 3.0] - Element[P, 3.0]}
b: {Element[B, 1.0] - Element[P, 1.0], Element[B, 2.0] - Element[P, 2.0], Element[B, 3.0] - Element[P, 3.0]}
ab: Element[a, 1.0] * Element[b, 1.0] + Element[a, 2.0] * Element[b, 2.0] + Element[a, 3.0] * Element[b, 3.0]
am: sqrt(Element[a, 1.0]^(2.0) + Element[a, 2.0]^(2.0) + Element[a, 3.0]^(2.0))
bm: sqrt(Element[b, 1.0]^(2.0) + Element[b, 2.0]^(2.0) + Element[b, 3.0]^(2.0))
ang: acos(ab / (am * bm)) * 180.0 * ° / 3.141592653589793

Tool: Plan passant par 3 Points (command Plan)
Plan[ XY, Z, Liste Point1, Liste Point2, Liste Point3]
Input: XY, Z, P, A, B
Output: poly1, poly2, angG

B: {-1.0, 0.0, 0.0}
A: {0.0, 0.0, 0.0}
P: {0.0, 2828.42, 0.0}
p3 = Element(P, 3.0)
p2 = Element(P, 2.0)
p1 = Element(P, 1.0)
b: {Element[B, 1.0] - Element[P, 1.0], Element[B, 2.0] - Element[P, 2.0], Element[B, 3.0] - Element[P, 3.0]}
b3 = Element(b, 3.0)
b2 = Element(b, 2.0)
b1 = Element(b, 1.0)
a: {Element[A, 1.0] - Element[P, 1.0], Element[A, 2.0] - Element[P, 2.0], Element[A, 3.0] - Element[P, 3.0]}
a3 = Element(a, 3.0)
a2 = Element(a, 2.0)
a1 = Element(a, 1.0)
n: {a2 * b3 - a3 * b2, a3 * b1 - a1 * b3, a1 * b2 - a2 * b1}
n3 = Element(n, 3.0)
n2 = Element(n, 2.0)
n1 = Element(n, 1.0)
Z4 = Point3D(XY, Z, {5.0, -3.0, Element[P, 3.0]})
Z3 = Point3D(XY, Z, {5.0, 5.0, Element[P, 3.0]})
Z2 = Point3D(XY, Z, {-3.0, 5.0, Element[P, 3.0]})
Z1 = Point3D(XY, Z, {-3.0, -3.0, Element[P, 3.0]})
Y4 = Point3D(XY, Z, {-3.0, -1.0 * n3 * (5.0 - p3) / n2 + p2, 5.0})
Y3 = Point3D(XY, Z, {5.0, -1.0 * n3 * (5.0 - p3) / n2 + p2, 5.0})
Y2 = Point3D(XY, Z, {5.0, -1.0 * n3 * (-3.0 - p3) / n2 + p2, -3.0})
Y1 = Point3D(XY, Z, {-3.0, -1.0 * n3 * (-3.0 - p3) / n2 + p2, -3.0})
X4 = Point3D(XY, Z, {If[n1 ≟ 0.0, 0.0, (-1.0 * n2 * (5.0 - p2) - n3 * (-3.0 - p3)) / n1 + p1], 5.0, -3.0})
V4 = If(n1 ≟ 0.0, If[n2 ≟ 0.0, Z4, Y4], X4)
X3 = Point3D(XY, Z, {If[n1 ≟ 0.0, 0.0, (-1.0 * n2 * (5.0 - p2) - n3 * (5.0 - p3)) / n1 + p1], 5.0, 5.0})
V3 = If(n1 ≟ 0.0, If[n2 ≟ 0.0, Z3, Y3], X3)
X2 = Point3D(XY, Z, {If[n1 ≟ 0.0, 0.0, (-1.0 * n2 * (-3.0 - p2) - n3 * (5.0 - p3)) / n1 + p1], -3.0, 5.0})
V2 = If(n1 ≟ 0.0, If[n2 ≟ 0.0, Z2, Y2], X2)
X1 = Point3D(XY, Z, {If[n1 ≟ 0.0, 0.0, (-1.0 * n2 * (-3.0 - p2) - n3 * (-3.0 - p3)) / n1 + p1], -3.0, -3.0})
V1 = If(n1 ≟ 0.0, If[n2 ≟ 0.0, Z1, Y1], X1)
poly1, c, d, e, f = Polygon(V1, V2, V3, V4)
G: (V1 + V2 + V3 + V4) / 4.0
angG = Angle(V2, G, V1)
poly2, v1, v2, v3, v4 = Polygon(V1, V2, V3, V4)