It can easily happen, and up to now, there's no certain way to prevent it happening. Perhaps in the future, there will be a system which will make filling up with petrol instead of Diesel impossible. Sometimes only the Diesel-nozzle fits, which makes filling up with petrol almost impossible. If you notice it, through the sound that the engine makes, it may already be too late. Best of all is, if a Diesel engine has petrol in the tank, not to start the engine at all. The more modern the petrol is, the more it endangers the Diesel engine because of its inability to lubricate the complete high-pressure Diesel injection system. This may even be more costly than buying a reconditioned engine. Therefore, a Diesel powered car that has been filled up with petrol, should never be driven to the workshop.
The biggest problem is the possibility that metal shavings are produced when the high-pressure pump only runs in petrol. These shavings, because it happens way past the fuel filters, can spread themselves around the entire rest of the system. One could perhaps, compare them with a virus, where one can never say exactly when the disease will break out. There are manufacturers, who consider that filling up with the wrong fuel, and then driving on, is a reason to replace the entire fuel-supply system. After one such complete replacement, the workshop forgot to prime the new pump with Diesel fuel for the first rotations, the result was: The whole replacement had to be repeated again …
Now, what happens in the workshop? In all cases, a hose must be fed as far as possible into the tank, then the contents can be syphoned off by a special pump into a container. In my opinion, this work is a waste of time because afterwards the tank has to still be opened from the top and the entire module removed, then completely emptied. Some manufacturers recommend further rinsing with Diesel and then emptying completely.
If the engine has not been started since the mistake took place, one can now begin to reassemble the parts, indeed, should the engine have been started, the search begins, every drop of petrol in the system must be found and removed, one can only hope that no damage has been done. One possibility is, to connect the suction device to the pre-flow pipe of the high pressure pump, then either by influencing the control device or by clamping it (not directly on the open tank) to the fuel pump, one can then flood with pure Diesel.
By the way, the high pressure pump is not the ony sensitive component, also the injectors work with extremely low tolerances. In the end, after rinsing the fuel-lines, all one can do, is to examine each individual component for shavings. Indeed, if nothing is found in the pump and particularly, in the filter, one can be, to a certain extent, relieved. Absolute certainty however, can only be brought about by replacing the entire injection system.
By the way, finding out exactly how much Diesel was in the tank beforehand, is worthwhile and may give grounds for hope, because Diesel is somewhat heavier than petrol, there may have still been enough in the tank to pevent the petrol from reaching the fuel-pipe. Finding this out from the unfortunate driver, might be very helpful.
If the damage was only noticed, when the engine started to make strange noises, all hopes of a reasonable solution are dashed. In addition, companies like, e.g., VW, refer to a restriction in the guarantee. The workshops are required to report such cases... 05/12