Opened 9 years ago

Last modified 9 years ago

#3953 new defect

simulate(..) returns record instead of string — at Initial Version

Reported by: Bernhard Thiele Owned by: somebody
Priority: high Milestone: Future
Component: Interactive Environment Version:
Keywords: Cc: Adrian Pop, Martin Sjölund

Description

According the its signature the MOS scripting function simulate(..) should return a String. However, (?sometimes?) a record is returned.

Consider following MOS script:

loadModel(Modelica);

res := simulate(Modelica.Blocks.Examples.PID_Controller);
print("A");
print(res); // No error, but this line will be blank?
print("B");

if true then
  res := simulate(Modelica.Blocks.Examples.PID_Controller);
  print(res); // Throws an error that a record is passed, but a String is expected
else
  print("Just to have an else");
end if;

The first print doesn't work (but gives error), the second print fails with a type error (expected String, but got a record).

How is the return value of simulate(..) supposed to work?

Change History (1)

by Bernhard Thiele, 9 years ago

Attachment: runSimulate.mos added

The mos script calling simulate(..)

Note: See TracTickets for help on using tickets.