- Index
- » Programming
- » Modelica Language
- » Array in modelica language
Page Start Prev 1 Next End
Array in modelica language
Re: Array in modelica language
Oct-27-13 21:03:09
Code:
Real r[3]; // Real array, 1 dimension of size 3
- sjoelund.se
- 1700 Posts
Re: Array in modelica language
Oct-27-13 21:09:02
That is matrix syntax (2-dimensional). 1D-arrays use curly bracers:
Real r[3] ={1.1, 2.1, 3.1};
- sjoelund.se
- 1700 Posts
Re: Array in modelica language
Oct-27-13 21:18:40
Code:
>>> loadString("model M Real r[2,3] = [1,2,3;4,5,6]; end M;")
true
>>> instantiateModel(M)
"class M
Real r[1,1];
Real r[1,2];
Real r[1,3];
Real r[2,1];
Real r[2,2];
Real r[2,3];
equation
r = {{1.0, 2.0, 3.0}, {4.0, 5.0, 6.0}};
end M;
"
As you can see, it is also possible to nest the array constructor to create a matrix.
- sjoelund.se
- 1700 Posts
Re: Array in modelica language
Oct-27-13 21:29:17
Hi,
I suggest you read these things:
Modelica specification (Chapter 10 is about arrays):
https://modelica.org/documents/ModelicaSpec33.pdf
Some more stuff about Modelica:
https://www.openmodelica.org/images/doc … torial.pdf
Some OpenModelica documentation:
https://www.openmodelica.org/index.php/ … umentation
Cheers,
Adrian Pop/
- adrpo
- 885 Posts
Page Start Prev 1 Next End
- Index
- » Programming
- » Modelica Language
- » Array in modelica language
There are 0 guests and 0 other users also viewing this topic