@@ -870,29 +870,34 @@ end
870870
871871
872872"""
873- addLinearEquations!(eq::EquationGraph, hasConstantCoefficients::Bool)
873+ addLinearEquations!(eq::EquationGraph, hasConstantCoefficients::Bool, unitless::Bool )
874874
875875A linear equation system is solved. Push this information to
876876eq.SortedEquations. Furthermore, generate the AST for a for-loop that builds
877877and solves a linear equation system A*x = b
878878from the solved equations and the residual equations,
879879and push this information to eq.SortedEquations.AST.
880880"""
881- function addLinearEquations! (eq:: EquationGraph , hasConstantCoefficients:: Bool ):: Nothing
881+ function addLinearEquations! (eq:: EquationGraph , hasConstantCoefficients:: Bool , unitless :: Bool ):: Nothing
882882 # Construct body of for-loop
883883 empty! (eq. AST_aux)
884884 while_body = eq. AST_aux
885885 vTear_names = String[]
886886 vTear_lengths = Int[]
887887
888888 # Assign iteration variables
889- # v_i = leq.vTear_value[i]
889+ # unitless = false:
890+ # v_i = leq.vTear_value[i]
891+ #
892+ # unitless = true:
893+ # v_i = leq.vTear_value[i]*@u_str($v_unit)
894+ #
890895 vAssigned_names = Any[]
891896 i1 = 0
892897 i2 = 0
893898 for (i,v) in enumerate (eq. vTear)
894899 v_name = eq. fc. var_julia_name (v)
895- v_unit = eq. fc. var_unit (v)
900+ v_unit = unitless ? " " : eq. fc. var_unit (v)
896901 v_length = eq. fc. var_length (undifferentiated (eq,v))
897902 i1 = i2 + 1
898903 i2 = i1 + v_length - 1
@@ -1392,7 +1397,7 @@ function getSortedAndSolvedAST(G, # Typically ::Vector{Vector{Int}}
13921397 end
13931398
13941399 # Generate AST to build-up and solve linear equation system of the teared equations
1395- addLinearEquations! (eq, hasConstantCoefficients)
1400+ addLinearEquations! (eq, hasConstantCoefficients, unitless )
13961401
13971402
13981403 else
0 commit comments