Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conditional connectors not handled by OMEdit #2081

Closed
OpenModelica-TracImporter opened this issue Jun 27, 2020 · 13 comments
Closed

Conditional connectors not handled by OMEdit #2081

OpenModelica-TracImporter opened this issue Jun 27, 2020 · 13 comments
Assignees
Labels
COMP/GUI/InstBased Interface Issues with new instantiation-based OMEdit feature COMP/GUI/OMEdit Issue and pull request related to OMEdit COMP/OMC/Interactive Environment
Milestone

Comments

@OpenModelica-TracImporter
Copy link
Member

No description provided.

@adeas31
Copy link
Member

adeas31 commented May 26, 2021

See original ticket description on trac #2081.

See also #5913 and #7492

@casella
Copy link
Contributor

casella commented Nov 10, 2021

@adrpo, I'm trying to figure out myself why this is so difficult. I tried a simple example case, see
TestConditionalConnectors.txt; I opened TestConditionalConnectors.Test1 and checked omedicommunication.log.

As I understand the problem is that currently OMEdit fetches display information from the class definitions

getElements(TestConditionalConnectors.Test1, useQuotes = true) 00:34:00:407
{{"co", "-", "TestConditionalConnectors.M1", "m1", "", "public", "false", "false", "false", "false", "unspecified", "none", "unspecified", "$Any", "{}"}} 00:34:00:407
#s#; 0.000000; 0.317000; 'getElements(TestConditionalConnectors.Test1, useQuotes = true)'

getElementAnnotations(TestConditionalConnectors.Test1) 00:34:00:407
{{Placement(true,0.0,0.0,-10.0,-10.0,10.0,10.0,0.0,-,-,-,-,-,-,)}} 00:34:00:408
#s#; 0.000000; 0.317000; 'getElementAnnotations(TestConditionalConnectors.Test1)'

getDiagramAnnotation(TestConditionalConnectors.Test1) 00:34:00:408
{} 00:34:00:408
#s#; 0.000000; 0.317000; 'getDiagramAnnotation(TestConditionalConnectors.Test1)'

countMessages() 00:34:00:409
(0,0,0) 00:34:00:409
#s#; 0.000000; 0.317000; 'countMessages()'

getElements(TestConditionalConnectors.M1, useQuotes = true) 00:34:00:409
{{"co", "-", "Boolean", "activateOutput", "", "public", "false", "false", "false", "false", "parameter", "none", "unspecified", "$Any", "{}"},{"co", "-", "TestConditionalConnectors.RealOutput", "y", "", "public", "false", "false", "false", "false", "unspecified", "none", "unspecified", "$Any", "{}"}} 00:34:00:409
#s#; 0.000000; 0.317000; 'getElements(TestConditionalConnectors.M1, useQuotes = true)'

getElementAnnotations(TestConditionalConnectors.M1) 00:34:00:409
{{},{Placement(true,100.0,2.0,-10.0,-10.0,10.0,10.0,0.0,100.0,1.77636e-15,-20.0,-20.0,20.0,20.0,0.0)}} 00:34:00:409
#s#; 0.000000; 0.317000; 'getElementAnnotations(TestConditionalConnectors.M1)'

getElements(TestConditionalConnectors.RealOutput, useQuotes = true) 00:34:00:410
{} 00:34:00:410
#s#; 0.000000; 0.317000; 'getElements(TestConditionalConnectors.RealOutput, useQuotes = true)'

getDiagramAnnotation(TestConditionalConnectors.RealOutput) 00:34:00:410
{-100.0,-100.0,100.0,100.0,true,-,-,, {Polygon(true, {0.0, 0.0}, 0.0, {0, 0, 127}, {255, 255, 255}, LinePattern.Solid, FillPattern.Solid, 0.25, {{-100.0, 50.0}, {0.0, 0.0}, {-100.0, -50.0}}, Smooth.None), Text(true, {0.0, 0.0}, 0.0, {0, 0, 127}, {0, 0, 0}, LinePattern.Solid, FillPattern.None, 0.25, {{30.0, 60.0}, {30.0, 110.0}}, "%name", 0.0, {-1, -1, -1}, "", {}, TextAlignment.Center)}} 00:34:00:411
#s#; 0.000000; 0.317000; 'getDiagramAnnotation(TestConditionalConnectors.RealOutput)'

but not from the actual instances. Specifically, it gets the information that TestConditionalConnectors.Test1 contains an instance of class TestConditionalConnectors.M1 named m1, but then it asks about elements of the class M1, not of the specific instance m1, which is were the information about the activation of conditional connectors is defined.

Do I understand correctly?

Is the problem that we should switch from gathering information about classes to gathering information about their instances?

@casella
Copy link
Contributor

casella commented Nov 11, 2021

We need a plan to implement an "instance-based" mechanism in place of the current one, which will also solve other long-standing issues. @perost and @adeas31 will work on that, with input from @adrpo that has ideas how to do this.

@casella
Copy link
Contributor

casella commented Nov 29, 2021

The current situation is that all conditional connectors are always shown. There were some cases where this did not happen, see #8172 and #8210, they were fixed in #8237.

Other cases are more involved, e.g. because of redeclared classes, see #8210, and cannot be easily fixed with the curent approach.

Eventually, once the new instantiation-based framework is established, #8237 should be reverted and the visibility attribute should be correctly evaluated in OMEdit based on the latest parameter value input.

@casella
Copy link
Contributor

casella commented Jan 10, 2022

Additionally, we need to update the icons that depend on parameters dynamically.

@casella
Copy link
Contributor

casella commented Jul 14, 2022

Prototype implementation available since PR #9230, start OMEdit with OMEdit --NAPI=true. Still doesn't show connections, but the conditional connectors are correctly updated.

MWE: TestConditionalConnectors.mo.txt, R1 has an activated thermal port, R2 hasn't. Changing the parameter useHeatPort of R2 immediately affects the status of the conditional connector shown on the diagram.

immagine

@niklwors
Copy link
Contributor

@adeas31 I tried the prototype with our BRSL pumps library and for the pumps components. I now only see a blank diagram or OMedit crashes. Also the error appears: OMCompiler/Compiler/Script/NFApi.mo: 901:9-901:92]: Internal errorNFApi.buildInstanceTree got unknown class tree
I used the library Rexroth_Pumps/package.mo and then you can use e.g. the component Rexroth_Pumps.AxialPistonUnits.VariableUnits.A4VSO
There are three ports which should no be visible.

@adrpo
Copy link
Member

adrpo commented Jul 14, 2022

@niklwors I suspect the getModelInstance API has some issues with some complex models for now. @perost will fix them when he comes back from the holidays. They have started with small models so they can do proper testing.

@casella
Copy link
Contributor

casella commented Jul 14, 2022

@niklwors, thanks for reporting!

What we have now is just a demo. It shows we are on the right track, but is still far from being usable. Work on that will resume from mid-August.

@adeas31
Copy link
Member

adeas31 commented Jul 15, 2022

@niklwors please send your library to me. I will do some testing.

@niklwors
Copy link
Contributor

@adeas31 Thank you, @adrpo can provide you with this information

@casella casella moved this from In progress to Top Priority in Improvements for BR Jul 24, 2022
@casella casella added the COMP/GUI/InstBased Interface Issues with new instantiation-based OMEdit feature label Oct 19, 2022
@adeas31
Copy link
Member

adeas31 commented Dec 4, 2022

@niklwors several improvements are done. Can you please test this again and report.

@casella casella modified the milestones: 1.20.0, 1.21.0 Dec 8, 2022
@casella
Copy link
Contributor

casella commented Jan 11, 2023

This functionality is now implemented for good in the new instance-based API, currently activated by running OMEdit --NAPI=true.

Please reopen this ticket if there are any problems which are specific of this feature.

@casella casella closed this as completed Jan 11, 2023
Improvements for BR automation moved this from Top Priority to Done Jan 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
COMP/GUI/InstBased Interface Issues with new instantiation-based OMEdit feature COMP/GUI/OMEdit Issue and pull request related to OMEdit COMP/OMC/Interactive Environment
Projects
Development

No branches or pull requests

6 participants