The European Spallation Source will be a 5 MW superconducting proton linac for the production of spallation neutrons. It is composed of an ion source, a radio frequency quadrupole, a drift tube linac and a superconducting linac as well as the low, medium and high, energy beam transport sections. At present these components of the linac are in the design phase: the optimization of the accelerator parameters requires an intensive campaign of simulations to test the model of the machine under possible operational conditions. In this paper the results of simulations performed with the IMPACT and MADX-PTC codes are presented and a comparison is made between them and independent simulations using TraceWin. The dynamics of the beam envelope and single and multiparticle tracking are reported.