- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » Inner Outer variable use for defining...
Inner Outer variable use for defining array size
Inner Outer variable use for defining array size
I want to pass value of 'm' to instantiated models and use it as array size, but while compiling it is saying array size of 's' is not defined, you need to define array size while compiling. Is there any other way to do this except specifically writing (m = m) while instantiating?
Code:
package Test
model one
outer parameter Integer m;
Real s[m];
equation
s = fill(7, m);
end one;
model three
inner parameter Integer m = 2;
one to, th;
end three;
end Test;
Re: Inner Outer variable use for defining array size
I assume you mean something like this:
Code:
model A
outer parameter Integer n;
Real x[n];
end A;
model M
inner parameter Integer n = 2;
A a;
end M;
It seems our current frontend has issues with this, but the new frontend handles it just fine. You can try using the new frontend by either enabling the "Enable experimental new instantiation phase" option in OMEdit->Tools->Simulation, or by setting the compiler flag "-d=newInst" if you use some other tool. If you use OMEdit and you don't have this option you might want to update to a newer version which has it, since the new frontend is constantly improved.
- perost
- 114 Posts
Re: Inner Outer variable use for defining array size
pravin wrote:
Yes. Thank you. But I am using OpenModelica 1.11 due to some compatibility issues for the library I am working on. Is it possible to update OMEdit to newer version and use OpenModelica 1.11?
No, it's not really OMEdit that needs to be updated but the compiler (omc). If you for some reason have to use OM 1.11 then you won't be able to use the new frontend, some OM 1.11 is far too old. I'd recommend trying to fix the issues with your library in that case though, rather than trying to work around old compiler bugs.
- perost
- 114 Posts
- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » Inner Outer variable use for defining...