# ModelingToolkit -- news?

**URL:** <https://discourse.julialang.org/t/modelingtoolkit-news/111126>\
**Category:** Modelling & Simulations\
**Created:** [March 4, 2024, 11:30am UTC](https://discourse.julialang.org/t/modelingtoolkit-news/111126 "2024-03-04T11:30:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![BLI](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bli/32/37206_2.png) [@BLI](https://discourse.julialang.org/u/BLI)\
**Post date:** [March 4, 2024, 11:30am UTC](https://discourse.julialang.org/t/modelingtoolkit-news/111126/1 "2024-03-04T11:30:41Z")

</div>

There seems to be a few changes to the latest versions of ModelingToolkit:

- Constructor `ODESystem` now _requires_ the independent variable as second argument [e.g., `ODESystem(eqs,t)` – in the past, the constructor tried to infer the independent variable, i.e., `ODESystem(eqs)` would often work]. _Is this correct_?

- Field (and function) `states` of systems has been changed to `unknowns`?

In the initial example of MTK:

```julia
using ModelingToolkit: t_nounits as t, D_nounits as D

```

- Does this mean that now, ModelingToolkit has built-in names for the time variable (`t_nounits`) and time differentiation (`D_nounits`)? And that the examples choose `t` and `D`, respectively, as aliases for `t_nounits` and `D_nounits`?
- If my above guess is correct, I _assume_ that the purpose of this is to (i) avoid having to define these when using MTK and possibly getting more efficient code, (ii) that the user can choose her/his own aliases, and (iii) make sure that all libraries use the same name for the time variable [`t_nounits`].
- The “casual user” can still define time as `@variables t` and differentiation as `D = Differial(t)`, but then this code will not work in conjunction with, e.g., `ModelingToolkitStandardLibrary`. Right?

---

<div class="post-metadata">

**Author:** ![baggepinnen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/baggepinnen/32/693_2.png) [@baggepinnen](https://discourse.julialang.org/u/baggepinnen)\
**Post date:** [March 4, 2024, 12:41pm UTC](https://discourse.julialang.org/t/modelingtoolkit-news/111126/2 "2024-03-04T12:41:19Z")

</div>

> [@BLI](#):
>
> Constructor `ODESystem` now _requires_ the independent variable as second argument [e.g., `ODESystem(eqs,t)` – in the past, the constructor tried to infer the independent variable, i.e., `ODESystem(eqs)` would often work]. _Is this correct_?

correct

> [@BLI](#):
>
> Field (and function) `states` of systems has been changed to `unknowns`?

correct

> [@BLI](#):
>
> Does this mean that now, ModelingToolkit has built-in names for the time variable (`t_nounits`) and time differentiation (`D_nounits`)? And that the examples choose `t` and `D`, respectively, as aliases for `t_nounits` and `D_nounits`?

correct

> [@BLI](#):
>
> I _assume_ that the purpose of this is to (i) avoid having to define these when using MTK

correct

> [@BLI](#):
>
> and possibly getting more efficient code

not really

> [@BLI](#):
>
> that the user can choose her/his own aliases

you can, but you could that before as well

> [@BLI](#):
>
> make sure that all libraries use the same name for the time variable [`t_nounits`].

the symbolic name of the time variable is `t`, it’s the julia variable that is called `t_nounits`

```julia-repl
julia> ModelingToolkit.t_nounits
t

```

> [@BLI](#):
>
> The “casual user” can still define time as `@variables t` and differentiation as `D = Differial(t)`, but then this code will not work in conjunction with, e.g., `ModelingToolkitStandardLibrary`. Right?

I think it would work anyway, but there is no need to define these yourself anymore

---

<div class="post-metadata">

**Author:** ![BLI](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bli/32/37206_2.png) [@BLI](https://discourse.julialang.org/u/BLI)\
**Post date:** [March 4, 2024, 12:55pm UTC](https://discourse.julialang.org/t/modelingtoolkit-news/111126/3 "2024-03-04T12:55:59Z")

</div>

> [@baggepinnen](#):
>
> the symbolic name of the time variable is `t`, it’s the julia variable that is called `t_nounits`

But in principle, I could alias `t_nounits` to `time` and `D_nounits` to `der`, like in Modelica? And MTK would understand that `time` is the same as `t` used in ModelingToolkitStandardLibrary?

Not that I would do it, though.  
\_\_  
Anyways, I like the changes!

---

<div class="post-metadata">

**Author:** ![baggepinnen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/baggepinnen/32/693_2.png) [@baggepinnen](https://discourse.julialang.org/u/baggepinnen)\
**Post date:** [March 4, 2024, 1:08pm UTC](https://discourse.julialang.org/t/modelingtoolkit-news/111126/4 "2024-03-04T13:08:17Z")

</div>

> [@BLI](#):
>
> But in principle, I could alias `t_nounits` to `time` and `D_nounits` to `der`, like in Modelica? And MTK would understand that `time` is the same as `t` used in ModelingToolkitStandardLibrary?

Absolutely, the name of the julia variable you use is not even known to MTK, so your choice cannot possibly have any effect on the result 🙂
