-
Notifications
You must be signed in to change notification settings - Fork 4
/
index.html
133 lines (125 loc) · 4.71 KB
/
index.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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Resistor combination calculator</title>
<link rel="stylesheet" href="jqui-1.12.0.md/jquery-ui.css">
<script type="text/javascript"
src="rescomb.js"
></script>
<script type="text/javascript"
src="jquery-3.1.0.min.js"
></script>
<script type="text/javascript"
src="jqui-1.12.0.md/jquery-ui.min.js"
></script>
<script type="text/javascript"
src="ctrl.js"
></script>
<style>
#resTable td, th { padding: 3pt 12pt .5em 12pt; line-height: 1.3em; }
#resTable th {
background: #839E99;
color: #fff;
font-family : Geneva, Arial, Helvetica, sans-serif;
font-weight: bold;
text-align: left; padding-right: .5em; vertical-align: top;
}
#resTable thead th { background: #2C5755; text-align: center; }
#resTable td:nth-child(odd) { background: #2C5755; }
#resTable td:nth-child(even) { background: #6E8D88; }
#resTable th:nth-child(even) { background: #6E8D88; }
</style>
<script type="text/javascript">
var ctrl=null;
var $rc=init$rc();
$(window).ready(
function() {
ctrl=new Ctrl();
}
);
</script>
</head>
<body>
<h2>Resistor combination calculator</h2>
<p>Enter the resistor value you need in Ohms (sorry, no unit parsing/converter now),
pick your maximum number of resistors in the combination,
choose the resistor values available to make combination
(you can even pick custom subsets of E12 or E24),
adjust the combination type (parallel only, series only or both),
hit the "Compute" button.
<br>Mind you, the closeness of the combination value to your required one
doesn't guarantee that you'll actually obtain that value using
resistors with a tolerance of ±10% (E12) or ±5% (E24).
</p>
<p>Every additional resistor in the combination will improve
the quality of the resulted values by roughly two orders of magnitude.
However asking for combinations made of a higher number of resistors
will cause longer searches for combinations (an exponential growth).
The calculator will restrict the maximum number of resistors in combination
based on the number of the available/input resistor values.</p>
<div id="input-area" style="float:left;margin-right:10pt;margin-bottom:10pt">
<fieldset style="float:left">
<label for="resistorValue">Desired value</label>
<input type="text" id="resistorValue"></input>
<br>
<label for="rSeries">Resistor set</label>
<select id="rSeries">
<option value="E12">E12</option>
<option value="E24">E24</option>
<option value="E12_subset">E12 custom subset</option>
<option value='E24_subset'>E24 custom subset</option>
</select>
<br>
<label for="numComponents">Max # in combination</label>
<select id="numComponents">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
</select>
<br>
<label for="combType">Combination type</label>
<select id="combType" style='margin-right:20pt'>
<option value="B">Series and parallel</option>
<option value='P'>Parallel only</option>
<option value='S'>Series only</option>
</select>
<br>
<button id="computeButton">Compute</button>
</fieldset>
</div>
<p><ul style='list-style-type:none'>
<li>For input sets up to 24 values, you can request combinations up to 6 resistors.</li>
<li>For input sets up to 36 values, the maximum number of resistor in the combination is 5</li>
<li>For up to 72 input values (full E12 included), combinations up to 4 resistors may be requested</li>
<li>For more than 72 values, only combinations of 3 resistors will be considered</li>
</ul>
Even with those restrictions, a full scan of all combinations may take quite a while;
hit the "Cancel" button earlier if you see a result that's good enough</p>
<div id="results" style="clear:both;display:table">
<div style="display:block; padding:8pt">
<div id="numCombs" style="display:inline;margin-right:9pt"></div><div id="cancelSupport" style="display:inline;padding-left:24pt"></div>
</div>
<div id="resList" style="display:table-row">
<table id='resTable'>
<thead>
<tr>
<th>Combination<br>(*:parallel,+:series)</th>
<th>Value</th>
<th>Rel.err<br>(% of target)</th>
<th>Min.value<br>(% of target)</th>
<th>Max.value<br>(% of target)</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
<!-- jqueryui support -->
<div id="custom-choice-dialog" style="display:block;overflow:scroll" title="Pick the available resistor values"></div>
</body>
</html>