我成功地在模式 6 中进行了这个模拟,这是一个微藻模型。我想和模式9比较。但是模式9总是不可行的。有什么建议吗?关于如何修复模式 9?我尝试我们不同的初始条件,但 ti 不起作用
#%% Bennatia Model Dynamic Optimization
#v 2.1
from gekko import GEKKO
import numpy as np
#Initialize model
m = GEKKO (remote=True)
#% Parameters
mu_ = m.Param(value=2, name="u");
rho_m = m.Param(value=9.3, name="rhom");
K_Q = m.Param(value=1.8, name="KQ");
K_s = m.Param(value=0.105, name="KS");
S_in = m.Param(value=100, name="S_in");
K_sI = m.Param(value=150, name="KsI");
K_iI = m.Param(value=2000, name="KiI");
mu_I = m.Param(value=0.6461, name="muI");
# Define Dilution rate as Manipulated variable
D = m.MV(value=0.1, lb=0.001, ub=2);
# Manipulated variable
D.STATUS = 1 # allow optimizer to change
D.DCOST = 0.1 # smooth out D movement
D.DMAX = 0.1 # slow down D
#%% Variables
# Constrains Equations
# x > 0, Q < 8.9969 , Q > 1.8, s > 0, s < 120
x = m.Var(value=0.2, lb=0 , ub=100, name ='x');
Q = m.Var(value=1.8, lb=1.8 , ub=8.9969, name = 'Q');
s = m.Var(value=0.01, lb=0 , ub=100, name = 's') ;
mu = m.Var(value=0.1, lb=0 , ub=2, name = 'mut');
#time
#t=m.Var(value=0) #for time optimization
tf = 60
nt =15*tf+1
m.time = np.linspace(0,tf,nt)
t = m.Param(value=m.time); # For maximun value
#%% Equations
# m.Equation(t.dt() == 1) # For time optimization only
#For implicit form x.dt() Q.dt() s.dt()
m.Equation(mu == mu_*(1 - K_Q/(Q) )*mu_I);
m.Equation(x.dt() == mu*x - D*x);
m.Equation(Q.dt() == rho_m*((s)/ ((s)+ K_s)) - mu*Q);
m.Equation(s.dt() == (S_in - s)*D - rho_m*((s)/ ((s)+ K_s)) * x);
m.Maximize(D*x)
#%% Solver options
m.options.SENSITIVITY = 1 # sensitivity analysis
m.options.IMODE = 9 # Mode 6 is working
m.solve(disp=True,GUI=True)
m.solve();
print(m.path)
我查看了 infeasibilities 文件,但无法掌握问题所在。感谢任何指导。