Internal stress in titanium nitride coatings: modelling of complex stress systems