I am working on an MPC problem with individual linear models predicting the control variable at each time step in the prediction horizon (see below where u is the manipulated variable and y is the control variable). The coefficients of each linear model in the prediction horizon change based on the current state variables each time the window moves.
y[i+1] = A[i]@u[i]+B[i]
y[i+2] = A[i+1]@u[i:i+2]+B[i+1]
...
y[i+n] = A[i+n-1]@u[i:i+n]+B[i+n-1]
A and B are a list of matrices which are determined from a function of the current state. I basically want to pause the controller at the beginning of each time step (prior to optimization) and recalculate these coefficient matrices based on the feedback from the system. Is it possible to do this in Gekko using MPC mode (IMODE=6) or do I need to manage the time outside of Gekko?