The longline is modelled using lumped masses and tension-only springs including structural damping. The mussel culture is modelled as cylinders attached to the main line and the equations are formulated for the coupled dynamics of the main line, buoys and mussel socks using Kane's formalism. Surface waves are described by Stokes' second-order wave theory. The hydrodynamic loads are applied via a Morison's equation approach using the instantaneous relative velocities and accelerations between the fluid field, the longline and the attached buoys and mussel masses. The algorithm is presented and the equations are solved using the Runge-Kutta routine 'ode45' in MATLAB. Outputs include position, orientation and velocity of all components and tension in all line segments. The numerical model may be used to predict the dynamics of longline systems using drag coefficients determined from field measurements. We expect that the results will be useful for checking and optimizing shellfish aquaculture designs prior to installation and for modifying existing designs to safeguard against failure.