-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrockerpod.html
301 lines (281 loc) · 11.9 KB
/
rockerpod.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
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
<!DOCTYPE html>
<meta content="text/html;charset=utf-8" http-equiv="Content-Type">
<meta content="utf-8" http-equiv="encoding">
<link rel="stylesheet" href="include/style.css">
<!-- Include relevant libraries -->
<script type="text/javascript" src="js/eclib.js"></script>
<script type="text/javascript" src="js/units.js"></script>
<script type="text/javascript" src="js/export.js"></script>
<script type="text/javascript" src="js/motors.js"></script>
<script type="text/javascript" src="js/plots.js"></script>
<script type="text/javascript" src="js/walkthrough.js"></script>
<!-- Export library requires this script tag -->
<script id="EXP_inputs_frame" ></script>
<script type="text/javascript">
EXP_FN_BASE = 'rockerpod';
UNIT_MAP = {
"force": ["N","lbf"],
"torque": ["N-m", "in-lbf"],
"dimension": ["mm", "in"],
"speed": ["m/s", "ft/s"],
"omega": ["RPM", "RPM"],
"pct": ["%", "%"]
};
WALK_STEPS = [
{poi: 'user_inputs_motor',
desc: 'Select motor...',
halign: 'left',
valign: 'below'
},
{poi: 'user_inputs_gearing',
desc: 'Plug in before-pod and after-pod ratios..',
halign: 'left'
},
{poi: 'user_inputs',
desc: 'Plug in geometric variables...',
halign: 'left'
},
{poi: 'outputs',
desc: 'Computed information appears here.',
halign: 'left'
},
{
poi:'mu_ideal_row',
desc: 'If this is larger than the wheel coefficient, the pod will slip, not dig.'
}];
</script>
<script type="text/javascript">
function init() {
EC_onload();
MOTOR_setupMotorSelect("motor");
EXP_onload();
MOTOR_selectMotor("motor");
UNIT_change();
EC_setOnInput(function(e) {
var key = e.keyCode ? e.keyCode : e.which;
if(key!=13) setError(1);
if (input.id.startsWith("G") && input.id.length == 3) {
computePreRatio();
}
if (input.id.startsWith("G") && input.id.length == 4) {
computePodRatio();
}
});
EC_setOnKeyUp(); // default handler OK
computePreRatio();
computePodRatio();
compute();
WALK_onload();
}
function computePreRatio() {
var G = 1;
G *= getV("G1B",1);
G *= getV("G2B",1);
G *= getV("G3B",1);
G /= getV("G1A",1);
G /= getV("G2A",1);
G /= getV("G3A",1);
setV("G_pre", G, 4);
setV("G_comb", G*getV("G_pod"));
}
function computePodRatio() {
var G = 1;
G *= getV("G1BP",1);
G *= getV("G2BP",1);
G *= getV("G3BP",1);
G /= getV("G1AP",1);
G /= getV("G2AP",1);
G /= getV("G3AP",1);
setV("G_pod", G, 4);
setV("G_comb", G*getV("G_pre"));
}
function compute() {
try{
let motor = MOTOR_packMotor('motor');
let G_pod = getV("G_pod");
let G_pre = getV("G_pre");
let h_pod = getV("h_pod");
let r_pod = getV("r_pod");
let mu = getV("mu");
let T_clutch = getV("T_clutch", 0);
let r_wheel = getV("d_wheel")/2;
let w = Math.sqrt(Math.pow(r_pod,2)-Math.pow(h_pod-r_wheel, 2));
let T_in = MOTOR_computeState(motor, "speed", 0).torque;
let F = G_pod*(T_in-T_clutch) / r_wheel;
let N = (T_in + F*h_pod)/w;
let mu_ideal = F/N;
setV("F", F);
setV("N", N);
setV("mu_ideal", mu_ideal);
setV("free_speed", MOTOR_computeState(motor, "torque", 0).speed*r_wheel/G_pod/G_pre);
if (mu < mu_ideal) {
document.getElementById("F").classList.add('slip');
document.getElementById("N").classList.add('slip');
document.getElementById("mu_ideal").classList.add('slip');
setError(0, 'Computed fully; but the rocker pod is going to slip!');
}
else{
document.getElementById("F").classList.remove('slip');
document.getElementById("N").classList.remove('slip');
document.getElementById("mu_ideal").classList.remove('slip');
setError(0);
}
EXP_dumpPersistence();
}catch(err){
console.log(err);
setError(2,err);
return;
}
}
</script>
<style>
.slip {
background-color: #e87 !important;
}
</style>
<html>
<!-- Make sure to call your init function on document load -->
<!-- You can copy the topbar template here -->
<body onload="init()">
<div id="topbar">
<div class="topbar-la selectable" onclick="window.location='./'">EveryCalc</div>
<div class="topbar-la" id='topbar_version'></div>
<div class="topbar-la" id='topbar_filename'></div>
<div class="topbar-la" id='topbar_unit'>
<!-- Required for unit library. You could also put this in the calculator main body -->
<select id="unit_select" onchange="UNIT_change(); compute();">
<option value=0 >Metric</option>
<option value=1 selected="selected">English</option>
</select>
</div>
<div class="topbar-ctr" id="topbar_title">Rocker Pod</div>
<div class="topbar-ra selectable" id="topbar_status"><span></span><span class='ttt'></span></div>
<div class="topbar-ra selectable" onclick="downloadPage();" id="download">Export HTML</div>
<div class="topbar-ra selectable" onclick="printPage();">Print</div>
<div class="topbar-ra selectable" onclick="WALK_enable();">Tutorial</div>
<a id="download_frame" hidden></a>
</div>
<svg id="walkthrough_overlay" onclick="WALK_nextStep()" >
<path id="walkthrough_frame" ></path>
<text id="walkthrough_text" ></text>
<text id="walkthrough_skip_button" onclick="WALK_disable();">Skip Tutorial</text>
</svg>
<!-- From here go nuts, do whatever works for you. Use the container to keep stuff from spilling under topbar. I'll point out patterns to pay attention to. -->
<div style="float: left;" class="container">
<div class="even">
<table id="user_inputs_motor">
<tr>
<th class="rowlabel"># Motors<span class="ttt">How many motors do you have in total for this mechanism (assuming they're identical, and geared together)</span></th>
<td><input id="motor_count" oninput="MOTOR_selectMotor('motor'); compute();" value=1 /></td>
</tr><tr>
<td class="rowlabel">Efficiency<span class="ttt">Efficiency of the transmission</span></td>
<td><input class='narrow' data-unit="pct" id="motor_efficiency" oninput="MOTOR_selectMotor('motor'); compute();" value=85 /></td>
<td class="unit" data-unit="pct" ></td>
</tr>
<tr>
<th>Motor</th>
<td colspan="2"><select class="doublewide" id="motor_select" oninput="MOTOR_selectMotor('motor'); compute();">
</select></td>
</tr>
<tr>
<th class="rowlabel">Free Speed<span class="ttt">The maximum RPM of the motor</span></th>
<td><input data-unit="omega" id="motor_max_speed" readonly value=5880 /></td>
<td class="unit" data-unit="omega" >[RPM]</td>
</tr><tr>
<th class="rowlabel">Stall Torque<span class="ttt">The maximum torque of the motor, occurring at 0 RPM</span></th>
<td><input data-unit="torque" id="motor_stall_torque" readonly value=3.36 /></td>
<td class="unit" data-unit="torque" id="unit_motor_stall_torque"></td>
</tr><tr>
<th class="rowlabel">Free Current<span class="ttt">The current drawn when the motor is unloaded</span></th>
<td><input id="motor_free_current" readonly value=1.3 /></td>
<td class="unit">[A]</td>
</tr><tr>
<th class="rowlabel">Stall Current<span class="ttt">The current drawn at 0 RPM / Max Torque</span></th>
<td><input id="motor_stall_current" readonly value=166 /></td>
<td class="unit">[A]</td>
</tr>
</table>
</div>
<div class="odd">
<table id="user_inputs_gearing">
<tr>
<th class="rowlabel" colspan=3>Overall Gear Ratio<span class="ttt">Gear ratio of both gearbox before rocker and in pod</span></th>
<td colspan=3><input id="G_comb" readonly/></td>
</tr><tr>
<th class="rowlabel">Pre-Pod Gear Ratio<span class="ttt">The gear ratio before the rocker pod. Larger than 1 is a reduction, smaller is a RPM increase. Empty cells are assumed to be 1. You can either blank out all the cells, and plug in a number in the top right one, or build a ratio by typing in the number of teeth on each gear (or belts/sprockets) starting from the motor.</span></th>
<td class="tiny"></td>
<td><input id="G_pre" readonly/></td>
<th class="rowlabel">Pod Gear Ratio<span class="ttt">The gear ratio in the rocker pod. Negative ratios are ratios where the direction is not reversed between input and output. Larger than 1 is a reduction, smaller is a RPM increase. Empty cells are assumed to be 1. You can either blank out all the cells, and plug in a number in the top right one, or build a ratio by typing in the number of teeth on each gear (or belts/sprockets) starting from the motor.</span></th>
<td class="tiny"></td>
<td><input id="G_pod" readonly/></td>
</tr><tr>
<td><input id="G1A" oninput="computePreRatio()" /></td>
<td class="tiny">:</td>
<td><input id="G1B" oninput="computePreRatio()" /></td>
<td><input id="G1AP" oninput="computePodRatio()" /></td>
<td class="tiny">:</td>
<td><input id="G1BP" oninput="computePodRatio()" /></td>
</tr><tr>
<td><input id="G2A" oninput="computePreRatio()" /></td>
<td class="tiny">:</td>
<td><input id="G2B" oninput="computePreRatio()" /></td>
<td><input id="G2AP" oninput="computePodRatio()" /></td>
<td class="tiny">:</td>
<td><input id="G2BP" oninput="computePodRatio()" /></td>
</tr><tr>
<td><input id="G3A" oninput="computePreRatio()" /></td>
<td class="tiny">:</td>
<td><input id="G3B" oninput="computePreRatio()" /></td>
<td><input id="G3AP" oninput="computePodRatio()" /></td>
<td class="tiny">:</td>
<td><input id="G3BP" oninput="computePodRatio()" /></td>
</tr>
</table>
</div>
<div class="even">
<table id="user_inputs">
<tr>
<th class="rowlabel">Clutch Torque<span class="ttt">The torque of the clutch/brake on the rocker pod (linking the input torque more directly to the pod), providing additional resistance and thus dig-in at the cost of propulsive force. <i>Leave blank if no such clutch.</i></span></th>
<td><input data-unit="torque" id="T_clutch" oninput="compute()" /></td>
<td class="unit" data-unit="torque" ></td>
</tr><tr>
<th class="rowlabel">Pod Radius<span class="ttt">Distance from pivot point to wheel's axle</span></th>
<td><input data-unit="dimension" id="r_pod" oninput="compute()" /></td>
<td class="unit" data-unit="dimension" id="unit_r_pod"></td>
</tr><tr>
<th class="rowlabel">Pod Pivot Height<span class="ttt">Distance from ground to pod's pivot point</span></th>
<td><input data-unit="dimension" id="h_pod" oninput="compute()" /></td>
<td class="unit" data-unit="dimension" id="unit_h_pod"></td>
</tr><tr>
<th class="rowlabel">Wheel Diameter<span class="ttt">Diameter of wheel</span></th>
<td><input data-unit="dimension" id="d_wheel" oninput="compute()" /></td>
<td class="unit" data-unit="dimension" id="unit_d_wheel"></td>
</tr><tr>
<th class="rowlabel">Coefficient of Friction<span class="ttt">Coefficient of friction</span></th>
<td><input id="mu" oninput="compute()" /></td></td><td class="unit">[-]</td>
</tr>
</table>
</div>
<div class="output">
<table id="outputs">
<tr>
<th class="rowlabel">Slide Stall Force<span class="ttt">The amount of propulsive force the pod will produce</span></th>
<td><input data-unit="force" id="F" readonly /></td></td>
<td class="unit" data-unit="force" id="unit_F"></td>
</tr><tr>
<th class="rowlabel">Normal Stall Force<span class="ttt">The amount of normal force the pod produces when operating. Excessive amounts may cause whatever holds back the pod to lift away.</span></th>
<td><input data-unit="force" id="N" readonly /></td></td>
<td class="unit" data-unit="force" id="unit_N"></td>
</tr><tr id="mu_ideal_row">
<th class="rowlabel">F/N<span class="ttt">Ratio of F to N; the effective frictional coefficient of the pod. If this is larger than the actual coefficient of friction, the pod will slip rather than dig in (cells will highlight orange to display this)</span></th>
<td><input id="mu_ideal" readonly /></td></td><td class="unit">[-]</td>
</tr><tr>
<th class="rowlabel">Free Speed<span class="ttt">Free speed of module</span></th>
<td><input data-unit="speed" id="free_speed" readonly /></td></td>
<td class="unit" data-unit="speed" id="unit_free_speed"></td>
</tr>
</table>
</div>
</div>
</body>
</html>