Model based detection of tool wear and breakage for machine tools