The impact of connected automated vehicles and platoons on the traffic safety and stability in complex heterogeneous traffic systems