Skip to content

Commit 1c5beef

Browse files
committed
Merge branch 'master' into myb/state_machine
2 parents 6dc929b + a297ee4 commit 1c5beef

File tree

145 files changed

+3548
-3583
lines changed

Some content is hidden

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

145 files changed

+3548
-3583
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: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ jobs:
3030
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} # For authentication with SSH deploy key
3131
run: DISPLAY=:0 xvfb-run -s '-screen 0 1024x768x24' julia --project=docs/ --code-coverage=user docs/make.jl
3232
- uses: julia-actions/julia-processcoverage@v1
33-
- uses: codecov/codecov-action@v3
33+
- uses: codecov/codecov-action@v4
3434
with:
3535
file: lcov.info
36+
token: ${{ secrets.CODECOV_TOKEN }}
37+
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.17.0
13+
uses: crate-ci/typos@v1.18.0

.github/workflows/ci.yml

Lines changed: 38 additions & 1 deletion
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,6 +60,8 @@ jobs:
2760
- InterfaceI
2861
- InterfaceII
2962
- Extensions
63+
- Downstream
64+
- RegressionI
3065
version:
3166
- '1'
3267
steps:
@@ -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

NEWS.md

Lines changed: 41 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,44 @@
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.
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+
To restore the old behavior:
37+
38+
+ Pass the `split = false` keyword to `structural_simplify`. E.g. `ss = structural_simplify(sys; split = false)`.
39+
+ Pass `split = false` to `@mtkbuild`. E.g. `@mtkbuild sys = ODESystem(...) split = false`.
40+
- Discrete-time system using `Difference` are unsupported. Instead, use the new `Clock`-based syntax.
41+
- Automatic scalarization has been removed, meaning that vector variables need to be treated with proper vector
42+
equations. For example, `[p[1] => 1.0, p[2] => 2.0]` is no longer allowed in default equations, use
43+
`[p => [1.0, 2.0]]` instead. Also, array equations like for `@variables u[1:2]` have `D(u) ~ A*u` as an
44+
array equation. If the scalarized version is desired, use `scalarize(u)`.

Project.toml

Lines changed: 7 additions & 5 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 = "9.0.0"
4+
version = "8.76.0"
55

66
[deps]
77
AbstractTrees = "1520ce14-60c1-5f80-bbc7-55ef81b5835c"
@@ -18,6 +18,7 @@ Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
1818
DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
1919
DomainSets = "5b8099bc-c8ec-5219-889f-1d9e522a28bf"
2020
DynamicQuantities = "06fc5a27-2a28-4c7c-a15d-362465fb6821"
21+
ExprTools = "e2ba6199-217a-4e67-a87a-7c52f15ade04"
2122
FindFirstFunctions = "64ca27bc-2ba2-4a57-88aa-44e436879224"
2223
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
2324
FunctionWrappersWrappers = "77dc65aa-8811-40c2-897b-53d922fa7daf"
@@ -31,14 +32,14 @@ Latexify = "23fbe1c1-3f47-55db-b15f-69d7ec21a316"
3132
Libdl = "8f399da3-3557-5675-b5ff-fb832c97cbdb"
3233
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
3334
MLStyle = "d8e11817-5142-5d16-987a-aa16d5891078"
34-
MacroTools = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09"
3535
NaNMath = "77ba4419-2d1f-58cd-9bb1-8ffee604a2e3"
3636
OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed"
3737
PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a"
3838
RecursiveArrayTools = "731186ca-8d62-57ce-b412-fbd966d074cd"
3939
Reexport = "189a3867-3050-52da-a836-e630ba90ab69"
4040
RuntimeGeneratedFunctions = "7e49a35a-f44a-4d26-94aa-eba1b4ca6b47"
4141
SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462"
42+
SciMLStructures = "53ae85a6-f571-4167-b2af-e1d143709226"
4243
Serialization = "9e88b42a-f829-5b0c-bbe9-9e923198166b"
4344
Setfield = "efcf1570-3423-57d1-acb7-fd33fddbac46"
4445
SimpleNonlinearSolve = "727e6d20-b764-4bd8-a329-72de5adea6c7"
@@ -73,22 +74,22 @@ DiffRules = "0.1, 1.0"
7374
Distributed = "1"
7475
Distributions = "0.23, 0.24, 0.25"
7576
DocStringExtensions = "0.7, 0.8, 0.9"
76-
DomainSets = "0.6"
77+
DomainSets = "0.6, 0.7"
7778
DynamicQuantities = "^0.11.2"
79+
ExprTools = "0.1.10"
7880
FindFirstFunctions = "1"
7981
ForwardDiff = "0.10.3"
8082
FunctionWrappersWrappers = "0.1"
8183
Graphs = "1.5.2"
8284
IfElse = "0.1"
8385
InteractiveUtils = "1"
84-
JuliaFormatter = "1"
86+
JuliaFormatter = "1.0.47"
8587
JumpProcesses = "9.1"
8688
LabelledArrays = "1.3"
8789
Latexify = "0.11, 0.12, 0.13, 0.14, 0.15, 0.16"
8890
Libdl = "1"
8991
LinearAlgebra = "1"
9092
MLStyle = "0.4.17"
91-
MacroTools = "0.5"
9293
NaNMath = "0.3, 1"
9394
OrdinaryDiffEq = "6"
9495
PrecompileTools = "1"
@@ -99,6 +100,7 @@ SciMLBase = "2.0.1"
99100
Serialization = "1"
100101
Setfield = "0.7, 0.8, 1"
101102
SimpleNonlinearSolve = "0.1.0, 1"
103+
SciMLStructures = "1.0"
102104
SparseArrays = "1"
103105
SpecialFunctions = "0.7, 0.8, 0.9, 0.10, 1.0, 2"
104106
StaticArrays = "0.10, 0.11, 0.12, 1.0"

docs/make.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ mathengine = MathJax3(Dict(:loader => Dict("load" => ["[tex]/require", "[tex]/ma
1616
"ams",
1717
"autoload",
1818
"mathtools",
19-
"require",
19+
"require"
2020
])))
2121

2222
makedocs(sitename = "ModelingToolkit.jl",

docs/pages.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ pages = [
1010
"tutorials/parameter_identifiability.md",
1111
"tutorials/bifurcation_diagram_computation.md",
1212
"tutorials/domain_connections.md"],
13-
"Examples" => Any["Basic Examples" => Any["examples/higher_order.md",
13+
"Examples" => Any[
14+
"Basic Examples" => Any["examples/higher_order.md",
1415
"examples/spring_mass.md",
1516
"examples/modelingtoolkitize_index_reduction.md",
1617
"examples/parsing.md"],
@@ -32,8 +33,7 @@ pages = [
3233
"systems/JumpSystem.md",
3334
"systems/NonlinearSystem.md",
3435
"systems/OptimizationSystem.md",
35-
"systems/DiscreteSystem.md",
3636
"systems/PDESystem.md"],
3737
"comparison.md",
38-
"internals.md",
38+
"internals.md"
3939
]

docs/src/basics/AbstractSystem.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Generally, it follows the order of:
2222

2323
1. Equations
2424
2. Independent Variables
25-
3. Dependent Variables (or States)
25+
3. Dependent Variables (or Unknowns)
2626
4. Parameters
2727

2828
All other pieces are handled via keyword arguments. `AbstractSystem`s share the
@@ -37,19 +37,19 @@ same keyword arguments, which are:
3737
## Composition and Accessor Functions
3838

3939
Each `AbstractSystem` has lists of variables in context, such as distinguishing
40-
parameters vs states. In addition, an `AbstractSystem` can also hold other
41-
`AbstractSystem` types. Direct accessing of the values, such as `sys.states`,
42-
gives the immediate list, while the accessor functions `states(sys)` gives the
40+
parameters vs unknowns. In addition, an `AbstractSystem` can also hold other
41+
`AbstractSystem` types. Direct accessing of the values, such as `sys.unknowns`,
42+
gives the immediate list, while the accessor functions `unknowns(sys)` gives the
4343
total set, which includes that of all systems held inside.
4444

4545
The values which are common to all `AbstractSystem`s are:
4646

4747
- `equations(sys)`: All equations that define the system and its subsystems.
48-
- `states(sys)`: All the states in the system and its subsystems.
48+
- `unknowns(sys)`: All the unknowns in the system and its subsystems.
4949
- `parameters(sys)`: All parameters of the system and its subsystems.
5050
- `nameof(sys)`: The name of the current-level system.
5151
- `get_eqs(sys)`: Equations that define the current-level system.
52-
- `get_states(sys)`: States that are in the current-level system.
52+
- `get_unknowns(sys)`: Unknowns that are in the current-level system.
5353
- `get_ps(sys)`: Parameters that are in the current-level system.
5454
- `get_systems(sys)`: Subsystems of the current-level system.
5555

@@ -129,7 +129,7 @@ pairs `var=>value`, which allows the user to designate the values without having
129129
to know the order that ModelingToolkit is internally using.
130130

131131
For the value maps, the parameters are allowed to be functions of each other,
132-
and value maps of states can be functions of the parameters, i.e. you can do:
132+
and value maps of unknowns can be functions of the parameters, i.e. you can do:
133133

134134
```
135135
u0 = [

0 commit comments

Comments
 (0)