Opened 9 years ago

Closed 3 years ago

#3059 closed discussion (fixed)

parameters in if equation

Reported by: wbraun Owned by: somebody
Priority: normal Milestone: 1.16.0
Component: New Instantiation Version: trunk
Keywords: Cc:

Description (last modified by lochel)

Why is in the following model the variable b structural parameter?
Or why is the user not allowed to change this parameter after translation?

loadString("
model A
  parameter Boolean b = true;
  Real x1,x2;
  Real y;
equation
  x1 = sin(time);
  x2 = cos(time);
  if b then
    y = x1^2+1;
  else
    y = x2^2-1;
  end if;
end A;
");
getErrorString();
instantiateModel(A);
getErrorString();

Result:

true
""
"class A
  parameter Boolean b = true;
  Real x1;
  Real x2;
  Real y;
equation
  x1 = sin(time);
  x2 = cos(time);
  y = 1.0 + x1 ^ 2.0;
end A;
"

Change History (3)

comment:1 Changed 9 years ago by lochel

  • Description modified (diff)
  • Summary changed from parametersin if equation to parameters in if equation

comment:2 Changed 9 years ago by wbraun

At least b should marked somehow that it is replace, so that the Backend has a chance to detected that? For example set VariableAttributes.finalPrefix to true.

comment:3 Changed 3 years ago by perost

  • Component changed from Frontend to New Instantiation
  • Milestone changed from Future to 1.16.0
  • Resolution set to fixed
  • Status changed from new to closed

The new frontend still evaluates the if-equation since that seems to be expected by both users and the backend, but unlike the old frontend it does make b final. So I guess we can consider this fixed for now.

Note: See TracTickets for help on using tickets.