Opened 12 years ago

Closed 16 months ago

#2081 closed defect (fixed)

Conditional connectors not handled by OMEdit

Reported by: Francesco Casella Owned by: Per Östlund
Priority: blocker Milestone: 1.21.0
Component: OMEdit Version: trunk
Keywords: Cc: Dietmar Winkler, Per Östlund

Description

Since cardinality was deprecated a few years ago, conditional connectors have been used extensively, in particular in the MSL.

Currently OMEdit always display conditional connectors even when they are switched off, which might be a bit confusing for the user. It would be nice (and probably not too hard to implement in MetaModelica) if we only drew conditional connectors when they are active.

Change History (41)

comment:1 by Francesco Casella, 12 years ago

Component: BackendOMEdit
Milestone: 1.9.0
Owner: changed from probably noone to Adeel Asghar
Status: newassigned

comment:2 by Martin Sjölund, 12 years ago

Summary: Conditional connectors not handled by OMCConditional connectors not handled by OMEdit

comment:3 by Francesco Casella, 11 years ago

Milestone: 2.0.0

comment:4 by Francesco Casella, 11 years ago

Priority: highcritical

comment:5 by Francesco Casella, 11 years ago

Milestone: 2.0.01.9.1
Owner: changed from Adeel Asghar to sjolund.se

I'm told by Adeel that OMEdit can now handle this, but that OMC always returns visible. Can you please have a look and check why? Any example from the Modelica.Electrical library can be used for this purpose.

comment:6 by Martin Sjölund, 11 years ago

Owner: changed from sjolund.se to Adeel Asghar

I have no clue what API commands are used for this... I need to know the command and expected output.

in reply to:  6 comment:7 by Adeel Asghar, 11 years ago

Replying to sjoelund.se:

I have no clue what API commands are used for this... I need to know the command and expected output.

For example, heatPort is the 3rd component of Modelica.Electrical.Analog.Interfaces.ConditionalHeatPort see the output below,

getComponents(Modelica.Electrical.Analog.Interfaces.ConditionalHeatPort)
{{Boolean,useHeatPort,"=true, if HeatPort is enabled", "public", false, false, false, false, "parameter", "none", "unspecified",{}},{Modelica.SIunits.Temperature,T,"Fixed device temperature if useHeatPort = false", "public", false, false, false, false, "parameter", "none", "unspecified",{}},{Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a,heatPort,"", "public", false, false, false, false, "unspecified", "none", "unspecified",{}},{Modelica.SIunits.Power,LossPower,"Loss power leaving component via HeatPort", "public", false, false, false, false, "unspecified", "none", "unspecified",{}},{Modelica.SIunits.Temperature,T_heatPort,"Temperature of HeatPort", "public", false, false, false, false, "unspecified", "none", "unspecified",{}}}

Following command gives the placement annotation values for Modelica.Electrical.Analog.Interfaces.ConditionalHeatPort components,

getComponentAnnotations(Modelica.Electrical.Analog.Interfaces.ConditionalHeatPort)
{{},{Dialog("General","Parameters",true,false,false,"","","","","",false)},{Placement(true,0.0,0.0,-10.0,-110.0,10.0,-90.0,0.0,0.0,0.0,-10.0,-110.0,10.0,-90.0,0.0)},{},{}}

Note that we get Placement(true which means heatPort should be visible. However, the code in the model says,

Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a heatPort(T(start=T)=T_heatPort, Q_flow=-LossPower) if useHeatPort annotation (Placement(transformation(extent={{-10,-110},{10,-90}}), iconTransformation(extent={{-10,-110},{10,-90}})));

which means if useHeatPort parameter is true only then use the placement annotation.

For a running example take a look at resistor component in Dymola.

comment:8 by Martin Sjölund, 11 years ago

Owner: Adeel Asghar removed

I still don't know what any of those things in the output mean... That API really should output a record.

And yes, you're doing it wrong if you query the class if it is enabled or not. This is a property of the component. If you have a class SomeClass(visible=true) component if someCondition, you need to look for both class being visible and the component actually being active given the parameters.

comment:9 by Adrian Pop, 11 years ago

Yes. The Placement is visible = true by default (See Constants.mo, the Placement record) if is not specifically given Placement(visible = false).
OMEdit should query the value of the conditional parameter useHeatPort in the class where is used and if is false the component annotation *and* its connections should be ignored!

Last edited 11 years ago by Adrian Pop (previous) (diff)

comment:10 by Adrian Pop, 11 years ago

The problem is a bit more complicated by the fact that the condition in conditional components
is an expression and currently there is no way for OMEdit to ask OMC the value of an expression. A workaround could be made by instantiating the model and seeing if the component is present or not in the DAE but that would slow things down even more.

comment:11 by Dietmar Winkler, 11 years ago

Cc: Dietmar Winkler added

comment:12 by Martin Sjölund, 10 years ago

Milestone: 1.9.11.9.2

This ticket was not closed for 1.9.1, which has now been released. It was batch modified for milestone 1.9.2 (but maybe an empty milestone was more appropriate; feel free to change it).

comment:13 by Martin Sjölund, 10 years ago

Milestone: 1.9.21.9.3

Milestone changed to 1.9.3 since 1.9.2 was released.

comment:14 by Adeel Asghar, 10 years ago

Cc: Per Östlund added

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

Milestone: 1.9.31.9.4

Moved to new milestone 1.9.4

comment:16 by Francesco Casella, 9 years ago

What is the current status with this ticket?

comment:17 by Dietmar Winkler, 9 years ago

Good question. The status says assigned but no one in the "Owned by" field ;-)

comment:18 by Per Östlund, 9 years ago

Owner: set to Per Östlund
Status: assignedaccepted

I guess I should take a look at it. Might be hard to implement though, but we'll see.

comment:19 by Francesco Casella, 9 years ago

Even a partial implementation that does not cover all the cases but just the basic one in the MSL would be very good.

comment:20 by Adrian Pop, 9 years ago

Owner: changed from Per Östlund to Adrian Pop

comment:21 by Adrian Pop, 9 years ago

For this a new front-end is needed. I'm still working on it :)

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

Milestone: 1.9.41.9.5

Milestone pushed to 1.9.5

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

Milestone: 1.9.51.10.0

Milestone renamed

comment:24 by Francesco Casella, 9 years ago

Milestone: 1.10.02.0.0
Priority: criticalblocker

I made this a blocker for 2.0, unless there are really compelling technical reasons why this cannot be solved by that milestone.

comment:25 by Francesco Casella, 6 years ago

Milestone: 2.0.01.14.0

Moved to 1.14.0, once the new API is in place this shouldn't be too hard.

comment:26 by Francesco Casella, 6 years ago

See #2132

comment:27 by massimo ceraolo, 6 years ago

Not only conditional connectors are displayed, but they can even be connected!

Even more surprisingly it can be connected to a non compatibile connector: for instance the heatport of a resistor can currently be connected by mouse action to one of its pins.

in reply to:  27 ; comment:28 by Francesco Casella, 6 years ago

Replying to ceraolo:

Not only conditional connectors are displayed, but they can even be connected!

Of course they can, as OMEdit is unaware of their actual activation status, because of the limitations discussed in 2132. Once those are resolved, this should no longer be an issue.

Even more surprisingly it can be connected to a non compatibile connector: for instance the heatport of a resistor can currently be connected by mouse action to one of its pins.

This is another story, I was not aware of it, thanks for pointing this out! I opened #5542 and #5543 on this topic.

comment:29 by Francesco Casella, 5 years ago

Owner: changed from Adrian Pop to Adeel Asghar
Status: acceptedassigned

@adeas31, I understand this requires changes both to OMEdit and to the API. Are the former already done, and what is missing from the API?

comment:30 by Adeel Asghar, 5 years ago

I can't do much in OMEdit about it yet until we handle this in the API. The problem is that we need a instance on which the modifiers are set.

comment:31 by Francesco Casella, 5 years ago

I mean, could we define the API interface precisely, so you can work on it and then we don't have to wait once @adrpo manages to take care of his part?

in reply to:  28 comment:32 by massimo ceraolo, 5 years ago

Of course they can, as OMEdit is unaware of their actual activation status, because of the limitations discussed in 2132. Once those are resolved, this should no longer be an issue.

Sure. I mentitled this because changes the relevance of the issue.
If a newbie (a student) can see a port that should not be visible but cannot connect it, is a relatively minor glitch. Totally different is the situation when he can. especially in cases where the conditional port is near a real one.
(It has happened and was not easy to spot)

comment:33 by Francesco Casella, 5 years ago

@ceraolo, in any case this is expected to get fixed in 1.14.0 (or possibly 1.14.1 if we run out of time)

comment:34 by Francesco Casella, 5 years ago

Milestone: 1.14.01.15.0

Releasing 1.14.0 which is stable and has many improvements w.r.t. 1.13.2.

This issue, previously marked as blocker for 1.14.0, is rescheduled to 1.15.0

comment:35 by Francesco Casella, 5 years ago

Milestone: 1.15.01.16.0

Release 1.15.0 was scrapped, because replaceable support eventually turned out to be more easily implemented in 1.16.0. Hence, all 1.15.0 tickets are rescheduled to 1.16.0

comment:36 by Francesco Casella, 5 years ago

Owner: changed from Adeel Asghar to Per Östlund

@perost, could you possibly take care of this? Otherwise, please reassign it to @adrpo

comment:37 by Francesco Casella, 4 years ago

Milestone: 1.16.01.17.0

Retargeted to 1.17.0 after 1.16.0 release

comment:38 by Francesco Casella, 4 years ago

Milestone: 1.17.01.18.0

Rescheduled to 1.18.0

comment:39 by Francesco Casella, 3 years ago

Milestone: 1.18.0

Ticket retargeted after milestone closed

comment:40 by Francesco Casella, 3 years ago

Milestone: 1.19.0

1.18.0 blocker tickets moved to 1.19.0

comment:41 by Adeel Asghar, 16 months ago

Milestone: 1.19.01.21.0
Resolution: fixed
Status: assignedclosed

Fixed with instance api.

Note: See TracTickets for help on using tickets.