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

Declaring variables

Declaring variables

I can test this, but does anyone know if a real Modelica variable can be declared as both input and output? Thanks, T.C. Why would I want to do something as weird as this? The answer is to create an interface class in a computer generated simulation environment.

Re: Declaring variables

Modelling a variable as 'input' or 'output' comes with the fact that the "signal" is directional.
Clearly a variable cannot be seen as both: otherwise simply it is not neither a input or output and it makes no sense to flag it as an input or output.

Why would you actually need to flag these variables as input AND output?
I think it's more a modelling error rather than else...

One of the most common problems is that one would create a connector and it gets stuck when it finds out that you have to have the same number of flow and state variables: well, if this is your case, you have to look at the Modelica library to have your answer. Modelica.Blocks.Interfaces is a perfect example.

As you can see there are plenty of XXXInput and XXXOuput: yes, you have to provide two different components. One for Input and one for Output.

But I'm just inferring, I don't know your application.

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