Question: Given a system of 1 2 buses, write python code to calculate the jacobaian matrix. Bus data attached. starter code given, assume bus data is
Given a system of buses, write python code to calculate the jacobaian matrix. Bus data attached. starter code given, assume bus data is read in correctly, but can be rearranged so that it is in order:
# Takes in bus and line data and returns the admittance matrix
def createadmittancematrix busdata, linedata:
# Creates numpy array of zeros to populate with admittances
ymatrix npzerosnumbuses, numbuses dtypecomplex
for i in rangelenlinedata:
frombus linedata.loci 'From'
tobus linedata.lociTo
R linedataRtotal puiloci
X linedataXtotal puiloci
B linedataBtotal puiloci
Y R jX
Bcomplex jB
#nondiagonals
ymatrixfrombustobusY
ymatrixtobus frombusY
#diagonals
ymatrixfrombus frombus Y Bcomplex
ymatrixtobus tobus Y Bcomplex
return ymatrix
ymatrix createadmittancematrix busdata, linedata
# Extract bus types
slackbus busdatabusdataTypeSindex
pqbuses busdatabusdataTypeDindex
pvbuses busdatabusdataTypeGindex
V nparraybusdataV Set"
#printV
theta npzerosnumbuses
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
