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

Consider connect sets when conditional component is disabled #2266

Closed
modelica-trac-importer opened this issue Nov 4, 2018 · 7 comments · Fixed by #2483
Closed

Consider connect sets when conditional component is disabled #2266

modelica-trac-importer opened this issue Nov 4, 2018 · 7 comments · Fixed by #2483
Labels
enhancement New feature or request

Comments

@modelica-trac-importer
Copy link
Collaborator

Reported by henrikt on 6 Sep 2018 12:19 UTC
The current specification (4.4.5, Conditional Component Declaration) says that, when a conditional component is disabled,

and connections to/from the component are removed and connections to/from the component are removed

Besides stating the rule twice, I feel that the rule doesn't take connect sets into consideration in a natural way; it is counter-intuitive to me that it matters how the connections making up the connect set are made. Instead, I would prefer a rule that only removes the component's connectors from the connect sets they are part of.

For connect sets with only two connectors, this would be the same as the current behavior, but for connect sets with more connectors, this would always leave the other connectors connected, regardless of how the connect set is constructed.


Migrated-From: https://trac.modelica.org/Modelica/ticket/2266

@modelica-trac-importer
Copy link
Collaborator Author

Comment by jmattsson on 25 Sep 2018 09:38 UTC
I think the proposed change would be more intuitive while making connections than the current rule, but one issue is how you would show those connections in the diagram layer when the conditional component is disabled. You would want it to be visible that the other connectors in the set are still connected, but I can't see an easily defined way to do that where it doesn't look like the conditional connector is still present/active.

@modelica-trac-importer
Copy link
Collaborator Author

Comment by henrikt on 25 Sep 2018 10:58 UTC
You just need show the component as disabled to start with. Then, and as a bonus, if there is only one connection to a connector of a disabled component, you would also show that connection as disabled to reduce clutter in the diagram.

@modelica-trac-importer
Copy link
Collaborator Author

Comment by hansolsson on 25 Sep 2018 11:36 UTC
Replying to [comment:2 Henrik Tidefelt]:

You just need show the component as disabled to start with. Then, and as a bonus, if there is only one connection to a connector of a disabled component, you would also show that connection as disabled to reduce clutter in the diagram.

Currently we (in Dymola and 3D Experience Platform) visually disable connections if either end is disabled, and that is a local check.

The proposed change would mean that we need to consider all connections to the same end-point when deciding whether to show each connection. That seems more complicated to implement. (There can also be non-graphical conditional connections, hopefully we can ignore those.)

As I see there are two alternatives that could be considered:

  • As a style-guide say that there should only be one connection to each conditional component/connector (well, one inside connection to such a connector and one outside connection to a conditional connector). I believe that in almost all cases we could handle this by moving the connections to the other side - and get something intuitive. We could later enforce those semantics.
  • Another alternative would be to add multi-connections to the language.

In order to evaluate this we would need realistic use-cases.

BTW: I assume this is primarily about physical connectors. For causal connectors it seems a bit weird if you remove a source connected two sinks and when removed it introduces a connection between those two sinks.

@modelica-trac-importer
Copy link
Collaborator Author

Comment by henrikt on 27 Sep 2018 06:12 UTC
I don't see the need for multi-connections in the language in order to solve this, but I am missing my proposal from the list of alternatives:

  • Define disabling of connections in terms of connect sets.

I think it is easy to construct a good use cases with Electrical.Analog. Say you create a circuit with a voltage source and two conditional but equal resistors a and b in parallel. To get nice connections, both in a real-world circuit and in the Modelica diagram, I think the most common way to make connections would be to first connect a and b in parallel, and then connect the parallel resistors to the voltage source. With the current semantics, you would get completely different results depending on which of the equal resistors that get disabled; in once case, the remaining resistor is still connected to the voltage source, in the other case it is not. With the proposed change, the remaining resistor would be connected to the voltage source in both cases.

I can see that the suggested style-guide would address the same problem, but I am much in favor of real language support rather than style guides to avoid non-intuitive semantics.

@modelica-trac-importer
Copy link
Collaborator Author

Comment by henrikt on 27 Sep 2018 06:20 UTC
For the case of causal connectors, removing the source would leave the connect without a source, not magically change the directionality of one of the connectors to satisfy the connect set constraints.

@modelica-trac-importer
Copy link
Collaborator Author

Comment by jmattsson on 2 Nov 2018 11:57 UTC
Getting back to this, I think that I have changed my opinion. I think that there is just as much potential for confusing results with either approach. If I have a conditional resistor a, and two other components b and c connected to it, then I'd say that we cant tell just from that information if the user intended and expected b and c to be connected if a is disabled - either would be reasonable. A user unfamiliar with these specific semantics, that was looking at the diagram would probably have different expectations depending on how the connection lines were laid out.

Given that, I'd say go with the simpler rule - the one we have currently.

The best way to avoid problems with this is probably for tools to give warnings for multiple connections to a conditional connector.

@HansOlsson
Copy link
Collaborator

Poll:
First construct connection sets then remove: 0
No change: 7
But want to confirm with Henrik who created it.

Remove double text: Agreement to change by acclamation.

HansOlsson added a commit to HansOlsson/ModelicaSpecification that referenced this issue Feb 12, 2020
Closes modelica#2266
(minor part; for the main part it was decided to not make any change).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment