Quantitative modeling of the emergence of macroscopic grid-like representations