Model generation for M31