Hi @thanapong,
I believe generation 1 should correspond to the primary particles, your protons. In general, generation i>1 are those particles created as a result of a reaction induced by a particle of generation i-1. Therefore, neutrons from a spallation reaction caused by your primary protons should be generation 2.
Please note that, in general, products of a spallation reaction may be able to induce further spallation reactions themselves. Consequently, not all of these reactions have to be caused by your primary protons. If you want to accurately identify the products of a spallation reaction and score their properties at the time of creation you may want to look to the reaction itself by means of the mgdraw routine, as proposed here: Volume neutron source information - #6 by fogallar.
Not sure what do you mean by “time referring to the generation”. Nonetheless you can access the Atrack variable included in trackr.inc to obtain the age of the particle in seconds (time since the creation of your primary particle: your proton). Since trackr.inc is already included in your routine, you should be able to access Atrack as any other of the variables you are using (e.g. Ij, Xx, Wee, …).
Hope this helps.
Kind regards,
Francisco