我试图用odeint和某些输出来解决微分方程,我得到的信息是:"在这个调用上完成了多余的工作(也许错误的Dfun类型)。"
我使用full_output = 1运行该函数,这就是我得到的:
lsoda-- at current t (=r1), mxstep (=i1) steps
taken on this call before reaching tout
in above message, i1 = 500
in above message, r1 = 0.1799966984891D+05
Excess work done on this call (perhaps wrong Dfun type).
Run with full_output = 1 to get quantitative information.
{'hu': array([ 0.00301005, 0.00082527, 0.00232656, 0.00026312, 0.04182098,
0. , 0. , 0. , 0. , 0. ]),
'imxer': -1,
'leniw': 26,
'lenrw': 116,
'message': 'Excess work done on this call (perhaps wrong Dfun type).',
'mused': array([ 2, 2, 2, 1, 2,
0, -1014454328, 32533, 48, 0], dtype=int32),
'nfe': array([ 513, 825, 1328, 2496, 3872, 0,
27648176, 0, 48, 0], dtype=int32),
'nje': array([ 30, 59, 103, 183, 268,
32533, -1129892592, 32533, 48, 0], dtype=int32),
'nqu': array([ 1, 1, 1, 2, 1,
0, -1014454328, 32533, 48, 0], dtype=int32),
'nst': array([ 184, 268, 401, 803, 1303, 0,
27648176, 0, 48, 0], dtype=int32),
'tcur': array([ 3.60000104e+003, 7.20000056e+003, 1.08000006e+004,
1.44000002e+004, 1.79996698e+004, 4.74303020e-322,
0.00000000e+000, 6.90364637e-310, 6.90364883e-310,
6.90364637e-310]),
'tolsf': array([ 6.90364882e-310, 6.90364882e-310, 6.90364882e-310,
6.90364882e-310, 6.90364882e-310, 4.79243676e-322,
1.87610085e-316, 6.90365099e-310, 6.90364141e-310,
3.21142670e-322]),
'tsw': array([ 7.84480753e-003, 7.84480753e-003, 7.84480753e-003,
1.43999973e+004, 1.44001827e+004, 1.36600614e-316,
1.36600139e-316, 1.36600614e-316, 1.36600614e-316,
1.36600139e-316])}
我不知道我正在解决的ODE有什么问题。这是它的代码:
def computeDiffEquations(state,t, m_coll_vals, m_load_vals):
#assign variables
Tout_coll = state[0]
T_tank = state[1:]
m_coll = valueAt(m_coll_vals, t)
m_load = valueAt(m_load_vals, t)
#calculate collector temperature
Tin_coll = T_tank[-1]
Tave_coll = (Tin_coll + Tout_coll) / 2.
eta = c_0 - c_1 * ((Tave_coll - T_amb) / (I_coll)) - c_2 * (math.pow(Tave_coll-T_amb, 2.) / (I_coll))
Tout_coll_dot = (eta * A_coll * I_coll - m_coll * c_p * (Tout_coll - Tin_coll)) / coll_cap
#calculate tank temperature
#build the Qcondution
T_tank_minus1 = np.insert(T_tank, 0, T_tank[0])[:-1]
T_tank_plus1 = np.insert(T_tank, len(T_tank), T_tank[-1])[1:]
Q_cond = (th_cond * A_node / L_node) * (T_tank_minus1 - 2. * T_tank + T_tank_plus1)
#build the Qflow
if m_coll >= m_load :
Q_flow = c_p * ((m_coll - m_load) * T_tank_minus1 - (m_coll - m_load) * T_tank)
Q_flow[0] = c_p * (m_coll * Tout_coll - (m_coll - m_load) * T_tank[0] - m_load * T_tank[0])
Q_flow[-1] = c_p * ((m_coll - m_load) * T_tank_minus1[-1] + m_load * T_chiller_out - m_coll * T_tank[-1])
else:
Q_flow = c_p * ((m_load - m_coll) * T_tank_plus1 - (m_load - m_coll) * T_tank)
Q_flow[0] = c_p * (m_coll * Tout_coll + (m_load - m_coll) * T_tank_plus1[0] - m_load * T_tank[0])
Q_flow[-1] = c_p * (- (m_load - m_coll) * T_tank[-1] + m_load * T_chiller_out - m_coll * T_tank[-1])
#build the Qloss
Q_loss = U_loss * A_loss * (T_amb - T_tank)
#assemble the equations
T_tank_dot = (Q_loss + Q_cond + Q_flow) / (rho * c_p * V_node)
return np.concatenate((np.array([Tout_coll_dot]),T_tank_dot))
我知道为什么会出现这个错误?提前谢谢!