How to model an adaptive optical system