Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/OMSimulatorPython/instantiated_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,14 @@ def _system_type_label(system_type: SystemType) -> str:
return "oms_system_wc" if system_type == SystemType.wc else "oms_system_sc"

class InstantiatedModel:
def __init__(self, json_description, system: System, resources: dict):
def __init__(self, json_description, ssdName: str, system: System, resources: dict):
#print(f"info: Instantiating model with JSON description:\n{json_description}", flush=True)
config = json.loads(json_description)
self.modelName = "model" ## create random name, but we cannot commits test as jenkins will gerate new model name
self.apiCall = []
self.mappedCrefs = {} # Store mapped CRefs associated with their export names
self.system = system
self.ssdName = ssdName
self.resources = resources
self.fmuInstantitated = False

Expand Down Expand Up @@ -205,7 +206,7 @@ def __init__(self, json_description, system: System, resources: dict):
if not export_name in self.mappedCrefs:
self.mappedCrefs[export_name] = comp_path
self.mappedCrefs[".".join(comp["name"][:-1])] = solver_path # map parent system too for connector lookup
status = Capi.setExportName(comp_path, export_name) # Set export name if provided
status = Capi.setExportName(comp_path, f"{self.ssdName}.{export_name}") # Set export name if provided
if status != Status.ok:
raise RuntimeError(f"Failed to set export name: {status}")

Expand Down Expand Up @@ -428,7 +429,7 @@ def _addConnector(self, connectors, systemName):
export_name = systemName
if not connector_name in self.mappedCrefs:
self.mappedCrefs[connector_name] = connector_path
status = Capi.setExportName(connector_path, export_name) # Set export name if provided
status = Capi.setExportName(connector_path, f"{self.ssdName}.{export_name}") # Set export name if provided
if status != Status.ok:
raise RuntimeError(f"Failed to set export name: {status}")
status = Capi.setAliasName(connector_path, str(connector.name)) # Set alias name for connector
Expand Down
2 changes: 1 addition & 1 deletion src/OMSimulatorPython/ssd.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ def instantiate(self, resources: dict | None = None, tempdir: str | None = None)
raise ValueError("Variant doesn't contain a system")
simulation_info = {"startTime": self.startTime, "stopTime": self.stopTime, "resultFile": self.resultFile, "loggingInterval": self.loggingInterval, "bufferSize": self.bufferSize}
json_desc = self.system.generateJson(resources, tempdir, simulation_info)
return InstantiatedModel(json_desc, self.system, resources)
return InstantiatedModel(json_desc, self._name, self.system, resources)

def list(self, prefix=""):
'''Prints the SSD contents.'''
Expand Down
1 change: 1 addition & 0 deletions testsuite/tests/reference-fmus/2.0/cs/BouncingBall-cs.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

from OMSimulator import SSP, CRef, Settings, Capi
Settings.suppressPath = True
Capi.setCommandLineOption("--stripRoot=true")

model = SSP()
model.addResource('../../../resources/BouncingBall.fmu', new_name='resources/BouncingBall.fmu')
Expand Down
1 change: 1 addition & 0 deletions testsuite/tests/reference-fmus/2.0/cs/Dahlquist-cs.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

from OMSimulator import SSP, CRef, Settings, Capi
Settings.suppressPath = True
Capi.setCommandLineOption("--stripRoot=true")

model = SSP()
model.addResource('../../../resources/Dahlquist.fmu', new_name='resources/Dahlquist.fmu')
Expand Down
4 changes: 2 additions & 2 deletions testsuite/tests/reference-fmus/2.0/cs/Feedthrough-cs.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
## win: yes
## asan: yes

from OMSimulator import SSP, CRef, Settings
from OMSimulator import SSP, CRef, Settings, Capi
Settings.suppressPath = True

model = SSP()
Expand Down Expand Up @@ -38,7 +38,7 @@

## Result:
## info: Result file: Feedthrough-cs.mat (bufferSize=10)
## info: Parameter default.Feedthrough.String_parameter will not be stored in the result file, because the signal type is not supported
## info: Parameter default.default.Feedthrough.String_parameter will not be stored in the result file, because the signal type is not supported
## info: Feedthrough.Boolean_output: True
## info: Feedthrough.Enumeration_output: 2
## info: Feedthrough.Float64_continuous_output: 3.1
Expand Down
1 change: 1 addition & 0 deletions testsuite/tests/reference-fmus/2.0/cs/Stair-cs.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

from OMSimulator import SSP, CRef, Settings, Capi
Settings.suppressPath = True
Capi.setCommandLineOption("--stripRoot=true")

model = SSP()
model.addResource('../../../resources/Stair.fmu', new_name='resources/Stair.fmu')
Expand Down
1 change: 1 addition & 0 deletions testsuite/tests/reference-fmus/2.0/cs/VanDerPol-cs.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

from OMSimulator import SSP, CRef, Settings, Capi
Settings.suppressPath = True
Capi.setCommandLineOption("--stripRoot=true")

model = SSP()
model.addResource('../../../resources/VanDerPol.fmu', new_name='resources/VanDerPol.fmu')
Expand Down
1 change: 1 addition & 0 deletions testsuite/tests/reference-fmus/2.0/me/BouncingBall-me.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

from OMSimulator import SSP, CRef, Settings, Capi
Settings.suppressPath = True
Capi.setCommandLineOption("--stripRoot=true")

model = SSP()
model.addResource('../../../resources/BouncingBall.fmu', new_name='resources/BouncingBall.fmu')
Expand Down
1 change: 1 addition & 0 deletions testsuite/tests/reference-fmus/2.0/me/Dahlquist-me.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

from OMSimulator import SSP, CRef, Settings, Capi
Settings.suppressPath = True
Capi.setCommandLineOption("--stripRoot=true")

model = SSP()
model.addResource('../../../resources/Dahlquist.fmu', new_name='resources/Dahlquist.fmu')
Expand Down
4 changes: 2 additions & 2 deletions testsuite/tests/reference-fmus/2.0/me/Feedthrough-me.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
## win: yes
## asan: yes

from OMSimulator import SSP, CRef, Settings
from OMSimulator import SSP, CRef, Settings, Capi
Settings.suppressPath = True

model = SSP()
Expand Down Expand Up @@ -44,7 +44,7 @@
## info: model doesn't contain any continuous state
## info: maximum step size for 'model.root': 0.001000
## info: Result file: Feedthrough-me.mat (bufferSize=10)
## info: Parameter default.Feedthrough.String_parameter will not be stored in the result file, because the signal type is not supported
## info: Parameter default.default.Feedthrough.String_parameter will not be stored in the result file, because the signal type is not supported
## info: Feedthrough.Boolean_output: True
## info: Feedthrough.Enumeration_output: 2
## info: Feedthrough.Float64_continuous_output: 3.1
Expand Down
2 changes: 1 addition & 1 deletion testsuite/tests/reference-fmus/2.0/me/Stair-me-events.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
with open("Stair-me-events.csv") as file:
rows = list(csv.reader(file, skipinitialspace=True))

counter = rows[0].index('default.Stair.counter')
counter = rows[0].index('default.default.Stair.counter')

# group the data points by their time stamp
groups = []
Expand Down
1 change: 1 addition & 0 deletions testsuite/tests/reference-fmus/2.0/me/Stair-me.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

from OMSimulator import SSP, CRef, Settings, Capi
Settings.suppressPath = True
Capi.setCommandLineOption("--stripRoot=true")

model = SSP()
model.addResource('../../../resources/Stair.fmu', new_name='resources/Stair.fmu')
Expand Down
1 change: 1 addition & 0 deletions testsuite/tests/reference-fmus/2.0/me/VanDerPol-me.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

from OMSimulator import SSP, CRef, Settings, Capi
Settings.suppressPath = True
Capi.setCommandLineOption("--stripRoot=true")

model = SSP()
model.addResource('../../../resources/VanDerPol.fmu', new_name='resources/VanDerPol.fmu')
Expand Down
1 change: 1 addition & 0 deletions testsuite/tests/reference-fmus/3.0/cs/BouncingBall-cs.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

from OMSimulator import SSP, CRef, Settings, Capi
Settings.suppressPath = True
Capi.setCommandLineOption("--stripRoot=true")

model = SSP()
model.addResource('../../../resources/BouncingBall3.fmu', new_name='resources/BouncingBall3.fmu')
Expand Down
1 change: 1 addition & 0 deletions testsuite/tests/reference-fmus/3.0/cs/Dahlquist-cs.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

from OMSimulator import SSP, CRef, Settings, Capi
Settings.suppressPath = True
Capi.setCommandLineOption("--stripRoot=true")

model = SSP()
model.addResource('../../../resources/Dahlquist3.fmu', new_name='resources/Dahlquist3.fmu')
Expand Down
1 change: 1 addition & 0 deletions testsuite/tests/reference-fmus/3.0/cs/Stair-cs.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

from OMSimulator import SSP, CRef, Settings, Capi
Settings.suppressPath = True
Capi.setCommandLineOption("--stripRoot=true")

model = SSP()
model.addResource('../../../resources/Stair3.fmu', new_name='resources/Stair3.fmu')
Expand Down
1 change: 1 addition & 0 deletions testsuite/tests/reference-fmus/3.0/cs/VanDerPol-cs.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

from OMSimulator import SSP, CRef, Settings, Capi
Settings.suppressPath = True
Capi.setCommandLineOption("--stripRoot=true")

model = SSP()
model.addResource('../../../resources/VanDerPol3.fmu', new_name='resources/VanDerPol3.fmu')
Expand Down
1 change: 1 addition & 0 deletions testsuite/tests/reference-fmus/3.0/me/BouncingBall-me.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

from OMSimulator import SSP, CRef, Settings, Capi
Settings.suppressPath = True
Capi.setCommandLineOption("--stripRoot=true")

model = SSP()
model.addResource('../../../resources/BouncingBall3.fmu', new_name='resources/BouncingBall3.fmu')
Expand Down
1 change: 1 addition & 0 deletions testsuite/tests/reference-fmus/3.0/me/Dahlquist-me.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

from OMSimulator import SSP, CRef, Settings, Capi
Settings.suppressPath = True
Capi.setCommandLineOption("--stripRoot=true")

model = SSP()
model.addResource('../../../resources/Dahlquist3.fmu', new_name='resources/Dahlquist3.fmu')
Expand Down
1 change: 1 addition & 0 deletions testsuite/tests/reference-fmus/3.0/me/Stair-me.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

from OMSimulator import SSP, CRef, Settings, Capi
Settings.suppressPath = True
Capi.setCommandLineOption("--stripRoot=true")

model = SSP()
model.addResource('../../../resources/Stair3.fmu', new_name='resources/Stair3.fmu')
Expand Down
1 change: 1 addition & 0 deletions testsuite/tests/reference-fmus/3.0/me/VanDerPol-me.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

from OMSimulator import SSP, CRef, Settings, Capi
Settings.suppressPath = True
Capi.setCommandLineOption("--stripRoot=true")

model = SSP()
model.addResource('../../../resources/VanDerPol3.fmu', new_name='resources/VanDerPol3.fmu')
Expand Down