Skip to content
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

Add support for transition_duration for transitions #21

Open
blegat opened this issue Sep 21, 2020 · 0 comments
Open

Add support for transition_duration for transitions #21

blegat opened this issue Sep 21, 2020 · 0 comments

Comments

@blegat
Copy link
Owner

blegat commented Sep 21, 2020

Consider the switched systems characterized by the graphs G1 and H3 of the examples https://github.com/blegat/SwitchOnSafety.jl/blob/master/examples/AJPR14e54.jl
The time duration of some of the transitions is 2 so this line:

scale(HybridSystems.resetmap(hs.system, t), hs.γ)

is not correct.
To fix this, we will assume that if there is no entry :transition_duration in the ext Dict:
https://github.com/blegat/HybridSystems.jl/blob/46d60438a2ae196a740274fb416f2093fe104547/src/HybridSystems.jl#L63
then the transition_duration is 1 second for each transition.
Otherwise, ext[:transition_duration] should contain the time duration of each transition.
So for instance, to construct the graph G1 of the example, one would do

transition_duration = HybridSystems.transition_property(G1, Float64)
transition_duration[HybridSystems.OneStateTransition(1)] = 1.0
transition_duration[HybridSystems.OneStateTransition(2)] = 1.0
transition_duration[HybridSystems.OneStateTransition(3)] = 2.0
G1.ext[:transition_duration] = transition_duration

Then the line

scale(HybridSystems.resetmap(hs.system, t), hs.γ)

would be replaced by

transition_duration = get(hs.system.ext, :transition_duration, nothing)
if transition_duration === nothing
    scaling = hs.γ
else
    scaling = hs.γ^transition_duration[t]
end
scale(HybridSystems.resetmap(hs.system, t), scaling)

Once this is implemented, it should be tested by adding the graph G1 and H3 to the example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant