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

Commit 77bf4cb

Browse files
committed
HideResult defaults to protected, ticket:4089
1 parent 339c749 commit 77bf4cb

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

Compiler/SimCode/SimCodeUtil.mo

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8469,7 +8469,7 @@ algorithm
84698469
commentStr = unparseCommentOptionNoAnnotationNoQuote(comment);
84708470
(unit, displayUnit) = extractVarUnit(dae_var_attr);
84718471
isProtected = getProtected(dae_var_attr);
8472-
hideResult = getHideResult(comment);
8472+
hideResult = getHideResult(comment, isProtected);
84738473
(minValue, maxValue) = getMinMaxValues(dlowVar);
84748474
initVal = getStartValue(dlowVar);
84758475
nomVal = getNominalValue(dlowVar);
@@ -8503,7 +8503,7 @@ algorithm
85038503
commentStr = unparseCommentOptionNoAnnotationNoQuote(comment);
85048504
(unit, displayUnit) = extractVarUnit(dae_var_attr);
85058505
isProtected = getProtected(dae_var_attr);
8506-
hideResult = getHideResult(comment);
8506+
hideResult = getHideResult(comment, isProtected);
85078507
(minValue, maxValue) = getMinMaxValues(dlowVar);
85088508
initVal = getStartValue(dlowVar);
85098509
nomVal = getNominalValue(dlowVar);
@@ -8531,7 +8531,7 @@ algorithm
85318531
commentStr = unparseCommentOptionNoAnnotationNoQuote(comment);
85328532
(unit, displayUnit) = extractVarUnit(dae_var_attr);
85338533
isProtected = getProtected(dae_var_attr);
8534-
hideResult = getHideResult(comment);
8534+
hideResult = getHideResult(comment, isProtected);
85358535
(minValue, maxValue) = getMinMaxValues(dlowVar);
85368536
initVal = getStartValue(dlowVar);
85378537
nomVal = getNominalValue(dlowVar);
@@ -10688,7 +10688,11 @@ algorithm
1068810688
end getProtected;
1068910689

1069010690
protected function getHideResult
10691+
"Returns the value of the HideResult annotation.
10692+
Uses isProtected as default if the annotation is not specified.
10693+
See Modelica Spec 3.3, section 18.3"
1069110694
input Option<SCode.Comment> inComment;
10695+
input Boolean isProtected;
1069210696
output Boolean outHideResult;
1069310697
protected
1069410698
SCode.Annotation ann;
@@ -10702,7 +10706,7 @@ algorithm
1070210706
else false;
1070310707
end match;
1070410708
else
10705-
outHideResult := false;
10709+
outHideResult := isProtected;
1070610710
end try;
1070710711
end getHideResult;
1070810712

Compiler/Template/CodegenCppInit.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ template scalarVariableAttributeXML(SimVar simVar, SimCode simCode, String index
138138
let causalityAtt = CodegenFMUCommon.getCausality(causality)
139139
let variability = getVariablity(varKind)
140140
let description = if comment then 'description="<%Util.escapeModelicaStringToXmlString(comment)%>"'
141-
let additionalAttributes = if generateFMUModelDescription then '' else 'isProtected="<%isProtected%>" isDiscrete="<%isDiscrete%>" isValueChangeable="<%isValueChangeable%>"'
141+
let additionalAttributes = if generateFMUModelDescription then '' else 'isProtected="<%isProtected%>" hideResult="<%hideResult%>" isDiscrete="<%isDiscrete%>" isValueChangeable="<%isValueChangeable%>"'
142142
<<
143143
name="<%System.stringReplace(Util.escapeModelicaStringToXmlString(crefStrNoUnderscore(name)),"$", "_D_")%>" valueReference="<%valueReference%>" <%description%> variability="<%variability%>" causality="<%causalityAtt%>" alias="<%alias%>" <%additionalAttributes%>
144144
>>

0 commit comments

Comments
 (0)