  We investigate the asymptotic convergence of the trajectories generated by
the second order dynamical system $\ddot x(t) + \gamma\dot x(t) + \nabla
\phi(x(t))+\beta(t)\nabla \psi(x(t))=0$, where $\phi,\psi:{\cal H}\rightarrow
\R$ are convex and smooth functions defined on a real Hilbert space ${\cal H}$,
$\gamma>0$ and $\beta$ is a function of time which controls the penalty term.
We show weak convergence of the trajectories to a minimizer of the function
$\phi$ over the (nonempty) set of minima of $\psi$ as well as convergence for
the objective function values along the trajectories, provided a condition
expressed via the Fenchel conjugate of $\psi$ is fulfilled. When the function
$\phi$ is assumed to be strongly convex, we can even show strong convergence of
the trajectories. The results can be seen as the second order counterparts of
the ones given by Attouch and Czarnecki (Journal of Differential Equations
248(6), 1315--1344, 2010) for first order dynamical systems associated to
constrained variational inequalities. At the same time we give a positive
answer to an open problem posed in \cite{att-cza-16} by the same authors.
