# Mismatch error when using the ODESystem and ODEProblem to convert DAE system to ODE system

**URL:** <https://discourse.julialang.org/t/mismatch-error-when-using-the-odesystem-and-odeproblem-to-convert-dae-system-to-ode-system/114438>\
**Category:** General Usage\
**Tags:** ode, modelingtoolkit, differentialequation\
**Created:** [May 18, 2024, 6:28pm UTC](https://discourse.julialang.org/t/mismatch-error-when-using-the-odesystem-and-odeproblem-to-convert-dae-system-to-ode-system/114438 "2024-05-18T18:28:09Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ethan\_Tran](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ethan_tran/32/49198_2.png) [@Ethan\_Tran](https://discourse.julialang.org/u/Ethan_Tran)\
**Post date:** [May 18, 2024, 6:28pm UTC](https://discourse.julialang.org/t/mismatch-error-when-using-the-odesystem-and-odeproblem-to-convert-dae-system-to-ode-system/114438/1 "2024-05-18T18:28:09Z")

</div>

I have used the ODESystem and ODEProblem to convert the DAE system into ODE system in Julia. It works well for the systems with 10 and 54 equations, but when I tried for the larger system with 88 or 198 equations it has the error below:

```julia
ArgumentError: Equations (88), states (84), and initial conditions (84) are of different lengths. To allow a different number of equations than states use kwarg check_length=false.

```

Even though I have checked the length of u0, it is equal to the length of the equations.  
Because my model is quite complex and has a lot of parameters, I have used out-of-place functions instead of in-place functions, which are used in DAEProblem and SteadyStateProblem.  
Example for equations in the model:

```julia
eq1 = [D(delta[i]) ~ omega[i] for i in 1:m]
...
eqs = [eq1; eq2; eq3; ...; eq10]

```

The part of my model is shown below:  
 ![Screenshot](https://global.discourse-cdn.com/julialang/original/3X/9/0/902361402819619acd8357f7fa2267bc5d4602a6.jpeg)

Please help me on how to fix it.  
Thank you for your time and consideration.

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [May 18, 2024, 11:20pm UTC](https://discourse.julialang.org/t/mismatch-error-when-using-the-odesystem-and-odeproblem-to-convert-dae-system-to-ode-system/114438/2 "2024-05-18T23:20:35Z")

</div>

Can you post an MWE?

---

<div class="post-metadata">

**Author:** ![Ethan\_Tran](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ethan_tran/32/49198_2.png) [@Ethan\_Tran](https://discourse.julialang.org/u/Ethan_Tran)\
**Post date:** [May 18, 2024, 11:50pm UTC](https://discourse.julialang.org/t/mismatch-error-when-using-the-odesystem-and-odeproblem-to-convert-dae-system-to-ode-system/114438/3 "2024-05-18T23:50:51Z")

</div>

Yes, there are the model file and its dataset directly to your message box. Please help me to check that.

---

<div class="post-metadata">

**Author:** ![Ethan\_Tran](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ethan_tran/32/49198_2.png) [@Ethan\_Tran](https://discourse.julialang.org/u/Ethan_Tran)\
**Post date:** [May 19, 2024, 4:54pm UTC](https://discourse.julialang.org/t/mismatch-error-when-using-the-odesystem-and-odeproblem-to-convert-dae-system-to-ode-system/114438/4 "2024-05-19T16:54:58Z")

</div>

I’ve resolved the issue. The problem was that several equations only contained constants without any variables because I made mistakes when implementing the parameters. For example, It had an equation like 0 = -1.2. When using the ODESystem to create the ODE, the tool dropped these equations and turned them into observed equations, causing a mismatch in dimension. I’ve double-checked everything, and now the system has been successfully created. Thank you for your consideration.
