Skip to content

Commit

Permalink
Check for FMUType, ticket:4130
Browse files Browse the repository at this point in the history
  • Loading branch information
rfranke authored and OpenModelica-Hudson committed Nov 8, 2016
1 parent 844621f commit efd9b1f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Compiler/Script/CevalScriptBackend.mo
Expand Up @@ -2989,7 +2989,7 @@ protected function buildModelFMU " author: Frenkel TUD
input Absyn.Path className "path for the model";
input GlobalScript.SymbolTable inInteractiveSymbolTable;
input String FMUVersion;
input String FMUType;
input String inFMUType;
input String inFileNamePrefix;
input Boolean addDummy "if true, add a dummy state";
input list<String> platforms = {"dynamic"};
Expand All @@ -3004,6 +3004,7 @@ protected
SimCode.SimulationSettings simSettings;
list<String> libs;
Boolean isWindows;
String FMUType = inFMUType;
algorithm
st := inInteractiveSymbolTable;
cache := inCache;
Expand All @@ -3021,6 +3022,10 @@ algorithm
Error.addMessage(Error.FMU_EXPORT_NOT_SUPPORTED, {FMUType, FMUVersion});
return;
end if;
if Config.simCodeTarget() == "Cpp" and FMI.isFMICSType(FMUType) then
Error.addMessage(Error.FMU_EXPORT_NOT_SUPPORTED_CPP, {FMUType});
FMUType := "me";
end if;
filenameprefix := Util.stringReplaceChar(if inFileNamePrefix == "<default>" then Absyn.pathString(className) else inFileNamePrefix,".","_");
defaulSimOpt := buildSimulationOptionsFromModelExperimentAnnotation(st, className, filenameprefix, SOME(defaultSimulationOptions));
simSettings := convertSimulationOptionsToSimCode(defaulSimOpt);
Expand Down
2 changes: 2 additions & 0 deletions Compiler/Util/Error.mo
Expand Up @@ -985,6 +985,8 @@ public constant Message PDEModelica_ERROR = MESSAGE(7013, TRANSLATION(), ERROR()
Util.gettext("PDEModelica: %s"));
public constant Message TEMPLATE_ERROR_FUNC = MESSAGE(7014, TRANSLATION(), ERROR(),
Util.gettext("Template error: A template call failed (a call with %s parameters: %s). One possible reason could be that a template imported function call failed (which should not happen for functions called from within template code; templates preserve pure 'match'/non-failing semantics)."));
public constant Message FMU_EXPORT_NOT_SUPPORTED_CPP = MESSAGE(7015, SCRIPTING(), WARNING(),
Util.gettext("Export of FMU type %s is not supported with Cpp target. FMU will be for Model Exchange (me)."));

protected import ErrorExt;

Expand Down

0 comments on commit efd9b1f

Please sign in to comment.