Most synchrotron radiation X-ray diffraction (XRD) beamlines have been primarily designed for studying conventional materials, whereas a modern approach to nanomaterials requires a complete control of the diffracted signal, and therefore of the optics and general setup of the beamline. This requirement is especially relevant when Line Profile Analysis is pushed to the limits of large domain sizes, small deformations, or low defects concentration, which is a driving force to use synchrotron radiation XRD. We combine the SHADOW ray-tracing optical simulation with the calculation of powder diffraction profile from standard materials, into a high-level workflow environment based on the ORANGE software. Algorithms are developed to reproduce optical elements in a realistic form, so to evaluate the effects of aberrations, with the final purpose of reconstructing the Instrumental Profile Function of the beamline, with the possibility of investigating the role of each separate element. The results of this work can be of interest to most beamlines as a powerful tool for the design of setups of existing as well as new beamlines.