147147=#
148148function apply_transform (transform:: T , prob:: ODESystem ) where T<: AbstractTransform
149149
150- # Factorize all equations to generate equations
150+ # Factorize all model equations to generate a new set of equations
151151 equations = Equation[]
152152 for eqn in prob. eqs
153153 current = length (equations)
@@ -162,7 +162,7 @@ function apply_transform(transform::T, prob::ODESystem) where T<:AbstractTransfo
162162 end
163163 end
164164
165- # Apply transform rules to the factored equations to make a new set of equations
165+ # Apply transform rules to the factored equations to make the final equation set
166166 new_equations = Equation[]
167167 for a in equations
168168 zn = var_names (transform, zstr (a))
@@ -178,12 +178,6 @@ function apply_transform(transform::T, prob::ODESystem) where T<:AbstractTransfo
178178 end
179179 end
180180
181- # Convert equations to equations (why are we doing equations in the first place, actually?)
182- # Combine all transforms into a new set of equations and create a new ODE system
183- # new_eqs = Equation[]
184- # for i in new_equations
185- # push!(new_eqs, Equation(i.lhs, i.rhs))
186- # end
187181 println (" " )
188182 println (" Old equations:" )
189183 for i in prob. eqs
@@ -196,10 +190,10 @@ function apply_transform(transform::T, prob::ODESystem) where T<:AbstractTransfo
196190 end
197191 println (" " )
198192
199- # Copy over given start points to the new variables
193+ # Copy model start points to the newly transformed variables
200194 var_defaults, param_defaults = translate_initial_conditions (transform, prob, new_equations)
201195
202-
196+ # Use the transformed equations and new start points to generate a new ODE system
203197 @named new_sys = ODESystem (new_equations, default_u0= var_defaults, default_p= param_defaults)
204198
205199
0 commit comments