A major uncertainty in models for photoionised outflows in AGN is the distance of the gas to the central black hole . We present the results of a massive multiwavelength monitoring campaign on the bright Seyfert 1 galaxy Mrk 509 to constrain the location of the outflow components dominating the soft X-ray band . Mrk 509 was monitored by XMM-Newton , Integral , Chandra , HST/COS and Swift in 2009 . We have studied the response of the photoionised gas to the changes in the ionising flux produced by the central regions . We were able to put tight constraints on the variability of the absorbers from day to year time scales . This allowed us to develop a model for the time-dependent photoionisation in this source . We find that the more highly ionised gas producing most X-ray line opacity is at least 5 pc away from the core ; upper limits to the distance of various absorbing components range between 20 pc up to a few kpc . The more lowly ionised gas producing most UV line opacity is at least 100 pc away from the nucleus . These results point to an origin of the dominant , slow ( v < 1000 km s ^ { -1 } ) outflow components in the NLR or torus-region of Mrk 509 . We find that while the kinetic luminosity of the outflow is small , the mass carried away is likely larger than the 0.5 Solar mass per year accreting onto the black hole . We also determined the chemical composition of the outflow as well as valuable constraints on the different emission regions . We find for instance that the resolved component of the Fe-K line originates from a region 40–1000 gravitational radii from the black hole , and that the soft excess is produced by Comptonisation in a warm ( 0.2–1 keV ) , optically thick ( \tau \sim 10–20 ) corona near the inner part of the disk .