Opened 10 years ago

Closed 4 years ago

#3108 closed defect (fixed)

evaluation of structural parametrers

Reported by: Lennart Ochel Owned by: Adrian Pop
Priority: high Milestone: 1.16.0
Component: New Instantiation Version: trunk
Keywords: Cc:

Description

The following model contains two structural parameters. Unfortunately, only N gets evaluated correctly. The other one (p) is not evaluated correctly. That means the if-equation is not simplified and the parameter is not marked as "unchangeable" in OMEdit.

model Unnamed
  Real x(fixed=p, start=1);
  parameter Boolean p = false;
  parameter Integer N=2;
  Real r[N] = fill(0.0, N);
equation 
  if p then
    der(x) = time;
  else
    x = time;
  end if;
end Unnamed;

Change History (4)

comment:1 by Martin Sjölund, 10 years ago

For me the if-equation is simplified, but p is marked isValueChangeable=true.

in reply to:  1 comment:2 by Lennart Ochel, 10 years ago

Replying to sjoelund.se:

For me the if-equation is simplified, but p is marked isValueChangeable=true.

You are right. It is the following if-expression that will not get simplified: time = if p then der(x) else x;

comment:3 by Martin Sjölund, 10 years ago

Owner: changed from somebody to Adrian Pop
Status: newassigned

I got this trace:

addEvaluatedCref: p
addEvaluatedCref: N
addEvaluatedCref: N
addEvaluatedCref: p
Make cr final N

For both the original and the new code. In the original the if-equation is evaluated but the parameter is never marked structural. The second one is more correct (it gives correct results, but p should be evaluated; probably by the back-end).

comment:4 by Per Östlund, 4 years ago

Component: FrontendNew Instantiation
Milestone: Future1.16.0
Resolution: fixed
Status: assignedclosed

The new frontend evaluates both p and N and sets them both to be final.

Note: See TracTickets for help on using tickets.