OMSimulator icon indicating copy to clipboard operation
OMSimulator copied to clipboard

OMSimulator does not export some variables listed in resources/signalFilter.xml

Open rruusu opened this issue 1 year ago • 2 comments

Description

Some variables with non-alphanumeric characters, such as square brackets or parentheses, are not exported to the result file, even when explicitly listed in the resources/signalFilter.xml file in the SSP.

Steps to reproduce the behavior

  1. Create an SSP with variables containing square brackets, listen in signalFilter.xml.
  2. Simulate SSP in OMSimulator.
  3. Observe the result file contents.
  4. Note missing variables with special characters.

Expected behavior

All variables listed in signalFilter.xml should be present in the result file.

Version and OS

  • Version: OMSimulator v2.1.2.post6-g637a1c9-win-notlm-debug
    • current HEAD,
  • OS: Windows 11, 64-bit

rruusu avatar Oct 18 '24 10:10 rruusu

The cause is fairly evident in method oms::Model::importSignalFilter, which sends the name attribute of the oms:Variable unquoted to a function that expects a regular expression argument.

Thus a name like "x[1]" does not actually match the name "x[1]", when interpreted as a regular expression, as it only matches the name "x1".

Luckily, the dots used as separators in the names match with any character, including a dot.

rruusu avatar Oct 18 '24 10:10 rruusu

@rruusu the issue is fixed with this commit https://github.com/OpenModelica/OpenModelica/commit/2a9e581976d97e97f8701a15a478da75aa73e3a4, please test it from the nightly builds tomorrow(26-10-2024)

arun3688 avatar Oct 25 '24 09:10 arun3688

I consider this issue resolved. @rruusu, please feel free to reopen if you encounter the same issue again.

lochel avatar Nov 13 '24 07:11 lochel