我尝试将所有num_of_cells
值设置为使用此代码计算的N
和Q
值:
import numpy as np
source_Q = 4
source_N = 9999.0
delta_t = 6
time = delta_t / float(3600)
delta_x = 50 * time
num_of_cells = np.int(1.25 / delta_x) + 1
N = 180 * delta_x
Q = 3000 * time
normal_cell_capacity = float(2400) / float(120)
incident_cell_capacity = float(600) / float(120)
for i in range (1, num_of_cells):
Q = Q[i+1]
N = N[i+1]
产生此错误:
TypeError: 'float' object is unsubscriptable