Model Predictive Control with Python GEKKO

preview_player
Показать описание
Model Predictive Control uses a mathematical description of a process to project the effect of Manipulated Variables (MVs) into the future and optimize a desired outcome. This example problem shows how to implement a simplified MPC for velocity regulation (cruise control) of a vehicle. An MV, accelerator pedal, is adjusted every 0.5 seconds over a time horizon of 20 seconds. The objective is to maintain the velocity of the vehicle at 40 meters per second with a reference trajectory to avoid excessive acceleration.

Рекомендации по теме
Комментарии
Автор

Hi! Thanks for the video. Your content on MPC has been my guidance to understand this kind of control. I was wondering, this is an example for an open-loop MPC, right? Do you have any example for close-loop? I mean, changing the size of the horizon, applying the first step of control on a simulation of the system, and recompute the trajectory for the next step til the final of the simulation. Thanks!

jomurciap
Автор

Dear Mr John,

I want to use this function according your tutorial but it didn't work :

point = [40, 20, 10, 35]
traject= [1, 30, 60, 100]

for i in range (len(point)):
# Controlled Variable
v = m.CV(value=0)
v.STATUS = 1 # add the SP to the objective
v.TAU = 5 # time constant of trajectory
m.options.CV_TYPE = 2 # squared error
m.options.IMODE = 6 # control

v.SP = point[i] # set point
v.TR_INIT = traject[i] # set point trajectory

# Process model
m.Equation(mass*v.dt() == -v*b + K*b*p)
m.solve(disp=False)

but found :
vp.__dict__[o] = data[vp.name][o]
KeyError: 'v2'

how to solve it ?

Thank you

liminm
Автор

How is the Weight (Wt) determined? Can we set it ourselves?

alexrunako
Автор

Hello, can I add a vector to track a trajectory in the obj function instead of a point ? where the size of the vector is Nx1 where N is the prediction horizon

ahmedtamer
Автор

Hi, can I ask again how is the Time Horizon, Control Horizon, and Prediction Horizon determined by using m.time?

alexrunako
Автор

Thank you for the explanation, what if the system model is discrete how can I declare it?

talebbouhamdan
Автор

How can I use a trained model (let's say Keras saved model) as the process model?

patrickduhirwenzivugira
Автор

is it possible to have a custom loss function? instead of l1 or l2?

BADERAK
Автор

Can I change the equation which is like 'y = a + bu'?

유재진-sf
Автор

Hi, , Can we use 2 manipulated variables?

ibtehajk
Автор

Incredible tutorial! Could I ask, is there a tutorial for real-time MPC?

tpsetati
join shbcf.ru