The electrification of commercial vehicles has led to new wheel torque allocation options for propulsion and braking of articulated heavy vehicles. Each unit or axle can be individually braked or propelled whilst the other units or axles are excluded from such action. This may achieve the best energy efficiency. However, this can also lead to potential yaw stability problems such as jackknifing and trailer swing, especially under bad loading and weather conditions. This paper describes the above instabilities and introduces a nonlinear single-track model to study the vehicle dynamics of the tractor-semitrailer combination. The effects of different vehicle and environment parameters are analysed with this vehicle model. A safe operating envelope for limiting the wheel forces is obtained using this vehicle model. Since the vehicle model introduced in this paper is computationally effective, it can be run online in real vehicles, with an instantaneous safe operating envelope obtained for the momentary conditions. Thus, yaw instabilities such as jackknifing and trailer swing may be avoided.