I am trying to run a Modelica script in Dymola, but I got an error when defining a variable in the script, as shown below:
Modelica.SIunits.Distance testData=2;
Boolean success;
success := clearlog();
Modelica.Utilities.Streams.print("Simulation result was:");
Modelica.Utilities.Streams.print("Distance = " + String(testData) + " m");
My question is:
Could I define new variables in the Modelica script?
I didn't find any regulation or chapter about the Modelica script file in the Modelica Specification 3.4, is there any reference material for Modelica script file specification?
Dymola just declares new variables based on assignments to the entire variable.
It should work for Real, Integer, Boolean, String, arrays and records.
However, it must be an assignment to the entire variable - so v[1]:=2;
doesn't generate a vector.