- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » Modelica Scripting Language
Modelica Scripting Language
Re: Modelica Scripting Language
They are built-in to the language:
https://build.openmodelica.org/Document … ()%27.html
https://build.openmodelica.org/Document … ()%27.html
- sjoelund.se
- 1700 Posts
Re: Modelica Scripting Language
https://build.openmodelica.org/Document … ()%27.html
Or just fill an array before the loop so you can assign each element (much faster; cat is expensive).
Code:
arr := fill(0.0, 6);
for ... loop
arr[i] := ...;
end for;
- sjoelund.se
- 1700 Posts
Re: Modelica Scripting Language
Code:
arr := fill(0.0,6);
for i in 0:6 loop
arr[i]:=abs(val(TABLO.y[1],i*1000)-val(vMetre.v,i*1000));
print arr[i];
end for;
print max(arr);
when run script i got; Error: Parse error: Only function call expressions may stand alone in an algorithm section
before use arr() i have to define or something?
Oki
Re: Modelica Scripting Language
I mean i know print only stdout,
When i try to write array to file i got nothing,
Code:
for i in 0:6 loop
arr[i]:= abs(val(TABLO.y[1],i*1000)-val(vMetre.v,i*1000));
end for;
writeFile("c:/loop/log.txt",String(arr[0])+"\n",append=true);
log.txt is never create w/o any error. But for testing purposes i try;
Code:
for i in 0:6 loop
arr[i]:= abs(val(TABLO.y[1],i*1000)-val(vMetre.v,i*1000));
end for;
writeFile("c:/loop/log.txt",String(11)+"\n",append=true);
log.txt created and inside data 11.
- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » Modelica Scripting Language