Python 创建2元组作为模型输入时出错。使用pyfmi模拟fmu模型的model.simulate()
我在gt套件中创建了一个fmu。我正在尝试使用python PyFMI包在python中使用它。 我的代码 文件显示,model.simulate将输入作为其参数之一Python 创建2元组作为模型输入时出错。使用pyfmi模拟fmu模型的model.simulate(),python,tuples,fmi,jmodelica,Python,Tuples,Fmi,Jmodelica,我在gt套件中创建了一个fmu。我正在尝试使用python PyFMI包在python中使用它。 我的代码 文件显示,model.simulate将输入作为其参数之一 input -- Input signal for the simulation. The input should be a 2-tuple consisting of first the names of the input variable(s) and then the da
input --
Input signal for the simulation. The input should be a 2-tuple
consisting of first the names of the input variable(s) and then
the data matrix.
“InputVarI”、“InputVarP”是输入变量,u_traj、v_traj是数据矩阵
我的代码给出了一个错误
给出一个错误-
TypeError: tuple indices must be integers or slices, not tuple
输入对象是否创建错误?有人能帮助您根据文档正确创建输入元组吗?输入对象创建不正确。输入元组中的第二个变量应该是单个数据矩阵,而不是两个数据矩阵 正确的输入应为:
data = np.transpose(np.vstack((t,u,v)))
input_object = (['InputVarI','InputVarP'],data)
另见
data = np.transpose(np.vstack((t,u,v)))
input_object = (['InputVarI','InputVarP'],data)