Methodology of Real-Time Modeling, Control and Self-learning