You are viewing an old version of this page. Return to the latest version.
Difference between revisions of "Robot Speed Calculator"
(Created page with "<script type="text/javascript"> // <![CDATA[ $("input:enabled").change(function() { calcValues(); }); function calcValues () { var...") (Tag: 2017 source edit) |
(Tag: 2017 source edit) |
||
Line 1: | Line 1: | ||
+ | |||
+ | <syntaxhighlight lang="html"> | ||
<script type="text/javascript"> | <script type="text/javascript"> | ||
// <![CDATA[ | // <![CDATA[ | ||
Line 4: | Line 6: | ||
calcValues(); | calcValues(); | ||
}); | }); | ||
− | |||
function calcValues () { | function calcValues () { | ||
var rpm = $("input[name='rpm']").val(); | var rpm = $("input[name='rpm']").val(); | ||
var ratio = $("input[name='ratio']").val(); | var ratio = $("input[name='ratio']").val(); | ||
var cir = $("input[name='diameter']").val() * Math.PI; | var cir = $("input[name='diameter']").val() * Math.PI; | ||
− | |||
var ipm = rpm * ratio * cir; | var ipm = rpm * ratio * cir; | ||
var fpm = ipm / 12.0; | var fpm = ipm / 12.0; | ||
Line 15: | Line 15: | ||
var mpm = fpm * 0.3048; | var mpm = fpm * 0.3048; | ||
var kph = mpm * 60 / 1000; | var kph = mpm * 60 / 1000; | ||
− | |||
$("input[name='circ']").val(cir.toFixed(2)); | $("input[name='circ']").val(cir.toFixed(2)); | ||
$("input[name='speedIPM']").val(ipm.toFixed(2)); | $("input[name='speedIPM']").val(ipm.toFixed(2)); | ||
Line 23: | Line 22: | ||
$("input[name='speedKPH']").val(kph.toFixed(2)); | $("input[name='speedKPH']").val(kph.toFixed(2)); | ||
} | } | ||
− | |||
$(function() { | $(function() { | ||
calcValues(); | calcValues(); | ||
Line 29: | Line 27: | ||
// ]]> | // ]]> | ||
</script> | </script> | ||
+ | </syntaxhighlight> |
Revision as of 13:05, 21 September 2020
<script type="text/javascript">
// <![CDATA[
$("input:enabled").change(function() {
calcValues();
});
function calcValues () {
var rpm = $("input[name='rpm']").val();
var ratio = $("input[name='ratio']").val();
var cir = $("input[name='diameter']").val() * Math.PI;
var ipm = rpm * ratio * cir;
var fpm = ipm / 12.0;
var mph = fpm * 60 / 5280;
var mpm = fpm * 0.3048;
var kph = mpm * 60 / 1000;
$("input[name='circ']").val(cir.toFixed(2));
$("input[name='speedIPM']").val(ipm.toFixed(2));
$("input[name='speedFPM']").val(fpm.toFixed(2));
$("input[name='speedMPH']").val(mph.toFixed(2));
$("input[name='speedMPM']").val(mpm.toFixed(2));
$("input[name='speedKPH']").val(kph.toFixed(2));
}
$(function() {
calcValues();
});
// ]]>
</script>