Different values on source and destination connection in ssd file
In an ssd file "D16_aero_stimuli.ssd" I have a connetor output "u" on the ssd top level. The "u" connector is connected to an output "u of an FMU in the ssd. After simulation of the model, I expect OMsimulator to log the same values on both "u" and "u.out.y", but this is not the case:
I have uploaded the complete .ssp file as a .zip file.
Running OMSimulator in python on windows: oms.version Out[9]: 'OMSimulator v2.1.3-win-notlm'
Execute the following code to simulate the model of interest:
ssd2Run= "D16_aero_stimuli" from OMSimulator import OMSimulator
oms = OMSimulator() oms.importFile("ParkerSimPack.ssp")# %% oms.setCommandLineOption("--emitEvents=false") # Removes duplicate log samples in result file oms.setCommandLineOption("--stripRoot=true") # Removes root names in variable names in log file oms.activateVariant(SSP1.SSDs[0].root.get("name"),ssd2Run) oms.instantiate(ssd2Run) oms.initialize(ssd2Run)
oms.simulate(ssd2Run) oms.terminate(ssd2Run) oms.delete(ssd2Run)
@larsviktorlarsson I have tested your ssp in our new oms3 API and the results looks fine for u and u.out.y, see the plot below
Please try to test the ssp on our new oms3 API which is pushed to the master branch. Please update your branch and test the API, But in principle it should also work with the version you have, But i suggest you to use our new API in python. An example script would be
import logging
logging.basicConfig(level=logging.INFO)
from OMSimulator import SSD, SSP, Settings, Capi
Settings.suppressPath = True
model = SSP('../resources/ParkerSimPack.ssp')
print(model.getAllVariantNames())
model.activeVariantName = "D16_aero_stimuli"
instantiated_model = model.instantiate() ## internally generate the json file and also set the model state like virgin,
print("", flush=True)
instantiated_model.setStopTime(20.0)
instantiated_model.setResultFile("parker_simulation_res.mat")
instantiated_model.initialize()
instantiated_model.simulate()
instantiated_model.terminate()
instantiated_model.delete()
Documentation about the new oms3 API can be read here https://openmodelica.org/doc/OMSimulator/master/OMSimulator/UsersGuide/html/OMSimulatorPython3.html And also more examples on how to use the new API are found here https://github.com/OpenModelica/OMSimulator/tree/master/testsuite/simulation