﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
2723	OM accepts invalid code	massimo ceraolo	Per Östlund	"Modelica specifications 3.3 at section 9.3 say:
""Connect-equations cannot be used inside if-equations with non-parametric condition"".

From this I understand that the following code is invalid:


{{{
model DynamicConnect
  Modelica.Electrical.Analog.Basic.Resistor R1(R = 1), R2(R = 2), R3(R = 3);
  Modelica.Electrical.Analog.Sources.ConstantVoltage E(V=10);
  Modelica.Electrical.Analog.Basic.Ground G;
equation
  connect(G.p, E.n);
  connect(E.p, R1.p);
  if time < 1 then
    connect(R1.n, R2.p);
  else
    connect(R1.n, R3.p);
  end if;
  connect(R2.n, G.p);
  connect(R3.n, G.p);
  annotation(uses(Modelica(version = ""3.2.1"")));
end DynamicConnect;
}}}

OM accepts it, but gives as result a current through R1 equal to zero. If it had really done what the code says, it should have computed (as long as time<1s) a current through R1 equal to 3.33A

This is indeed what we get if we just use 


{{{
model DynamicConnect
  Modelica.Electrical.Analog.Basic.Resistor R1(R = 1), R2(R = 2), R3(R = 3);
  Modelica.Electrical.Analog.Sources.ConstantVoltage E(V=10);
  Modelica.Electrical.Analog.Basic.Ground G;
equation
  connect(G.p, E.n);
  connect(E.p, R1.p);
//  if time < 1 then
    connect(R1.n, R2.p);
//  else
//    connect(R1.n, R3.p);
//  end if;
  connect(R2.n, G.p);
  connect(R3.n, G.p);
  annotation(uses(Modelica(version = ""3.2.1"")));
end DynamicConnect;
}}}"	defect	closed	low	1.9.1	Frontend	trunk	fixed		
