SEESAW.mws

Dynamic Equations for the SEESAW-E System

©  2012 Quanser Consulting Inc.

URL: http://www.quanser.com

NOTE: This worksheet presents the general dynamic equations modelling a linear track-and-cart system mounted on top of a seesaw.

Description

The Quanser_Tools  Package

Worksheet Initialization

>    restart: interface( imaginaryunit = j ):

>    with( LinearAlgebra ):

>    libname := "C:/Program Files/Quanser/Maple Repository", ".", libname:

>    with( Quanser_Tools );

HTM deriveA deriveB deriveF kinetic_energy lagrange_equations moment_of_inertia n_norm potential_energy write_ABCD_to_Mfile

environment variable representing the order of series calculations

>    Order := 2:

>   

Notations

Generalized Coordinates: q[i] 's

The generalized coordinates are also called Lagrangian coordinates.

x[c](t)  =  driving cart (i.e. IP02 or IP01) linear position: the cart zero position is defined at mid-stroke, at the system's quiescent point of operation.

θ t  = Seesaw tilt angle about the horizontal: the zero angle [mod 2 π ] is defined when the seesaw is in the perfect horizontal position.

>    q := [ x[c](t), theta(t) ];

q := [x[c](t), theta(t)]

Nq = number of Lagrangian coordinates (e.g. here, it is Nq = 2)

Nq is also the number of position states.

>    Nq := nops( q ):

qd = first-order time derivative of the generalized coordinates, e.g. position and angular velocities

>    qd := map( diff, q, t );

qd := [diff(x[c](t),t), diff(theta(t),t)]

Absolute Cartesian Coordinates of the Centre Of Gravity

conventions:

1) θ = 0  corresponds to seesaw perfectly horizontal.

2) positive rotation is CCW when facing the cart.

absolute Cartesian coordinates of the Centre Of Gravity (COG) of the seesaw-plus-IP01-or-IP02-track system

>    X[sw] := - D[c] * sin( q[2] );
Y[sw] := D[c] * cos( q[2] );

X[sw] := -D[c]*sin(theta(t))

Y[sw] := D[c]*cos(theta(t))

absolute Cartesian coordinates of the IP01 or IP02 linear cart's Centre Of Gravity (COG)

remark: the cart slides on top of the seesaw

>    X[c] := - D[T] * sin( q[2] ) + q[1] * cos( q[2] );
Y[c] := D[T] * cos( q[2] ) + q[1] * sin( q[2] );

X[c] := -D[T]*sin(theta(t))+x[c](t)*cos(theta(t))

Y[c] := D[T]*cos(theta(t))+x[c](t)*sin(theta(t))

absolute Cartesian velocity coordinates of the IP01 or IP02 linear cart's COG

>    Xd[c] := diff( X[c], t );
Yd[c] := diff( Y[c], t );

Xd[c] := -D[T]*cos(theta(t))*diff(theta(t),t)+diff(x[c](t),t)*cos(theta(t))-x[c](t)*sin(theta(t))*diff(theta(t),t)

Yd[c] := -D[T]*sin(theta(t))*diff(theta(t),t)+diff(x[c](t),t)*sin(theta(t))+x[c](t)*cos(theta(t))*diff(theta(t),t)

State-Space Variables

  • The chosen states should at least include the generalized coordinates and their first-time derivatives.
  • X is the state vector.
  • In the state vector X: Lagrangian coordinates are first, followed by their first-time derivatives, and finally any other states, as required.

Substitution sets for the states (to obtain time-independent state equations).

>    subs_Xq := { seq( q[i] = X[i], i=1..Nq ) };
subs_Xqd := { seq( qd[i] = X[i+Nq], i=1..Nq ) };

subs_Xq := {theta(t) = X[2], x[c](t) = X[1]}

subs_Xqd := {diff(theta(t),t) = X[4], diff(x[c](t),t) = X[3]}

Substitution set for the input(s).

set the input to be the motor voltage:

>    #subs_U := { V[m] = U[1] }:

set the input to be the cart's driving force: F[c]  (if not expressed as a function of the motor voltage):

>    subs_U := { F[c] = U[1] }:

Nu = number of inputs; U = input (row) vector (e.g. U = [ V[m] ] )

>    Nu := nops( subs_U ):

substitution set for the position states' second time derivatives

>    subs_Xqdd := { seq( diff( q[i], t$2 ) =  Xd[i+Nq], i=1..Nq ) };

subs_Xqdd := {diff(theta(t),`$`(t,2)) = Xd[4], diff(x[c](t),`$`(t,2)) = Xd[3]}

second time derivatives of the position states (written as time-independent variables).

The set of unknowns is obtained from this list to solve the Lagrange's equations of motion.

>    Xqdd := [ seq( Xd[i+Nq], i=1..Nq ) ];

Xqdd := [Xd[3], Xd[4]]

substitution set to linearize the state-space matrices (i.e. A and B)

about the quiescent null state vector (small-displacement theory)

>    subs_XUzero := { seq( X[i] = 0, i=1..2*Nq ), seq( U[i] = 0, i=1..Nu ) }:

Nx = dim( X ) = total number of states (should be greater than or equal to: 2 * Nq)

Ny = chosen number of outputs

>    Nx := 2 * Nq + 0:
Ny := Nq:

Total Potential and Kinetic Energies of the System

The total potential and kinetic energies are needed to calculate the Lagrangian of the system.

Total Potential Energy: V[T]  

The total potential energy can be expressed in terms of the generalized coordinates alone.

Ve[T] = Total Elastic Potential Energy of the system

>    Ve[T] := 0:

IP01 or IP02 cart's gravitational potential energy

>    Vg[c] := potential_energy( 'gravity', m[c], g, Y[c] );

Vg[c] := m[c]*g*(D[T]*cos(theta(t))+x[c](t)*sin(theta(t)))

gravitational potential energy of the one-seesaw-plus-one-IP01-or-IP02-track system

>    Vg[sw] := potential_energy( 'gravity', m[sw], g, Y[sw] );

Vg[sw] := m[sw]*g*D[c]*cos(theta(t))

Vg[T] = Total Gravitational Potential Energy of the system

>    Vg[T] := Vg[c] + Vg[sw]:

V[T] = Total Potential Energy of the system

>    V[T] := simplify( Ve[T] + Vg[T] );

V[T] := g*(m[c]*D[T]*cos(theta(t))+m[c]*x[c](t)*sin(theta(t))+m[sw]*D[c]*cos(theta(t)))

Total Kinetic Energy: T[T]

The total kinetic energy can be expressed in terms of the generalized coordinates and their first-time derivatives.

The cart's directions of translation and rotation are orthogonal.

Tr[c]  = kinetic energy due to rotation tied to the motorized cart

J[m]  = motor armature inertia; K[g]  = gear ratio; r[mp]  = motor pinion radius

>    Tr[c] := kinetic_energy( 'rotation', J[m], omega[m](t) ):

>    omega[m](t) := K[g] * qd[1] / r[mp]:

>    'Tr[c]' = Tr[c];

Tr[c] = 1/2*J[m]*K[g]^2*diff(x[c](t),t)^2/r[mp]^2

from the IP02 or IP01 parameters: J[m]*K[g]^2/(r[mp]^2)  < 0.14 kg < Mm[c]

The cart's rotational kinetic energy can be neglected

>    Tr[c] := 0:

or if:

>    M[rc] = J[m] * K[g]^2 / r[mp]^2:

then

>    Tr[c] = 1/2 * m[rc] * qd[1]^2:

V[c] = IP01 or IP02 Cartesian linear velocity
Euclidian norm (i.e. magnitude) of the absolute Cartesian (linear) velocity of the IP01 or IP02 cart's COG

>    V[c] := n_norm( [ Xd[c], Yd[c] ], 2 ):
V[c] := combine( V[c], trig );

V[c] := (D[T]^2*diff(theta(t),t)^2-2*D[T]*diff(theta(t),t)*diff(x[c](t),t)+diff(x[c](t),t)^2+x[c](t)^2*diff(theta(t),t)^2)^(1/2)

Tt[c]  = translational kinetic energy of the motorized cart (e.g. IP02 or IP01)

M[c]  = cart total mass

>    Tt[c] := kinetic_energy( 'translation', m[c], V[c] );

Tt[c] := 1/2*m[c]*(D[T]^2*diff(theta(t),t)^2-2*D[T]*diff(theta(t),t)*diff(x[c](t),t)+diff(x[c](t),t)^2+x[c](t)^2*diff(theta(t),t)^2)

The motion of the one-seesaw-plus-one-IP01-or-IP02-track system consists only of one rotation (no translation).

t θ t  = seesaw absolute angular velocity

Tr[sw] = seesaw rotational kinetic kinergy

>    Tr[sw] := kinetic_energy( 'rotation', J[sw], qd[2] );

Tr[sw] := 1/2*J[sw]*diff(theta(t),t)^2

T[T]  = Total Kinetic Energy of the system

>    T[T] := combine( Tr[sw] + Tt[c] + Tr[c], trig ):

>    T[T] := collect( T[T], diff );

T[T] := (1/2*J[sw]+1/2*m[c]*D[T]^2+1/2*m[c]*x[c](t)^2)*diff(theta(t),t)^2-m[c]*D[T]*diff(theta(t),t)*diff(x[c](t),t)+1/2*m[c]*diff(x[c](t),t)^2

>   

Generalized Forces: Q[i] 's

The non-conservative forces corresponding to the generalized coordinates are: F[c]  and the viscous damping forces, where

F[c]  = linear force generated by the motorized cart (e.g. IP02, IP01)

Bsw = seesaw viscous friction torque coefficient (a.k.a. viscous damping)

Beq = cart viscous damping force coefficient

B[eq]  = 0 and B[sw]  = 0 if both viscous dampings are neglected

>    #B[eq] = 0: B[p] = 0:

Q[i] = generalized force applied on generalized coordinate q[i]

>    Q[1] := F[c] - B[eq] * qd[1];

Q[1] := F[c]-B[eq]*diff(x[c](t),t)

>    Q[2] := - B[sw] * qd[2];

Q[2] := -B[sw]*diff(theta(t),t)

F[c]  = Linear force produced by the motor at the motor pinion (i.e. after the gearbox): cart driving force

F[c]  is calculated in the Maple worksheet titled: IP01_2_Equations.mws .
rm: comment the following line out if U = F[c], uncomment it if U = V[m]

>    #F[c] := eta[g] * K[g] * eta[m] * K[t] * ( V[m] * r[mp] - K[g] * K[m] * qd[1] ) / R[m] / r[mp]^2;

>    Q := [ seq( Q[i], i=1..Nq ) ];

Q := [F[c]-B[eq]*diff(x[c](t),t), -B[sw]*diff(theta(t),t)]

Euler-Lagrange's Equations

For a N -DOF system, the Lagrange's equations can be written:

Diff(Diff(L,qdot[i]),t)-Diff(L,q[i]) = Q[i]   for i = 1  through N

where:

  Q[i] 's are special combinations of external forces and called the generalized forces,

  q[1] , ..., q[N] , are N independent coordinates chosen to describe the system and called the generalized coordinates ,

 and L  is the Lagrangian  of the system.

L  is defined by:

L = T - U

where T  is the total kinetic energy of the system and U  the total potential energy of the system.

>    EOM_orig := lagrange_equations( T[T], V[T], q, Q ):

this is to display the EOM's

>    EOM_orig := collect( EOM_orig, { seq( diff( q[i], t$2 ), i=1..Nq ), seq( diff( q[i], t ), i=1..Nq ), seq( q[i], i=1..Nq ) } );

EOM_orig := [-m[c]*D[T]*diff(theta(t),`$`(t,2))+m[c]*diff(x[c](t),`$`(t,2))-m[c]*x[c](t)*diff(theta(t),t)^2+g*m[c]*sin(theta(t)) = F[c]-B[eq]*diff(x[c](t),t), (J[sw]+m[c]*D[T]^2+m[c]*x[c](t)^2)*diff(th...
EOM_orig := [-m[c]*D[T]*diff(theta(t),`$`(t,2))+m[c]*diff(x[c](t),`$`(t,2))-m[c]*x[c](t)*diff(theta(t),t)^2+g*m[c]*sin(theta(t)) = F[c]-B[eq]*diff(x[c](t),t), (J[sw]+m[c]*D[T]^2+m[c]*x[c](t)^2)*diff(th...
EOM_orig := [-m[c]*D[T]*diff(theta(t),`$`(t,2))+m[c]*diff(x[c](t),`$`(t,2))-m[c]*x[c](t)*diff(theta(t),t)^2+g*m[c]*sin(theta(t)) = F[c]-B[eq]*diff(x[c](t),t), (J[sw]+m[c]*D[T]^2+m[c]*x[c](t)^2)*diff(th...

Express the Euler-Lagrange equations of motion as functions of the states:

1) substitute (i.e. name) the acceleration states first!

2) then substitute the velocity states!

3) and only after, the position states, and the inputs!

>    EOM_states := subs( subs_Xqd, subs( subs_Xqdd, EOM_orig ) ):

>    EOM_states := subs( subs_Xq, subs_U, EOM_states );

EOM_states := [-m[c]*D[T]*Xd[4]+m[c]*Xd[3]-m[c]*X[1]*X[4]^2+g*m[c]*sin(X[2]) = U[1]-B[eq]*X[3], (J[sw]+m[c]*D[T]^2+m[c]*X[1]^2)*Xd[4]+2*m[c]*X[1]*X[3]*X[4]-g*m[c]*D[T]*sin(X[2])+g*m[c]*X[1]*cos(X[2])-g...
EOM_states := [-m[c]*D[T]*Xd[4]+m[c]*Xd[3]-m[c]*X[1]*X[4]^2+g*m[c]*sin(X[2]) = U[1]-B[eq]*X[3], (J[sw]+m[c]*D[T]^2+m[c]*X[1]^2)*Xd[4]+2*m[c]*X[1]*X[3]*X[4]-g*m[c]*D[T]*sin(X[2])+g*m[c]*X[1]*cos(X[2])-g...
EOM_states := [-m[c]*D[T]*Xd[4]+m[c]*Xd[3]-m[c]*X[1]*X[4]^2+g*m[c]*sin(X[2]) = U[1]-B[eq]*X[3], (J[sw]+m[c]*D[T]^2+m[c]*X[1]^2)*Xd[4]+2*m[c]*X[1]*X[3]*X[4]-g*m[c]*D[T]*sin(X[2])+g*m[c]*X[1]*cos(X[2])-g...

Linearization in the EOM's   of the Trigonometric Functions

Linearization of the equations of motion around the quiescent point of operation.

Here, linearization around the zero theta angle, i.e. for small-amplitude seesaw oscillations.

Linearization around: theta0 = 0, and theta_dot0 = 0

>    EOM_ser := EOM_states:

Generalized series expansions of the trigonometric functions is used (for small angles).

>    for i from 1 to Nq do
  EOM_ser[i] := subsop( 1 = convert( series( op( 1, EOM_ser[i] ), X[2] ), polynom ), EOM_ser[i] );
  EOM_ser[i] := simplify( EOM_ser[i] );
end do:

>    EOM_ser;

[-m[c]*D[T]*Xd[4]+m[c]*Xd[3]-m[c]*X[1]*X[4]^2+g*m[c]*X[2] = U[1]-B[eq]*X[3], Xd[4]*J[sw]+Xd[4]*m[c]*D[T]^2+Xd[4]*m[c]*X[1]^2+2*m[c]*X[1]*X[3]*X[4]+g*m[c]*X[1]-m[c]*D[T]*Xd[3]-X[2]*g*m[c]*D[T]-X[2]*g*m[...
[-m[c]*D[T]*Xd[4]+m[c]*Xd[3]-m[c]*X[1]*X[4]^2+g*m[c]*X[2] = U[1]-B[eq]*X[3], Xd[4]*J[sw]+Xd[4]*m[c]*D[T]^2+Xd[4]*m[c]*X[1]^2+2*m[c]*X[1]*X[3]*X[4]+g*m[c]*X[1]-m[c]*D[T]*Xd[3]-X[2]*g*m[c]*D[T]-X[2]*g*m[...

Additional Insight: Inertia (or mass) Matrix: Fi

The nonlinear system of equations resulting from the Lagrangian mechanics can be written in the following matrix form:

F( q ) . qdd + G( q, qd ) . qd + H( q ) . q = L( q, qd, u )

F, G, and H are called, respectively, the mass, damping, and stiffness matrices.

They are symmetric in form.

The inertia (a.k.a. mass) matrix, F, gives indications regarding the coupling existing in the system.

>    Fi := Matrix( Nq, Nq ):

>    for i from 1 to Nq do
  for k from 1 to Nq do
    Fi[ i, k ] := simplify( diff( op( 1, EOM_states[i] ), Xd[k+Nq] ) );
    Fi[ i, k ] := collect( combine( Fi[ i, k ], trig ), cos );
  end do;
end do:

>    'F[i]' = Fi;

F[i] = Matrix(%id = 135211900)

Linearization of the inertia matrix for small-displacements

>    Fi_lin := Matrix( Nq, Nq ):

>    for i from 1 to Nq do
  for k from 1 to Nq do
    Fi_lin[ i, k ] := Fi[ i, k ];
    Fi_lin[ i, k ] := convert( series( Fi_lin[ i, k ], X[ 2 ] ), polynom );
    Fi_lin[ i, k ] := subs( subs_XUzero, Fi_lin[ i, k ] );
  end do;
end do:

>    'F_lin' = Fi_lin;

F_lin = Matrix(%id = 135212220)

Solving the Euler-Lagrange's Equations

Reverse State Substitution for Pretty Display of the Solved EOM's

only for pretty print

>    subs_Xq_rev := { seq( X[i] = q[i], i=1..Nq ) }:
subs_Xqd_rev := { seq( X[i+Nq] = qd[i], i=1..Nq ) }:

>    #subs_U_rev := { U[1] = V[m] }:
subs_U_rev := { U[1] = F[c] }:

>    eom_collect_list := { seq( diff( q[i], t ), i=1..Nq ), seq( q[i], i=1..Nq ), J[sw] };

eom_collect_list := {J[sw], diff(theta(t),t), diff(x[c](t),t), theta(t), x[c](t)}

Solution to the Non-Linear Equations of Motion

Solve the non-linear form of the equations of motion for the states' second time derivatives

>    Xqdd_solset_nl := solve( convert( EOM_states, set ), convert( Xqdd, set ) ):

>    assign( Xqdd_solset_nl );

>    Xd_nl[3] := simplify( Xd[3] ):
Xd_nl[4] := simplify( Xd[4] ):
unassign( 'Xd[3]', 'Xd[4]' ):

pretty display w.r.t. the named system states

>    Xd_nl[3] := simplify( subs( subs_U_rev, subs_Xq_rev, subs_Xqd_rev, Xd_nl[3] ) ):
diff( qd[1], t ) = collect( Xd_nl[3], eom_collect_list );

diff(x[c](t),`$`(t,2)) = -((-F[c]+B[eq]*diff(x[c](t),t)-m[c]*x[c](t)*diff(theta(t),t)^2+g*m[c]*sin(theta(t)))*J[sw]+(-m[c]^2*D[T]^2*x[c](t)-m[c]^2*x[c](t)^3)*diff(theta(t),t)^2+(2*m[c]^2*D[T]*x[c](t)*d...
diff(x[c](t),`$`(t,2)) = -((-F[c]+B[eq]*diff(x[c](t),t)-m[c]*x[c](t)*diff(theta(t),t)^2+g*m[c]*sin(theta(t)))*J[sw]+(-m[c]^2*D[T]^2*x[c](t)-m[c]^2*x[c](t)^3)*diff(theta(t),t)^2+(2*m[c]^2*D[T]*x[c](t)*d...
diff(x[c](t),`$`(t,2)) = -((-F[c]+B[eq]*diff(x[c](t),t)-m[c]*x[c](t)*diff(theta(t),t)^2+g*m[c]*sin(theta(t)))*J[sw]+(-m[c]^2*D[T]^2*x[c](t)-m[c]^2*x[c](t)^3)*diff(theta(t),t)^2+(2*m[c]^2*D[T]*x[c](t)*d...
diff(x[c](t),`$`(t,2)) = -((-F[c]+B[eq]*diff(x[c](t),t)-m[c]*x[c](t)*diff(theta(t),t)^2+g*m[c]*sin(theta(t)))*J[sw]+(-m[c]^2*D[T]^2*x[c](t)-m[c]^2*x[c](t)^3)*diff(theta(t),t)^2+(2*m[c]^2*D[T]*x[c](t)*d...

>    Xd_nl[4] := simplify( subs( subs_U_rev, subs_Xq_rev, subs_Xqd_rev, Xd_nl[4] ) ):
diff( qd[2], t ) = collect( Xd_nl[4], eom_collect_list );

diff(theta(t),`$`(t,2)) = -(-D[T]*m[c]*x[c](t)*diff(theta(t),t)^2+(2*m[c]*x[c](t)*diff(x[c](t),t)+B[sw])*diff(theta(t),t)-g*m[sw]*D[c]*sin(theta(t))+g*m[c]*x[c](t)*cos(theta(t))-D[T]*F[c]+D[T]*B[eq]*di...
diff(theta(t),`$`(t,2)) = -(-D[T]*m[c]*x[c](t)*diff(theta(t),t)^2+(2*m[c]*x[c](t)*diff(x[c](t),t)+B[sw])*diff(theta(t),t)-g*m[sw]*D[c]*sin(theta(t))+g*m[c]*x[c](t)*cos(theta(t))-D[T]*F[c]+D[T]*B[eq]*di...

>   

Solution to the Linearized EOM's

Solve the linear form of the equations of motion for the states' second time derivatives

>    Xqdd_solset_ser := solve( convert( EOM_ser, set ), convert( Xqdd, set ) );

Xqdd_solset_ser := {Xd[3] = (m[c]*D[T]*X[2]*g*m[sw]*D[c]-m[c]*D[T]*B[sw]*X[4]-2*m[c]^2*D[T]*X[1]*X[3]*X[4]-m[c]^2*D[T]*g*X[1]+m[c]*D[T]^2*U[1]-m[c]*D[T]^2*B[eq]*X[3]+m[c]^2*D[T]^2*X[1]*X[4]^2-B[eq]*X[3...
Xqdd_solset_ser := {Xd[3] = (m[c]*D[T]*X[2]*g*m[sw]*D[c]-m[c]*D[T]*B[sw]*X[4]-2*m[c]^2*D[T]*X[1]*X[3]*X[4]-m[c]^2*D[T]*g*X[1]+m[c]*D[T]^2*U[1]-m[c]*D[T]^2*B[eq]*X[3]+m[c]^2*D[T]^2*X[1]*X[4]^2-B[eq]*X[3...
Xqdd_solset_ser := {Xd[3] = (m[c]*D[T]*X[2]*g*m[sw]*D[c]-m[c]*D[T]*B[sw]*X[4]-2*m[c]^2*D[T]*X[1]*X[3]*X[4]-m[c]^2*D[T]*g*X[1]+m[c]*D[T]^2*U[1]-m[c]*D[T]^2*B[eq]*X[3]+m[c]^2*D[T]^2*X[1]*X[4]^2-B[eq]*X[3...
Xqdd_solset_ser := {Xd[3] = (m[c]*D[T]*X[2]*g*m[sw]*D[c]-m[c]*D[T]*B[sw]*X[4]-2*m[c]^2*D[T]*X[1]*X[3]*X[4]-m[c]^2*D[T]*g*X[1]+m[c]*D[T]^2*U[1]-m[c]*D[T]^2*B[eq]*X[3]+m[c]^2*D[T]^2*X[1]*X[4]^2-B[eq]*X[3...

>    assign( Xqdd_solset_ser );

Moreover, for small angles and small displacements

>    Xd[3] := subs( X[1]^2 = 0, X[4]^2 = 0, Xd[3] ):
Xd[3] := algsubs( X[3]*X[4] = 0, Xd[3] );

Xd[3] := 1/J[sw]/m[c]*(m[c]*D[T]*X[2]*g*m[sw]*D[c]-m[c]^2*D[T]*g*X[1]+m[c]*D[T]^2*U[1]-g*m[c]*X[2]*J[sw]+U[1]*J[sw]+(-B[eq]*J[sw]-m[c]*D[T]^2*B[eq])*X[3]-m[c]*D[T]*B[sw]*X[4])
Xd[3] := 1/J[sw]/m[c]*(m[c]*D[T]*X[2]*g*m[sw]*D[c]-m[c]^2*D[T]*g*X[1]+m[c]*D[T]^2*U[1]-g*m[c]*X[2]*J[sw]+U[1]*J[sw]+(-B[eq]*J[sw]-m[c]*D[T]^2*B[eq])*X[3]-m[c]*D[T]*B[sw]*X[4])

>    Xd[4] := subs( X[1]^2 = 0, X[4]^2 = 0, Xd[4] ):
Xd[4] := algsubs( X[3]*X[4] = 0, Xd[4] );

Xd[4] := 1/J[sw]*(X[2]*g*m[sw]*D[c]-B[sw]*X[4]-g*m[c]*X[1]+D[T]*U[1]-D[T]*B[eq]*X[3])

pretty display w.r.t. the named system states

>    diff( qd[1], t ) = collect( subs( subs_U_rev, subs_Xq_rev, subs_Xqd_rev, Xd[3] ), eom_collect_list );

diff(x[c](t),`$`(t,2)) = -1/m[c]*B[eq]*diff(x[c](t),t)-g*theta(t)+1/m[c]*F[c]+(-D[T]*B[sw]*diff(theta(t),t)-D[T]^2*B[eq]*diff(x[c](t),t)+D[T]*g*m[sw]*D[c]*theta(t)-g*m[c]*D[T]*x[c](t)+D[T]^2*F[c])/J[sw...
diff(x[c](t),`$`(t,2)) = -1/m[c]*B[eq]*diff(x[c](t),t)-g*theta(t)+1/m[c]*F[c]+(-D[T]*B[sw]*diff(theta(t),t)-D[T]^2*B[eq]*diff(x[c](t),t)+D[T]*g*m[sw]*D[c]*theta(t)-g*m[c]*D[T]*x[c](t)+D[T]^2*F[c])/J[sw...

>    diff( qd[2], t ) = collect( subs( subs_U_rev, subs_Xq_rev, subs_Xqd_rev, Xd[4] ), eom_collect_list );

diff(theta(t),`$`(t,2)) = 1/J[sw]*(theta(t)*g*m[sw]*D[c]-B[sw]*diff(theta(t),t)-g*m[c]*x[c](t)+D[T]*F[c]-D[T]*B[eq]*diff(x[c](t),t))

Determine the System State-Space Matrices: A, B, C, and D

>    A_ss := Matrix( Nx, Nx ):

>    A_ss := deriveA( Xqdd, A_ss, Nq, subs_XUzero ): 'A' = A_ss;

A = Matrix(%id = 138732092)

>    #lprint( A_ss );

>    B_ss := Matrix( Nx, Nu ):

>    B_ss := deriveB( Xqdd, B_ss, Nq, subs_XUzero ): 'B' = B_ss;

B = Matrix(%id = 138732988)

>    #lprint( B_ss );

>    C_ss := IdentityMatrix( Nx, Nx );

C_ss := Matrix(%id = 138733308)

>    #lprint( C_ss );

>    D_ss := Matrix( Nx, Nu, 0 );

D_ss := Matrix(%id = 138733436)

>    #lprint( D_ss );

Write A, B, C, and D to a Matlab file

Save the state-space matrices A, B, C and D to a MATLAB file.

>    Matlab_File_Name := "SEESAW_ABCD_eqns.m":

unassign variables, when necessary, for those present in the "Matlab_Notations" substitution set

>    if assigned( B[eq] ) then
  unassign( 'B[eq]' );
end if;

>    if assigned( B[sw] ) then
  unassign( 'B[sw]' );
end if;

substitution set containing a notation consistent with that used in the MATLAB design script(s)

>    Matlab_Notations := { m[c] = mc, m[sw] = msw, J[sw] = Jsw, D[T] = Dt, D[c] = Dc, B[sw] = Bsw, J[m] = Jm, B[eq] = Beq, K[g] = Kg, K[t] = Kt, K[m] = Km, R[m] = Rm, r[mp] = r_mp, eta[g] = eta_g, eta[m] = eta_m }:

>    Experiment_Name := "Seesaw":

>    write_ABCD_to_Mfile( Matlab_File_Name, Experiment_Name, Matlab_Notations, A_ss, B_ss, C_ss, D_ss );

Procedure Printing

default:

>    #interface( verboseproc = 1 );

>    eval( lagrange_equations ):

>   

Formula to Estimate J[sw] from the "inverted" seesaw free oscillations

period of oscillation of a compound pendulum (free swing)

>    EQN := T[osc] = 2 * pi * sqrt( J[pivot] / (m[sw] * g * D[c] ) );

EQN := T[osc] = 2*pi*(J[pivot]/g/m[sw]/D[c])^(1/2)

parallel-axis theorem

>    J[pivot] := J[sw] + m[sw] * D[c]^2;

J[pivot] := J[sw]+m[sw]*D[c]^2

>    EQN;

T[osc] = 2*pi*((J[sw]+m[sw]*D[c]^2)/g/m[sw]/D[c])^(1/2)

estimation of J[sw]

>    J[sw] = solve( EQN, J[sw] );

J[sw] = 1/4*m[sw]*D[c]*(-4*D[c]*pi^2+T[osc]^2*g)/pi^2

>   

>   

>   

>   

>   

>   

Click here to go back to top: Description Section.