gekko

Gekko and CoolProp

ぐ巨炮叔叔 提交于 2020-08-08 06:03:34
问题 I'm using GEKKO and CoolProp for thermal systems simulation. When trying to use CoolProp's functions inside the model equations (as shown below for an isentropic expansion) I'm getting an error message regarding the variable type: " must be real number, not GKVariable ". Could someone please help me with this issue? from gekko import GEKKO import CoolProp.CoolProp as CP # p1 = 2e5 T1 = 300.0 + 273.15 p2 = 1e5 eta = 0.80 fluid = 'H2O' # h1 = CP.PropsSI('H','T',T1,'P',p1,fluid) s1 = CP.PropsSI(

How to set variable value at x[3]=6 (not initial condition) in Python Gekko?

喜欢而已 提交于 2020-08-07 08:16:08
问题 I can set an initial condition y(0)=5 in Gekko with y = m.Var(5) but how do I set a value that is not the initial condition such as y(3)=6 where the value at time=3 is 6 as shown by the red dot? from gekko import GEKKO import numpy as np import matplotlib.pyplot as plt m = GEKKO(remote=False) m.time = np.linspace(0,10,11) x = m.Var(np.ones(11)*6) m.Equation(5*x.dt() == -x) m.options.IMODE = 4 m.solve() plt.plot(m.time, x.value) plt.plot([3],[6],'ro',MarkerSize=5) plt.show() I have a

How to set variable value at x[3]=6 (not initial condition) in Python Gekko?

不想你离开。 提交于 2020-08-07 08:13:48
问题 I can set an initial condition y(0)=5 in Gekko with y = m.Var(5) but how do I set a value that is not the initial condition such as y(3)=6 where the value at time=3 is 6 as shown by the red dot? from gekko import GEKKO import numpy as np import matplotlib.pyplot as plt m = GEKKO(remote=False) m.time = np.linspace(0,10,11) x = m.Var(np.ones(11)*6) m.Equation(5*x.dt() == -x) m.options.IMODE = 4 m.solve() plt.plot(m.time, x.value) plt.plot([3],[6],'ro',MarkerSize=5) plt.show() I have a

“int 'object is not subscriptable”

☆樱花仙子☆ 提交于 2020-06-16 02:14:10
问题 i'm starting to learn GEKKO. Now, I am solving a knapsak problem to learn, but this time I get the error "int 'object is not subscriptable". can you look at this code? what is the source of the problem How should I define the 1.10 matrices? from gekko import GEKKO import numpy as np m = GEKKO(remote=False) x = m.Var((10),lb=0,ub=1,integer=True) #x = m.Array(m.Var,(1,10),lb=0,ub=1,integer=True) v=np.array([2, 2, 7, 8, 2, 1, 7, 9, 4, 10]) w=np.array([2, 2, 2, 2, 2, 1, 6, 7, 3, 3]) capacity=16

“int 'object is not subscriptable”

▼魔方 西西 提交于 2020-06-16 02:13:47
问题 i'm starting to learn GEKKO. Now, I am solving a knapsak problem to learn, but this time I get the error "int 'object is not subscriptable". can you look at this code? what is the source of the problem How should I define the 1.10 matrices? from gekko import GEKKO import numpy as np m = GEKKO(remote=False) x = m.Var((10),lb=0,ub=1,integer=True) #x = m.Array(m.Var,(1,10),lb=0,ub=1,integer=True) v=np.array([2, 2, 7, 8, 2, 1, 7, 9, 4, 10]) w=np.array([2, 2, 2, 2, 2, 1, 6, 7, 3, 3]) capacity=16

SCIPY - building constraints without listing each variable separately

你。 提交于 2020-05-29 06:49:11
问题 I am using SCIPY to optimize a storage facility that uses forward prices for a deal term of 1 year. Gas can be injected and withdrawn from this facility, based on monthly spreads (e.g. March 21 vs May 20 spread) being high enough to cover the variable cost of operation. The attached picture represents the problem (the values here are arbitrary, don't match the values in the code; pic is just for concept) The cells in blue are the "changing cells", volumes that SCIPY will adjust to maximize

Gekko can't find solution of a small problem

耗尽温柔 提交于 2020-05-27 05:14:06
问题 I am making some tests with Gekko library from python, and have a small problem in which I know the solution. The complet code is as follows: from gekko import GEKKO P = [[3.0,3.55,5.18,7.9,5.98], [1.56,1.56,2.48,3.15,2.38], [1.49,4.96,6.4,9.4,6.5]] M = [[1,2,3,4,5], [6,7,8,9,10], [11,12,13,14,15]] mm = M pp = P c1 = [300,200,150,250,180] qtde = [10,10,10] flex = [0.2,0.2,0.2] m = GEKKO(remote=False) ni = 3 nj = 5 x = [[m.Var(lb=0,integer=True) for j in range(nj)] for i in range(ni)] s = 0