final simulation code and data file