Error when trying to simulate one FMU with 4 inputs from csv files

44 Views Asked by At

I have a single FMU and with 4 inputs, which I want to feed them with csv files. I did the following:

from pyfmi import load_fmu
import pandas as pd

electricity_network = load_fmu(r"C:\Users\kosmy\Pandapower.fmu")

load_file = r"C:\Users\kosmy\load_prof.csv"
load = pd.read_csv(load_file, index_col = 0)
load = load.to_numpy()

pv_file = r"C:\Users\kosmy\pv_prof.csv"
pv = pd.read_csv(pv_file, index_col = 0)
pv = pv.to_numpy()

input_object = [((electricity_network, 'P_load1'), load), 
                ((electricity_network, 'P_load2'), load),
                ((electricity_network, 'P_pv1'), pv),
                ((electricity_network, 'P_pv2'), pv)]

res = electricity_network.simulate(final_time = 96, input = input_object)

But I got the following error:

Traceback (most recent call last):

  File "C:\Users\kosmy\run_pyfmi_csv.py", line 27, in <module>
    res = electricity_network.simulate(final_time = 96, input = input_object)

  File "src\pyfmi\fmi.pyx", line 7501, in pyfmi.fmi.FMUModelCS2.simulate

  File "src\pyfmi\fmi.pyx", line 365, in pyfmi.fmi.ModelBase._exec_simulate_algorithm

  File "src\pyfmi\fmi.pyx", line 359, in pyfmi.fmi.ModelBase._exec_simulate_algorithm

  File "C:\Users\kosmy\anaconda3\envs\env\lib\site-packages\pyfmi\fmi_algorithm_drivers.py", line 772, in __init__
    TrajectoryLinearInterpolation(self.input[1][:,0],

TypeError: tuple indices must be integers or slices, not tuple

Any idea of what is going wrong?

0

There are 0 best solutions below