Opened 12 years ago

Closed 12 years ago

#2067 closed defect (fixed)

OMNotebook is not able to plot $cpu_time

Reported by: Lennart Ochel Owned by: Adeel Asghar
Priority: high Milestone: 1.9.0
Component: Interactive Environment Version: trunk
Keywords: Cc:

Description

If I simulate with simflags=”-cpu”, it is not possible to plot $cpu_time from OMNotebook.

Attachments (1)

$cpuTime.png (20.9 KB ) - added by Adrian Pop 12 years ago.

Download all attachments as: .zip

Change History (12)

comment:1 by Lennart Ochel, 12 years ago

I try to do something like this in OMNotebook:

loadString("
model test
  Real x;
equation
  x = sin(x) + time;
end test;
");
simulate(test, simflags="-cpu");
plot($cpu_time)

But I get only that error-message:

Error occured building AST
Syntax Error
[<interactive>:9:6-9:6:writable] Error: Lexer failed to recognize '$cpu_time)'

In OMPlot and OMEdit everything is working quite fine.

comment:2 by Lennart Ochel, 12 years ago

I guess we can fix this in two ways:

  1. rename $cpu_time to a modelica-valid variable name. But then we can get into trouble if that specific variable-name is used in any model.
  2. maintain $cpu_time and fix the lexer instead

comment:3 by Adrian Pop, 12 years ago

  1. you can use quoted identifiers '$cpu_time'

comment:4 by Lennart Ochel, 12 years ago

Option 3: r15140

comment:5 by Lennart Ochel, 12 years ago

It is still not working! Maybe that is related to my corrupt OMNotebook installation. Can someone check that out?

loadString("
model test
  Real x;
equation
  x = sin(x) + time;
end test;
");
simulate(test, simflags="-cpu");
plot('$cpu_time')

comment:6 by Lennart Ochel, 12 years ago

Option 3 was probably not a good idea - because that is the same as option 1. '$cpu_time' is already a valid modelica identifier, so we will get into trouble if someone will call a variable '$cpu_time'.

comment:7 by Adrian Pop, 12 years ago

Ok. I'll see if I can add $cpuTime to the lexer. I don't like $cpu_time :)

comment:8 by Lennart Ochel, 12 years ago

Ok - Now it is called $cpuTime. (r15143)

comment:9 by Adrian Pop, 12 years ago

Added $cpuTime to the identifiers known by OpenModelica in r15144.
The example works now and $cpuTime is plotted fine.

Last edited 12 years ago by Adrian Pop (previous) (diff)

by Adrian Pop, 12 years ago

Attachment: $cpuTime.png added

comment:10 by Adrian Pop, 12 years ago


comment:11 by Adeel Asghar, 12 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.