Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#2310 closed defect (fixed)

referenced a variable that was not declared as a <variable>

Reported by: Lennart Ochel Owned by: Lennart Ochel
Priority: critical Milestone: 1.9.0
Component: Code Generation Version: trunk
Keywords: Cc: Adeel Asghar, Martin Sjölund

Description (last modified by Lennart Ochel)

This model should probably be simulated without errors:

model foo
  Real a;
  Real b(fixed=true);
initial equation
  pre(a) = b^2;
equation
  der(a) = time;
  when initial() then
    b = pre(a);
  end when;
end foo;

output:

assert            | assert  | Referenced '$PRE._a' that was not declared as <variable>


Process crashed

Change History (10)

comment:1 by Lennart Ochel, 11 years ago

Description: modified (diff)

comment:2 by Lennart Ochel, 11 years ago

Owner: changed from probably noone to Lennart Ochel
Status: newassigned

With +d=initialization I get also:

Assuming fixed start value for the following 1 variables:
         a:VARIABLE() .foo, .Real type: Real

This is wrong. The initial conditions are already fully specified.

comment:3 by Lennart Ochel, 11 years ago

Description: modified (diff)

comment:4 by Lennart Ochel, 11 years ago

Cc: Adeel Asghar added

comment:5 by Adeel Asghar, 11 years ago

OMEdit passes the -lv=LOG_STATS flag to the executable by default. This flag is making the executable crash. I will investigate about it a bit more tonight. But perhaps you can have a look at the way flags of the executable are used since you have rewritten them.

comment:6 by Adeel Asghar, 11 years ago

Cc: Martin Sjölund added
Component: BackendCode Generation

A little bit of more debugging shows that the problem is not with simulation flags. The -lv=LOG_STATS enables the measure_time_flag and the process will go onto reading of the model_info.xml file.

In SimCodeDump.tpl we are writing the xml file. Either the equations tag writing should be corrected or we should add the variable that is referenced in the equation to the variables tag.

comment:7 by Lennart Ochel, 11 years ago

Good hint. I had forgotten that OMEdit passes LOG_STATS per default. Now things make sense again :-)

comment:8 by Lennart Ochel, 11 years ago

Priority: highcritical

comment:9 by Lennart Ochel, 11 years ago

Resolution: fixed
Status: assignedclosed

Fixed in r16898. I added the $PRE._* variables tot he model_info.xml.

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

Replying to lochel:

With +d=initialization I get also:

Assuming fixed start value for the following 1 variables:
         a:VARIABLE() .foo, .Real type: Real

This is wrong. The initial conditions are already fully specified.

I fixed this already some revision ago.

Note: See TracTickets for help on using tickets.