Skip to content

Instantly share code, notes, and snippets.

View swanav's full-sized avatar
:octocat:

Swanav Swaroop swanav

:octocat:
View GitHub Profile
@swanav
swanav / Y_Bus_Assembly_Singular.m
Last active February 20, 2018 23:34
Y Bus Assembly (Using Singular Transformation technique)
function yBus = Y_Bus_Assembly_Singular()
% Data from IEEE 5-bus Data
% "http://shodhganga.inflibnet.ac.in/bitstream/10603/26549/14/14_appendix.pdf""
lineData = csvread('Y_Bus_Data.csv', 1, 0);
% Calculate the number of lines in the line data
lines = length(lineData);
% Calculate the number of buses in the line data
buses = max(max(lineData(:,2)),max(lineData(:,3)));
% Calculate the line admittance by taking element by element inverse
lineAdmittance = lineData(:,4).^-1;
@swanav
swanav / Y_Bus_Assembly_Direct.m
Last active February 20, 2018 23:29
Y Bus Assembly (Direct Method)
function yBus = Y_Bus_Assembly_Direct()
% Data from IEEE 5-bus Data
% "http://shodhganga.inflibnet.ac.in/bitstream/10603/26549/14/14_appendix.pdf""
lineData = csvread('Y_Bus_Data.csv', 1, 0);
% Calculate the number of lines in the line data
lines = length(lineData);
% Calculate the number of buses in the line data
buses = max(max(lineData(:,2)),max(lineData(:,3)));
% Calculate the line admittance by taking element by element inverse
lineAdmittance = lineData(:,4).^-1;