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

about the use outer and inner variables

about the use outer and inner variables

Hello there,
I need to  share a variable, beta_c, between two classes, which behave at two different packages Compressor and Turbine.
I put this variable as global (inner tag)  in a class which behaves at a package, Turbocharger, which contains the two package Compressor and Turbine.
So the class in  Compressor and Turbine, are able to reference to it by the tag outer.
I have some doubt, if I did that in the right way,

this is the code:
I'm wondering

package Turbocharger
               partial class Coupling Parameters
                         inner Real beta_c (start=0.1);
             end Coupling Parameters;
        package Turbine
                    ......
                 class TurbineQpTW
                         outer Real beta_c (start=0.1);
                         equation
                               ..............
                               beta_c = .........;
                               ..............
                  end TurbineQpTW;
                    ......
       end  Turbine;


      package Compressor
                ...........................
                class CompressorQpTW
                         ...........................
                         outer Real beta_c (start=0.1);
                          ...........................
                  end CompressorQpTW;
                ...........................
       end  Compressor;       
end Turbocharger;




I'm wondering why when I try to compile I receive every-time this message:

   
This class has a top-level outer beta_c, you can use this class as a sub-component.
You have to add an inner element when using this.
   component context: beta_c
    component declared as Real beta_c




I'm wondering if it should be better if I put this variable like an input for the compressor and  an input and an output for the turbine. The variable beta_c is modified only in the turbine, but I'm not able to predict the causality of this system, that is to say I don't know if the compressor will be the first to work or it will be the turbine

have a good day

Edited by: Fonte - Aug-23-10 11:54:51

Re: about the use outer and inner variables

How would you write it?
if you have to share  a variable (coupling parameter) between two components, and this parameter can be modified by these components during the simulation.

a good day

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