A processor obtains input of a logistically attainable end tidal partial pressure of gas X (PetX[i]T) for one or more respective breaths [i] and input of a prospective computation of an amount of gas X required to be inspired by the subject in an inspired gas to target the PetX[i]T for a respective breath [i] using inputs required to utilize a mass balance relationship, wherein one or more values required to control the amount of gas X in a volume of gas delivered to the subject is output from an expression of the mass balance relationship. The mass balance relationship is expressed in a form which takes into account (prospectively), for a respective breath [i], the amount of gas X in the capillaries surrounding the alveoli and the amount of gas X in the alveoli, optionally based on a model of the lung which accounts for those sub-volumes of gas in the lung which substantially affect the alveolar gas X concentration affecting mass transfer.