Skip to content

Commit

Permalink
Only reassign start value if it has been overwritten
Browse files Browse the repository at this point in the history
  • Loading branch information
ptaeuber authored and OpenModelica-Hudson committed Mar 6, 2017
1 parent ae9b4cf commit 4f66de9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 3 additions & 0 deletions Compiler/Template/CodegenC.tpl
Expand Up @@ -2946,6 +2946,7 @@ template functionUpdateBoundVariableAttributes(SimCode simCode, list<SimEqSystem
<<
<%crefAttributes(cref)%>.min = <%cref(cref)%>;
infoStreamPrint(LOG_INIT, 0, "%s(min=<%crefToPrintfArg(cref)%>)", <%crefVarInfo(cref)%>.name, (<%crefType(cref)%>) <%crefAttributes(cref)%>.min);
<%cref(cref)%> = <%crefAttributes(cref)%>.start;
>>
;separator="\n"
%>
Expand All @@ -2959,6 +2960,7 @@ template functionUpdateBoundVariableAttributes(SimCode simCode, list<SimEqSystem
<<
<%crefAttributes(cref)%>.max = <%cref(cref)%>;
infoStreamPrint(LOG_INIT, 0, "%s(max=<%crefToPrintfArg(cref)%>)", <%crefVarInfo(cref)%>.name, (<%crefType(cref)%>) <%crefAttributes(cref)%>.max);
<%cref(cref)%> = <%crefAttributes(cref)%>.start;
>>
;separator="\n"
%>
Expand All @@ -2972,6 +2974,7 @@ template functionUpdateBoundVariableAttributes(SimCode simCode, list<SimEqSystem
<<
<%crefAttributes(cref)%>.nominal = <%cref(cref)%>;
infoStreamPrint(LOG_INIT, 0, "%s(nominal=<%crefToPrintfArg(cref)%>)", <%crefVarInfo(cref)%>.name, (<%crefType(cref)%>) <%crefAttributes(cref)%>.nominal);
<%cref(cref)%> = <%crefAttributes(cref)%>.start;
>>
;separator="\n"
%>
Expand Down
Expand Up @@ -574,7 +574,6 @@ int initialization(DATA *data, threadData_t *threadData, const char* pInitMethod
if(!(pInitFile && strcmp(pInitFile, ""))) {
data->callback->updateBoundParameters(data, threadData);
data->callback->updateBoundVariableAttributes(data, threadData);
setAllVarsToStart(data);
}

/* update static data of linear/non-linear system solvers */
Expand Down

0 comments on commit 4f66de9

Please sign in to comment.