Skip to content

Commit

Permalink
update OMSimulator API in omc (#6831)
Browse files Browse the repository at this point in the history
  • Loading branch information
arun3688 authored and adrpo committed Oct 21, 2020
1 parent aebc02b commit 72358fa
Show file tree
Hide file tree
Showing 5 changed files with 172 additions and 81 deletions.
17 changes: 17 additions & 0 deletions OMCompiler/Compiler/FrontEnd/ModelicaBuiltin.mo
Expand Up @@ -4560,12 +4560,21 @@ end oms_export;
function oms_exportDependencyGraphs
input String cref;
input String initialization;
input String event;
input String simulation;
output Integer status;
external "builtin";
annotation(preferredView="text");
end oms_exportDependencyGraphs;

function oms_exportSnapshot
input String cref;
output String contents;
output Integer status;
external "builtin";
annotation(preferredView="text");
end oms_exportSnapshot;

function oms_extractFMIKind
input String filename;
output Integer kind;
Expand Down Expand Up @@ -4690,6 +4699,14 @@ external "builtin";
annotation(preferredView="text");
end oms_importFile;

function oms_importSnapshot
input String cref;
input String snapshot;
output Integer status;
external "builtin";
annotation(preferredView="text");
end oms_importSnapshot;

function oms_initialize
input String cref;
output Integer status;
Expand Down
17 changes: 17 additions & 0 deletions OMCompiler/Compiler/NFFrontEnd/NFModelicaBuiltin.mo
Expand Up @@ -4778,12 +4778,21 @@ end oms_export;
function oms_exportDependencyGraphs
input String cref;
input String initialization;
input String event;
input String simulation;
output Integer status;
external "builtin";
annotation(preferredView="text");
end oms_exportDependencyGraphs;

function oms_exportSnapshot
input String cref;
output String contents;
output Integer status;
external "builtin";
annotation(preferredView="text");
end oms_exportSnapshot;

function oms_extractFMIKind
input String filename;
output Integer kind;
Expand Down Expand Up @@ -4908,6 +4917,14 @@ external "builtin";
annotation(preferredView="text");
end oms_importFile;

function oms_importSnapshot
input String cref;
input String snapshot;
output Integer status;
external "builtin";
annotation(preferredView="text");
end oms_importSnapshot;

function oms_initialize
input String cref;
output Integer status;
Expand Down
18 changes: 15 additions & 3 deletions OMCompiler/Compiler/Script/CevalScriptOMSimulator.mo
Expand Up @@ -49,7 +49,7 @@ public function ceval
algorithm
(outValue) := matchcontinue (inFunctionName,inVals)
local
String cref,crefA,crefB,busCref,connectorCref,stype_,signal,s_lower,s_upper,path,startscript,regex,fmuPath,filenameA,filenameB,var,source,target,filename,initialization,simulation,contents,snapshot,newCref,cmd,newTempDir,address,newWorkingDir,version;
String cref,crefA,crefB,busCref,connectorCref,stype_,signal,s_lower,s_upper,path,startscript,regex,fmuPath,filenameA,filenameB,var,source,target,filename,initialization,event,simulation,contents,snapshot,newCref,cmd,newTempDir,address,newWorkingDir,version;
Real stepSize,lower,upper,delay,alpha,linearimpedance,angularimpedance,relTol,absTol,faultValue,loggingInterval,rvalue,startTime,stopTime,x1,x2,x3,A11,A12,A13,A21,A22,A23,A31,A32,A33,absoluteTolerance,relativeTolerance,initialStepSize,minimumStepSize,maximumStepSize;
Integer status,causality,type_,domain,kind,faultType,ivalue,logLevel,bufferSize,solver,dimensions,interpolation,managerPort,monitorPort;
Boolean b;
Expand Down Expand Up @@ -204,12 +204,18 @@ algorithm
then
Values.INTEGER(status);

case("oms_exportDependencyGraphs",{Values.STRING(cref), Values.STRING(initialization), Values.STRING(simulation)})
case("oms_exportDependencyGraphs",{Values.STRING(cref), Values.STRING(initialization), Values.STRING(event), Values.STRING(simulation)})
equation
status = OMSimulator.oms_exportDependencyGraphs(cref,initialization,simulation);
status = OMSimulator.oms_exportDependencyGraphs(cref,initialization,event,simulation);
then
Values.INTEGER(status);

case("oms_exportSnapshot",{Values.STRING(cref)})
equation
(contents,status) = OMSimulator.oms_exportSnapshot(cref);
then
Values.TUPLE({Values.STRING(contents),Values.INTEGER(status)});

case("oms_extractFMIKind",{Values.STRING(filename)})
equation
(kind,status) = OMSimulator.oms_extractFMIKind(filename);
Expand Down Expand Up @@ -300,6 +306,12 @@ algorithm
then
Values.TUPLE({Values.STRING(cref),Values.INTEGER(status)});

case("oms_importSnapshot",{Values.STRING(cref), Values.STRING(snapshot)})
equation
status = OMSimulator.oms_importSnapshot(cref,snapshot);
then
Values.INTEGER(status);

case("oms_initialize",{Values.STRING(cref)})
equation
status = OMSimulator.oms_initialize(cref);
Expand Down
17 changes: 16 additions & 1 deletion OMCompiler/Compiler/Util/OMSimulator.mo
Expand Up @@ -245,11 +245,19 @@ end oms_export;
function oms_exportDependencyGraphs
input String cref;
input String initialization;
input String event;
input String simulation;
output Integer status;
external "C" status = OMSimulator_oms_exportDependencyGraphs(cref,initialization,simulation) annotation(Library = "omcruntime");
external "C" status = OMSimulator_oms_exportDependencyGraphs(cref,initialization,event,simulation) annotation(Library = "omcruntime");
end oms_exportDependencyGraphs;

function oms_exportSnapshot
input String cref;
output String contents;
output Integer status;
external "C" status = OMSimulator_oms_exportSnapshot(cref,contents) annotation(Library = "omcruntime");
end oms_exportSnapshot;

function oms_extractFMIKind
input String filename;
output Integer kind;
Expand Down Expand Up @@ -359,6 +367,13 @@ function oms_importFile
external "C" status = OMSimulator_oms_importFile(filename,cref) annotation(Library = "omcruntime");
end oms_importFile;

function oms_importSnapshot
input String cref;
input String snapshot;
output Integer status;
external "C" status = OMSimulator_oms_importSnapshot(cref,snapshot) annotation(Library = "omcruntime");
end oms_importSnapshot;

function oms_initialize
input String cref;
output Integer status;
Expand Down

0 comments on commit 72358fa

Please sign in to comment.