Opened 9 years ago
Last modified 4 years ago
#4372 accepted defect
replaceable path changes when a model icon is moved — at Initial Version
| Reported by: | Andrea Bartolini | Owned by: | Adeel Asghar |
|---|---|---|---|
| Priority: | blocker | Milestone: | 1.19.0 |
| Component: | OMEdit | Version: | v1.12.0 |
| Keywords: | Cc: |
Description
Please consider the following models (also attached):
package P1
model M1
extends Modelica.Blocks.Interfaces.SISO;
Boolean Flag = false;
Real x = if Flag then u else 0;
equation
y = 0.5*x;
end M1;
model M2
extends Modelica.Blocks.Interfaces.SISO;
replaceable model Mx = P1.M1;
Mx mx annotation(Placement(visible = true, transformation(origin = {-2, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
equation
connect(u, mx.u) annotation(Line(points = {{-120, 0}, {-14, 0}}, color = {0, 0, 127}));
connect(mx.y, y) annotation(Line(points = {{9, 0}, {110, 0}}, color = {0, 0, 127}));
end M2;
model M3
P1.M2 m2(redeclare model Mx=P1.M1(Flag=true)) annotation(Placement(visible = true, transformation(origin = {-2, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Blocks.Sources.Step step1(startTime = 0.5) annotation(Placement(visible = true, transformation(origin = {-36, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
equation
connect(step1.y, m2.u) annotation(Line(points = {{-24, 0}, {-14, 0}}, color = {0, 0, 127}));
end M3;
end P1;
The model M2 defines the model Mx as replaceable and the model M3 uses M2 redeclaring the model Mx in order to change the Flag parameter value from false to true.
Simulating the model M3 the results is according I expect, the Flag parameter value is changed (from false to true) and the step is propagated to the model m2 output.
Now open the model M2 and simply move the model mx
the line:
Mx mx annotation(Placement(visible = true, transformation(origin = {-2, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
is changed by OmEdit in:
P1.M2.Mx mx annotation(Placement(visible = true, transformation(origin = {-2, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
and the model mx now seems to be no more replaceable, in fact, re-simulating the model M3 the Flag parameter value now is not propagated and the output y of model m2 stays fixed to 0.
Attached are: package P1, output before M1 moving, output after M1 moving.
OMEdit 1.12.0~dev-250-g0f5c07d
Connected to OpenModelica 1.12.0~dev-561-gc489db1
sysop: Ubunti 14.04 - 34 bit
Change History (3)
by , 9 years ago
| Attachment: | BeforeMoving.png added |
|---|
by , 9 years ago
| Attachment: | AfterMoving.png added |
|---|
