The base defense always prefers units that are most damaging to you. So the basic defence always prefers
As soon as units that are specialized against the base defense come into range, the Defense (SAM) opens fire on these units. Even if the defensive SAM is currently firing at other units, for example normal tanks, the defense will switch targets to the more important ones: the ERC90, howitzers, Zuzanna.
How does the target selection take place?
First of all, as mentioned before, by specialization. Then according to which units are moving. And here is the strategic point! At the moment when the base defense is looking for a target, only ERC90 tanks should be moving, as they are the cheapest and therefore serve as a good distraction!
If several units move, the random principle decides.
So make sure that if one group of ERC90 is about to be fired upon and is about to be completely destroyed (so only 2-3 left), the other ERC90 groups are set in motion and keep moving until the SAM (base defense) have found a new target.
Tip: Howitzers need many resources! If a group of howitzers is attacked, drive them out of range and continuously move the ERC90. As soon as the howitzers are out of range, the SAM will of course switch back to the ERC90. Pulling out is more resource-efficient than standing still. It's a strategy game and sometimes it's strategically wiser to back out for a short while.