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

variables and constants

variables and constants

How,

    How we can make a difference between variables and constants in OpenModelica code, please give me an example
can anyone help me, please
    thank you in advance for your answer

Re: variables and constants

Code:


model goo
  parameter Real x;
  constant Integer c = 3;
  Real y

equation
  y = c * x;
end goo;

y is a variable that will be calulated in the simulation, x is a variable that you can change before a simulation (but will held cosntant from t=0 until t=end) and c is a constant that you define in the model and can not be change directly.

hope it helps.One good read about modeling in modelica could be found in http://book.xogeny.com/ if you are interested.

cheers

Re: variables and constants

Hello,
  thank you @Arinomo23, your answer it was helpful
now I have another question if you want, it is about blocks in OpenModelica, so can you tell me how I can create a block MIMO in OpenModelica and how I can specify the inputs and the outputs in the programme that I will write in this block,
thank you in advance for your answer.
 

Re: variables and constants

Abderezakabidi,
  hello,

    I want to create two blocks in OpenModelica and to connect between them, such that the second block's inputs are the first block's outputs.
can you help me to do this, please?
thank you   

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