-
-
Couldn't load subscription status.
- Fork 233
Add symbolic tspan field to System struct (fixes #847) #3837
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The tests are weirdly redundant, and don't actually test creating an |
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -1614,3 +1614,31 @@ end | |||||||||
| @test_nowarn push!(arr, sys) | ||||||||||
| @test_nowarn TestWrapper(sys) | ||||||||||
| end | ||||||||||
|
|
||||||||||
| @testset "Symbolic tspan" begin | ||||||||||
| @variables x(t) y(t) | ||||||||||
| @parameters σ ρ β | ||||||||||
|
|
||||||||||
| # Test creating a system with tspan | ||||||||||
| eqs = [D(x) ~ σ * (y - x), | ||||||||||
| D(y) ~ x * (ρ - x) - y] | ||||||||||
|
|
||||||||||
|
Comment on lines
+1624
to
+1625
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [JuliaFormatter] reported by reviewdog 🐶
Suggested change
|
||||||||||
| # Test with numeric tspan | ||||||||||
| @named sys1 = System(eqs, t, [x, y], [σ, ρ, β]; tspan = (0.0, 10.0)) | ||||||||||
| @test ModelingToolkit.get_tspan(sys1) == (0.0, 10.0) | ||||||||||
| @test ModelingToolkit.has_tspan(sys1) == true | ||||||||||
|
|
||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [JuliaFormatter] reported by reviewdog 🐶
Suggested change
|
||||||||||
| # Test with symbolic tspan | ||||||||||
| @parameters t0 tf | ||||||||||
| @named sys2 = System(eqs, t, [x, y], [σ, ρ, β]; tspan = (t0, tf)) | ||||||||||
| @test isequal(ModelingToolkit.get_tspan(sys2), (t0, tf)) | ||||||||||
|
|
||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [JuliaFormatter] reported by reviewdog 🐶
Suggested change
|
||||||||||
| # Test without tspan | ||||||||||
| @named sys3 = System(eqs, t, [x, y], [σ, ρ, β]) | ||||||||||
| @test ModelingToolkit.get_tspan(sys3) === nothing | ||||||||||
| @test ModelingToolkit.has_tspan(sys3) == true # Field exists but is nothing | ||||||||||
|
|
||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [JuliaFormatter] reported by reviewdog 🐶
Suggested change
|
||||||||||
| # Test that tspan is preserved through system completion | ||||||||||
| sys1_complete = complete(sys1) | ||||||||||
| @test ModelingToolkit.get_tspan(sys1_complete) == (0.0, 10.0) | ||||||||||
| end | ||||||||||
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 adds the field to the system, but does not handle it in
flattenand the other functions that operate on (hierarchical) systems.