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

Duplicated code in Add3? #772

Closed
modelica-trac-importer opened this issue Jan 14, 2017 · 2 comments
Closed

Duplicated code in Add3? #772

modelica-trac-importer opened this issue Jan 14, 2017 · 2 comments
Assignees
Labels
bug Critical/severe issue L: Blocks Issue addresses Modelica.Blocks
Milestone

Comments

@modelica-trac-importer
Copy link

Reported by davies on 6 Jul 2012 05:59 UTC
I'm new to Modelica, via Wolfram System Modeler. To convert a colleague's model into System Modeler, I needed an Add4 module. Yes, I could have built it out of Add and/or Add3, but I thought I would accelerate my learning by creating my own new block, basically expanding Add3 into Add4. In trying to understand the graphical annotations for Add3, it seemed like there was a lot of code there for such a simple icon. First, I learned the distinction between Icon and Diagram accounting for one level of duplication: for this simple block, the icon and diagram appear to be the same. Next, however, I looked closely at the diagram code and noticed that it seemed to contain two almost identical copies of the same drawing sequence. Presumably one is unnecessary. Is this true, or am I missing something?

Here's the diagram code, with a little formatting to clarify:

Diagram(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{100,100}}, grid={2,2}),
graphics={

Rectangle(extent={{-100,-100},{100,100}}, lineColor={0,0,255}, fillColor={255,255,255}, fillPattern=FillPattern.Solid),
Text(extent={{-100,50},{5,90}}, lineColor={0,0,0}, textString="%k1"),
Text(extent={{-100,-20},{5,20}}, lineColor={0,0,0}, textString="%k2"),
Text(extent={{-100,-50},{5,-90}}, lineColor={0,0,0}, textString="%k3"),
Text(extent={{2,36},{100,-44}}, lineColor={0,0,0}, textString="+"),

Rectangle(extent={{-100,-100},{100,100}}, lineColor={0,0,255}, fillColor={255,255,255}, fillPattern=FillPattern.Solid),
Text(extent={{-100,50},{5,90}}, lineColor={0,0,0}, textString="k1"),
Text(extent={{-100,-20},{5,20}}, lineColor={0,0,0}, textString="k2"),
Text(extent={{-100,-50},{5,-90}}, lineColor={0,0,0}, textString="k3"),
Text(extent={{2,36},{100,-44}}, lineColor={0,0,0}, textString="+")}))

The only apparent difference between the two chunks is the % sign before the text strings k1, k2, k3? Is this meaningful?


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

@modelica-trac-importer modelica-trac-importer added bug Critical/severe issue L: Blocks Issue addresses Modelica.Blocks labels Jan 14, 2017
@modelica-trac-importer
Copy link
Author

Comment by dietmarw on 6 Jul 2012 07:58 UTC
Thanks for the report. You are right this is most likely some leftover which is not easy to detect when only looking at the diagram layer. I'm going to remove the duplicate definition (also present in "Add" btw) right away.

@modelica-trac-importer
Copy link
Author

Comment by dietmarw on 6 Jul 2012 08:01 UTC
Fixed in r5282 (release branch 3.2.1) and ce80bd1 (trunk).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Critical/severe issue L: Blocks Issue addresses Modelica.Blocks
Projects
None yet
Development

No branches or pull requests

3 participants