Skip to content

ModelicaModel.getParameters returns values as string instead of float #244

@ondras12345

Description

@ondras12345

Description

The documentation seems to indicate that the values of Real parameters should be returned as float:

>>> mod.getParameters()  // method-1
{'c': 0.9, 'radius': 0.1}

However, strings are returned in practice - something like this:

{'c': '0.9', 'radius': '0.1'}

Steps to Reproduce

I have added a test for this (currently failing) to my fork:
https://github.com/ondras12345/OMPython/blob/53fc10ded9a89d33238c529352bc01f989a80e80/tests/test_ModelicaSystem.py#L33-L46

Expected Behavior

Library behavior should match documentation.

Version and OS

  • Python Version: 3.12.3
  • OMPython Version: 5904e4e
  • OpenModelica Version: 1.25.0
  • OS: Ubuntu 24.04.2 LTS

I might have a look at fixing this myself. However, I would someone to confirm whether changing the behavior to match the documentation would be acceptable. I guess it would technically break backwards compatibility.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions