# Equating ModelingToolkit parameters and variables?

**URL:** <https://discourse.julialang.org/t/equating-modelingtoolkit-parameters-and-variables/74642>\
**Category:** Modelling & Simulations\
**Tags:** question, modelingtoolkit\
**Created:** [January 14, 2022, 7:59pm UTC](https://discourse.julialang.org/t/equating-modelingtoolkit-parameters-and-variables/74642 "2022-01-14T19:59:05Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![AndreaRH](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/andrearh/32/32809_2.png) [@AndreaRH](https://discourse.julialang.org/u/AndreaRH)\
**Post date:** [January 23, 2022, 1:44pm UTC](https://discourse.julialang.org/t/equating-modelingtoolkit-parameters-and-variables/74642/3 "2022-01-23T13:44:31Z")

</div>

No, because I found this issue already existed:

> [@Solving chemical systems of equations with both equilibrium and kinetic species](https://discourse.julialang.org/t/solving-chemical-systems-of-equations-with-both-equilibrium-and-kinetic-species/68755):
>
> This is building on a different discourse post I made previously: [https://discourse.julialang.org/t/constraints-in-catalyst-jl-for-weak-acids-and-ph-equilibrium/68037/2](https://discourse.julialang.org/t/constraints-in-catalyst-jl-for-weak-acids-and-ph-equilibrium/68037/2) And on Github: [https://github.com/SciML/Catalyst.jl/issues/398](https://github.com/SciML/Catalyst.jl/issues/398) I am trying to solve a chemical system of equations that combines both equilibrium and kinetic species. Below is the sample code I am using: using OrdinaryDiffEq using Catalyst using DifferentialEquations using Plots using Latexify using ModelingToolkit @paramet…

It’s the same problem I encountered, except the message I got about `More equations than variables, here are the potential extra equation(s)` did not say which equation was the extra one.

So in my example I decided to re-write the equation I needed to take the `g(t)` variable.

```julia
gstate = sys2.states[1]
gparam = sys1.ps[1]
my_idx = 3 # for the INa eq. 
LHS = equations(sys1)[my_idx].lhs
RHS = equations(sys1)[my_idx].rhs
equations(sys1)[my_idx] = LHS ~ gstate / gparam * RHS 
sys = alias_elimination(extend(sys1, sys2))

```

---

_[View the full topic](https://discourse.julialang.org/t/equating-modelingtoolkit-parameters-and-variables/74642)._
