Model Predictive Control from Scratch: Derivation and Python Implementation-Optimal Control Tutorial

Поделиться
HTML-код
  • Опубликовано: 3 дек 2024

Комментарии • 49

  • @aleksandarhaber
    @aleksandarhaber  Год назад +8

    If you need help with your professional engineering problem, or you need to develop new skills in the fields of control, signal processing, embedded systems, programming, machine learning, robotics, etc., we are here to help. We provide professional engineering services as well as tutoring and skill development services. We have more than 15 years of industry, research, and university-level teaching experience. Describe your problem and we will send you a quote for our services. The contact information is ml.mecheng@gmail.com
    It takes a significant amount of time and energy to create these free video tutorials. You can support my efforts in this way:
    - Buy me a Coffee: www.buymeacoffee.com/AleksandarHaber
    - PayPal: www.paypal.me/AleksandarHaber
    - Patreon: www.patreon.com/user?u=32080176&fan_landing=true
    - You Can also press the Thanks RUclips Dollar button

  • @krisnaanandakusuma9426
    @krisnaanandakusuma9426 11 месяцев назад +9

    the best tutorial about MPC! i've been looking such explanation out there until the very detail of MPC and I must say I have finally found it! Thank you very much

    • @aleksandarhaber
      @aleksandarhaber  11 месяцев назад +1

      This is because people who create RUclips control tutorials do not properly understand control and they never implemented a simple PID control algorithm in real life.

  • @faisaltariq_artist
    @faisaltariq_artist Месяц назад +1

    One of the best tutorials on MPC. Short, sweet and to the point. Thank you.

    • @aleksandarhaber
      @aleksandarhaber  Месяц назад +1

      Hello Faisal Tariq, thank you very much for your generous support of this channel through a donation. Best Regards, Aleksandar Haber

  • @vatastakoul
    @vatastakoul Месяц назад +1

    Probably the best explanation for MPC! Thank you so much for this video.

  • @aleksandarhaber
    @aleksandarhaber  4 месяца назад +3

    It takes a significant amount of time and energy to create these free video tutorials. You can support my efforts in this way:
    - Buy me a Coffee: www.buymeacoffee.com/AleksandarHaber
    - PayPal: www.paypal.me/AleksandarHaber
    - Patreon: www.patreon.com/user?u=32080176&fan_landing=true
    - You Can also press the Thanks RUclips Dollar button

  • @Trextreks
    @Trextreks 10 месяцев назад +3

    The best tutorial , thank you. Obrigado ! from Brazil ! Brasil 🇧🇷

  • @mortezaghodoosi
    @mortezaghodoosi 10 месяцев назад +2

    Wow, it is amazing explanation and implementation about MPC which I’ve never seen before.

  • @shurenmei2308
    @shurenmei2308 Месяц назад +1

    Great video, thanks! In addition, look forward to seeing the explanation of the multi-output problem!

    • @aleksandarhaber
      @aleksandarhaber  Месяц назад

      1) It is straightforward to generalize everything explained in this video to the MIMO case. 2) These are free tutorials, and we do not have a time capacity to fulfill every wish.

  • @aleksandarhaber
    @aleksandarhaber  Год назад +2

    The website tutorial is given here:
    aleksandarhaber.com/model-predictive-control-mpc-tutorial-1-unconstrained-formulation-derivation-and-implementation-in-python-from-scratch/
    The GitHub page with all the codes is given here:
    github.com/AleksandarHaber/Model-Predictive-Control-Implementation-in-Python-1
    The MPC algorithm implementation in C++:
    ruclips.net/video/fgNz1RE2DG4/видео.html

  • @markusbuchholz3518
    @markusbuchholz3518 Год назад +4

    I want to express my appreciation for the effort and passion you put into creating your channel, website, and content. Your work is exceptional, and you are a brilliant person with exceptional teaching skills. I wish you the best of luck in all of your endeavors and objectives. Have a fantastic day!

    • @aleksandarhaber
      @aleksandarhaber  Год назад +3

      Thank you very much Markus for the kind words and encouraging comments! I spent a lot of time developing this channel. Sometimes I wonder does it is really worth my time to do all this since there is no proper financial compensation. However, the positive feedback I receive encourages me to keep on going. It is really go to know that people find these tutorials useful.

    • @markusbuchholz3518
      @markusbuchholz3518 Год назад +1

      ​@@aleksandarhaberI completely understand your perspective as I also work in academia. Nevertheless, I hope you will receive great support for your endeavors. I always appreciate those who possess wisdom, an open mind, and a willingness to share. Wishing you the best of luck with all your pursuits!

    • @aleksandarhaber
      @aleksandarhaber  Год назад +1

      @@markusbuchholz3518 Thank you!

  • @YueXu-y2m
    @YueXu-y2m Год назад +2

    Hey, there are some written errrors:
    in equation(13) the last line of matrix M, the power of A should be {f-1}, {f-2}, {f-3}
    the equation(15) has the same problem, and "C\bar{A}_{1,v}B" should be replaced by "C\bar{A}_{v+1,v}B".
    By the way, the tutorial is great that helps me a lot, thank you.

    • @aleksandarhaber
      @aleksandarhaber  Год назад +1

      Thank you! I will correct these typos in the updated tutorial and on the webpage.

  • @behnammohseni496
    @behnammohseni496 8 месяцев назад +2

    Such a fantastic video:)

  • @박봉경-w9i
    @박봉경-w9i 3 месяца назад +1

    입문자에게 완벽합니다 - from korea

  • @AbhijitBhaktechd
    @AbhijitBhaktechd 7 месяцев назад

    Very precise and easy to understand explanation with implementation. Thanks @Aleksander 🙂

  • @AniketRoy-q8r
    @AniketRoy-q8r Год назад +1

    Hi,
    Your tutorial videos are exactly what I am searching so far but didn't got any, The perfect combination of theory + code implementation from scratch. I am currently a final year engineering bachelor student and learning about Control systems , these video lecture series is noting less than a treasure for me. Thank you so much for helping me. I have a request, can you please make tutorials on the various state estimation techniques also and show how to integrate data from observation, multiple sensor inputs with the state model to get a more accurate state estimate, and a series on controlling non-linear control systems,

    • @aleksandarhaber
      @aleksandarhaber  Год назад

      Thank you. There are some videos on this channel covering these topics. However, more will follow. So stay tuned!

  • @jafarmajali9255
    @jafarmajali9255 10 месяцев назад +2

    Brilliant !

  • @halihammer
    @halihammer 9 месяцев назад +1

    Very good content! Thank you very much for your effort! It helps alot :)

  • @MuhammadTahir-tm3lp
    @MuhammadTahir-tm3lp Год назад +1

    Very interesting video .......

    • @aleksandarhaber
      @aleksandarhaber  Год назад +1

      Thank you. I see that you also have video tutorials. When I find some free time, I will look into them.

  • @MeinHerrDreyer
    @MeinHerrDreyer Год назад +1

    Great video, thank you for this. Im commenting as Im working through your detailed explanation.
    I have 2 questions:
    1. For 9:47, from equation (5), is there a B missing from the u_k | k term? Should it be C*(A^2)*B instead of C*(A^2)? I also realised the B term is missing until later on for equation (13) for the u_k|k term.
    2. Why is it that we will need to obtain control inputs for time k+2 and later? Wouldn't having just control input at time k and k+1 be sufficient? Is this because we need the future control inputs to obtain the predicted trajectory for time instants k+2 and later?

    • @aleksandarhaber
      @aleksandarhaber  Год назад +1

      Yes, that is a typo. I will correct that. It is very obvious what is happening and that this is a typo.

    • @MeinHerrDreyer
      @MeinHerrDreyer Год назад +1

      @@aleksandarhaber Thank you! I would also like to ask: Why is it that we will need to obtain control inputs for time k+2 and later? Wouldn't having just control input at time k and k+1 be sufficient since we wont be able to execute control inputs in the far future? Is this because we need the future control inputs to obtain the predicted trajectory for time instants k+2 and later?

    • @aleksandarhaber
      @aleksandarhaber  Год назад +1

      @@MeinHerrDreyer At the time instant k, the MPC computes the vectors u_{k|k},u_{k+1|k},...,u_{k+v-1|k}. At the time instant k, you only apply u_{k|k}. Then, you observe the state x_{k+1}, and then you repeat the complete procedure, and you compute u_{k+1|k+1},u_{k+2|k+1},...,u_{k+v|k+1}. Then, again, you only apply u_{k+1|k+1}, observe the state x_{k+2}, and you repeat the complete procedure.. That is, only the first control input is applied at avery time step and the prediction horizon window is shifted. This is the standard MPC. Of course you can deviate from this if you want. For example, if you do not have significant disturbance.

    • @MeinHerrDreyer
      @MeinHerrDreyer Год назад +1

      @@aleksandarhaber Thanks for explaining. I realised that even though at time index k, we are only applying the control input calculated for the next time index, we still need to calculate for k+1 and beyond because without these future control inputs, we won't be able to obtain the predicted trajectory and hence adjust for future potential disturbances, am I right to say that?

    • @aleksandarhaber
      @aleksandarhaber  Год назад +2

      @@MeinHerrDreyer Not exactly. Disturbances are something that you cannot predict. That is why they are called disturbances. If you can predict them, you can include them as known inputs in the model, and then you can account for them when predicting the trajectory. We are only applying the first computed input since we want to get an update of what that input did to our system, and then by using the state feedback we can see what happened and repeat the computations again to have a better input for the next step. That is, if the disturbance acted on the system between the time steps k and k+1 through the state feedback we can see that disturbance and then adjust the future control inputs. However, if you apply u_{k} and u_{k+1} that are computed at the time instant k , and between the time step k and k+1 there was a disturbance, then u_{k} might be a valid signal, however, the input u_{k+1} is not since this signal is computed at the time instnat k without the knowledge of the future disturbance. You have to think logically about this and from the engineering perspective and everything will come together and become completely logical.

  • @consuelovega1230
    @consuelovega1230 9 месяцев назад

    Indeed, the best tutorial, thank you very much, can I ask if the model can be easily modified for a Multiple Input Single Output (MISO) system with 4 inputs and 1 output by changing r=1; m=4 and n= 1 ? or there are more considerations? Thanks for your time!

    • @aleksandarhaber
      @aleksandarhaber  9 месяцев назад +1

      Hello, these are free tutorials, and it took as a significant amount of time and energy to create them. Usually, you will have to pay thousands of dollars to enroll in a university course in the US to obtain this quality of lecture. Except providing these tutorials, we do not have time and energy to provide answers to particular questions. Spend some time to understand the algorithm and the code and your answer will follow immediately.

  • @amel3778
    @amel3778 4 месяца назад +1

    Thank you for sharing. However, I have a question, please. I am currently implementing an MPC to control the temperature inside a room. To model the system, I used a neural network that takes as input a window of data (disturbance_w, control_w, output_w) to predict the output over a prediction horizon. Then, I use these predictions to calculate an objective function in order to obtain the first command to apply to my system to get the first output. For this, I use scipy, but the control proposed by this library remains constant regardless of the output values (the output does not follow the reference). Do you have any advice to improve this?

    • @aleksandarhaber
      @aleksandarhaber  4 месяца назад +2

      Unfortunately, due to lack of time and energy, we do not provide free help and free consultation.

    • @amel3778
      @amel3778 4 месяца назад

      @@aleksandarhaber No worries, thank you anyway for the effort you put in and for sharing this valuable information in your tutorials.

  • @emperor4102
    @emperor4102 7 месяцев назад

    Would love to see Mpc for boost converter in simulink

    • @aleksandarhaber
      @aleksandarhaber  7 месяцев назад +1

      You will never learn control if you use Simulink.