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

Trouble importing packages: Class SI.Temperature not found

Trouble importing packages: Class SI.Temperature not found

I think I'm missing something obvious, but I don't seem to be able to use types from packages I've imported:

Code:


model ImportExample
  import SI = Modelica.SIunits;

  SI.Temperature T;
  initial equation
    T=2;
  equation
    der(T) = 1-T;
end ImportExample;

Results in:

Code:


omc -s ../ModelExample.mo
Error processing file: ../ModelExample.mo
[/path/to/ModelExample.mo:4:3-4:19:writable] Error: Class SI.Temperature not found in scope ImportExample.
Error: Error occurred while flattening model ImportExample

# Error encountered! Exiting...
# Please check the error message and the flags.

Execution failed!

Re: Trouble importing packages: Class SI.Temperature not found

You need to load the Modelica library also

Code:


omc -s ../ModelExample.mo Modelica

alternative with a script.mos containing;

Code:


loadModel(Modelica); getErrorString();
loadFile("../ModelExample.mo"); getErrorString();
translateModel(ModelExample); getErrorString();

then execute it via;

Code:


omc script.mos

Re: Trouble importing packages: Class SI.Temperature not found

Thanks, Adrian!

There are 0 guests and 0 other users also viewing this topic
You are here: