OpenModelica / OMSimulator

The OpenModelica FMI & SSP-based co-simulation environment.
Other
71 stars 50 forks source link

exportSSVTemplate() does not export template files for fmu's inside subsystem #1172

Open arun3688 opened 2 years ago

arun3688 commented 2 years ago

Description

The API exportSSVTemplate() works only on the top level system and its component and it does not work on the subsystem and its components, Also the exportSSVTemplate() API does not update the start values in the template file when setting new start values in ssv resources, but it works well with inline parameter settings.

Steps to reproduce the behavior for exportSSVtemplate not working in subsystems

oms_newModel("model")
oms_addSystem("model.root", oms_system_wc)
oms_addSubModel("model.root.sine", "../resources/Modelica.Blocks.Sources.Sine.fmu")
-- add resources to submodule
oms_newResources("model.root.sine:sine.ssv")
oms_setReal("model.root.sine.phase", 27)
oms_setReal("model.root.sine.amplitude", -100)
oms_setReal("model.root.sine.freqHz", -300)
-- add subsytems
oms_addSystem("model.root.subsystem", oms_system_sc)
oms_addSubModel("model.root.subsystem.sine1", "../resources/Modelica.Blocks.Sources.Sine.fmu")
oms_newResources("model.root.subsystem.sine1:sine1.ssv")

oms_exportSSVTemplate("model.root.subsystem.sine1", "sine1.ssv")

Steps to reproduce the behavior for not updating start values from ssv resources

oms_newModel("model")
oms_addSystem("model.root", oms_system_wc)
oms_addSubModel("model.root.sine", "../resources/Modelica.Blocks.Sources.Sine.fmu")
-- add resources to submodule
oms_newResources("model.root.sine:sine.ssv")
oms_setReal("model.root.sine.phase", 27)
oms_setReal("model.root.sine.amplitude", -100)
oms_setReal("model.root.sine.freqHz", -300)
oms_exportSSVTemplate("model.root.sine", "sine.ssv")