Skip to content

Commit

Permalink
Document translateModel. (#11886)
Browse files Browse the repository at this point in the history
  • Loading branch information
perost committed Jan 26, 2024
1 parent 1853a89 commit e02c577
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 2 deletions.
21 changes: 20 additions & 1 deletion OMCompiler/Compiler/FrontEnd/ModelicaBuiltin.mo
Original file line number Diff line number Diff line change
Expand Up @@ -2596,12 +2596,31 @@ external "builtin";
annotation(preferredView="text");
end simulate;

function translateModel
"Translates a modelica model into C code without building it."
input TypeName className "the class that should be built";
input Real startTime = "<default>" "the start time of the simulation. <default> = 0.0";
input Real stopTime = 1.0 "the stop time of the simulation. <default> = 1.0";
input Integer numberOfIntervals = 500 "number of intervals in the result file. <default> = 500";
input Real tolerance = 1e-6 "tolerance used by the integration method. <default> = 1e-6";
input String method = "<default>" "integration method used for simulation. <default> = dassl";
input String fileNamePrefix = "<default>" "fileNamePrefix. <default> = \"\"";
input String options = "<default>" "options. <default> = \"\"";
input String outputFormat = "mat" "Format for the result file. <default> = \"mat\"";
input String variableFilter = ".*" "Filter for variables that should store in result file. <default> = \".*\"";
input String cflags = "<default>" "cflags. <default> = \"\"";
input String simflags = "<default>" "simflags. <default> = \"\"";
output Boolean success;
external "builtin";
annotation(preferredView="text");
end translateModel;

function buildModel "builds a modelica model by generating c code and build it.
It does not run the code!
The only required argument is the className, while all others have some default values.
simulate(className, [startTime], [stopTime], [numberOfIntervals], [tolerance], [method], [fileNamePrefix], [options], [outputFormat], [variableFilter], [cflags], [simflags])
Example command:
simulate(A);
buildModel(A);
"
input TypeName className "the class that should be built";
input Real startTime = "<default>" "the start time of the simulation. <default> = 0.0";
Expand Down
21 changes: 20 additions & 1 deletion OMCompiler/Compiler/NFFrontEnd/NFModelicaBuiltin.mo
Original file line number Diff line number Diff line change
Expand Up @@ -2849,12 +2849,31 @@ external "builtin";
annotation(preferredView="text");
end simulate;

function translateModel
"Translates a modelica model into C code without building it."
input TypeName className "the class that should be built";
input Real startTime = "<default>" "the start time of the simulation. <default> = 0.0";
input Real stopTime = 1.0 "the stop time of the simulation. <default> = 1.0";
input Integer numberOfIntervals = 500 "number of intervals in the result file. <default> = 500";
input Real tolerance = 1e-6 "tolerance used by the integration method. <default> = 1e-6";
input String method = "<default>" "integration method used for simulation. <default> = dassl";
input String fileNamePrefix = "<default>" "fileNamePrefix. <default> = \"\"";
input String options = "<default>" "options. <default> = \"\"";
input String outputFormat = "mat" "Format for the result file. <default> = \"mat\"";
input String variableFilter = ".*" "Filter for variables that should store in result file. <default> = \".*\"";
input String cflags = "<default>" "cflags. <default> = \"\"";
input String simflags = "<default>" "simflags. <default> = \"\"";
output Boolean success;
external "builtin";
annotation(preferredView="text");
end translateModel;

function buildModel "builds a modelica model by generating c code and build it.
It does not run the code!
The only required argument is the className, while all others have some default values.
simulate(className, [startTime], [stopTime], [numberOfIntervals], [tolerance], [method], [fileNamePrefix], [options], [outputFormat], [variableFilter], [cflags], [simflags])
Example command:
simulate(A);
buildModel(A);
"
input TypeName className "the class that should be built";
input Real startTime = "<default>" "the start time of the simulation. <default> = 0.0";
Expand Down

0 comments on commit e02c577

Please sign in to comment.