npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

crocker

v0.8.6

Published

crocker - a Crank-Rocker design and analysis library

Downloads

7

Readme

License npm npm no dependencies

Crank-Rocker -- Design and Analysis.

Crocker is a javascript namespace and function library, which has proven successful in designing and analyzing Crank-Rockers as special planar fourbar mechanisms in my lectures. Crocker.js is tiny, it weights only 1.5 kB compressed and gzipped.

Crocker is not meant to simulate mechanisms. For this and general fourbar mechanisms see fourbar.

Here is a Crank-Rocker animation using the tiny Morphr javascript class and a g2 command queue for vector graphics.

Geometry

A Crank-Rocker is a specific fourbar mechanism. It is composed of four binary links that are connected to each other by revolute joints. These links are called crank, coupler, rocker and frame. Their lengths are named a, b, c, d respectively.

Extreme positions

The input crank is fully rotatable and performs a complete 360° turn. At the same time the rocker oscillates between its extreme positions ψ_min and ψ_max. Both crank and rocker are connected to the fixed frame by pivots. The coupler functions as a connecting rod between that two.

Extreme positions 2

The rocker's working angular range is named ψ_0 and corresponds during tracking motion (crank and rocker move unidirectional - counterclockwise here) to the crank's angular range φ_0. On their way back they run in opposite directions. The crank's angle is 360° - φ_0 then and the rocker's -ψ_0. As a descriptive angle we use the difference α = 180° - φ_0 here. So if φ_0 is not 180° or α is not 0°, the crank needs different times for the rocker's back and forth motion. This degree of non-uniformity can be expressed by the ratio t_f/t_b, which is an important parameter of the engineer's point of view while designing a crank-rocker mechanism and directly relates to α. The other important design parameter of course is the rocker's angular range ψ_0.

As the four link lengths a, b, c, d sufficiently define a specific crank-rocker and α and ψ_0 are added as important design parameters, there must be two relations between those now six parameters. It can be shown that these relations are:

Relations

Another important value is the transmission angle μ between coupler and rocker. Of special interest here is the minimal transmission angle μ_min which occurs, when the crank is collinear with the frame. This happens two times while the crank performs a complete rotation.

Transmission Angles

So the minimal transmission angle μ_min has to be calculated as min(μ_inner,μ_outer). Please note, that - as a convention - the transmission angle is always considered to be in the range 0 < μ <= 90°. So in case μ happens to be greater than 90°, its supplement angle (180° - μ) should be taken instead.

Ideally the transmission angle is always 90°, which isn't possible of course. So a specific design goal with crank-rockers is to maximize the minimal transmission angle. A valuable optimization method regarding this can be applied with crocker.js.

See [1], [2] or [3] for further details.

Implementation

The crocker library consists mostly of small functions. It is no class, so you cannot instantiate any Crank-Rocker objects.

The most simple way to use the crocker library is with node.js.

Node Example - Simple Crank-Rocker

function toRad(w) { return w/180*Math.PI; }
function toDeg(w) { return w*180/Math.PI; }

var crocker = require("../crocker.js");

// Design a Crank-Rocker with 
// * Given crank and frame length
// * Rocker's angular range of 80°
// * A forth and back ratio of 10/9
var a = 60,
    d = 120,
    psi0 = toRad(80),
    alfa = crocker.alfa_tfb(10/9),
    b = crocker.b_ad(a,d,alfa,psi0),
    c = crocker.c_ad(a,d,alfa,psi0),
    muMin = crocker.muMin(a,b,c,d);

console.log("psi0 = " + toDeg(psi0));   // 80°
console.log("alfa = " + toDeg(alfa));   // 9.5°
console.log("b = " + b);                // 103
console.log("c = " + c);                //  94
console.log("muMin = " + toDeg(muMin)); // 35°

Here is a table of Crocker functions. Please note that these functions are only loosely coupled. Usually the validity of the parameter set handed over to them is checked in the context, from where they are invoked. So please ensure to use valid parameters, as

  • a,b,c,d are Grashof positive.
  • a is the smallest link length.
  • ψ_0 is smaller than 180°.
  • All angles are provided in radians.

just to name a few.

| Function | Comment | | --- | --- | --- | | .psiMin(a,b,c,d) | Minimal Rocker angle ψ_min. | | .psiMax(a,b,c,d) | Maximal Rocker angle ψ_max. | | .phiMin(a,b,c,d) | Crank angle ϕ_min corresponding to rocker angle ψ_min. | | .phiMax(a,b,c,d) | Crank angle ϕ_max corresponding to rocker angle ψ_max. | | .phi0(a,b,c,d) | Crank angular range ϕ_0 corresponding to ψ_0 in unidirectional mode. | | .muInner(a,b,c,d) | Transmission angle μ_inner corresponding to crank's inner frame position. | | .muOuter(a,b,c,d) | Transmission angle μ_outer corresponding to crank's outer frame position. | | .muMin(a,b,c,d) | Minimal Transmission angle μ_min. | | .alfa_tfb(tfb) | Crank angular range difference α from time ratio tf/tb of rocker's forth and back moving times. | | .a_muMinMax(d,alfa,psi0) | Crank length for maximized minimal transmission angle. |

The other functions in the crocker library help to determine the missing parameters when four out of the six a, b, c, d, α, ψ_0 are given. The following table shows those functions with their required arguments:

| function | a | b | c | d | α | ψ_0 | | --- | --- | --- | --- | --- | --- | --- | | .alfa | * | * | * | * | - | - | | .alfa_abc | * | * | * | - | - | * | | .alfa_abd | * | * | - | * | - | * | | .alfa_acd | * | - | * | * | - | * | | .alfa_bcd | - | * | * | * | - | * | | .psi0 | * | * | * | * | - | - | | .psi0_abc | * | * | * | - | * | - | | .psi0_abd | * | * | - | * | * | - | | .psi0_acd | * | - | * | * | * | - | | .psi0_bcd | - | * | * | * | * | - | | .a_bc | - | * | * | - | * | * | | .a_bd | - | * | - | * | * | * | | .a_cd | - | - | * | * | * | * | | .b_ac | * | - | * | - | * | * | | .b_ad | * | - | - | * | * | * | | .b_cd | - | - | * | * | * | * | | .c_ab | * | * | - | - | * | * | | .c_ad | * | - | - | * | * | * | | .c_bd | - | * | - | * | * | * | | .d_ab | * | * | - | - | * | * | | .d_ac | * | - | * | - | * | * | | .d_bc | - | * | * | - | * | * |

Node Example - Optimal Crank-Rocker

function toRad(w) { return w/180*Math.PI; }
function toDeg(w) { return w*180/Math.PI; }

var Crocker = require("./crocker.js").Crocker;

// Design a Crank-Rocker with 
// * Given frame length
// * Rocker's angular range of 80°
// * A forth and back ratio of 10/9
// Find the optimal Crank-Rocker with maximum of minimal transmission angle.
var d = 120,
    psi0 = toRad(80),
    alfa = Crocker.alfa_tfb(10/9),
    a = Crocker.a_muMinMax(d,alfa,psi0),
    b = Crocker.b_ad(a,d,alfa,psi0),
    c = Crocker.c_ad(a,d,alfa,psi0),
    muMin = Crocker.muMin(a,b,c,d);

console.log("psi0 = " + toDeg(psi0));   // 80°
console.log("alfa = " + toDeg(alfa));   // 9.5°
console.log("a = " + a);                // 46.7
console.log("b = " + b);                // 116
console.log("c = " + c);                // 73.9
console.log("muMin = " + toDeg(muMin)); // 37.7°

Here is a graphics example using crocker.js and g2.

References

[1] S. Gössner: Getriebelehre - Vektorielle Analyse ebener Mechanismen

[2] J.M. McCarthy: Geometric Design of Linkages

[3] J.J. Uicker: Theory of Machines and Mechanisms

GitCDN

Use the link https://gitcdn.xyz/repo/goessner/crocker/master/crocker.min.js for getting the latest commit as a raw file.

In HTML use ...

<script src="https://gitcdn.xyz/repo/goessner/crocker/master/crocker.min.js"></script>

License

crocker.js is licensed under the terms of the MIT License. See LICENSE-MIT for details.

API Reference

See the API Reference for details.

#Change Log

All notable changes to this project will be documented here. This project adheres to Semantic Versioning.

0.8.6 - 2016-07-06

Added

  • GitCDN link.
  • NPM links.

0.8.0 - 2016-03-25

First Commit to Github