﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
4372	replaceable path changes when a model icon is moved	Andrea Bartolini	Adeel Asghar	"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"	defect	new	blocker	1.12.0	OMEdit	v1.12.0			
