Opened 12 years ago

Last modified 8 years ago

#2309 closed defect

Cannot read numbers from a file — at Version 3

Reported by: paul Owned by: Adeel Asghar
Priority: high Milestone: 1.12.0
Component: Code Generation Version: trunk
Keywords: Cc: Willi Braun

Description (last modified by Lennart Ochel)

With OMEdit i wanted to execute the following model:

model ReadNumber
  import Streams = Modelica.Utilities.Streams;
  import Strings = Modelica.Utilities.Strings;
  constant String filename = "<pathtofile>/numberfile.txt";
  Integer lineno = 1;
  String line;
  Boolean eof;
  Real value;
algorithm
  (line, eof) := Streams.readLine( filename, lineno );
  value := Strings.scanReal( line );
end ReadNumber;

The content of numberfile.txt in the path <pathtofile> is

1.1
2.1
3.1

OMEdit apparently exectutes all steps including simulation. There is no error message. However, the plot shows no variables to be displayed, as if no simulation had been done.

I am using OpenModelica 1.9.0 beta4+dev (r16769). The two original files have been attached.

Change History (6)

by anonymous, 12 years ago

Attachment: ReadNumber-br.mo added

by anonymous, 12 years ago

Attachment: numberfile.txt added

comment:1 by Lennart Ochel, 12 years ago

Component: BackendOMEdit
Owner: changed from probably noone to Adeel Asghar

I tested your model with OMNotebook and OMEdit. It is working fine with both tools.

using Windows and OpenModelica 1.9.0 beta4+dev (r16751)

Last edited 12 years ago by Lennart Ochel (previous) (diff)

by Adeel Asghar, 12 years ago

Attachment: plot.png added

comment:2 by Adeel Asghar, 12 years ago

It even works fine for me also. Check the attached screenshot "plot.png".

comment:3 by Lennart Ochel, 12 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.