We report on numerical simulation studies of the dynamical behavior of edge localized modes (ELMs) under the influence of repetitive injection of pellets. In our nonlinear 2-fluid model the ELMs are excited by introducing a particle source in the confinement region and a particle sink in the edge region. The injection of pellets is simulated by periodically raising the edge density in a pulsed manner. We find that when the edge density is raised to twice the normal edge density with a duty cycle (on time:off time) of 1:2, the ELMs are generated on an average at a faster rate and with reduced amplitudes. These changes lead to significant improvements in the plasma beta indicative of an improvement in the energy confinement due to pellet injection. Concurrently, the plasma density and temperature profiles also get significantly modified. A comparative study is made of the nature of ELM dynamics for different magnitudes of edge density enhancements. We also discuss the relative impact on ELMs from resonant magnetic perturbations compared to pellet injection in terms of changes in the plasma temperature, density, location of the ELMs and the nonlinear spectral transfer of energies.