Skip to content

Commit

Permalink
FMI2 Cpp: generate appropriate modelDescription.xml
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@25197 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
rfranke committed Mar 21, 2015
1 parent 9b531d4 commit 993877c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Compiler/SimCode/SimCodeMain.mo
Expand Up @@ -587,7 +587,7 @@ algorithm
then ();
case (_,"Cpp")
equation
Tpl.tplNoret(CodegenFMUCpp.translateModel, simCode);
Tpl.tplNoret3(CodegenFMUCpp.translateModel, simCode, FMUVersion, FMUType);
then ();
else
equation
Expand Down
12 changes: 7 additions & 5 deletions Compiler/Template/CodegenFMUCpp.tpl
Expand Up @@ -52,7 +52,7 @@ import CodegenUtil.*;
import CodegenCpp.*; //unqualified import, no need the CodegenC is optional when calling a template; or mandatory when the same named template exists in this package (name hiding)
import CodegenFMU.*;

template translateModel(SimCode simCode)
template translateModel(SimCode simCode, String FMUVersion, String FMUType)
"Generates C code and Makefile for compiling a FMU of a
Modelica model."
::=
Expand All @@ -71,7 +71,7 @@ case SIMCODE(modelInfo=modelInfo as MODELINFO(__)) then
let()= textFile(simulationFunctionsFile(simCode, extraFuncs ,extraFuncsDecl, "", modelInfo.functions,literals,externalFunctionIncludes,stateDerVectorName,false), 'OMCpp<%lastIdentOfPath(modelInfo.name)%>Functions.cpp')
let()= textFile(simulationTypesHeaderFile(simCode, extraFuncs ,extraFuncsDecl, "",modelInfo.functions,literals, stateDerVectorName, false), 'OMCpp<%fileNamePrefix%>Types.h')
let()= textFile(fmuModelWrapperFile(simCode, extraFuncs ,extraFuncsDecl, "",guid,name), 'OMCpp<%name%>FMU.cpp')
let()= textFile(fmuModelDescriptionFileCpp(simCode, extraFuncs ,extraFuncsDecl, "",guid), 'modelDescription.xml')
let()= textFile(fmuModelDescriptionFileCpp(simCode, extraFuncs ,extraFuncsDecl, "", guid, FMUVersion, FMUType), 'modelDescription.xml')
let()= textFile(simulationInitHeaderFile(simCode, extraFuncs ,extraFuncsDecl, ""), 'OMCpp<%fileNamePrefix%>Initialize.h')
let()= textFile(simulationInitCppFile(simCode, extraFuncs ,extraFuncsDecl, "", stateDerVectorName, false),'OMCpp<%fileNamePrefix%>Initialize.cpp')
let()= textFile(simulationFactoryFile(simCode, extraFuncs ,extraFuncsDecl, ""),'OMCpp<%fileNamePrefix%>FactoryExport.cpp')
Expand All @@ -97,15 +97,17 @@ case SIMCODE(modelInfo=modelInfo as MODELINFO(__)) then
// Return empty result since result written to files directly
end translateModel;

template fmuModelDescriptionFileCpp(SimCode simCode,Text& extraFuncs,Text& extraFuncsDecl,Text extraFuncsNamespace,String guid)
template fmuModelDescriptionFileCpp(SimCode simCode,Text& extraFuncs,Text& extraFuncsDecl,Text extraFuncsNamespace,String guid, String FMUVersion, String FMUType)
"Generates code for ModelDescription file for FMU target."
::=
match simCode
case SIMCODE(__) then
<<
<?xml version="1.0" encoding="UTF-8"?>
<%fmiModelDescriptionCpp(simCode, extraFuncs ,extraFuncsDecl, extraFuncsNamespace,guid)%>

<%
if isFMIVersion20(FMUVersion) then fmi2ModelDescription(simCode, guid)
else fmiModelDescriptionCpp(simCode, extraFuncs ,extraFuncsDecl, extraFuncsNamespace,guid)
%>
>>
end fmuModelDescriptionFileCpp;

Expand Down

0 comments on commit 993877c

Please sign in to comment.