# Real-time input and plotting with ModelingToolkit

**URL:** https://discourse.julialang.org/t/real-time-input-and-plotting-with-modelingtoolkit/120713
**Category:** Modelling & Simulations
**Created:** [September 30, 2024, 8:44am UTC](https://discourse.julialang.org/t/real-time-input-and-plotting-with-modelingtoolkit/120713 "2024-09-30T08:44:30Z")
**Posts on this page:** 1
**Showing post:** 8

<div class="post-metadata">

### Author: ![cstjean](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cstjean/32/1444_2.png) [@cstjean](https://discourse.julialang.org/u/cstjean)
#### Post date: [November 1, 2024, 6:59am UTC](https://discourse.julialang.org/t/real-time-input-and-plotting-with-modelingtoolkit/120713/8 "2024-11-01T06:59:22Z")

</div>

> [@ufechner7](#):
>
> Well, normally a system has inputs that are different variables than the state variables. You can always modify the inputs. No need for callbacks.

This was working fine for a while, but after reformulating my model I’m now hitting return codes of `Unstable`. To be clear, I’ve got a loop like

```julia
my_value = 10
read_my_value(t) = my_value
@register_symbolic read_my_value(t)
while true
    step!(integrator, dt, true)
    my_value += 1 # super-simplified; in reality it's a GUI slider
end

```

I read the [PSA](https://discourse.julialang.org/t/psa-how-to-help-yourself-debug-differential-equation-solving-issues/62489) and this part:

> Double check if you’re doing anything that violates assumptions of being an ODE. As an ODE, the right-hand side `f` function should always give you the same result: `u' = f(u,p,t)` needs to be uniquely defined. These issues are just fundamental to the mathematics: if you do these things in `f` , then `f` no longer defines an ODE so of course it cannot be solved!

makes me worry that maybe `step!` can go before the current time `t` and get upset that `f(t-1)` no longer returns the value it did before.

---

_[View the full topic](https://discourse.julialang.org/t/real-time-input-and-plotting-with-modelingtoolkit/120713)._
