cellml / cellml-specification

CellML Specification
0 stars 8 forks source link

Can resets change variables of integration? #327

Open kerimoyle opened 4 years ago

kerimoyle commented 4 years ago

In the introduction page we say: image

... but later on we use the terms (x', t', p') to describe the new state after reset. I wouldn't have thought that t could change? so should be (x', t, p') instead? See here for an example: https://cellml-specification-dev.readthedocs.io/en/i324_examples_chapter/reference/examples/resets/reset_example_3_orderofevaluation.html

MichaelClerx commented 4 years ago

yeah. should be (x', t, p) even

kerimoyle commented 4 years ago

Hmm ... we need to make it clearer that values of p can't change then. At the moment the reading I got (from elsewhere, not the intro page) was that they were the set of non-integrated variables, but that resets could change them... I guess 2. says not though.

MichaelClerx commented 4 years ago

I only changed it last week to have that big preamble defining x, t, an p, so it's not really clear throughout the doc yet

MichaelClerx commented 4 years ago

and the document might be inconsistent at some points, because I used to think p could change! But then changed it so that x is all variables that are either defined through a derivative, or with an initial condition but no "eternal truth". Otherwise it wouldn't make sense to say "x = 1" AND a reset can set it to 12. We can only say "x[0] = 1 AND a reset can set it to 12"

But that was quite a late realisation!

kerimoyle commented 4 years ago

OK, I'll keep an eye out... though I wonder whether it's actually needed to define them like this? You've used the terminology in a few of the examples at the beginning, but then just say "system values don't change" or something like that in the later ones? Do you have a preference for which is used where, or is there a reason for the change?

MichaelClerx commented 4 years ago

Just trying to clarify

kerimoyle commented 4 years ago

But is it an eternal truth to say A = B and then reset the value of B or A? Or are we totally forbidding changes to non-integrated variables?

kerimoyle commented 4 years ago

Hmmm ... thinking about it again, what about this:

dx/dt = 1
a = x
reset x -> 3 at x = 3

.. so in this example x = [x], p = [a], but the reset changes x, so the value of a changes too ... so does this mean that p has changed? in which case we need to keep the p'notation?

MichaelClerx commented 4 years ago

But is it an eternal truth to say A = B and then reset the value of B or A? Or are we totally forbidding changes to non-integrated variables?

Not non-integrated variables. The set x is all variables with an initial condition, but without a statement like y = 3

MichaelClerx commented 4 years ago

So if A = B then that holds forever, and you can't change A to not be equal to B. You might update A or B if they're otherwise free, but changing A would change B and vice versa

MichaelClerx commented 4 years ago

Hmmm ... thinking about it again, what about this:

dx/dt = 1
a = x
reset x -> 3 at x = 3

.. so in this example x = [x], p = [a], but the reset changes x, so the value of a changes too ... so does this mean that p has changed? in which case we need to keep the p'notation?

Here x is in the set of state variables x (it defines part of the state of the model) And a is in the set of derived variables g (its derived from x)

MichaelClerx commented 4 years ago

t: Free variables, not set by the model in any way x: States, are defined at some initial condition p: Things that are eternally constant (including parameters, for the sake of this argument) g: things that depend on t, x, p but are not in x themselves

kerimoyle commented 4 years ago

maybe we should call x: anything that you want to reset ... and then say that it must be defined with an initial condition?

kerimoyle commented 4 years ago

And this bit should be changed to just x now too? image

kerimoyle commented 4 years ago

So if A = B then that holds forever, and you can't change A to not be equal to B. You might update A or B if they're otherwise free, but changing A would change B and vice versa

So A = B in the reset is only an assignment, not an eternal truth? As in this example: https://cellml-specification-dev.readthedocs.io/en/i324_examples_chapter/reference/examples/resets/reset_example_3_orderofevaluation.html

MichaelClerx commented 4 years ago

Not sure! I think of them as changes to apply, not eternal truths. Maybe we can come up with an example where it matters?