In-situ analysis for intelligent control