JuliaReach / SpaceExParser.jl

Parser for the SpaceEx modeling language in Julia
https://juliareach.github.io/SpaceExParser.jl/
MIT License
7 stars 1 forks source link

Reading an output variable #26

Open mforets opened 6 years ago

mforets commented 6 years ago

In a model such as ISS, y1 is defined as

<param name="y1" type="real" local="false" d1="1" d2="1" dynamics="any" controlled="false" />

Since it is not controlled, it is currently interpreted as an "input" variable which is not really the case. Actually, it is defined in the invariant as a linear combination of state variables,

...
y1 == 0.000067947*x1 - 0.029964*x2 + 0.025941*x3 - 0.00012623*x4 + 6.5319e-6*x5 + 0.00013057*x6 - 0.06363*x7 - 0.00012503*x8 + 0.01654*x9 - 0.0012343*x10
...

hence it is really an "output". There is no flow equation for y1.

Since this invariants contains a combination of input variables and state variables, the current code breaks (does it belong to the X or to the U fields of the ConstrainedLinearControlContinuousSystem? i think none of them..):

invariant y1 = (((((((6.7947e-5x1 - 0.029964x2) + 0.025941x3) - 0.00012623x4) + 6.5319e-6x5 + 0.00013057x6) - 0.06363x7) - 0.00012503x8) + 0.01654x9) - 0.0012343x10 in location 1 contains a combination of state variables and input variables, and conversion to a system of type MathematicalSystems.ConstrainedLinearControlContinuousSystem is not possible

My proposal is to wait for systems with output to add this information properly to the underlying system type.

Otherwise, extra information can always be added in the ext field of the hybrid automaton.

schillic commented 6 years ago

I think in general it is hard to say if a constraint is on states or on inputs. What to do with the constraint x < u (admittedly, I never saw this)?

How do you discriminate outputs from inputs?

mforets commented 6 years ago

i think we can say that: if the parameter appears in an invariant, but there is no flow equation for it, then this is an output.

What to do with the constraint x < u (admittedly, I never saw this)?

i think that one could be rewritten as a state constraint, if we know that u is inside some bounds.

schillic commented 6 years ago

i think we can say that: if the parameter appears in an invariant, but there is no flow equation for it, then this is an output.

And what is the difference to an input? :wink:

nikos-kekatos commented 6 years ago

good point! maybe add an extra check, i.e. the output should be a function of the states while the input is not.

schillic commented 6 years ago

What about this: An input is as described above, and additionally it is used on the r.h.s. of a flow equation.

nikos-kekatos commented 6 years ago

It makes sense! Indeed, this is another way to differentiate inputs/outputs.

However, I think it might be better suited for linear systems. An input may not appear at all in the flow, e.g. we may have an input only in a reset.

On the other hand, the condition with output may be more suitable (as the outputs always appear on the invariant).