-
Notifications
You must be signed in to change notification settings - Fork 5
/
DG.py
39 lines (29 loc) · 1.12 KB
/
DG.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import numpy
import math
# --------------------------------- #
# ----- DG With Complex Power ----- #
# --------------------------------- #
# Line Current of Star Connected DG - Voltage (LN)
def generatorStar(voltage, power):
I = numpy.divide(power,voltage)
return I
# Line Current of Delta Connected DG - Voltage (LL)
def generatorStarDelta(voltage, power):
I = numpy.divide(power,voltage)
return I
# --------------------------------- #
# ----- DGs With Power Factor ----- #
# --------------------------------- #
# Line Current of Star Connected DG - Voltage (LN)
def generatorStar(voltage, power, powerFactor):
Q = power * math.tan(math.acos(powerFactor))
I = numpy.divide(complex(power,Q),voltage)
return I
# Line Current of Delta Connected DG - Voltage (LL)
def generatorStarDelta(voltage, power, powerFactor):
Q = power * math.tan(math.acos(powerFactor))
I = numpy.divide(complex(power,Q),voltage)
return I
# Transformation Matrix is not required since we do the calculation either on LN or LL.
# tfMatrix = numpy.array([[1,0,-1],[-1,1,0],[0,-1,1]])
# return numpy.dot(tfMatrix, I)