From e5210939053adcf65062c13a3702e0ce132c39fd Mon Sep 17 00:00:00 2001 From: Kristoffer Skare Date: Tue, 12 Mar 2024 13:24:12 +0100 Subject: [PATCH] Handle if there are more states to be initialized then length of variable --- src/mlfmu/types/fmu_component.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mlfmu/types/fmu_component.py b/src/mlfmu/types/fmu_component.py index ae3c170..c2afb81 100644 --- a/src/mlfmu/types/fmu_component.py +++ b/src/mlfmu/types/fmu_component.py @@ -456,6 +456,8 @@ def get_template_mapping( input_mapping.append((input_index, inp.variable_references[variable_index])) for variable_index, state_init_index in enumerate(inp.agent_state_init_indexes): + if variable_index >= len(inp.variable_references): + break state_init_mapping.append((state_init_index, inp.variable_references[variable_index])) for out in self.outputs: