Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register

How to modify a component's value within a redeclare statement via CLI

How to modify a component's value within a redeclare statement via CLI

Hello there!

I asked this question on stackoverflow, with a complete working example and more explanation:
https://stackoverflow.com/questions/62168453

But the gist is: I would like to be able to replace the "sensitivity" in the example below via a command line expression. Using setComponentModifierValue() allows me to edit component.value, but not anything within a redeclare statement.

Code:


  model System "A system with a component"
    Component component(value = 200, redeclare SpecialSensor sensor(sensitivity = 10)) "Modified component";
  end System;

While my question refers to the use of Python, any answer relying on the OpenModelica Compiler CLI should help me, since omc.sendExpression() is just a wrapper around the CLI. I would be grateful for any advice.

Or will this only (maybe) be possible when this issue has been resolved (i.e. when this functionality has been added to OMEdit)?
https://trac.openmodelica.org/OpenModelica/ticket/2079

Edited by: jzimmer - Jun-03-20 10:21:10

Re: How to modify a component's value within a redeclare statement via CLI

Is not possible yet.
I'm working on getting my support for redeclares in so that you can change those as well.
Hopefully should be available later this week in the nightly builds.

Re: How to modify a component's value within a redeclare statement via CLI

Thanks for the fast response, I will look out for those builds!

There are 0 guests and 0 other users also viewing this topic
You are here: