Skip to content

Commit 185ae58

Browse files
authored
Merge branch 'master' into discretedocs
2 parents dfdb618 + a64aad8 commit 185ae58

File tree

157 files changed

+7650
-4320
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

157 files changed

+7650
-4320
lines changed

.github/dependabot.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ updates:
77
interval: "weekly"
88
ignore:
99
- dependency-name: "crate-ci/typos"
10-
update-types: ["version-update:semver-patch"]
10+
update-types: ["version-update:semver-patch", "version-update:semver-minor"]

.github/workflows/Documentation.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,11 @@ jobs:
2828
env:
2929
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # For authentication with GitHub Actions token
3030
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} # For authentication with SSH deploy key
31+
JULIA_DEBUG: "Documenter"
3132
run: DISPLAY=:0 xvfb-run -s '-screen 0 1024x768x24' julia --project=docs/ --code-coverage=user docs/make.jl
3233
- uses: julia-actions/julia-processcoverage@v1
33-
- uses: codecov/codecov-action@v3
34+
- uses: codecov/codecov-action@v4
3435
with:
3536
file: lcov.info
37+
token: ${{ secrets.CODECOV_TOKEN }}
38+
fail_ci_if_error: true

.github/workflows/Downstream.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ jobs:
6868
exit(0) # Exit immediately, as a success
6969
end
7070
- uses: julia-actions/julia-processcoverage@v1
71-
- uses: codecov/codecov-action@v3
71+
- uses: codecov/codecov-action@v4
7272
with:
7373
file: lcov.info
74+
token: ${{ secrets.CODECOV_TOKEN }}
75+
fail_ci_if_error: true

.github/workflows/FormatCheck.yml

Lines changed: 0 additions & 48 deletions
This file was deleted.

.github/workflows/SpellCheck.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ jobs:
1010
- name: Checkout Actions Repository
1111
uses: actions/checkout@v4
1212
- name: Check spelling
13-
uses: crate-ci/typos@v1.16.25
13+
uses: crate-ci/typos@v1.18.0

.github/workflows/ci.yml

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ on:
33
pull_request:
44
branches:
55
- master
6+
- 'release-'
67
paths-ignore:
78
- 'docs/**'
89
push:
@@ -18,7 +19,39 @@ concurrency:
1819
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}
1920

2021
jobs:
22+
formatter:
23+
runs-on: ${{ matrix.os }}
24+
strategy:
25+
matrix:
26+
julia-version: [1]
27+
julia-arch: [x86]
28+
os: [ubuntu-latest]
29+
steps:
30+
- uses: julia-actions/setup-julia@latest
31+
with:
32+
version: ${{ matrix.julia-version }}
33+
34+
- uses: actions/checkout@v4
35+
- name: Install JuliaFormatter and format
36+
# This will use the latest version by default but you can set the version like so:
37+
#
38+
# julia -e 'using Pkg; Pkg.add(PackageSpec(name="JuliaFormatter", version="0.13.0"))'
39+
run: |
40+
julia -e 'using Pkg; Pkg.add(PackageSpec(name="JuliaFormatter"))'
41+
julia -e 'using JuliaFormatter; format(".", verbose=true)'
42+
- name: Format check
43+
run: |
44+
julia -e '
45+
out = Cmd(`git diff`) |> read |> String
46+
if out == ""
47+
exit(0)
48+
else
49+
@error "Some files have not been formatted !!!"
50+
write(stdout, out)
51+
exit(1)
52+
end'
2153
test:
54+
needs: formatter
2255
runs-on: ubuntu-latest
2356
strategy:
2457
fail-fast: false
@@ -27,14 +60,16 @@ jobs:
2760
- InterfaceI
2861
- InterfaceII
2962
- Extensions
63+
- Downstream
64+
- RegressionI
3065
version:
3166
- '1'
3267
steps:
3368
- uses: actions/checkout@v4
3469
- uses: julia-actions/setup-julia@v1
3570
with:
3671
version: ${{ matrix.version }}
37-
- uses: actions/cache@v3
72+
- uses: actions/cache@v4
3873
env:
3974
cache-name: cache-artifacts
4075
with:
@@ -49,6 +84,8 @@ jobs:
4984
env:
5085
GROUP: ${{ matrix.group }}
5186
- uses: julia-actions/julia-processcoverage@v1
52-
- uses: codecov/codecov-action@v3
87+
- uses: codecov/codecov-action@v4
5388
with:
5489
file: lcov.info
90+
token: ${{ secrets.CODECOV_TOKEN }}
91+
fail_ci_if_error: true

.typos.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ nin = "nin"
33
nd = "nd"
44
Strat = "Strat"
55
eles = "eles"
6-
ser = "ser"
6+
ser = "ser"
7+
isconnection = "isconnection"

NEWS.md

Lines changed: 57 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,60 @@
1-
# ModelingToolkit v8 Release Notes
1+
# ModelingToolkit v9 Release Notes
22

33
### Upgrade guide
44

5-
- `connect` should not be overloaded by users anymore. `[connect = Flow]`
6-
informs ModelingToolkit that particular variable in a connector ought to sum
7-
to zero, and by default, variables are equal in a connection. Please check out
8-
[acausal components tutorial](https://docs.sciml.ai/ModelingToolkit/stable/tutorials/acausal_components/)
9-
for examples.
5+
- The function `states` is renamed to `unknowns`. In a similar vein:
6+
7+
+ `unknown_states` is now `solved_unknowns`.
8+
+ `get_states` is `get_unknowns`.
9+
+ `get_unknown_states` is now `get_solved_unknowns`.
10+
11+
- The default backend for using units in models is now `DynamicQuantities.jl` instead of
12+
`Unitful.jl`.
13+
- ModelingToolkit.jl now exports common definitions of `t` (time independent variable)
14+
and `D` (the first derivative with respect to `t`). Any models made using ModelingToolkit.jl
15+
should leverage these common definitions. There are three variants:
16+
17+
+ `t` and `D` use DynamicQuantities.jl units. This is the default for standard library
18+
components.
19+
+ `t_unitful` and `D_unitful` use Unitful.jl units.
20+
+ `t_nounits` and `D_nounits` are unitless.
21+
- `ODAEProblem` is deprecated in favor of `ODEProblem`.
22+
- Specifying the independent variable for an `ODESystem` is now mandatory. The `ODESystem(eqs)`
23+
constructor is removed. Use `ODESystem(eqs,t)` instead.
24+
- Systems must be marked as `complete` before creating `*Function`/`*FunctionExpr`/`*Problem`/
25+
`*ProblemExpr`. Typically this involved using `@mtkbuild` to create the system or calling
26+
`structural_simplify` on an existing system.
27+
- All systems will perform parameter splitting by default. Problems created using ModelingToolkit.jl
28+
systems will have a custom struct instead of a `Vector` of parameters. The internals of this
29+
type are undocumented and subject to change without notice or a breaking release. Parameter values
30+
can be queried, updated or manipulated using SciMLStructures.jl or SymbolicIndexingInterface.jl.
31+
This also requires that the symbolic type of a parameter match its assigned value. For example,
32+
`@parameters p` will always use a `Float64` value for `p`. To use `Int` instead, use
33+
`@parameters p::Int`. Array-valued parameters must be array symbolics; `@parameters p = [1.0, 2.0]`
34+
is now invalid and must be changed to `@parameters p[1:2] = [1.0, 2.0]`. The index of a parameter
35+
in the system is also not guaranteed to be an `Int`, and will instead be a custom undocumented type.
36+
Parameters that have a default value depending on other parameters are now treated as dependent
37+
parameters. Their value cannot be modified directly. Whenever a parameter value is changed, dependent
38+
parameter values are recalculated. For example, if `@parameters p1 p2 = 3p1` then `p2` can not be
39+
modified directly. If `p1` is changed, then `p2` will be updated accordingly. To restore the old behavior:
40+
41+
+ Pass the `split = false` keyword to `structural_simplify`. E.g. `ss = structural_simplify(sys; split = false)`.
42+
+ Pass `split = false` to `@mtkbuild`. E.g. `@mtkbuild sys = ODESystem(...) split = false`.
43+
- Discrete-time system using `Difference` are unsupported. Instead, use the new `Clock`-based syntax.
44+
- Automatic scalarization has been removed, meaning that vector variables need to be treated with proper vector
45+
equations. For example, `[p[1] => 1.0, p[2] => 2.0]` is no longer allowed in default equations, use
46+
`[p => [1.0, 2.0]]` instead. Also, array equations like for `@variables u[1:2]` have `D(u) ~ A*u` as an
47+
array equation. If the scalarized version is desired, use `scalarize(u)`.
48+
- Parameter dependencies are now supported. They can be specified using the syntax
49+
`(single_parameter => expression_involving_other_parameters)` and a `Vector` of these can be passed to
50+
the `parameter_dependencies` keyword argument of `ODESystem`, `SDESystem` and `JumpSystem`. The dependent
51+
parameters are updated whenever other parameters are modified, e.g. in callbacks.
52+
- Support for `IfElse.jl` has been dropped. `Base.ifelse` can be used instead.
53+
- DAE initialization and the solving for consistent initial conditions has been changed to use a customized
54+
initialization solve. This change adds `guess` semantics which are clearly delinated from the behavior of
55+
the defaults, where `default` (and `u0`) is designed to be always satisfied and error if unsatisfiable,
56+
while `guess` is an initial guess to the initializer. In previous iterations, initialization with the
57+
default (`BrownBasicInit`) would treat the initial condition to the algebraic variables as a `guess`,
58+
and with `ShampineCollocationInit` would treat all initial conditions as a `guess`. To return to the
59+
previous behavior, use the keyword argument `initializealg` in the solve, i.e.
60+
`solve(prob;initializealg = BrownBasicInit())`.

Project.toml

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "ModelingToolkit"
22
uuid = "961ee093-0014-501f-94e3-6117800e7a78"
33
authors = ["Yingbo Ma <[email protected]>", "Chris Rackauckas <[email protected]> and contributors"]
4-
version = "8.75.0"
4+
version = "9.3.0"
55

66
[deps]
77
AbstractTrees = "1520ce14-60c1-5f80-bbc7-55ef81b5835c"
@@ -17,10 +17,12 @@ Distributed = "8ba89e20-285c-5b6f-9357-94700520ee1b"
1717
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
1818
DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
1919
DomainSets = "5b8099bc-c8ec-5219-889f-1d9e522a28bf"
20+
DynamicQuantities = "06fc5a27-2a28-4c7c-a15d-362465fb6821"
21+
ExprTools = "e2ba6199-217a-4e67-a87a-7c52f15ade04"
22+
FindFirstFunctions = "64ca27bc-2ba2-4a57-88aa-44e436879224"
2023
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
2124
FunctionWrappersWrappers = "77dc65aa-8811-40c2-897b-53d922fa7daf"
2225
Graphs = "86223c79-3864-5bf0-83f7-82e725a168b6"
23-
IfElse = "615f187c-cbe4-4ef1-ba3b-2fcf58d6d173"
2426
InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
2527
JuliaFormatter = "98e50ef6-434e-11e9-1051-2b60c6c9e899"
2628
JumpProcesses = "ccbc3e58-028d-4f4c-8cd5-9ae44345cda5"
@@ -29,14 +31,14 @@ Latexify = "23fbe1c1-3f47-55db-b15f-69d7ec21a316"
2931
Libdl = "8f399da3-3557-5675-b5ff-fb832c97cbdb"
3032
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
3133
MLStyle = "d8e11817-5142-5d16-987a-aa16d5891078"
32-
MacroTools = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09"
3334
NaNMath = "77ba4419-2d1f-58cd-9bb1-8ffee604a2e3"
3435
OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed"
3536
PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a"
3637
RecursiveArrayTools = "731186ca-8d62-57ce-b412-fbd966d074cd"
3738
Reexport = "189a3867-3050-52da-a836-e630ba90ab69"
3839
RuntimeGeneratedFunctions = "7e49a35a-f44a-4d26-94aa-eba1b4ca6b47"
3940
SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462"
41+
SciMLStructures = "53ae85a6-f571-4167-b2af-e1d143709226"
4042
Serialization = "9e88b42a-f829-5b0c-bbe9-9e923198166b"
4143
Setfield = "efcf1570-3423-57d1-acb7-fd33fddbac46"
4244
SimpleNonlinearSolve = "727e6d20-b764-4bd8-a329-72de5adea6c7"
@@ -66,32 +68,34 @@ Compat = "3.42, 4"
6668
ConstructionBase = "1"
6769
DataStructures = "0.17, 0.18"
6870
DiffEqBase = "6.103.0"
69-
DiffEqCallbacks = "2.16"
71+
DiffEqCallbacks = "2.16, 3"
7072
DiffRules = "0.1, 1.0"
7173
Distributed = "1"
7274
Distributions = "0.23, 0.24, 0.25"
7375
DocStringExtensions = "0.7, 0.8, 0.9"
74-
DomainSets = "0.6"
76+
DomainSets = "0.6, 0.7"
77+
DynamicQuantities = "^0.11.2, 0.12"
78+
ExprTools = "0.1.10"
79+
FindFirstFunctions = "1"
7580
ForwardDiff = "0.10.3"
7681
FunctionWrappersWrappers = "0.1"
7782
Graphs = "1.5.2"
78-
IfElse = "0.1"
7983
InteractiveUtils = "1"
80-
JuliaFormatter = "1"
84+
JuliaFormatter = "1.0.47"
8185
JumpProcesses = "9.1"
8286
LabelledArrays = "1.3"
8387
Latexify = "0.11, 0.12, 0.13, 0.14, 0.15, 0.16"
8488
Libdl = "1"
8589
LinearAlgebra = "1"
8690
MLStyle = "0.4.17"
87-
MacroTools = "0.5"
8891
NaNMath = "0.3, 1"
89-
OrdinaryDiffEq = "6"
92+
OrdinaryDiffEq = "6.73.0"
9093
PrecompileTools = "1"
9194
RecursiveArrayTools = "2.3, 3"
9295
Reexport = "0.2, 1"
9396
RuntimeGeneratedFunctions = "0.5.9"
94-
SciMLBase = "2.0.1"
97+
SciMLBase = "2.28.0"
98+
SciMLStructures = "1.0"
9599
Serialization = "1"
96100
Setfield = "0.7, 0.8, 1"
97101
SimpleNonlinearSolve = "0.1.0, 1"
@@ -100,7 +104,7 @@ SpecialFunctions = "0.7, 0.8, 0.9, 0.10, 1.0, 2"
100104
StaticArrays = "0.10, 0.11, 0.12, 1.0"
101105
SymbolicIndexingInterface = "0.3.1"
102106
SymbolicUtils = "1.0"
103-
Symbolics = "5.7"
107+
Symbolics = "5.20.1"
104108
URIs = "1"
105109
UnPack = "0.1, 1.0"
106110
Unitful = "1.1"
@@ -109,7 +113,7 @@ julia = "1.9"
109113
[extras]
110114
AmplNLWriter = "7c4d4715-977e-5154-bfe0-e096adeac482"
111115
BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
112-
ControlSystemsMTK = "687d7614-c7e5-45fc-bfc3-9ee385575c88"
116+
ControlSystemsBase = "aaaaaaaa-a6ca-5380-bf3e-84a91bcd477e"
113117
DeepDiffs = "ab62b9b5-e342-54a8-a765-a90f495de1a6"
114118
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
115119
Ipopt = "b6b21f68-93f8-5de0-b562-5493be1d77c9"
@@ -132,4 +136,4 @@ Sundials = "c3572dad-4567-51f8-b174-8c6c989267f4"
132136
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
133137

134138
[targets]
135-
test = ["AmplNLWriter", "BenchmarkTools", "ControlSystemsMTK", "NonlinearSolve", "ForwardDiff", "Ipopt", "Ipopt_jll", "ModelingToolkitStandardLibrary", "Optimization", "OptimizationOptimJL", "OptimizationMOI", "Random", "ReferenceTests", "SafeTestsets", "StableRNGs", "Statistics", "SteadyStateDiffEq", "Test", "StochasticDiffEq", "Sundials", "StochasticDelayDiffEq", "Pkg"]
139+
test = ["AmplNLWriter", "BenchmarkTools", "ControlSystemsBase", "NonlinearSolve", "ForwardDiff", "Ipopt", "Ipopt_jll", "ModelingToolkitStandardLibrary", "Optimization", "OptimizationOptimJL", "OptimizationMOI", "Random", "ReferenceTests", "SafeTestsets", "StableRNGs", "Statistics", "SteadyStateDiffEq", "Test", "StochasticDiffEq", "Sundials", "StochasticDelayDiffEq", "Pkg"]

0 commit comments

Comments
 (0)