Model-based reproduction and validation of the total spectra of a solar flare and their impact on the global environment at the X9.3 event of September 6, 2017