popsim function

Simulation of a model.