Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register

terminal() call

terminal() call

Hello,
the following code:

model test111
  Real a(start = 0.1);
algorithm
if terminal() then
    a:=1.0;
  Modelica.Utilities.Streams.print("terminal", "terminal.txt");
  end if;
end test111;

gives me the error:

test111.cpp:734: error: `terminal' was not declared in this scope

Does OpenModelica currently support the terminal() function?

Frank

Re: terminal() call

No, we don't support it properly.
I could alias it to false if you need the code to run (but still not generate the event). I'm adding a ticket here: http://openmodelica.org:8080/cb/issue/1 … ation=true

You can also work around this bug by adding "#define terminal() 0" to OPENMODELICAHOME/include/omc/modelica.h

Re: terminal() call

Thanks for the work around, but I need to write a text file after the simulation to export some data.

Could I use the "destructor" of a external object as a work around?

Re: terminal() call

Yes, constructor/deconstructor is called properly when defined as top-level variables of a simulation.
External Objects work fine for non-array inputs and without any weird call mapping (like trying to send constant expressions...).

Re: terminal() call

What does "top level" mean? I did some tests with a model that contains several blocks (each block has a external object inside).
In my test case the constructor and destructor seems to be called as expected.

Do I run into problems if the bock some were on a deeper model level?
I need a reliable solution because my block might be used somewhere in the model

Re: terminal() call

Not created in a local scope (i.e. inside a function-call).

Re: terminal() call

ok

There are 0 guests and 0 other users also viewing this topic