My best method for beating rats is flashers (I use
Rid-A-Rats). They keep the rats out of my car and truck, but to cover a large area you need too many of them.
My son has a motorhome on an E-250 chassis; his engine compartment is big enough and divided enough that one flasher can't cover it. Plus, we have clever rats on that side of the house who have learned how to chew off the repellant device wires to the battery to defeat them (photo). They ate an entire foot off his ultrasonic repellant cable. (This is why we went to the drycell version of the flasher for our own vehicles.) I have some braided metal sleeving on the way right now to armor his cable.
It doesn't help that the environmentalists agitated to remove PVC (which rats hate) from wire and cable insulation in favor of polymers made out of PLA (cornstarch/sugar cane), soy, and even cannabis. It's like throwing the little buggers a catered rave with a disco ball.