  We aim to constrain the temperature and velocity structures, and H2O
abundances in the winds of a sample of M-type AGB stars. We further aim to
determine the effect of H2O line cooling on the energy balance in the inner
circumstellar envelope. We use two radiative-transfer codes to model molecular
emission lines of CO and H2O towards four M-type AGB stars. We focus on
spectrally resolved observations of CO and H2O from HIFI. The observations are
complemented by ground-based CO observations, and spectrally unresolved CO and
H2O observations with PAC. The observed line profiles constrain the velocity
structure throughout the circumstellar envelopes (CSEs), while the CO
intensities constrain the temperature structure in the CSEs. The H2O
observations constrain the o-H2O and p-H2O abundances relative to H2. Finally,
the radiative-transfer modelling allows to solve the energy balance in the CSE,
in principle including also H2O line cooling. The fits to the line profiles
only set moderate constraints on the velocity profile, indicating shallower
acceleration profiles in the winds of M-type AGB stars than predicted by
dynamical models, while the CO observations effectively constrain the
temperature structure. Including H2O line cooling in the energy balance was
only possible for the low-mass-loss-rate objects in the sample, and required an
ad hoc adjustment of the dust velocity profile in order to counteract extreme
cooling in the inner CSE. H2O line cooling was therefore excluded from the
models. The constraints set on the temperature profile by the CO lines
nevertheless allowed us to derive H2O abundances. The derived H2O abundances
confirm previous estimates and are consistent with chemical models. However,
the uncertainties in the derived abundances are relatively large, in particular
for p-H2O, and consequently the derived o/p-H2O ratios are not well
constrained.
