The ramming is actually a method of ship determination for those NPC's that have diminished vision or sensor malfunction.... they collide with your ship and the 'clang' it makes varies depending on ship model and modules fitted
It's known as a "Hull Resonance Scan"
Its all very simple and straightforward....