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

Systems are considered equal, even if they have different events #2638

Closed
TorkelE opened this issue Apr 14, 2024 · 0 comments · Fixed by #3317
Closed

Systems are considered equal, even if they have different events #2638

TorkelE opened this issue Apr 14, 2024 · 0 comments · Fixed by #3317
Assignees
Labels
bug Something isn't working events

Comments

@TorkelE
Copy link
Member

TorkelE commented Apr 14, 2024

In some cases, systems are marked as equal, even if they are not. One example are systems with different events.

Here, the last 3 cases should return false.

using ModelingToolkit
import ModelingToolkit.t_nounits as t
import ModelingToolkit.D_nounits as D

@variables X(t)
@parameters p d
eq = D(X) ~ p - d*X

osys1 = complete(ODESystem([eq], t; name = :osys))
osys2 = complete(ODESystem([eq], t; name = :osys))
osys1 == osys2 # true

continuous_events = [[X ~ 1.0] => [X ~ X + 5.0]]
discrete_events = [5.0 => [d ~ d / 2.0]]

osys1 = complete(ODESystem([eq], t; name = :osys, continuous_events))
osys2 = complete(ODESystem([eq], t; name = :osys))
osys1 == osys2 # true

osys1 = complete(ODESystem([eq], t; name = :osys, discrete_events))
osys2 = complete(ODESystem([eq], t; name = :osys))
osys1 == osys2 # true

osys1 = complete(ODESystem([eq], t; name = :osys, continuous_events))
osys2 = complete(ODESystem([eq], t; name = :osys, discrete_events))
osys1 == osys2 # true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working events
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants