-
Notifications
You must be signed in to change notification settings - Fork 0
/
hist.html
221 lines (165 loc) · 5.9 KB
/
hist.html
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Power Flow - Random Branch Flow</title>
<link rel="stylesheet" href="css/style.css" media="screen" type="text/css" />
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]}
});
</script>
<script type="text/javascript"
src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>
</head>
<body>
<div id="title">Random Branch Flow</div>
The linear shift factor will give you a sensitivity of power flow to random net injects. Assuming a subset of nodes has volatile net injects that are gaussian random variables, the linear shift factor for a fixed slack distribution hits the random vector and produces a translated and scaled gaussian. This gaussian of random power flows is scaled,translated, and truncated due to the piece-wise linear failure distribution of the line to find the probability of failure for each line flow.
<div id="tooltip" class="hidden">
<p><strong><span id="name">Important Label Heading</span></strong></p>
<p><span id="ex">100</span></p>
<p><span id="var">100</span></p>
<p><span id="min">100</span></p>
<p><span id="max">100</span></p>
<p><span id="dif">100</span></p>
<p><span id="neg">100</span></p>
</div>
<br/>
<center><div id="nodetitle">Histogram</div></center>
<div id="histgraph"></div>
<div id="histgraph2"></div>
<script type="text/javascript" src="js/d3.v3.js"></script>
<script type="text/javascript">
var dataset=[];
var values = [];
d3.csv("data/hist.csv",function(error, data) {
if (error) {
console.log(error);
}
else {
dataset = data
for (var key in dataset) {
if(dataset[key].value){
values.push(dataset[key].value);
}
}
generateVis();
}
});
function generateVis() {
var numticks=32;
// A formatter for counts.
var formatCount = d3.format(",.0f");
var margin = {top: 10, right: 30, bottom: 30, left: 30},
width = 960 - margin.left - margin.right,
height = 500 - margin.top - margin.bottom;
var minx = d3.min(values);
var maxx = d3.max(values);;
var x = d3.scale.linear()
.domain([minx, maxx])
.range([0, width]);
// Generate a histogram using twenty uniformly-spaced bins.
var data = d3.layout.histogram()
.bins(x.ticks(numticks))
(values);
var y = d3.scale.linear()
.domain([0, d3.max(data, function(d) { return d.y; })])
.range([height, 0]);
var xAxis = d3.svg.axis()
.scale(x)
.orient("bottom");
var svg = d3.select("#histgraph").append("svg")
.attr("width", width + margin.left + margin.right)
.attr("height", height + margin.top + margin.bottom+525)
.append("g")
.attr("transform", "translate(" + margin.left + "," + margin.top + ")");
console.log(data);
var bar = svg.selectAll(".bar")
.data(data)
.enter().append("g")
.attr("class", "bar")
.attr("transform", function(d) { return "translate(" + x(d.x) + "," + y(d.y) + ")"; });
bar.append("rect")
.attr("x", 1)
.attr("width", function(d) { console.log(d);return x(d.x+d.dx) -x(d.x) -1; })
.attr("height", function(d) { return height - y(d.y); });
bar.append("text")
.attr("dy", ".75em")
.attr("y", 6)
.attr("x", function(d){ return ( x(d.x+d.dx)-x(d.x) ) / 2; })
.attr("text-anchor", "middle")
.text(function(d) { return formatCount(d.y); });
svg.append("g")
.attr("class", "x axis")
.attr("transform", "translate(0," + height + ")")
.call(xAxis);
console.log(minx,maxx);
var x2 = d3.scale.linear()
.domain([minx, maxx])
.range([0+15, width-15]);
var circles = svg.selectAll("circle")
.data(values)
.enter()
.append("circle");
circles
.attr("cx", function(d){ return x2(d); })
.attr("cy", height+75)
.attr("r",5.72)
.style("opacity",100/values.length)
;
var htop=height+125;
var h2 = 400;
var totalprob=0;
var numvals=values.length;
var probint=1/numvals;
var sorted=values.sort();
console.log(sorted,numvals);
var y2 = d3.scale.linear()
.domain([0, numvals])
.range([0, h2]);
var pairs=[];
for( i in sorted){
pairs.push([i,sorted[i]]);
totalprob=totalprob+probint*sorted[i];
}
console.log(pairs);
console.log(totalprob);
var circles2 = svg.selectAll("square")
.data(pairs)
.enter()
.append("circle");
circles2
.attr("cx", function(d){ return x2(d[1]); })
.attr("cy", function(d){ return htop+h2-y2(d[0]); } )
.attr("r",2.57)
.style("opacity",200/values.length)
;
}
</script>
<hr class="break" />
<table class="pages">
<tr>
<td class="linktitle" colspan="4" ><b>Pages<b></td>
</tr>
<tr>
<td><a href="miso.html"><b>Midwest Independent System Operator<b></a></td>
<td><a href="reg.html">Regions</a></td>
<td><a href="mge.html">Madison Gas and Electric Loadzone</a> </td>
<td><a href="kwe.html">Kewaunee Nuclear Power Plant</a> </td>
</tr>
<tr>
<td><a href="pow.html">Power Flow</a></td>
</tr>
<tr>
<td colspan="4">..........................................................................................................................................................................................................</td>
</tr>
<tr>
<td class="home" colspan="2"><a href="index.html">Home</a></td>
<td colspan="2">
<a href="ref.html">References</a>
</td>
</tr>
</table>
</body>
</html>