From cda5d97dd402873a6086a5c8da532711fe8987e9 Mon Sep 17 00:00:00 2001 From: RuedKamp Date: Fri, 13 Nov 2015 08:48:02 +0100 Subject: [PATCH] -xml file generation for functionsblock --- Compiler/Template/CodegenCpp.tpl | 105 ++++++++++++++++++++----- Compiler/Template/CodegenCppCommon.tpl | 8 +- 2 files changed, 91 insertions(+), 22 deletions(-) diff --git a/Compiler/Template/CodegenCpp.tpl b/Compiler/Template/CodegenCpp.tpl index 9227f7a1ef5..cb75e271899 100644 --- a/Compiler/Template/CodegenCpp.tpl +++ b/Compiler/Template/CodegenCpp.tpl @@ -87,7 +87,7 @@ template translateModel(SimCode simCode) match target case "vxworks69" then - let()= textFile(functionBlock(simCode), '<%fileNamePrefix%>_spsblock.txt') + let()= textFile(functionBlock(simCode), '<%fileNamePrefix%>_PLCOPEN.xml') let()= textFile(ftp_script(simCode), '<%fileNamePrefix%>_ftp.bat') "" else "" @@ -2557,7 +2557,11 @@ then let inputnames = vars.inputVars |> SIMVAR(__) hasindex i0 => << - <%crefST(name, false)%> : <%crefTypeST(name)%> ; + + + <<%crefTypeST(name)%>/> + + >> ;separator="\n" @@ -2591,7 +2595,11 @@ then let outputnames = vars.outputVars |> SIMVAR(__) hasindex i0 => << - <%crefTypeMLPI(name)%> <%crefST(name, false)%>; + + + <<%crefTypeST(name)%>/> + + >> ;separator="\n" @@ -11884,20 +11892,81 @@ let outputVars = spsOutputVars(simCode) match simCode case SIMCODE(modelInfo = MODELINFO(__)) then let modelname = identOfPath(modelInfo.name) -'FUNCTION_BLOCK <%modelname%> -VAR_INPUT - <%inputVars%> -END_VAR -VAR_OUTPUT - <%outputVars%> -END_VAR -VAR - cycletime : REAL :=0.05; - bAlreadyInitialized : BOOL; - bErrorOccured : BOOL(FALSE); - controller : DWORD; - simdata : DWORD; -END_VAR +' + + + + + + + + + + + + + + + + + + + + + + <%inputVars%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ' end functionBlock; @@ -11914,7 +11983,7 @@ typedef struct <%modelname%>_struct void* __VFTABLEPOINTER; <%inputVars%> <%outputVars%> - MLPI_IEC_REAL cycletime; + MLPI_IEC_LREAL cycletime; MLPI_IEC_BOOL bAlreadyInitialized; MLPI_IEC_BOOL bErrorOccured; ISimController* controller; diff --git a/Compiler/Template/CodegenCppCommon.tpl b/Compiler/Template/CodegenCppCommon.tpl index b844c1e7147..6f3034e08cf 100644 --- a/Compiler/Template/CodegenCppCommon.tpl +++ b/Compiler/Template/CodegenCppCommon.tpl @@ -840,12 +840,12 @@ template expTypeShortSPS(DAE.Type type) ::= match type case T_INTEGER(__) then "INT" - case T_REAL(__) then "REAL" + case T_REAL(__) then "LREAL" case T_STRING(__) then if acceptMetaModelicaGrammar() then "metatype" else "string" case T_BOOL(__) then "BOOL" case T_ENUMERATION(__) then "INT" /* assumming real for uknown type! */ - case T_UNKNOWN(__) then "REAL" + case T_UNKNOWN(__) then "LREAL" case T_ANYTYPE(__) then "type not supported" case T_ARRAY(__) then expTypeShortSPS(ty) case T_COMPLEX(complexClassType=EXTERNAL_OBJ(__)) @@ -860,12 +860,12 @@ template expTypeShortMLPI(DAE.Type type) ::= match type case T_INTEGER(__) then "MLPI_IEC_INT" - case T_REAL(__) then "MLPI_IEC_REAL" + case T_REAL(__) then "MLPI_IEC_LREAL" case T_STRING(__) then if acceptMetaModelicaGrammar() then "metatype" else "string" case T_BOOL(__) then "MLPI_IEC_BOOL" case T_ENUMERATION(__) then "MLPI_IEC_INT" /* assumming real for uknown type! */ - case T_UNKNOWN(__) then "MLPI_IEC_REAL" + case T_UNKNOWN(__) then "MLPI_IEC_LREAL" case T_ANYTYPE(__) then "type not supported" case T_ARRAY(__) then expTypeShortSPS(ty) case T_COMPLEX(complexClassType=EXTERNAL_OBJ(__))