Simulation of sandpile dynamics via cellular automata and corresponding analysis to extract critical exponents