Skip to content

Commit b8bff12

Browse files
kabdelhaklochel
authored andcommitted
[BE] remove unused dumping functions
- ticket #5602
1 parent f96d9de commit b8bff12

File tree

5 files changed

+8
-134
lines changed

5 files changed

+8
-134
lines changed

OMCompiler/Compiler/BackEnd/Initialization.mo

Lines changed: 0 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -291,12 +291,6 @@ algorithm
291291
end if;
292292
end if;
293293

294-
// warn about iteration variables with default zero start attribute
295-
// b := warnAboutIterationVariablesWithDefaultZeroStartAttribute(initdae);
296-
//if b and (not Flags.isSet(Flags.INITIALIZATION)) then
297-
// Error.addMessage(Error.INITIALIZATION_ITERATION_VARIABLES, {msg});
298-
//end if;
299-
300294
if Flags.isSet(Flags.DUMP_EQNINORDER) and Flags.isSet(Flags.DUMP_INITIAL_SYSTEM) then
301295
BackendDump.dumpEqnsSolved(initdae, "initial system: eqns in order");
302296
end if;
@@ -659,89 +653,6 @@ algorithm
659653
end match;
660654
end collectPreVariablesTraverseExp2;
661655

662-
// =============================================================================
663-
// warn about iteration variables with default zero start attribute
664-
//
665-
// =============================================================================
666-
667-
protected function warnAboutIterationVariablesWithDefaultZeroStartAttribute "author: lochel
668-
This function ... read the function name."
669-
input BackendDAE.BackendDAE inDAE;
670-
output Boolean outWarning;
671-
algorithm
672-
outWarning := warnAboutIterationVariablesWithDefaultZeroStartAttribute0(inDAE.eqs, Flags.isSet(Flags.INITIALIZATION));
673-
end warnAboutIterationVariablesWithDefaultZeroStartAttribute;
674-
675-
protected function warnAboutIterationVariablesWithDefaultZeroStartAttribute0 "author: lochel"
676-
input list<BackendDAE.EqSystem> inEqs;
677-
input Boolean inShowWarnings;
678-
output Boolean outWarning = false;
679-
protected
680-
Boolean warn;
681-
algorithm
682-
for eqs in inEqs loop
683-
warn := warnAboutIterationVariablesWithDefaultZeroStartAttribute1(eqs, inShowWarnings);
684-
outWarning := outWarning or warn;
685-
686-
// If we found an iteration variable with default zero start attribute but
687-
// -d=initialization wasn't given, we don't need to continue searching.
688-
if warn and not inShowWarnings then
689-
return;
690-
end if;
691-
end for;
692-
end warnAboutIterationVariablesWithDefaultZeroStartAttribute0;
693-
694-
protected function warnAboutIterationVariablesWithDefaultZeroStartAttribute1 "author: lochel"
695-
input BackendDAE.EqSystem inEqSystem;
696-
input Boolean inShowWarnings;
697-
output Boolean outWarning = false "True if any warnings were printed.";
698-
protected
699-
BackendDAE.StrongComponents comps;
700-
list<Integer> vlst = {};
701-
list<BackendDAE.Var> vars;
702-
String err;
703-
algorithm
704-
BackendDAE.EQSYSTEM(matching=BackendDAE.MATCHING(comps=comps)) := inEqSystem;
705-
706-
// Go through all the strongly connected components.
707-
for comp in comps loop
708-
// Get the component's variables and select the correct error message.
709-
(err, vlst) := match(comp)
710-
case BackendDAE.EQUATIONSYSTEM(vars = vlst, jacType = BackendDAE.JAC_NONLINEAR())
711-
then ("nonlinear equation system:\n", vlst);
712-
case BackendDAE.EQUATIONSYSTEM(vars = vlst, jacType = BackendDAE.JAC_GENERIC())
713-
then ("equation system with analytic Jacobian:\n", vlst);
714-
case BackendDAE.EQUATIONSYSTEM(vars = vlst, jacType = BackendDAE.JAC_NO_ANALYTIC())
715-
then ("equation system without analytic Jacobian:\n", vlst);
716-
case BackendDAE.TORNSYSTEM(strictTearingSet = BackendDAE.TEARINGSET(tearingvars = vlst), linear = false)
717-
then ("torn nonlinear equation system:\n", vlst);
718-
// If the component is none of these types, do nothing.
719-
else ("", {});
720-
end match;
721-
722-
if not listEmpty(vlst) then
723-
// Filter out the variables that are missing start values.
724-
vars := List.map1r(vlst, BackendVariable.getVarAt, inEqSystem.orderedVars);
725-
//vars := list(BackendVariable.getVarAt(inEqSystem.orderedVars, idx) for idx in vlst);
726-
vars := list(v for v guard(not BackendVariable.varHasStartValue(v)) in vars);
727-
//vars := List.filterOnTrue(vars, BackendVariable.varHasStartValue);
728-
729-
// Print a warning if we found any variables with missing start values.
730-
if not listEmpty(vars) then
731-
outWarning := true;
732-
733-
if inShowWarnings then
734-
Error.addCompilerWarning("Iteration variables with default zero start attribute in " + err + warnAboutVars2(vars));
735-
else
736-
// If -d=initialization wasn't given we don't need to continue searching
737-
// once we've found one.
738-
return;
739-
end if;
740-
end if;
741-
end if;
742-
end for;
743-
end warnAboutIterationVariablesWithDefaultZeroStartAttribute1;
744-
745656
protected function warnAboutVars2 "author: lochel
746657
TODO: Replace this with an general BackendDump implementation."
747658
input list<BackendDAE.Var> vars;

OMCompiler/Compiler/BackEnd/SymbolicJacobian.mo

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -2872,7 +2872,6 @@ protected function printNonLinIterVarsAndEqs
28722872
protected
28732873
BackendDAE.EqSystem syst;
28742874
BackendDAE.Shared shared;
2875-
list<BackendDAE.Equation> nonLinEqns = {};
28762875
Integer idx = 1;
28772876
list<BackendDAE.Var> diffVars, residualVars, allDiffedVars, nonLin = {}, nonLinStart = {}, lin = {};
28782877
list<DAE.ComponentRef> dependentVarsCref;
@@ -2911,17 +2910,6 @@ algorithm
29112910
BackendDump.dumpVarList(lin, "Linear iteration variables with predefined start attributes that are unrelevant in " + name + ".");
29122911
end if;
29132912

2914-
// Get nonlinear equations
2915-
for i in eqnIndices loop
2916-
nonLinEqns := addNonlinearEquation(ExpandableArray.get(i,inEqns),ExpandableArray.get(idx,syst.orderedEqs),syst.orderedVars, shared.globalKnownVars,nonLinEqns);
2917-
//BackendDump.dumpEquationList({ExpandableArray.get(i,inEqns)}, "check eq");
2918-
//BackendDump.dumpEquationList({ExpandableArray.get(idx,syst.orderedEqs)}, "diffed eq");
2919-
idx := idx + 1;
2920-
end for;
2921-
if not listEmpty(nonLinEqns) then
2922-
BackendDump.dumpEquationList(nonLinEqns, "Relevant nonlinear equations in " + name + ".");
2923-
end if;
2924-
29252913
if not (listEmpty(nonLin) and listEmpty(nonLinStart) and listEmpty(lin)) then
29262914
print("Info: Only non-linear iteration variables in non-linear eqation systems require start values. " +
29272915
"All other start values have no influence on convergence and are ignored. " +
@@ -2932,30 +2920,6 @@ algorithm
29322920
// BackendDAE.FULL_JACOBIAN()
29332921
end printNonLinIterVarsAndEqs;
29342922

2935-
protected function addNonlinearEquation
2936-
"Checks an equation for nonlinearity regarding input vars and adds
2937-
it to a list if the check succeeds. "
2938-
input BackendDAE.Equation originalEqn;
2939-
input BackendDAE.Equation diffedEqn;
2940-
input BackendDAE.Variables vars;
2941-
input BackendDAE.Variables knownVars;
2942-
input output list<BackendDAE.Equation> nonlinearEquationLst;
2943-
protected
2944-
Integer eqnIndex;
2945-
HashTable.HashTable ht;
2946-
algorithm
2947-
try
2948-
ht := HashTable.emptyHashTable();
2949-
(_, (_, _, ht)) := BackendEquation.findUnknownCrefs(diffedEqn,(vars, knownVars, ht));
2950-
2951-
if not listEmpty(BaseHashTable.hashTableKeyList(ht)) then
2952-
nonlinearEquationLst := originalEqn::nonlinearEquationLst;
2953-
end if;
2954-
else
2955-
Error.addMessage(Error.INTERNAL_ERROR,{"SymbolicJacobian.addNonlinearEquation failed"});
2956-
end try;
2957-
end addNonlinearEquation;
2958-
29592923
protected function traverserhasEqnNonDiffParts
29602924
"function breaks differentiation for
29612925
currently not working parts of functions"

testsuite/simulation/modelica/initialization/OverdeterminedInitialization.Fluid.TwoVolumesEquationsFullSteadyStateMassAndEnergy.mos

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ buildModel(OverdeterminedInitialization.Fluid.TwoVolumesEquationsFullSteadyState
2424
// 4: p1:VARIABLE(stateSelect=StateSelect.prefer ) type: Real
2525
// 5: T2:VARIABLE(stateSelect=StateSelect.prefer ) type: Real
2626
//
27+
// Info: Only non-linear iteration variables in non-linear eqation systems require start values. All other start values have no influence on convergence and are ignored. Use "-d=dumpLoops" to show all loops. In OMEdit Tools->Options->Simulation->OMCFlags, in OMNotebook call setCommandLineOptions("-d=dumpLoops")
28+
//
2729
// {"OverdeterminedInitialization.Fluid.TwoVolumesEquationsFullSteadyStateMassAndEnergy","OverdeterminedInitialization.Fluid.TwoVolumesEquationsFullSteadyStateMassAndEnergy_init.xml"}
2830
// "Notification: It was not possible to check the given initialization system for consistency symbolically, because the relevant equations are part of an algebraic loop. This is not supported yet.
2931
// Warning: The initial conditions are over specified. The following 1 initial equations are redundant, so they are removed from the initialization sytem:

testsuite/simulation/modelica/initialization/OverdeterminedInitialization.Fluid.TwoVolumesEquationsFullSteadyStatePressureAndTemperature.mos

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ buildModel(OverdeterminedInitialization.Fluid.TwoVolumesEquationsFullSteadyState
2222
// 2: p2:VARIABLE(stateSelect=StateSelect.prefer ) type: Real
2323
// 3: T2:VARIABLE(stateSelect=StateSelect.prefer ) type: Real
2424
//
25+
// Info: Only non-linear iteration variables in non-linear eqation systems require start values. All other start values have no influence on convergence and are ignored. Use "-d=dumpLoops" to show all loops. In OMEdit Tools->Options->Simulation->OMCFlags, in OMNotebook call setCommandLineOptions("-d=dumpLoops")
26+
//
2527
// {"OverdeterminedInitialization.Fluid.TwoVolumesEquationsFullSteadyStatePressureAndTemperature","OverdeterminedInitialization.Fluid.TwoVolumesEquationsFullSteadyStatePressureAndTemperature_init.xml"}
2628
// "Warning: The initial conditions are over specified. The following 1 initial equations are redundant, so they are removed from the initialization sytem:
2729
// $DER.p1 = 0.0.

testsuite/simulation/modelica/nonlinear_system/nonlinearDelayTest.mos

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,11 @@ val(y, {0.0,0.25,0.5,0.75,1.0});
3838
// true
3939
// ""
4040
//
41-
//Nonlinear iteration variables with default zero start attribute in NLSJac0. (1)
42-
//========================================
43-
//1: x2:VARIABLE() type: Real
41+
// Nonlinear iteration variables with default zero start attribute in NLSJac0. (1)
42+
// ========================================
43+
// 1: x2:VARIABLE() type: Real
4444
//
45-
//
46-
//Relevant nonlinear equations in NLSJac0. (1)
47-
//========================================
48-
//1/1 (1): -4.0 + x1 ^ 2.0 + 4.0 * x2 ^ 4.0 = 0.0 [dynamic |0|0|0|0|]
49-
//
50-
//Info: Only non-linear iteration variables in non-linear eqation systems require start values. All other start values have no influence on convergence and are ignored. Use "-d=dumpLoops" to show all loops. In OMEdit Tools->Options->Simulation->OMCFlags, in OMNotebook call setCommandLineOptions("-d=dumpLoops")
45+
// Info: Only non-linear iteration variables in non-linear eqation systems require start values. All other start values have no influence on convergence and are ignored. Use "-d=dumpLoops" to show all loops. In OMEdit Tools->Options->Simulation->OMCFlags, in OMNotebook call setCommandLineOptions("-d=dumpLoops")
5146
//
5247
// record SimulationResult
5348
// resultFile = "nonlinear_system.nonlinearDelayTest_res.mat",

0 commit comments

Comments
 (0)