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

ComplexInput and ComplexOutput icons have strange greyed boxes #2765

Closed
max-privato opened this issue Nov 2, 2018 · 13 comments · Fixed by #2769
Closed

ComplexInput and ComplexOutput icons have strange greyed boxes #2765

max-privato opened this issue Nov 2, 2018 · 13 comments · Fixed by #2769
Assignees
Labels
L: Complex* Issue addresses Complex, Modelica.ComplexBlocks or Modelica.ComplexMath specification Issue (also) addresses the Modelica language specification
Milestone

Comments

@max-privato
Copy link
Contributor

max-privato commented Nov 2, 2018

ComplexBlocks.Interfaces.ComplexInput and ComplexBlocks.Interfaces.ComplexOutput icons have a strange greyed background (a rounded box below the arrow).

I don't know whether this is done on purpose, but it seems to me rather confusing.
I propose to remove those greyed boxes.

@beutlich beutlich added L: Complex* Issue addresses Complex, Modelica.ComplexBlocks or Modelica.ComplexMath specification Issue (also) addresses the Modelica language specification labels Nov 2, 2018
@beutlich
Copy link
Member

beutlich commented Nov 2, 2018

Confirmed. I always wondered about these grey boxes and strongly believe it is not by design to inherit the icon of the operator record Complex here. It actually looks like a design hole of the Modelica specification to me.

Causal connectors can only be defined by short class definitions using the base-prefix input or output, see section 4.5.1 They cannot be defined by "long-class" extends clause. However, only for "long-class" definitions using inheritance the icon and diagram graphics of the base class can be remapped or set invisible, see section 18.6.3.

Thus, we either have the short-class definition and get a causal connector along with the base class graphics or we have a "long-class" definition, but miss the base-prefix in any case:

connector ComplexNotCausal "Not what we want"
  extends Complex annotation(IconMap(primitivesVisible=false));
  annotation(Icon(coordinateSystem(
    extent={{-100,-100},{100,100}},
    preserveAspectRatio=true,
    initialScale=0.2), graphics={Polygon(
      points={{-100,100},{100,0},{-100,-100},{-100,100}},
      lineColor={85,170,255},
      fillColor={85,170,255},
      fillPattern=FillPattern.Solid)}));
end ComplexNotCausal; 

@max-privato
Copy link
Contributor Author

I see. Thank you for the explanation.
So I understand that we must live with those grey boxes, for an unpredictable (probably very long) time.
I posted the ticket just in case it was an easy fix, which resulted not to be the case.

@beutlich
Copy link
Member

beutlich commented Nov 2, 2018

I played around with an additional ComplexBase class (w/o) icon definition but failed.

Probably, the easiest solution is to remove the icon graphics from the operator record (which is not displayed in the Dymola library panel anyway to pretend a builtin type Complex).

@max-privato
Copy link
Contributor Author

max-privato commented Nov 3, 2018

Probably, the easiest solution is to remove the icon graphics from the operator record (which is not displayed in the Dymola library panel anyway to pretend a builtin type Complex).

A fallback option is just adding an intermediate rectangle between the grey and the triangle as follows. Does not solve the issue in its roots, but hides it, I suppose satisfactorily.

connector ComplexOutput = output Complex "'output Complex' as connector"
  annotation (
  defaultComponentName="y",
  Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{100,
          100}}),
          graphics={Rectangle(
        extent={{-100,102},{100,-100}},
        fillColor={255,255,255},
        fillPattern=FillPattern.Solid,
        pattern=LinePattern.None),
                    Polygon(
        points={{-100,100},{100,0},{-100,-100},{-100,100}},
        lineColor={85,170,255},
        fillColor={255,255,255},
        fillPattern=FillPattern.Solid)}),
  Diagram(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{
          100,100}}), graphics={Polygon(
        points={{-100,50},{0,0},{-100,-50},{-100,50}},
        lineColor={85,170,255},
        fillColor={255,255,255},
        fillPattern=FillPattern.Solid), Text(
        extent={{30,110},{30,60}},
        lineColor={0,0,127},
        textString="%name")}),
  Documentation(info="<html>
<p>
Connector with one output signal of type Complex.
</p>
</html>"));

@beutlich
Copy link
Member

beutlich commented Nov 3, 2018

A fallback option is just adding an intermediate rectangle between the grey and the triangle as follows.

Possible. But not good enough for a standard library.

@max-privato
Copy link
Contributor Author

Possible. But not good enough for a standard library.

Yes it is tricky. In addition, it works well with Dymola, but is unreliable in OM.

@max-privato
Copy link
Contributor Author

I clarify a little.
In case it turns out that because of a hole in Modelica specification no cleaner solutions exist, maybe a tricky -one is acceptable also in MSL?
That's why I called it "a fallback option".

But such a choice should be painless for users. If does not work in OM it is unacceptable.
I will try to understand why. In case there is an easy-to-solve issue OpenModelica code I can open a ticket on this.

beutlich added a commit to beutlich/ModelicaStandardLibrary that referenced this issue Nov 5, 2018
Remove the icon graphics from the operator record Complex, and thus also from the ComplexInput/ComplexOutput (which inherited the graphics via the short-class connector definition)
@beutlich
Copy link
Member

beutlich commented Nov 7, 2018

@HansOlsson Do you confirm the language hole? Shall I create a separate issue (since it does neither fit in modelica/ModelicaSpecification#377 nor modelica/ModelicaSpecification#2200)?

@HansOlsson
Copy link
Contributor

@HansOlsson Do you confirm the language hole?

To me the simplest way of specifying it would be:
connector ComplexOutput=output Complex annotation(IconMap(primitivesVisible=false),Icon(...));

As far as I can understand that should work according to 18.6:
"The allowed annotations for a short class definition is the union of the allowed annotations in classes and on extends-clauses."
But we could likely clarify that further, and e.g. show it as an example.
(Additionally, it does not seem to be implemented in all tools.)

@beutlich
Copy link
Member

beutlich commented Nov 7, 2018

To me the simplest way of specifying it would be:
connector ComplexOutput=output Complex annotation(IconMap(primitivesVisible=false),Icon(...));

Ok.

The other option would be to allow base-prefix for long-class definitions, which opens the general question if every short-class defintion must always be possible to be defined as long-class equivalent.

@beutlich
Copy link
Member

beutlich commented Nov 7, 2018

(Additionally, it does not seem to be implemented in all tools.)

Afaik, SimulationX, OMEdit and MapleSim support the IconMap. It's just that it is not yet used in the MSL and that there are some open clarification issues to be dealt with.

@HansOlsson
Copy link
Contributor

The other option would be to allow base-prefix for long-class definitions., which opens the general question if every short-class defintion must always be possible to be defined as long-class equivalent.

Since you cannot combine the base-prefixed class with any other contents that seems like something that is easy to use incorrectly.

Afaik, SimulationX, OMEdit and MapleSim support the IconMap. It's just that it is not yet used in the MSL and that there are some open clarification issues to be dealt with.

I specifically meant IconMap on short class.

@beutlich
Copy link
Member

beutlich commented Nov 7, 2018

Right, got it. Will open a specification issue with your clarification proposal and a new MSL PR making it a tool issue then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
L: Complex* Issue addresses Complex, Modelica.ComplexBlocks or Modelica.ComplexMath specification Issue (also) addresses the Modelica language specification
Projects
None yet
4 participants