The slider crank dynamics: a DAE formulation


Dynamics of the Slider-Crank

> restart: libname := `C:/MBSymba`, libname: with(MBSymba_r6):
#alias(S=sin,C=cos);

Warning, these protected names have been redefined and unprotected: *, +, -, union

> PDEtools[declare](theta1(t), x2(t),y2(t),theta2(t), x3(t) , prime=t, quiet):

1st step: definition of the bodies

each body is associated to a reference frame and it is described by means the (x,y) coordinates of the frame origin plus the rotation around the Z axis

> T1 := Rotate('Z',theta1(t)):
G1 := make_POINT(T1,l1,0,0): show(G1);

> crank := make_BODY(G1,m1,0,0,IG1): show(crank);

> T2 := Translate(x2(t),y2(t),0) * Rotate('Z',theta2(t)):
rod := make_BODY(T2,m2,0,0,IG2): show(rod);

>

> T3 := Translate(x3(t),0,0):
piston := make_BODY(T3,m3): show(piston);

2nd step: formulation of the constraint equations

testa di biella

> B1 := make_POINT(T1,r,0,0): show(B1);

> B2 := make_POINT(T2,-a,0,0): show(B2);

> PDEtools[declare](FxB(t),FyB(t) , prime=t, quiet):
FzB(t):=0; planar case

> pinB,RBA,RBR := spherical_JOINT(B1,B2,crank,rod,"B"):
show(pinB); show(RBA); show(RBR);

piede di biella

> C2 := make_POINT(T2,+b,0,0): show(C2);

> C3 := make_POINT(T3,0,0,0): show(C3);

> PDEtools[declare](FxC(t),FyC(t) , prime=t, quiet):
FzC(t):=0; planar case

> pinC,RCA,RCR := spherical_JOINT(C2,C3,rod,piston,"C"):
show(pinC); show(RCA); show(RCR);

external forces

crank torque

> M1 := make_TORQUE( make_VECTOR(ground,0,0,Mext) , crank): #show(M1);

piston force

> F3 := make_FORCE( make_VECTOR(ground,Fext,0,0), origin(T3), piston): #show(F3);

> forces := {RBA,RBR,RCA,RCR,M1,F3};

Newton's equations

> eqnsE_crank := euler_equations({crank} union forces,origin(T1)): show(%);

> eqnsN_rod := newton_equations({rod} union forces): show(%);

> eqnsE_rod := euler_equations ({rod} union forces,CoM(rod)): show(%);

<F3> FORCE is not valid: it must be applied to a BODY

<RBA> FORCE is not valid: it must be applied to a BODY

<RCR> FORCE is not valid: it must be applied to a BODY

> eqnsN_piston := newton_equations({piston} union forces): show(%);

<RBA> FORCE is not valid: it must be applied to a BODY

<RBR> FORCE is not valid: it must be applied to a BODY

<RCA> FORCE is not valid: it must be applied to a BODY

> dyna_eqns := [comp_Z(eqnsE_crank), comp_X(eqnsN_rod), comp_Y(eqnsN_rod), comp_Z(eqnsE_rod), comp_X(eqnsN_piston)]: Vector(%);

Lagrange's equations (1)

> qq := [theta1(t), x2(t),y2(t),theta2(t), x3(t)];

> leqns := lagrange_equations({crank,rod,piston, pinB,pinC , M1,F3},qq): Vector(leqns);

check

> simplify(leqns - dyna_eqns);

Lagrange's equations (2)

> leqns2 := lagrange_equations({crank,rod,piston} union forces,qq): Vector(leqns2);

check

> simplify(leqns2 - dyna_eqns);

>

Comments are closed.