Opened 9 years ago

Closed 9 years ago

Last modified 7 years ago

#3783 closed defect (fixed)

OMEdit parameter changes overwrite existing arguments

Reported by: Christoph <buchner@…> Owned by: Adrian Pop
Priority: blocker Milestone:
Component: Interactive Environment Version:
Keywords: Cc:

Description

Let's say I start putting together a simple Modelica.Fluid system, with just a source for now (annotations omitted):

model test_overwritten_args
  replaceable package liquid = Modelica.Media.Water.StandardWater;
  Modelica.Fluid.Sources.FixedBoundary boundary(redeclare package Medium = liquid)
end test_overwritten_args;

Checking the model works fine. Now, let's use OMEdit to change the FixedBoundary pressure to what we actually need: Diagram view - double-click - put 10e5 into the p field - OK - save - Check model.

Funny, we get an error message:

[2] 11:18:17 Translation Error
[test_overwritten_args: 3:3-3:204]: component boundary contains the definition of a partial class Medium.
Please redeclare it to any package compatible with Modelica.Media.Interfaces.PartialMedium.

[3] 11:18:17 Translation Error
Error occurred while flattening model test_overwritten_args

Let's check the source:

  Modelica.Fluid.Sources.FixedBoundary boundary(p = 10e5)

The pressure was added, but surprisingly, the medium redeclaration was deleted!
This happens on every change of a parameter, as far as I can see, so on every change I have to go into text view and re-do the redeclare argument, which is very annoying!

Using OMEdit 1.9.4 on Windows 10 64bit.

Change History (9)

comment:1 by Adrian Pop, 9 years ago

Component: *unknown*Interactive Environment
Milestone: Future1.10.0
Owner: changed from somebody to Adrian Pop
Status: newaccepted

Yes, the OMC API that OMEdit is using does not handle redeclare modifications. We will fix that.

comment:2 by Christoph <buchner@…>, 9 years ago

Thank you.
Would it be possible to even make that settable with the UI? Maybe even a dropdown or whatever.
I tried doing this via the modifiers tab, but that didn't seem possible.

comment:3 by Adrian Pop, 9 years ago

Of course, that would be the goal to have a dropdown list for the replaceable classes based on choicesAllMatching annotation. But will probably do this in phases, first we should fix so we don't remove the redeclares when we change the other modifiers.

comment:4 by Christoph <buchner@…>, 9 years ago

first we should fix so we don't remove the redeclares when we change the other modifiers.

I know about the vagaries of time estimates, but can you maybe at least guess when this could be fixed? I'm currently putting together a Medium-using model, and constantly re-adding the redeclares is frustrating. :-/

comment:5 by Christoph <buchner@…>, 9 years ago

Can we put this on at least critical (o priority for 1.10.0? I think OMEdit mangling user code should warrant priorization of this issue.

comment:6 by Adrian Pop, 9 years ago

Priority: highblocker

I already started looking into this one and then I'll continue with #2079.

comment:7 by Adrian Pop, 9 years ago

Resolution: fixed
Status: acceptedclosed

This should be fixed by a21da84/OMCompiler, 43d1b0b/OMEdit and tested in 131a472/OpenModelica-testsuite.

comment:8 by Christoph <buchner@…>, 9 years ago

Thank you, confirmed fixed!

comment:9 by Martin Sjölund, 7 years ago

Milestone: 1.10.0

Milestone deleted

Note: See TracTickets for help on using tickets.