Изменение параметра pyFMI не меняет вывод моделирования

Я меняю начальные 2 значения параметра (в диапазоне возможных значений) с помощью pyFMI и имитирую отклик модели. Я вижу, что на мой ответ влияет только изменение одной переменной, а не другое, но если я имитирую модель только с помощью вторая переменная (которая не меняется в начальных симуляциях) я могу ясно видеть влияние на отклик модели.

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)

person kelamahim    schedule 06.12.2018    source источник


Ответы (1)


Входной объект не определен правильно, он должен быть:

traj         = np.array([[tstart,Rserie, Rshunt]])
input_object = (['champPV.param2diodes.Rserie', 'champPV.param2diodes.Rshunt],traj)

Однако в вашем случае это не нужно, так как вы хотите установить только два параметра, поэтому я предлагаю вам просто удалить входной объект и перед вызовом моделирования:

model.set('champPV.param2diodes.Rserie', Rserie)
model.set('champPV.param2diodes.Rshunt', Rshunt)
person Christian Winther    schedule 07.12.2018