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

Commit 5b5cfe8

Browse files
Willi BraunOpenModelica-Hudson
authored andcommitted
[FMI] added debug flag "disableFMIDependencies"
- disables also the directional derivatives Belonging to [master]: - #2652 - OpenModelica/OpenModelica-testsuite#1033
1 parent 9e884a5 commit 5b5cfe8

File tree

3 files changed

+32
-4
lines changed

3 files changed

+32
-4
lines changed

Compiler/SimCode/SimCodeMain.mo

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -850,7 +850,7 @@ algorithm
850850
(dlow, initDAE, initDAE_lambda0, inlineData, removedInitialEquationLst) := BackendDAEUtil.getSolvedSystem(dlow,inFileNamePrefix,strPostOptModules=strOptPostOptModules);
851851

852852
// generate derivatives
853-
if isFMI2 then
853+
if isFMI2 and not Flags.isSet(Flags.FMI20_DEPENDENCIES) then
854854
// activate symolic jacobains for fmi 2.0
855855
// to provide dependence information and partial derivatives
856856
(fmiDer, funcs) := SymbolicJacobian.createFMIModelDerivatives(dlow);

Compiler/SimCode/SimCodeUtil.mo

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12005,8 +12005,33 @@ algorithm
1200512005
SimCode.FMIDISCRETESTATES(discreteStates),
1200612006
SimCode.FMIINITIALUNKNOWNS({})));
1200712007
else
12008-
Error.addInternalError("SimCodeUtil.createFMIModelStructure failed", sourceInfo());
12009-
fail();
12008+
// create empty model structure
12009+
try
12010+
// create empty derivatives dependencies
12011+
derivatives := list(createFmiUnknownFromSimVar(v,1) for v in inModelInfo.vars.derivativeVars);
12012+
12013+
// create empty output dependencies
12014+
varsA := List.filterOnTrue(inModelInfo.vars.algVars, isOutputSimVar);
12015+
outputs := list(createFmiUnknownFromSimVar(v,1) for v in varsA);
12016+
12017+
// create empty clockedStates dependencies
12018+
clockedStates := List.filterOnTrue(inModelInfo.vars.algVars, isClockedStateSimVar);
12019+
discreteStates := list(createFmiUnknownFromSimVar(v,1) for v in clockedStates);
12020+
12021+
contPartSimDer := NONE();
12022+
12023+
outFmiModelStructure :=
12024+
SOME(
12025+
SimCode.FMIMODELSTRUCTURE(
12026+
SimCode.FMIOUTPUTS(outputs),
12027+
SimCode.FMIDERIVATIVES(derivatives),
12028+
contPartSimDer,
12029+
SimCode.FMIDISCRETESTATES(discreteStates),
12030+
SimCode.FMIINITIALUNKNOWNS({})));
12031+
else
12032+
Error.addInternalError("SimCodeUtil.createFMIModelStructure failed", sourceInfo());
12033+
fail();
12034+
end try;
1201012035
end try;
1201112036
end createFMIModelStructure;
1201212037

Compiler/Util/Flags.mo

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -538,6 +538,8 @@ constant DebugFlag NF_EXPAND_OPERATIONS = DEBUG_FLAG(181, "nfExpandOperations",
538538
Util.gettext("Expand all unary/binary operations to scalar expressions in the new frontend."));
539539
constant DebugFlag NF_API = DEBUG_FLAG(182, "nfAPI", false,
540540
Util.gettext("Enables experimental new instantiation use in the OMC API."));
541+
constant DebugFlag FMI20_DEPENDENCIES = DEBUG_FLAG(183, "disableFMIDependency", false,
542+
Util.gettext("Disables the dependency analysis and generation for FMI 2.0."));
541543

542544
// This is a list of all debug flags, to keep track of which flags are used. A
543545
// flag can not be used unless it's in this list, and the list is checked at
@@ -726,7 +728,8 @@ constant list<DebugFlag> allDebugFlags = {
726728
NF_SCALARIZE,
727729
NF_EVAL_CONST_ARG_FUNCS,
728730
NF_EXPAND_OPERATIONS,
729-
NF_API
731+
NF_API,
732+
FMI20_DEPENDENCIES
730733
};
731734

732735
public

0 commit comments

Comments
 (0)