This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- module MatpowerCases | |
- using MAT | |
- | |
- export loadcase,casenames | |
- | |
- """ Return a Dict containing power system data | |
- in MATPOWER's format. | |
- Return this list of cases by running casenames(). | |
- """ | |
- function loadcase(caseName::ASCIIString; describe=true) |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Requests, Graphs, ProgressMeter | |
function surfer(root,n=100) | |
# Crawling mechanics: hyperlink regex and | |
# filter used for skipping certain links | |
rexp = r"https?://[^\"|<|>|;|'|)| |…]+" | |
# Focus on links that contribute to the graph by skipping | |
# all links that contain the following strings: | |
skip = [".gif";".jpg";".jpeg";".pdf";".css";".js";".asp";".mwc";".ram"; | |
".cgi";"lmscadsi";"cybernet";"w3.org";"google";"yahoo"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Calculate injection shift factor matrix. | |
Each row corresponds to a line in the network. | |
Each column corresponds to a node. | |
Credit to Jonathon Martin for derivation. | |
Inputs: | |
* `Y`: full admittance matrix | |
* `lines`: vector of tuples; each tuple encodes a line as (i,j) | |
* `ref`: index of angle reference bus |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
createY(f,t,x [,r,b]) -> Y | |
Create an admittance matrix for AC power flow. | |
All inputs are real. The output matrix is real if no line | |
resistances are provided (DC case), and complex otherwise. | |
* `f`,`t`: vectors encoding all lines (fi,ti) | |
* `x`: per-unit reactance xi for all lines | |
* `r`: per-unit resistance ri for all lines | |
* `b`: per-unit susceptance bi for all lines |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ipywidgets as ipw | |
from pylab import * | |
def classify_image(tst,trn,k): | |
""" Input: | |
tst: a n x T vector corresponding to T images that are to be classified | |
trn: n x m x 10 matrix containing m training samples for each digit | |
k: integer between 1 and n | |
""" | |
n,T = tst.shape |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Naive LU decomposition (no pivoting) from | |
[Bindel's CS6210 class notes](http://www.cs.cornell.edu/~bindel/class/cs6210-f12/notes/lec09.pdf). | |
Beware A[1,1] = 0... | |
""" | |
function mylu(A) | |
m,n = size(A) | |
for j = 1:n-1 | |
A[j+1:n,j] = A[j+1:n,j]/A[j,j] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Given a permutation vector, return the corresponding permutation matrix such that | |
`A[p,:] = P*A`. | |
See [Wikipedia](https://en.wikipedia.org/wiki/Permutation_matrix#Definition). | |
""" | |
function pvec2mat(p) | |
n = length(p) | |
P = zeros(n,n) | |
for i in 1:n | |
P[i,:] = ej(n,p[i]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
heigh: 800 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
LTC model used by [Baghsorkhi2015](http://deepblue.lib.umich.edu/handle/2027.42/113584) | |
(see section 5.3.2). | |
""" | |
type DBODE | |
"index of bus whose voltage is regulated" | |
bus::Int64 | |
"index of line whose tap is influenced" | |
line::Int64 | |
"voltage setpoint [pu]" |
OlderNewer