A cargo ship suffered power failure twice; causing it to veer way off course and collide with a support beam.