# [ODE] Using mass damper spring system with added mass in ODE

Ole Jacob Hagen oleha at waterthrill.org
Tue Aug 28 04:31:54 MST 2007

```Hi,

I am trying to use ODE to simulate ocean vehicle  by using its
mathematical model.
This mathematical model is a mass-spring-damper system that is defined
like this:

M*v_dot + [C + D]*v + G = tau ,  where
v = [u,v,w, p,q,r] velocities in body fixed frame.
u = surge, v = sway, w = heave, p = roll, p = pitch and r = yaw.
tau is control action, such as thruster force.

M = M_rigid_body + M_added, d(M_rigid_body)/dt = 0;  M > 0

C_rigid_body is determined from M_rigid_body.

M _rigid_body= [m*eye(3), -m*S(r_g); m*S(r_g), I ],
I = inertia tensor, m = body mass, r_g = [r_x, r_y, r_z ]: Center of
gravity, eye(3) = identity matrix with 3 columns.

S(r_g) = [0, -r_z, r_y; r_z, 0, -r_x, -r_y, r_x, 0], note that S(r_g) =
- transpose(S(r_g)),

M_added = [m11, m12, m13, m14, m15, m16, ......, m61, m62, m63, m64,
m65, m66]
The values m11, m12....,  m65, m66 is found analytically or by real test
trials.

ODE's representation of mass matrix is:
> typedef struct dMass {
>  dReal mass; // total mass of the rigid body
>  dVector4 c; // center of gravity position in body frame (x,y,z)
>  dMatrix3 I; // 3x3 inertia tensor in body frame, about POR
> } dMass;
Is ODE constrained to the fact that it's using only F = m*a?
If ODE is constrained to F=m*a, how can I expand ODE to use both spring
and damper dynamics?
Maybe ODE was never intended to work with mass-damper-spring systems?

Is it a lot of work to make ODE handle both mass, damper and spring
dynamics?
Is it easy to make a new dMassExt { dMass mass; dMatrix added} and a
similar data type for Coriolis/Sentripetal  and Damping matrix?
We could additionally for instance add a dSpring and a dDamper to ODE.

This could be done by :

> dMassExt Mass;
> dSpringExt Spring;
> dDamperExt Damper;
>
> dBodySetMass(Mass);
> dBodySetSpring(Spring);
> dBodySetDamper(Damper);
> .
> .
> Solve collisions if any
> Solve the equations of motions numerically by a chosen ODE-solver....
> ..

Is this possible in ODE with a little effort, or does it involves a lot
of work?
Anyone tried to do something familiar? How did you solve it?

Cheers,

Ole J.
```