A generic description of spectrographs based on first optical principl
es is developed. It incorporates off-plane grating equations and rotat
ions in three dimensions in order to adequately account for line tilt
and order curvature. This formalism is validated by confronting the mo
dels for two actual spectrographs (UVES and CASPEC) with ray tracing r
esults and arc lamp exposures. The versatility of these models for the
control of instrument configurations, for the generation of calibrati
on databases, and for the preparation of observations is shown. As an
important application, we derive from this formulation various forms o
f the echelle relation which can be used to implement automatic wavele
ngth calibration procedures. Finally, we discuss possible applications
of such analytical models of astronomical instruments for calibration
, data analysis and observatory operations.