I used gekko sysid to model a process with 5 MV's and 4 CV's. I want to simulate the real process and it does fairly well, except at the beginning. Even with a good initial value for CV's, the plots always look something like this:
I have tried different inputs for the MV's but I always see this initial dip before returning to reasonable values. I am using na=2 and nb=4 but it doesn't seem to matter. Is there an explanation or fix?
Perform steady-state initialization as a first step. When calculating the steady state, ensure that the correct MVs are used to get the desired output. This is demonstrated in the TCLab F example Python GEKKO System ID with ARX Model
The initial point in your plot is the initial guess value. The states of the model also need to be initialized with a stead state calculation:
# create control ARX model
y = m.Array(m.CV,2)
u = m.Array(m.MV,2)
m.arx(p,y,u)
# rename CVs
TC1 = y[0]
TC2 = y[1]
# rename MVs
Q1 = u[0]
Q2 = u[1]
# steady state initialization
m.options.IMODE = 1
m.solve(disp=False)
Then the MPC application can be configured with those steady-state values:
# set up MPC
m.options.IMODE = 6 # MPC
m.options.CV_TYPE = 1 # Objective type
m.options.NODES = 2 # Collocation nodes
m.options.SOLVER = 3 # IPOPT
m.time=np.linspace(0,120,61)
Correct initialization should solve the problem.