Tutorial on modelling of lightwave devices and systems