blegat / HybridSystems.jl

Hybrid Systems definitions in Julia
Other
28 stars 5 forks source link

Define global statedim and inputdim for HybridSystem #60

Open schillic opened 7 months ago

blegat commented 6 months ago

What's the motivation ? It can be the source of bugs if someone forgets to give this argument

schillic commented 6 months ago

Sorry, should have written that. I propose to define the dimension of a hybrid system globally. Different modes can have different dynamics, constraint sets etc. But the dimension should be the same in all modes because a hybrid system still describes one big system, just with sudden mode changes.

We can discuss whether at the time of construction there should be an assertion that this property holds.

schillic commented 6 months ago

@blegat, do you generally agree or disagree?

mforets commented 6 months ago

but different modes can have different state space dimension, right? seems to me that there's no unique definition of global dim, in the general case.

schillic commented 6 months ago

That is exactly what I argued against. Yes, you can create a HybridSystem instance with mixed dimensions, but you can also create a differential equation x' = (x < 5) ? 1.5 : "oh no". In both cases, that does not make sense to me. Every definition I have seen has a common dimension in all modes. For instance from Henzinger's The theory of hybrid automata:

hybrid

Maybe it helps to think about the consequence of mixed dimensions. What is a trajectory of such a mixed system? For instance, if your system models a 3D object's position, what does it mean that you suddenly only have two dimensions? Do you have an example where this makes sense?

clagms commented 6 months ago

Thanks for all the great work!

Perhaps a simple example could be a 6 joint robot manipulator carrying out different manufacturing task?. In some cases it may be easier to model. This is a hybrid system and in different modes different joints will be allowed to move thus yielding different dimensions. To be fair, one could model this with the same set of dimensions except the constraints change.

Another example is a falling rod example provided by Pieter Mosterman. In one mode, the rod is falling and in the other mode it hits the table and starts rotating. Again one could model the system with a fixed number of dimensions, but I think it would be maybe harder to understand.

my 2 cents :)

schillic commented 6 months ago

Of course modeling can be slightly easier (although I would argue writing $\dot{x} = 0$ for unchanged dimensions is not super complicated), but the interpretation is much harder. I cannot see how you would write a simulator for such a mixed system; how would it know how to map dimensions when the mode changes?