If this is your first time writing UDF, it will be a little bit difficult ... but the learning experience will open the door for you to do lots of staff in your simulation that you were not able to do earlier. nThe UDF manual has many examples ... the first thing you need to decide which macro you need. In your case, you will look in the DPM macros. Go read what every macro does. After deciding you need to use this, look at the example and you can start from there. Try to understand the sequence and try to modify the example to your case. And if you need help, you can come ask questions here in the forum. n