Skip to content
This repository has been archived by the owner on May 18, 2019. It is now read-only.

Commit

Permalink
Follow FMI 2.0 schema (no empty output section)
Browse files Browse the repository at this point in the history
  • Loading branch information
sjoelund authored and OpenModelica-Hudson committed Jan 19, 2017
1 parent 6ed4cfd commit 4fe59c4
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions Compiler/Template/CodegenFMUCommon.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,7 @@ template ModelStructureOutputs(FmiOutputs fmiOutputs)
"Generates Model Structure Outputs."
::=
match fmiOutputs
case FMIOUTPUTS(fmiUnknownsList={}) then ""
case FMIOUTPUTS(__) then
<<
<Outputs>
Expand All @@ -377,43 +378,35 @@ template ModelStructureDerivatives(FmiDerivatives fmiDerivatives)
"Generates Model Structure Derivatives."
::=
match fmiDerivatives
case FMIDERIVATIVES(fmiUnknownsList={}) then ""
case FMIDERIVATIVES(__) then
if intGt(listLength(fmiUnknownsList), 0) then
<<
<Derivatives>
<%ModelStructureUnknowns(fmiUnknownsList)%>
</Derivatives>
>>
else
// don't generate the element if model has none
<<>>
end ModelStructureDerivatives;

template ModelStructureDiscreteStates(FmiDiscreteStates fmiDiscreteStates)
"Generates Model Structure DiscreteStates."
::=
match fmiDiscreteStates
// don't generate if model has no discrete states for FMI 2.0 compatibility
case FMIDISCRETESTATES(fmiUnknownsList={}) then ""
case FMIDISCRETESTATES(__) then
if intGt(listLength(fmiUnknownsList), 0) then
<<
<DiscreteStates>
<%ModelStructureUnknowns(fmiUnknownsList)%>
</DiscreteStates>
>>
else
// don't generate if model has no discrete states for FMI 2.0 compatibility
<<>>
end ModelStructureDiscreteStates;

template ModelStructureInitialUnknowns(FmiInitialUnknowns fmiInitialUnknowns)
"Generates Model Structure InitialUnknowns."
::=
match fmiInitialUnknowns
case FMIINITIALUNKNOWNS(fmiUnknownsList={}) then ""
case FMIINITIALUNKNOWNS(__) then
if listEmpty(fmiUnknownsList)
then
''
else
<<
<InitialUnknowns>
<%ModelStructureUnknowns(fmiUnknownsList)%>
Expand Down

0 comments on commit 4fe59c4

Please sign in to comment.