Real-time Analysis and Control for Smart Manufacturing Systems