We present an implementation of heavy quarkonium production within a perturbative QCD cascade based on the Color Dipole Cascade model. We consider the processes most relevant in the context of the ψ′ surplus at the Tevatron; g → ψ′ and c → ψ′ in the color-singlet model and g → ψ′ through the color-octet mechanism. Our implementation is, however, easily extendible to other quarkonia and other production mechanisms. Where comparison is possible we find good agreement with analytical calculations. We present some suggestions for measurements at the Tevatron that would be sensitive to the shape of the fragmentation functions. Our calculations indicate that such measurements could be used to test the color-octet mechanism solution to the ψ′ surplus at the Tevatron.