@@ -474,9 +474,12 @@ Return the sorted equation graph with selection of states and dummy states.
474474function getSortedEquationGraph (G, Gsolvable, BLT, assign, A, B, VNames; withStabilization:: Bool = true )
475475 eqInit = StateSelection. SortedEquationGraph (G, BLT, assign, A, B, VNames)
476476 eq = getSortedEquationGraph! (eqInit, Gsolvable)
477+ # printSortedEquationGraph(eq; equations=false)
478+ # println("\n")
477479
478480 if ! withStabilization
479481 # Check whether lambda and/or mue variables are present
482+ #=
480483 lambdaVariables = String[]
481484 for i in eachindex(eq.Vx)
482485 vx = eq.Vx[i]
@@ -489,25 +492,41 @@ function getSortedEquationGraph(G, Gsolvable, BLT, assign, A, B, VNames; withSta
489492
490493 if length(lambdaVariables) > 0 || eq.nmue > 0
491494 # Code generator not prepared to handle DAE stabilization -> Trigger error
495+ printSortedEquationGraph(eq; equations=false)
496+
492497 constraintVariables = String[]
493498 for i in eq.ider1n1
494499 vc = eq.Vx[ eq.VxRev[ i ] ]
495500 push!(constraintVariables, eq.VNames[ vc ])
496501 end
497502
498503 if length(lambdaVariables) > 0
499- error (" ... Automatic state selection is not possible, because the code generator does not\n " ,
504+ error("\n ... Automatic state selection is not possible, because the code generator does not\n",
500505 " yet support DAE stabilization of higher index systems.\n",
501506 " Number of lambda variables: ", length(lambdaVariables), ", number of mue variables: ", eq.nmue, "\n",
502- " The following (lambda) variables are the reason: " , lambdaVariables, " \n " ,
503- " The following (state) variables are the reason: " , constraintVariables, " ." )
507+ " The following (lambda) variables are the reason: ", lambdaVariables, ".")
504508 elseif eq.nmue > 0
505- error (" ... Automatic state selection is not possible, because the code generator does not\n " ,
509+ error("\n ... Automatic state selection is not possible, because the code generator does not\n",
506510 " yet support the generation of stabilizing equations.\n",
507511 " Number of lambda variables: ", length(lambdaVariables), ", number of mue variables: ", eq.nmue, "\n",
508512 " The following (state) variables are the reason: ", constraintVariables, ".")
509513 end
510514 end
515+ =#
516+ if eq. nmue > 0
517+ # Code generator not prepared to handle DAE stabilization -> Trigger error
518+ printSortedEquationGraph (eq; equations= false )
519+
520+ constraintVariables = String[]
521+ for i in eq. ider1n1
522+ vc = eq. Vx[ eq. VxRev[ i ] ]
523+ push! (constraintVariables, eq. VNames[ vc ])
524+ end
525+ error (" \n ... Automatic state selection is not possible, because the code generator does not\n " ,
526+ " yet support the generation of stabilizing equations.\n " ,
527+ " Number of mue variables: " , eq. nmue, " \n " ,
528+ " The following (state) variables are the reason: " , constraintVariables, " ." )
529+ end
511530
512531 # Determine differentiated variables in the original equations that are no states (dummy states)
513532 end
@@ -700,11 +719,12 @@ end
700719
701720
702721"""
703- printSortedEquationGraph(eq)
722+ printSortedEquationGraph(eq; equations=true )
704723
705- Print information about the sorted equation graph
724+ Print information about the sorted equation graph.
725+ If `equations = false`, the equations are not printed.
706726"""
707- function printSortedEquationGraph (eq:: SortedEquationGraph )
727+ function printSortedEquationGraph (eq:: SortedEquationGraph ; equations :: Bool = true )
708728 # Determine original number of equations (that are not differentiated)
709729 neqOrig = 0
710730 i = 0
@@ -786,6 +806,10 @@ function printSortedEquationGraph(eq::SortedEquationGraph)
786806 print (" \n " )
787807 end
788808
809+ if ! equations
810+ return
811+ end
812+
789813 # Print sorted equations
790814 println (" \n Sorted equations (length(_r) = " , length (eq. Er), " , nc = " , eq. nc, " ):" )
791815
0 commit comments