我正在使用 pyFMI 更改初始的 2 个参数值(在可能值的范围内)并模拟模型响应我可以看到我的响应仅受 1 个变量更改的影响,而不受另一个变量更改的影响,但如果我仅用第二个变量(在初始模拟中没有变化)我可以清楚地看到对模型响应的影响。
model.reset()
model=load_fmu('Series_0Resistance.fmu')
tstart = model.get_default_experiment_start_time() #### start time of the model
tstop = model.get_default_experiment_stop_time() #### Stop time of the model
Rshunt=0.09141 # Initial values of parameters ( not affecting the simulation response while simulated with the second parameter)
Rserie=0.00012 # Initial values of parameters (affecting the simulation response)
Rserie_traj = np.array([[tstart,Rserie]])
Rshunt_traj = np.array([[tstart,Rshunt]])
input_object = ('champPV.param2diodes.Rserie',Rserie_traj,
'champPV.param2diodes.Rshunt',Rshunt_traj)
opts = model.simulate_options ()
opts['ncp']=266### The number of output points
opts["CVode_options"]["store_event_points"] = True
model_try=model.simulate(options=opts, input=input_object,final_time=tstop )
results=(model_try['champPV.Pmpp_DC'])
plt.plot(results)
但是,如果我只使用参数模拟我的模型响应(在上述情况下不影响模拟响应),我可以看到明显的模型响应差异。欢迎任何提示如何解决这个问题。
global model
model.reset()
model=load_fmu('Series_0Resistance.fmu')
tstart = model.get_default_experiment_start_time() #### start time of the model
tstop = model.get_default_experiment_stop_time() #### Stop time of the model
Rshunt=0.9141 # Initial values of parameters
Rshunt_traj = np.array([[tstart,Rshunt]])
input_object = ('champPV.param2diodes.Rshunt',Rshunt_traj)
opts = model.simulate_options ()
opts['ncp']=266### The number of output points
opts["CVode_options"]["store_event_points"] = True
model_try=model.simulate(options=opts, input=input_object,final_time=tstop )
results=(model_try['champPV.Pmpp_DC'])
plt.plot(results)