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

InitType in a PI block

InitType in a PI block

I would like to set intitType=3 in a PI block.
I've written the following simple minimal model:

Code:

model PI

  Modelica.Blocks.Continuous.PI PI(initType = 3, x_start = 1);
  Modelica.Blocks.Sources.Constant const;
equation
  connect(PI.u,const.y);
end PI;

When I run this in OM r17838 I get the following error:

Translation    08:23:37    C:\OpenModelica1.9.1Nightly\lib\omlibrary\Modelica 3.2.1\Blocks\Continuous.mo    568:5-571:40    Type mismatch in binding initType = 3, expected subtype of enumeration(NoInit, SteadyState, InitialState, InitialOutput), got type Integer.

Can someone tell me how to solve this?

Thank you.

Re: InitType in a PI block

There is no InitType=3. Use Modelica.Blocks.Types.Init.InitialState or Modelica.Blocks.Types.InitPID.InitialState depending on if you use a PI or PID block.

Re: InitType in a PI block

Hi,

Modelica Specification is clear when it says that you cannot bind Integers to Enumerations.
Dymola supports it, but is not really conform to the Modelica Specification!
Use enumerations when you bind/compare enumerations and use Integer(Enumeration) when you want to convert enumerations to Integers.
See more here:
https://trac.openmodelica.org/OpenModel … tLibraries

Cheers,
Adrian Pop/

Re: InitType in a PI block

Thanks a lot.
Massimo

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