-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathRunPF.py
More file actions
29 lines (21 loc) · 843 Bytes
/
RunPF.py
File metadata and controls
29 lines (21 loc) · 843 Bytes
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
import numpy as np
def runPF(dssObj, p, q, evNode, evP):
evExtraP = np.zeros(len(p))
for e in range(0, len(evP)):
evExtraP[evNode[e]] = evP[e]
p = [sum(x) for x in zip(p, evExtraP)]
#return (p,q)
dssCircuit = dssObj.ActiveCircuit
dssText = dssObj.Text
nNodes = 33
for ind in range(2, nNodes +1, 1):
for secInd in range(56 ,111):
loadIdx = (ind - 2) * 55 + secInd - 55 - 1
nodeNumber = ind * 1000 + secInd
loadchangecommand = 'Edit Load.' + str(nodeNumber) + ' kW= ' + str(p[loadIdx]) + ' kvar= ' + str(q[loadIdx])
dssText.Command = loadchangecommand
dssText.Command = 'Set mode=snapshot'
dssText.Command = 'solve'
# DSSText.Command = 'show voltage'
# getting bus voltages
return dssCircuit