- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » InitType in a PI block
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.
- ceraolo
- 147 Posts
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.
- sjoelund.se
- 1700 Posts
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/
- adrpo
- 885 Posts
Re: InitType in a PI block
Thanks a lot.
Massimo
- ceraolo
- 147 Posts
- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » InitType in a PI block