In order to meet emissions and power requirements, modern engine design has evolved in complexity and control. The cost and time restraints of calibration and testing of various control strategies have made virtual testing environments increasingly popular. Using Hardware-in-the-Loop (HiL), Volvo Penta has built a virtual test rig named VIRTEC for efficient engine testing, using a model simulating a fully instrumented engine. This paper presents an novel Artificial Neural Network (ANN) based model for engine simulations in a HiL environment. The engine model, herein called Artificial Neural Network Engine (ANN-E), was built for a D8-600 hp Volvo Penta engine, and directly implemented in the VIRTEC system. ANN-E uses a combination of feedforward and recursive ANNs, processing 7 actuator signals from the engine management system (EMS) to provide 30 output signals. To improve the accuracy in predicting exhaust emissions, the ANNs were arranged into two layers, such that engine temperature and pressure output signals and their average rate of change act as extra inputs for exhaust emission signals. The simulation results agree with test cell data, showing that the ANN-E model accurately predicts engine performance, engine temperatures and pressures along the flow path, as well as exhaust emissions. In addition, the modular nature of ANN-E makes it possible for fast rebuild of the model if engine components are changed. Therefore, the layered modular ANN modeling method represents a powerful tool for virtual engine testing and calibration optimization.