Heavy trucks are involved in many accidents every year and Electronic Stability Control (ESC) is viewed as a means to help mitigate this problem. ESC systems are designed to reduce the incidence of single vehicle loss of control, which might lead to rollover or jackknife. As the working details and control strategies of commercially available ESC systems are proprietary, a generic model of an ESC system that mimics the basic logical functionality of commercial systems was developed. This paper deals with the study of the working of a commercial ESC system equipped on an actual tractor trailer vehicle.The particular ESC system found on the test vehicle contained both roll stability control (RSC) and yaw stability control (YSC) features. This work focused on the development of a reliable RSC software model, and the integration of it into a full vehicle simulation (TruckSim) of a heavy truck.