Skip to content

Commit

Permalink
Make diagnostic message clearer!
Browse files Browse the repository at this point in the history
  • Loading branch information
nl78 committed Dec 19, 2024
1 parent 7f23f61 commit e955811
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions fmu_manipulation_toolbox/fmu_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,8 @@ def add_input(self, container_port_name: str, to_fmu_filename: str, to_port_name
container_port_name = to_port_name
cport_to = ContainerPort(self.get_fmu(to_fmu_filename), to_port_name)
if not cport_to.port.causality == "input": # check causality
raise FMUContainerError(f"{cport_to} is {cport_to.port.causality} instead of INPUT.")
raise FMUContainerError(f"Tried to use '{cport_to}' as INPUT of the container but FMU causality is "
f"'{cport_to.port.causality}'.")

logger.debug(f"INPUT: {to_fmu_filename}:{to_port_name}")
self.mark_ruled(cport_to, 'INPUT')
Expand All @@ -242,7 +243,8 @@ def add_output(self, from_fmu_filename: str, from_port_name: str, container_port

cport_from = ContainerPort(self.get_fmu(from_fmu_filename), from_port_name)
if cport_from.port.causality not in ("output", "local"): # check causality
raise FMUContainerError(f"{cport_from} is {cport_from.port.causality} instead of OUTPUT or LOCAL")
raise FMUContainerError(f"Tried to use '{cport_from}' as INPUT of the container but FMU causality is "
f"'{cport_from.port.causality}'.")

logger.debug(f"OUTPUT: {from_fmu_filename}:{from_port_name}")
self.mark_ruled(cport_from, 'OUTPUT')
Expand Down Expand Up @@ -422,7 +424,7 @@ def make_fmu_xml(self, xml_file, step_size: float, profiling: bool):
<CoSimulation
modelIdentifier="{self.identifier}"
canHandleVariableCommunicationStepSize="yes"
canHandleVariableCommunicationStepSize="true"
canBeInstantiatedOnlyOncePerProcess="{capabilities['canBeInstantiatedOnlyOncePerProcess']}"
canNotUseMemoryManagementFunctions="true"
canGetAndSetFMUstate="false"
Expand Down

0 comments on commit e955811

Please sign in to comment.