Skip to content

Commit

Permalink
disable fmi directional derivatives by default
Browse files Browse the repository at this point in the history
Belonging to [master]:
  - OpenModelica/OMCompiler#1911
  • Loading branch information
Willi Braun authored and OpenModelica-Hudson committed Oct 17, 2017
1 parent 73e4cc5 commit 75ec7ef
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
6 changes: 3 additions & 3 deletions Compiler/Template/CodegenC.tpl
Expand Up @@ -1116,9 +1116,9 @@ template simulationFile(SimCode simCode, String guid, Boolean isModelExchangeFMU
<%symbolName(modelNamePrefixStr,"function_equationsSynchronous")%>,
<%symbolName(modelNamePrefixStr,"inputNames")%>,
<% if isModelExchangeFMU then symbolName(modelNamePrefixStr,"read_input_fmu") else "NULL" %>,
<% if isSome(modelStructure) then symbolName(modelNamePrefixStr,"initialAnalyticJacobianFMIDER") else "NULL" %>,
<% if isSome(modelStructure) then symbolName(modelNamePrefixStr,"functionJacFMIDER_column") else "NULL" %>,
<% if isSome(modelStructure) then symbolName(modelNamePrefixStr,"INDEX_JAC_FMIDER") else "-1" %>
<% if isSome(modelStructure) then match modelStructure case SOME(FMIMODELSTRUCTURE(continuousPartialDerivatives=SOME(__))) then symbolName(modelNamePrefixStr,"initialAnalyticJacobianFMIDER") else "NULL" else "NULL" %>,
<% if isSome(modelStructure) then match modelStructure case SOME(FMIMODELSTRUCTURE(continuousPartialDerivatives=SOME(__))) then symbolName(modelNamePrefixStr,"functionJacFMIDER_column") else "NULL" else "NULL" %>,
<% if isSome(modelStructure) then match modelStructure case SOME(FMIMODELSTRUCTURE(continuousPartialDerivatives=SOME(__))) then symbolName(modelNamePrefixStr,"INDEX_JAC_FMIDER") else "-1" else "-1" %>
<%\n%>
};

Expand Down
2 changes: 1 addition & 1 deletion Compiler/Util/Flags.mo
Expand Up @@ -454,7 +454,7 @@ constant DebugFlag DUMP_RTEARING = DEBUG_FLAG(139, "dumpRecursiveTearing", false
Util.gettext("Dump between steps of recursiveTearing"));
constant DebugFlag DIS_SIMP_FUN = DEBUG_FLAG(140, "disableSimplifyComplexFunction", false,
Util.gettext("disable simplifyComplexFunction\nDeprecated flag: Use --postOptModules-=simplifyComplexFunction/--initOptModules-=simplifyComplexFunction instead."));
constant DebugFlag DIS_SYMJAC_FMI20 = DEBUG_FLAG(141, "disableDirectionalDerivatives", false,
constant DebugFlag DIS_SYMJAC_FMI20 = DEBUG_FLAG(141, "disableDirectionalDerivatives", true,
Util.gettext("For FMI 2.0 only dependecy analysis will be perform."));
constant DebugFlag EVAL_OUTPUT_ONLY = DEBUG_FLAG(142, "evalOutputOnly", false,
Util.gettext("Generates equations to calculate outputs only."));
Expand Down
10 changes: 8 additions & 2 deletions SimulationRuntime/fmi/export/fmi2/fmu2_model_interface.c
Expand Up @@ -404,8 +404,14 @@ fmi2Component fmi2Instantiate(fmi2String instanceName, fmi2Type fmuType, fmi2Str
#endif

/* allocate memory for Jacobian */
comp->_has_jacobian = !comp->fmuData->callback->initialPartialFMIDER(comp->fmuData, comp->threadData);
comp->fmiDerJac = &(comp->fmuData->simulationInfo->analyticJacobians[comp->fmuData->callback->INDEX_JAC_FMIDER]);
if (comp->fmuData->callback->initialPartialFMIDER != NULL){
comp->_has_jacobian = 1;
comp->fmiDerJac = &(comp->fmuData->simulationInfo->analyticJacobians[comp->fmuData->callback->INDEX_JAC_FMIDER]);
}
else{
comp->_has_jacobian = 0;
comp->fmiDerJac = NULL;
}

FILTERED_LOG(comp, fmi2OK, LOG_FMI2_CALL, "fmi2Instantiate: GUID=%s", fmuGUID)
return comp;
Expand Down

0 comments on commit 75ec7ef

Please sign in to comment.