Description
Empty SSM files seem to cause OMS to bypass some of the logic that normally allows values in SSV files with no corresponding parameters in the system.
Steps to reproduce the behavior
SSP file demonstrating issue. In this case we have an SSV file with some parameters with no corresponding parameter in the system.
<?xml version='1.0' encoding='utf-8'?>
<ssv:ParameterSet xmlns:ssc="http://ssp-standard.org/SSP1/SystemStructureCommon" xmlns:ssv="http://ssp-standard.org/SSP1/SystemStructureParameterValues" version="2.0" name="parameters">
<ssv:Parameters>
<ssv:Parameter name="t_start">
<ssv:Real value="0.0" unit="None"/>
</ssv:Parameter>
<ssv:Parameter name="t_end">
<ssv:Real value="10.0" unit="None"/>
</ssv:Parameter>
</ssv:Parameters>
</ssv:ParameterSet>
and an SSM file with no entries:
<?xml version='1.0' encoding='utf-8'?>
<ssm:ParameterMapping xmlns:ssc="http://ssp-standard.org/SSP1/SystemStructureCommon" xmlns:ssm="http://ssp-standard.org/SSP1/SystemStructureParameterMapping" version="2.0">
</ssm:ParameterMapping>
SSP file:
example.zip
from OMSimulator import SSP
ssp = SSP("example.ssp")
instantiated_model = ssp.instantiate()
instantiated_model.setResultFile("out.csv")
instantiated_model.setStopTime(10)
instantiated_model.setFixedStepSize(0.05)
instantiated_model.initialize()
instantiated_model.simulate()
instantiated_model.terminate()
instantiated_model.delete()
When simulating this with latest version of OMS OMSimulator v3.0.0.post164-g33c40b0-linux i get the following error:
error: [setReal] Unknown signal "model.root.t_start"
Traceback (most recent call last):
File "/home/axema/Documents/oms3-ssv-example/sim.py", line 5, in <module>
instantiated_model = ssp.instantiate()
^^^^^^^^^^^^^^^^^
File "/home/axema/Documents/OMSimulator/install/lib/x86_64-linux-gnu/OMSimulator/ssp.py", line 438, in instantiate
return self.activeVariant.instantiate(self.resources, self.temp_dir)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/axema/Documents/OMSimulator/install/lib/x86_64-linux-gnu/OMSimulator/ssd.py", line 273, in instantiate
return InstantiatedModel(json_desc, self.system, resources)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/axema/Documents/OMSimulator/install/lib/x86_64-linux-gnu/OMSimulator/instantiated_model.py", line 253, in __init__
self.setStartValuesFromSSV(self.system.parameterResources, self.system.name)
File "/home/axema/Documents/OMSimulator/install/lib/x86_64-linux-gnu/OMSimulator/instantiated_model.py", line 291, in setStartValuesFromSSV
self.setStartValues(ssv.value, systemName, ssm)
File "/home/axema/Documents/OMSimulator/install/lib/x86_64-linux-gnu/OMSimulator/instantiated_model.py", line 370, in setStartValues
self.apply_start_value(value_path, source_value, type)
File "/home/axema/Documents/OMSimulator/install/lib/x86_64-linux-gnu/OMSimulator/instantiated_model.py", line 384, in apply_start_value
self._setReal(value_path, float(value_))
File "/home/axema/Documents/OMSimulator/install/lib/x86_64-linux-gnu/OMSimulator/instantiated_model.py", line 489, in _setReal
raise RuntimeError(f"Failed to set value for {mapped_cref}: {status}")
RuntimeError: Failed to set value for model.root.t_start: Status.error
info: 0 warnings
info: 1 errors
Adding a dummy entry to the SSM file, e.g:
<ssm:ParameterMapping xmlns:ssc="http://ssp-standard.org/SSP1/SystemStructureCommon" xmlns:ssm="http://ssp-standard.org/SSP1/SystemStructureParameterMapping" version="2.0">
<ssm:MappingEntry source="dummy" target="dummy2"/>
</ssm:ParameterMapping>
makes the SSP work again.
Expected behavior
SSP is able to be instantiated and should be able to simulate.
Version
OMSimulator v3.0.0.post164-g33c40b0-linux
- Ubuntu 24.04
Description
Empty SSM files seem to cause OMS to bypass some of the logic that normally allows values in SSV files with no corresponding parameters in the system.
Steps to reproduce the behavior
SSP file demonstrating issue. In this case we have an SSV file with some parameters with no corresponding parameter in the system.
and an SSM file with no entries:
SSP file:
example.zip
When simulating this with latest version of OMS
OMSimulator v3.0.0.post164-g33c40b0-linuxi get the following error:Adding a dummy entry to the SSM file, e.g:
makes the SSP work again.
Expected behavior
SSP is able to be instantiated and should be able to simulate.
Version
OMSimulator v3.0.0.post164-g33c40b0-linux