-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#7 - Initial implementation #10
Conversation
From my side this branch is ready to be merged. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I only had a rough look.
docs/src/examples/examples.md
Outdated
|
||
`spaceex -g name.cfg -m name.xml --output-system-file new_name.xml` | ||
|
||
However, note that the flattening process change the original model and may induce parsing errors. The parsing errors only appear when the constructed model is visualized/analyzed with the Model Editor or/and the Web Interface. There are no parsing errors with the source code/executable SpaceEx. A list of identified parsing problems follows below. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changes
docs/src/examples/examples.md
Outdated
However, note that the flattening process change the original model and may induce parsing errors. The parsing errors only appear when the constructed model is visualized/analyzed with the Model Editor or/and the Web Interface. There are no parsing errors with the source code/executable SpaceEx. A list of identified parsing problems follows below. | ||
|
||
1. Special symbols, e.g. ~, _ in the variable and location names | ||
2. Characters and symbols in the notes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the difference between characters and symbols?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably the best thing is to suggest that users employ only Latin alphabet and no special characters.
To answer your question, from my standpoint, symbols correspond to mathematical operations (,},/,*,+,_ and characters to non-latin characters, e.g. Greek or Russian letters
docs/src/examples/examples.md
Outdated
|
||
1. Special symbols, e.g. ~, _ in the variable and location names | ||
2. Characters and symbols in the notes | ||
3. Nondeterministic flows, e.g. x'==x+w, where 0<w1<0.1 (see bball_nondet) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"w" or "w1"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
correct! w or w1 should be kept
docs/src/index.md
Outdated
3. Nondeterministic flows, e.g. x'==x+w, where 0<w1<0.1 (see bball_nondet) | ||
4. Nondeterministic resets, e.g. v' == -0.75*v+w2 (see bball_nondet) | ||
5. Naming issues, e.g. default variable name is component.subcomponent.variable | ||
A visual model editor is available for download in the [SpaceEx website](http://spaceex.imag.fr/download-6). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in → on ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indeed!
src/io.jl
Outdated
### Output | ||
|
||
Hybrid system that corresponds to the given SX model and the given assumptions | ||
on the system type. If `raw_dict=true`; otherwise, a dictionary with the Julia |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If
raw_dict=true
Is there something missing?
src/parse.jl
Outdated
### Output | ||
|
||
The tuple `(q, r, G, A)` where `q` and `r` are the source mode and target mode | ||
respectively for this location, `G` is the list of guards for this location, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
location → transition (2x)
src/parse.jl
Outdated
|
||
The tuple `(q, r, G, A)` where `q` and `r` are the source mode and target mode | ||
respectively for this location, `G` is the list of guards for this location, | ||
and `A` is the list of assignments. Both objects are vectors of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both objects → Both G
and A
?
|
||
### Notes | ||
|
||
It is assumed that the "source" and "target" fields can be cast to integers. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This sounds strict. Is this reasonable?
Otherwise you could store the transitions in a temporary data structure and obtain the location IDs later from a dictionary "location name → location ID".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is given by the format, those id's are assigned automatically (for locations, transitions, etc). I don't remember if there is a way of editing these fields in the model editor.
test/runtests.jl
Outdated
end | ||
|
||
#= | ||
@testset "Circle" begin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about this one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added.
src/parse.jl
Outdated
|
||
Consists of the following steps (in the given order): | ||
|
||
- split the string with the `&` key |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you want to allow parentheses? Since the formulas are purely conjunctive, they could just be ignored.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good point. as a by-product of parse
, parentheses are ignored:
julia> parse_sxmath("(x == 0) & ((v <= 0))")
2-element Array{Expr,1}:
:(x = 0)
:(v <= 0)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note that & is the same as && for SpaceEx
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note that & is the same as && for SpaceEx
Thanks. I've updated the function parse_sxmath
accordingly.
src/io.jl
Outdated
- `invariants` | ||
- `flows` | ||
- `resetmaps` | ||
- `switchings` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the difference between resetmaps
and switchings
? Is there a reason to have both?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the association that i did (naively, subject to discussion) is:
resetmaps
field in HybridSystems <-> assignments in SXswitchings
field in HybridSystems <-> guards in SX
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah ok, this is coming from HybridSystems
. Makes sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The guards (i.e. the sets in which the states need to be to do the switching should be in the resetmaps
) as the constraint set X
of Systems.jl. switchings
is meant to be the nature of the switching (e.g. controlled switching vs autonomous switching of Section 1.1.3 of Liberzon "Switching in Systems and Control")
EDIT I have added documentation for it in the HybridSystems doc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the hints, this helped a lot.
In the examples added up to now, the switchings are autonomous since they are defined by hypersurfaces for the states.
For the resetmaps
, we take discrete constrained systems, whose state constraints are given by guards
in SX (or eventually, input constraints), and the coefficient matrices are read from the assignments
in SX.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That seems perfect :)
Thanks to all of you for the feedback. |
Closes #7.
raw_dict=true
[ ] make optionraw_dict=false
(default)[ ] add functions to docsEDIT: i'm readdressing this issue:
this leaves for the next issue to transform the information of the hybrid automaton into a given system type, that is
(A, B, X, U)
, whereX, U
have to be transformed from expressions to some LazySet representation.