I would like to run alternative FMU models using python fmpy module.
I can run simple simulation withs default inputs and strating values ploting the various output variables defined in ouputs. However I can not find the structure of nd array which should allow alternate inputs. I found only coupled_clutches which is some sort of timeline like signal.
There are variables iVarX defined in FMU as inputs as well as oVarY variables as outputs here is my simple fmpy call
inputv = np.array([('iVar0', 28.7),
('iVar1', 51.6),
('iVar2', 51.6),
('iVar3', 37.2),
('iVar4', 2920)]
outputs = ['oVar0',
'oVar1',
'oVar2',
'oVar3']
result = fmpy.simulate_fmu(filename,input=inputv, output=outputs)
If i do not use the input=inputv the simulation runs ok with default FMU defined input values. But running the code above leads to
...
File ~\AppData\Local\Programs\Python\Python311\Lib\site-packages\fmpy\simulation.py:758 in simulate_fmu
result = simulateCS(model_description, fmu, start_time, stop_time, relative_tolerance, start_values, apply_default_start_values, input, output, output_interval, timeout, step_finished, set_input_derivatives, use_event_mode, early_return_allowed, validate, initialize, terminate)
File ~\AppData\Local\Programs\Python\Python311\Lib\site-packages\fmpy\simulation.py:1180 in simulateCS
input = Input(fmu=fmu, modelDescription=model_description, signals=input_signals, set_input_derivatives=set_input_derivatives)
File ~\AppData\Local\Programs\Python\Python311\Lib\site-packages\fmpy\simulation.py:219 in __init__
self.t = signals[signals.dtype.names[0]]
TypeError: 'NoneType' object is not subscriptable
I tried to use a list of values in the input variable order,dataframe and array described above as a input. None of that actually works.
Would you advise the correct structure of the inputv variables array please?