@@ -172,28 +172,20 @@ end
172172```
173173Finally, we extend the ` hhmodel ` with the systems defining the ion channel currents
174174``` @example hh1
175- for sys in (IKmodel, INamodel, ILmodel )
176- @named hhmodel2 = extend(sys , hhmodel2)
177- end
175+ @named hhmodel2 = extend (IKmodel, hhmodel2 )
176+ @named hhmodel2 = extend(INamodel , hhmodel2)
177+ @named hhmodel2 = extend(ILmodel, hhmodel2)
178178hhmodel2 = complete(hhmodel2)
179179```
180- Let's again solve the system for the resting state, and then solve with the same
181- applied current as above (to verify we get the same figure). Note, we now
182- explicitly convert to an ` ODESystem ` and then run ` structural_simplify ` from
183- ModelingToolkit to eliminate the algebraic equations for the ionic currents
180+ Let's again solve the system starting from the previously calculated resting
181+ state, using the same applied current as above (to verify we get the same
182+ figure). Note, we now run ` structural_simplify ` from ModelingToolkit to
183+ eliminate the algebraic equations for the ionic currents when constructing the
184+ ` ODEProblem ` :
184185
185186``` @example hh1
186- osys = convert(ODESystem, hhmodel2)
187- osys = structural_simplify(osys)
188-
189- tspan = (0.0, 50.0)
190- u₀ = symmap_to_varmap(osys, [:V => -70, :m => 0.0, :h => 0.0, :n => 0.0,
191- :m′ => 1.0, :n′ => 1.0, :h′ => 1.0])
192- oprob = ODEProblem(osys, u₀, tspan)
193- hhsssol = solve(oprob, Rosenbrock23())
194- u_ss = unknowns(osys) .=> hhsssol(tspan[2], idxs = unknowns(osys))
195187@unpack I₀,V = hhmodel2
196- oprob = ODEProblem(osys , u_ss, tspan, [I₀ => 10.0])
188+ oprob = ODEProblem(hhmodel2 , u_ss, tspan, [I₀ => 10.0]; structural_simplify = true )
197189sol = solve(oprob)
198190plot(sol, idxs = V, legend = :outerright)
199191```
0 commit comments