Skip to content

Commit

Permalink
Merge pull request #22 from blegat/mforets/20
Browse files Browse the repository at this point in the history
#20 - Add assignment as getter function of reset map
  • Loading branch information
blegat committed Feb 8, 2019
2 parents a2d1a9f + a4d11da commit 59f8eb8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
3 changes: 2 additions & 1 deletion docs/src/lib/methods.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,9 @@ in_transitions
out_transitions
```

### Guards
### Guards and Assignments

```@docs
guard
assignment
```
9 changes: 8 additions & 1 deletion src/HybridSystems.jl
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,19 @@ Returns the set of allowed states of the system at mode `u`.
"""
MathematicalSystems.stateset(hs::HybridSystem, u::Int) = stateset(hs.modes[u])

"""
assignment(hs::HybridSystem, t)
Returns the assignment for the transition `t`.
"""
assignment(hs::HybridSystem, t) = hs.resetmaps[symbol(hs, t)]

"""
guard(hs::HybridSystem, t)
Returns the guard for the transition `t`.
"""
guard(hs::HybridSystem, t) = stateset(hs.resetmaps[symbol(hs, t)])
guard(hs::HybridSystem, t) = stateset(assignment(hs, t))

# for completeness, extend the stateset function from MathematicalSystems
# because guards are given as the state constraints of the reset map
Expand Down

0 comments on commit 59f8eb8

Please sign in to comment.