Skip to content

Commit

Permalink
- Replaced the import FMU with the new functionality. importFMU => im…
Browse files Browse the repository at this point in the history
…portFMUOld and importFMUNew => importFMU.

- Updated some of the test cases. Few test cases still uses the old API.

git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@13417 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
adeas31 committed Oct 16, 2012
1 parent f4d1837 commit 801cd9d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
9 changes: 5 additions & 4 deletions Compiler/FrontEnd/ModelicaBuiltin.mo
Expand Up @@ -1872,27 +1872,28 @@ external "builtin";
annotation(preferredView="text");
end reopenStandardStream;

function importFMU "Imports the Functional Mockup Unit
function importFMUOld "Imports the Functional Mockup Unit
Example command:
importFMU(\"A.fmu\");"
input String filename "the fmu file name";
input String workdir := "<default>" "The output directory for imported FMU files. <default> will put the files to current working directory.";
output Boolean success "Returns true on success";
external "builtin";
annotation(preferredView="text");
end importFMU;
end importFMUOld;

/* Under Development */
function importFMUNew "Imports the Functional Mockup Unit
function importFMU "Imports the Functional Mockup Unit
Example command:
importFMU(\"A.fmu\");"
input String filename "the fmu file name";
input String workdir := "<default>" "The output directory for imported FMU files. <default> will put the files to current working directory.";
input Integer loglevel := 2 "loglevel_nothing=0;loglevel_fatal=1;loglevel_error=2;loglevel_warning=3;loglevel_info=4;loglevel_verbose=5;loglevel_debug=6";
input Boolean fullPath := false "When true the full output path is returned otherwise only the file name.";
output String generatedFileName "Returns the full path of the generated file.";
external "builtin";
annotation(preferredView="text");
end importFMUNew;
end importFMU;
/* Under Development */

function getSourceFile "Returns the filename of the class."
Expand Down
15 changes: 8 additions & 7 deletions Compiler/Script/CevalScript.mo
Expand Up @@ -1460,7 +1460,7 @@ algorithm
then
(cache,Values.BOOL(b),st);

case (cache,env,"importFMU",{Values.STRING(filename),Values.STRING(workdir)},st,_)
case (cache,env,"importFMUOld",{Values.STRING(filename),Values.STRING(workdir)},st,_)
equation
// get OPENMODELICAHOME
omhome = Settings.getInstallationDirectoryPath();
Expand All @@ -1473,11 +1473,11 @@ algorithm
then
(cache,Values.BOOL(true),st);

case (cache,env,"importFMU",_,st,_)
case (cache,env,"importFMUOld",_,st,_)
then
(cache,Values.BOOL(false),st);

case (cache,env,"importFMUNew",{Values.STRING(filename),Values.STRING(workdir),Values.INTEGER(fmiLogLevel)},st,_)
case (cache,env,"importFMU",{Values.STRING(filename),Values.STRING(workdir),Values.INTEGER(fmiLogLevel),Values.BOOL(b1)},st,_)
equation
Error.clearMessages() "Clear messages";
true = System.regularFileExists(filename);
Expand All @@ -1492,22 +1492,23 @@ algorithm
pd = System.pathDelimiter();
str1 = FMI.getFMIModelIdentifier(fmiInfo);
str2 = FMI.getFMIType(fmiInfo);
filename_1 = stringAppendList({workdir,pd,str1,"_",str2,"_FMU.mo"});
System.writeFile(filename_1, str);
outputFile = stringAppendList({workdir,pd,str1,"_",str2,"_FMU.mo"});
filename_1 = Util.if_(b1,stringAppendList({workdir,pd,str1,"_",str2,"_FMU.mo"}),stringAppendList({str1,"_",str2,"_FMU.mo"}));
System.writeFile(outputFile, str);
/* Release FMI objects */
FMIExt.releaseFMIImport(fmiModelVariablesInstance, fmiInstance, fmiContext);
then
(cache,Values.STRING(filename_1),st);

case (cache,env,"importFMUNew",{Values.STRING(filename),Values.STRING(workdir),Values.INTEGER(fmiLogLevel)},st,_)
case (cache,env,"importFMU",{Values.STRING(filename),Values.STRING(workdir),Values.INTEGER(fmiLogLevel),Values.BOOL(b1)},st,_)
equation
false = System.regularFileExists(filename);
Error.clearMessages() "Clear messages";
Error.addMessage(Error.FILE_NOT_FOUND_ERROR, {filename});
then
(cache,Values.STRING(""),st);

case (cache,env,"importFMUNew",{Values.STRING(filename),Values.STRING(workdir),Values.INTEGER(fmiLogLevel)},st,_)
case (cache,env,"importFMU",{Values.STRING(filename),Values.STRING(workdir),Values.INTEGER(fmiLogLevel),Values.BOOL(b1)},st,_)
then
(cache,Values.STRING(""),st);

Expand Down

0 comments on commit 801cd9d

Please sign in to comment.