from gekko import GEKKO
import numpy as np
import matplotlib.pyplot as plt
m = GEKKO()
m.options.SOLVER = 1
m.options.IMODE = 3
Num_car = 1
TOU = [64.9,64.9,64.9,64.9,64.9,64.9,64.9,64.9,152.6,239.8,239.8,152.6,239.8,239.8,239.8,239.8,152.6,152.6,152.6,152.6,152.6,152.6,152.6,64.9]
n=len(TOU)
p_i = m.Array(m.Var,(n,Num_car))
input = m.Array(m.Var, (n), value = 0.0, lb = 0.0, ub = 7.0, integer = True)
SOC_t = m.Array(m.Var,(n, Num_car))
for tt in range(0,n):
for i in range(0,Num_car):
SOC_t[tt,i].lower = 30
SOC_t[tt,i].upper = 70
SOC_t[0,0] = 30
eq_car_bat = np.zeros((n))
eq_car_bat = list(eq_car_bat)
for tt in range(0,n):
eq_car_bat[tt] = SOC_t[tt] + input[tt] == p_i[tt]
m.Equation(eq_car_bat)
SOC_Max = 90
SOC_Min = 30
sum_soc = sum(SOC_t[tt])
eq_total = np.zeros((n))
eq_total = list(eq_total)
eq_total = sum_soc == SOC_Max
m.Equation(eq_total)
for i in range(n):
m.Minimize(TOU[i]*p_i[i])
m.options.IMODE = 3
m.options.SOLVER = 1
m.solve(disp=True)
I want to find minimized charging costs when the EV charging. My code is shown below but, I received the following error "x must be a python list of GEKKO parameters, variables, or expressions" that I don't know how to solve.