MBsymba release 4 - February 2006
(C) Roberto Lot, Matteo Massaro
Building objects
In MBsymba there are two type of entities:
1) the <objects>, which are high level entities, defined by means of Maple tables;
2) the <elements>, which are low level entities, used to build <objects>.
ELEMENTS
<frame> = <4x4 transformation matrix>
<coords> = <[<x>,<y>,<z>,1] column vector>
<comps> = <[<x>,<y>,<z>,0] column vector>
BASE OBJECTS
may be created using following procedures:
create a <POINT>
<POINT> = table([ obj=POINT, frame=<frame>, coords=<coords> ])
make_POINT (TT::frame, x,y,z::scalar)
create a <VECTOR>
<VECTOR> = table([ obj=VECTOR, frame=<frame>, comps =<comps> ])
make_VECTOR(TT::frame, x,y,z::scalar)
create a <BODY>
<BODY> = table([ obj=BODY, frame=<frame>, CM=<coords>, mass=<m>, inertia=<3x3 inertia matrix>)
make_BODY(BF::{frame}, m::scalar, *optional* Ix,Iy,Iz,Cyz,Cxz,Cxy::scalar)
create a <FORCE>
<FORCE> = table([ obj=FORCE, frame=<frame>, comps=<comps>, applied=<POINT>, acting=<BODY> (or <frame>), reacting=<BODY> (or <frame>) )
make_FORCE(TT::frame, x,y,z::scalar, PP::POINT, TA::{BODY,frame})
create a <TORQUE>
(to be updated)
<TORQUE> = table([ obj=TORQUE, frame=<frame>, comps=<comps>,
acting=<BODY> (or <frame>), reacting=<BODY> (or <frame>) )
make_TORQUE(TT::frame, x,y,z::scalar, TA::{frame,BODY}, *optional* TR::{BODY,frame})
create a <CONSTRAINT> (to be updated)
<CONSTRAINT> = table([ obj=CONSTRAINT, expr=<set> ])
make_CONSTRAINT(phi::list)
show an existing <OBJECT>
show(OO::OBJECT)
Kinematics Procedures
create a <frame> using translational operator translate(x,y,z::scalar)
create a <frame> using rotational operator
rotate({'X','Y','Z'},angle::scalar)
extracting the origin of a <frame>
origin(TT::frame)
compute the inverse transformation matrix of a <frame>
inv_frame(TT::frame)
center of mass of a body
CoM(BB::BODY)
project points and vectors into anothe <frame>
project(A::{POINT,VECTOR,FORCE,TORQUE},TT::frame)
compute the velocity of a point
velocity(P::{POINT,VECTOR}, *optional* {'absolute','relative','eulerian'} )
angular velocity of reference frame
angular_velocity(T::frame)
dot product
dot_prod(u,v::{VECTOR,FORCE,TORQUE})
cross product
cross_prod(u,v::{VECTOR,FORCE,TORQUE})
exctract components of a POINT of a VECTOR
Comps(P::{POINT,VECTOR,FORCE,TORQUE}), Xcomp(), Ycomp(), Zcomp()
Energy
compute generalized force
generalized_force(FT::{FORCE,TORQUE},q)
yc
,
zc
: contact point geometric position;
ym
,
zm
: carcass distortion
compute Kinetic Energy
kinetic_energy(BB::BODY)
compute Gravitational Energy
gravitational_energy(BB::BODY)
Lagrange Equations
derive Lagrange's Equation
lagrange(L,q,t::scalar)
derive Lagrange's Equations of a complex system
TO BE UPDATED
lagrange_equations({bodies,forces,constraints,springs,dampers,...},coords::list, *optional* multipliers)
1st
argument is a set wich contain the element of the system (i.e bodies, forces, torques, springs, dampers and so on). I particular the system may contains CONSTRAINT elements
2nd
argument is the set of time-dependent coordinates
3rd
optional argument is tha name of the Lagrange's multipliers, which are used only in presence of constraints
convert N order DAEs into N-1 order DAEs
down_order(eqns,vars::{list,set},t)
convert a 2nd order DAE into a1st order DAE
first_order(eqns,vars::{list,set},t,flag)
Netwon-Euler Equations
linear momentum of a rigid body
linear_momentum(BB::BODY)
compute the Netwon's translational equations of motion of a system of bodies and forces with respect the give reference frame
(internal and external forces are automatically recognized)
newton_equations({body,force},TT::frame)
angular momentum of a rigid body with respect to a given point
angular_momentum(BB::BODY, pole::POINT)
compute the Euler's rotational equations of a system of bodies and forces with respect to the given pole and in the given reference frame
(internal and external forces are automatically recognized; the pole may be either a fixed or moving point)
euler_equations({body,force,torque}, pole::POINT, TT::frame)
Miscellaneous
differentiate with respect to a variable diffF(expression,variable)
multiple expansion Taylor serie
taylorF(ff::{algebraic,list,set},vv::{name,function,list,set},n::posint)
jacobian with respect to variables
jacobianFproc(ff,vv::{list,set})
create time derivative of variables make_dot(var,t)
Linear Modeling
define the set of infinitesimaly variables linear_modeling(small_vars::set)
linearize equations
linearize(ff,vv,t)
exctract matrix Q from quadratic form xT*Q*x
quadratic_form(F,x)
matrix form MM*Xdot2+CC*Xdot+KK*X = F matrix_form(eqns,coords,t)
matrix form A*Xdot = B*(X-X0) + D*(U-U0) (A,B,D) = state_space(eqs,vv,t,uu)
Basic Examples
> restart:
> mylib :="C:/LIBS": libname := mylib,libname: with(MBSymba_r4):
building reference frame
> type(T1,'frame');
> T1 := translate(x,y,x);
> type(T1,'frame');
> T2 := rotate('X',phi);
> T3 := T1*rotate('Z',psi)*T2;
> PP := make_POINT('ground',a,bc,c);
> show(PP);
> make_POINT(ground,a,b,c);
> type(RR,'frame');
> type(SS,coords);
point
>
P1 := make_POINT(T2,a,b(t),c): show(P1);
P1bis := project(P1,T1): show(P1bis);
> VP1r := velocity(P1,'relative');
> evalm(ground);
> VP1r := velocity(P1,'absolute');
unit vector
> UT := make_VECTOR(T2,1,0,0): show(UT);
> UTbis := project(UT,T1): show(UTbis);
point + vector
> P2 := P1+UT: show(P2);
vector + point
> P2bis := UT+P1; show(P2bis);