Name | Description |
---|---|
get_time | Return the current time |
timeTranslation | Print the time required to translate a model |
Type | Name | Description |
---|---|---|
Integer | t | Time in milliseconds since January 1, 1970 |
function get_time "Return the current time" extends Modelica.Icons.Function; output Integer t "Time in milliseconds since January 1, 1970"; external"C"; // Note: Since Dymola 7.4 doesn't support the IncludeDirectory annotation, // it will be necessary to use the full // path in the Include annotation, e.g. // Include="#include \"FCSys/FCSys 2.0/Resources/Source/C/time.c\"" end get_time;
The time is rounded down to the integer second.
Extends from Modelica.Icons.Function (Icon for functions).
Type | Name | Default | Description |
---|---|---|---|
String | problem | Path and name of the model (with modifiers, if any) | |
String | fileName | "translg.txt" | File where to print (empty string is the terminal) |
Type | Name | Description |
---|---|---|
Boolean | ok | true if successful |
function timeTranslation
"Print the time required to translate a model"
extends Modelica.Icons.Function;
import Modelica.Utilities.Streams.print;
input String problem "Path and name of the model (with modifiers, if any)";
input String fileName="translg.txt"
"File where to print (empty string is the terminal)";
output Boolean ok "true
if successful";
protected
Integer t_0 "Start time in seconds";
algorithm
if fileName <> "" then
Modelica.Utilities.Files.remove(fileName);
end if;
t_0 := get_time();
ok := translateModel(problem);
print("Translation time: " + String(get_time() - t_0) + " s", fileName);
end timeTranslation;