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

Scope or instance of variables beetween to blocks embeded in a model

Scope or instance of variables beetween to blocks embeded in a model

Hi all,

I have created a block PT (pressure transmitter) to give the measure of fluid pressure with some options.
It can deliver absolute pressure as bar a or effective pressure as bar g ( = absolute pressure - atmospheric pressure )
When I put on the graphical sheet of Omedit model a system block, I can then  use the global variable system.p_ambient everywhere.
In the definition of PT block, I have the line:
  type Press = Real(final quantity = "Pressure");
parameter Press Ambient_Pressure = system.p_ambient "Pressure reference (Pa a)";

(or .system.p_ambient)


That causes a compilation error (unknown variable), but if I enter system.p_ambient in instanced object it runs well.

As well, there is no error with  a constant like parameter Press Ambient_Pressure = 101325 "Pressure reference (Pa a)";

An idea ?

/Bruno

Edited by: Brunad - Nov-24-20 16:43:29
There are 0 guests and 0 other users also viewing this topic
You are here: