Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#4381 closed defect (fixed)

OMEdit: A for loop in equations leads to vanishing of connection annotations (wires)

Reported by: Jan Kokert Owned by: Adeel Asghar
Priority: normal Milestone: 1.12.0
Component: OMEdit Version:
Keywords: for loop connection annotations Cc:

Description (last modified by Jan Kokert)

We just figured out another very strange bug in OMEdit. Consider the following example:

model test
  Modelica.Electrical.Analog.Basic.Ground ground1 annotation(
    Placement(visible = true, transformation(origin = {-30, -30}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Electrical.Analog.Basic.Ground ground2 annotation(
    Placement(visible = true, transformation(origin = {30, -30}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Electrical.Analog.Basic.Resistor resistor1 annotation(
    Placement(visible = true, transformation(origin = {30, 10}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
  Modelica.Electrical.Analog.Basic.Capacitor capacitor1 annotation(
    Placement(visible = true, transformation(origin = {-30, 10}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));

  Real a,b;
equation
  for i in 1:2 loop
    a = b;
  end for;
  connect(resistor1.n, ground2.p) annotation(
    Line(points = {{30, 0}, {30, 0}, {30, -20}, {30, -20}}, color = {0, 0, 255}));
  connect(capacitor1.p, resistor1.p) annotation(
    Line(points = {{-30, 20}, {-30, 20}, {-30, 30}, {30, 30}, {30, 20}, {30, 20}}, color = {0, 0, 255}));
  connect(capacitor1.n, ground1.p) annotation(
    Line(points = {{-30, 0}, {-30, 0}, {-30, -20}, {-30, -20}}, color = {0, 0, 255}));
  
  annotation(
    uses(Modelica(version = "3.2.2")));
end test;

The connection annotation between capacitor1 and ground1 is not shown. You can put a /* ... */ comment around the for loop block and the connection will be displayed corretly.

It is always the annotation of the last connection statement, which is not evaluated. I guess, that the internal iterator which evaluates the connection annotations somehow interprets also the for statement and then one annotation is missing in the end.

I hope this analysis helps to fix this issue.

Attachments (1)

test.mo (1.3 KB ) - added by Jan Kokert 8 years ago.

Download all attachments as: .zip

Change History (4)

by Jan Kokert, 8 years ago

Attachment: test.mo added

comment:1 by Jan Kokert, 8 years ago

Description: modified (diff)

comment:2 by Adeel Asghar, 8 years ago

Milestone: Future1.12.0
Resolution: fixed
Status: newclosed

Fixed in e3fdafb/OMCompiler.

comment:3 by Jan Kokert, 8 years ago

A comprehensive fix - well done!

Note: See TracTickets for help on using tickets.