sadly the sub AI is in worse shape than the airplane AI. There are limited functions that one can use and the ones available aren't really that good

I've asked the devs for more info on it (received some info for airplanes but had already figured out 99% of what was received) so hopefully they come through with some information that isn't listed or I haven't figured out yet.
When you see them 'turn tail and run' it's not because they're scared. It's because of one of the functions in the AI that tells them to go to outer limits of target sensor THEN they can try and line up an attack