@@ -870,29 +870,34 @@ end
870
870
871
871
872
872
"""
873
- addLinearEquations!(eq::EquationGraph, hasConstantCoefficients::Bool)
873
+ addLinearEquations!(eq::EquationGraph, hasConstantCoefficients::Bool, unitless::Bool )
874
874
875
875
A linear equation system is solved. Push this information to
876
876
eq.SortedEquations. Furthermore, generate the AST for a for-loop that builds
877
877
and solves a linear equation system A*x = b
878
878
from the solved equations and the residual equations,
879
879
and push this information to eq.SortedEquations.AST.
880
880
"""
881
- function addLinearEquations! (eq:: EquationGraph , hasConstantCoefficients:: Bool ):: Nothing
881
+ function addLinearEquations! (eq:: EquationGraph , hasConstantCoefficients:: Bool , unitless :: Bool ):: Nothing
882
882
# Construct body of for-loop
883
883
empty! (eq. AST_aux)
884
884
while_body = eq. AST_aux
885
885
vTear_names = String[]
886
886
vTear_lengths = Int[]
887
887
888
888
# 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
+ #
890
895
vAssigned_names = Any[]
891
896
i1 = 0
892
897
i2 = 0
893
898
for (i,v) in enumerate (eq. vTear)
894
899
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)
896
901
v_length = eq. fc. var_length (undifferentiated (eq,v))
897
902
i1 = i2 + 1
898
903
i2 = i1 + v_length - 1
@@ -1392,7 +1397,7 @@ function getSortedAndSolvedAST(G, # Typically ::Vector{Vector{Int}}
1392
1397
end
1393
1398
1394
1399
# Generate AST to build-up and solve linear equation system of the teared equations
1395
- addLinearEquations! (eq, hasConstantCoefficients)
1400
+ addLinearEquations! (eq, hasConstantCoefficients, unitless )
1396
1401
1397
1402
1398
1403
else
0 commit comments