Skip to content

Commit d26c649

Browse files
author
Oscar Smith
authored
Merge branch 'master' into compathelper/new_version/2025-01-09-00-24-04-925-01350785233
2 parents 78a406d + ee48915 commit d26c649

File tree

262 files changed

+31843
-17981
lines changed

Some content is hidden

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

262 files changed

+31843
-17981
lines changed

.github/workflows/Documentation.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
push:
55
branches:
66
- master
7+
- v10
78
tags: '*'
89
pull_request:
910

.github/workflows/Downstream.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ on:
66
pull_request:
77
paths-ignore:
88
- 'docs/**'
9+
- 'benchmark/**'
910

1011
concurrency:
1112
# Skip intermediate builds: always, but for the master branch and tags.
@@ -26,18 +27,22 @@ jobs:
2627
os: [ubuntu-latest]
2728
package:
2829
- {user: SciML, repo: SciMLBase.jl, group: Downstream}
30+
- {user: SciML, repo: SciMLBase.jl, group: SymbolicIndexingInterface}
2931
- {user: SciML, repo: Catalyst.jl, group: All}
30-
- {user: SciML, repo: CellMLToolkit.jl, group: All}
32+
- {user: SciML, repo: CellMLToolkit.jl, group: Core}
3133
- {user: SciML, repo: SBMLToolkit.jl, group: All}
3234
- {user: SciML, repo: NeuralPDE.jl, group: NNPDE}
3335
- {user: SciML, repo: DataDrivenDiffEq.jl, group: Downstream}
34-
- {user: SciML, repo: StructuralIdentifiability.jl, group: All}
36+
- {user: SciML, repo: StructuralIdentifiability.jl, group: Core}
3537
- {user: SciML, repo: ModelingToolkitStandardLibrary.jl, group: Core}
3638
- {user: SciML, repo: ModelOrderReduction.jl, group: All}
3739
- {user: SciML, repo: MethodOfLines.jl, group: Interface}
3840
- {user: SciML, repo: MethodOfLines.jl, group: 2D_Diffusion}
3941
- {user: SciML, repo: MethodOfLines.jl, group: DAE}
40-
- {user: ai4energy, repo: Ai4EComponentLib.jl, group: Downstream}
42+
- {user: SciML, repo: ModelingToolkitNeuralNets.jl, group: All}
43+
- {user: SciML, repo: SciMLSensitivity.jl, group: Core8}
44+
45+
- {user: Neuroblox, repo: Neuroblox.jl, group: All}
4146
steps:
4247
- uses: actions/checkout@v4
4348
- uses: julia-actions/setup-julia@v1

.github/workflows/FormatCheck.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
push:
55
branches:
66
- 'master'
7+
- v10
78
tags: '*'
89
pull_request:
910

.github/workflows/Invalidations.yml

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

.github/workflows/ReleaseTest.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: ReleaseTest
2+
on:
3+
push:
4+
branches: [master]
5+
tags: [v*]
6+
pull_request:
7+
paths-ignore:
8+
- 'docs/**'
9+
- 'benchmark/**'
10+
11+
concurrency:
12+
# Skip intermediate builds: always, but for the master branch and tags.
13+
# Cancel intermediate builds: always, but for the master branch and tags.
14+
group: ${{ github.workflow }}-${{ github.ref }}
15+
cancel-in-progress: ${{ github.ref != 'refs/heads/master' && github.refs != 'refs/tags/*' }}
16+
17+
jobs:
18+
test:
19+
name: ${{ matrix.package.package }}/${{ matrix.package.group }}/${{ matrix.julia-version }}
20+
runs-on: ${{ matrix.os }}
21+
env:
22+
GROUP: ${{ matrix.package.group }}
23+
strategy:
24+
fail-fast: false
25+
matrix:
26+
julia-version: [1]
27+
os: [ubuntu-latest]
28+
package:
29+
- {package: Catalyst, group: All}
30+
steps:
31+
- uses: actions/checkout@v4
32+
- uses: julia-actions/setup-julia@v1
33+
with:
34+
version: ${{ matrix.julia-version }}
35+
arch: x64
36+
- uses: julia-actions/julia-buildpkg@latest
37+
- name: Create test directory
38+
run: mkdir downstream
39+
- name: Load this and run the downstream tests
40+
shell: julia --color=yes --project=downstream {0}
41+
run: |
42+
using Pkg
43+
try
44+
Pkg.activate("downstream")
45+
# force it to use this PR's version of the package
46+
Pkg.develop(PackageSpec(path=".")) # resolver may fail with main deps
47+
Pkg.add("${{ matrix.package.package }}")
48+
Pkg.update()
49+
Pkg.test("Catalyst"; coverage=true) # resolver may fail with test time deps
50+
catch err
51+
err isa Pkg.Resolve.ResolverError || rethrow()
52+
# If we can't resolve that means this is incompatible by SemVer and this is fine
53+
# It means we marked this as a breaking change, so we don't need to worry about
54+
# Mistakenly introducing a breaking change, as we have intentionally made one
55+
@info "Not compatible with this release. No problem." exception=err
56+
exit(0) # Exit immediately, as a success
57+
end
58+
- uses: julia-actions/julia-processcoverage@v1
59+
- uses: codecov/codecov-action@v5
60+
with:
61+
files: lcov.info
62+
token: ${{ secrets.CODECOV_TOKEN }}
63+
fail_ci_if_error: false

.github/workflows/Tests.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@ on:
55
branches:
66
- master
77
- 'release-'
8+
- v10
89
paths-ignore:
910
- 'docs/**'
1011
push:
1112
branches:
1213
- master
1314
paths-ignore:
1415
- 'docs/**'
16+
- 'benchmark/**'
1517

1618
concurrency:
1719
# Skip intermediate builds: always, but for the master branch.
@@ -38,6 +40,7 @@ jobs:
3840
- Extensions
3941
- Downstream
4042
- RegressionI
43+
- FMI
4144
uses: "SciML/.github/.github/workflows/tests.yml@v1"
4245
with:
4346
julia-version: "${{ matrix.version }}"

.github/workflows/benchmark.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Benchmark this PR
2+
on:
3+
pull_request:
4+
branches:
5+
- master
6+
paths-ignore:
7+
- 'docs/**'
8+
9+
permissions:
10+
pull-requests: write # needed to post comments
11+
12+
jobs:
13+
bench:
14+
name: "Benchmarks"
15+
strategy:
16+
matrix:
17+
version:
18+
- "1"
19+
- "lts"
20+
runs-on: ubuntu-latest
21+
steps:
22+
- uses: MilesCranmer/AirspeedVelocity.jl@action-v1
23+
with:
24+
julia-version: "${{ matrix.version }}"
25+
script: "benchmark/benchmarks.jl"
26+
extra-pkgs: "ModelingToolkitStandardLibrary,OrdinaryDiffEqDefault"

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ Manifest.toml
66
.vscode/*
77
docs/src/assets/Project.toml
88
docs/src/assets/Manifest.toml
9+
.CondaPkg

.typos.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,6 @@ nd = "nd"
44
Strat = "Strat"
55
eles = "eles"
66
ser = "ser"
7-
isconnection = "isconnection"
7+
isconnection = "isconnection"
8+
Ue = "Ue"
9+
Derivate = "Derivate"

NEWS.md

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,134 @@
1+
# ModelingToolkit v10 Release Notes
2+
3+
## Callbacks
4+
5+
Callback semantics have changed.
6+
7+
- There is a new `Pre` operator that is used to specify which values are before the callback.
8+
For example, the affect `A ~ A + 1` should now be written as `A ~ Pre(A) + 1`. This is
9+
**required** to be specified - `A ~ A + 1` will now be interpreted as an equation to be
10+
satisfied after the callback (and will thus error since it is unsatisfiable).
11+
12+
- All parameters that are changed by a callback must be declared as discrete parameters to
13+
the callback constructor, using the `discrete_parameters` keyword argument.
14+
15+
```julia
16+
event = SymbolicDiscreteCallback(
17+
[t == 1] => [p ~ Pre(p) + 1], discrete_parameters = [p])
18+
```
19+
20+
## New `mtkcompile` and `@mtkcompile`
21+
22+
`structural_simplify` is now renamed to `mtkcompile`. `@mtkbuild` is renamed to
23+
`@mtkcompile`. Their functionality remains the same. However, instead of a second
24+
positional argument `structural_simplify(sys, (inputs, outputs))` the inputs and outputs
25+
should be specified via keyword arguments as `mtkcompile(sys; inputs, outputs, disturbance_inputs)`.
26+
27+
## Reduce reliance on metadata in `mtkcompile`
28+
29+
Previously, `mtkcompile` (formerly `structural_simplify`) used to rely on the metadata of
30+
symbolic variables to identify variables/parameters/brownians. This was regardless of
31+
what the system expected the variable to be. Now, it respects the information in the system.
32+
33+
## Unified `System` type
34+
35+
There is now a single common `System` type for all types of models except PDEs, for which
36+
`PDESystem` still exists. It follows the same syntax as `ODESystem` and `NonlinearSystem`
37+
did. `System(equations, t[, vars, pars])` will construct a time-dependent system.
38+
`System(equations[, vars, pars])` will construct a time-independent system. Refer to the
39+
docstring for `System` for further information.
40+
41+
Utility constructors are defined for:
42+
43+
- `NonlinearSystem(sys)` to convert a time-dependent system to a time-independent one for
44+
its steady state.
45+
- `SDESystem(sys, noise_eqs)` to add noise to a system
46+
- `JumpSystem(jumps, ...)` to define a system with jumps. Note that normal equations can
47+
also be passed to `jumps`.
48+
- `OptimizationSystem(cost, ...)` to define a system for optimization.
49+
50+
All problem constructors validate that the system matches the expected structure for
51+
that problem.
52+
53+
## No more `parameter_dependencies`
54+
55+
The `parameter_dependencies` keyword is deprecated. All equations previously passed here
56+
should now be provided as part of the standard equations of the system. If passing parameters
57+
explicitly to the `System` constructor, the dependent parameters (on the left hand side of
58+
parameter dependencies) should also be provided. These will be separated out when calling
59+
`complete` or `mtkcompile`. Calling `parameter_dependencies` or `dependent_parameters` now
60+
requires that the system is completed. The new `SDESystem` constructor still retains the
61+
`parameter_dependencies` keyword argument since the number of equations has to match the
62+
number of columns in `noise_eqs`.
63+
64+
ModelingToolkit now has discretion of what parameters are eliminated using the parameter
65+
equations during `complete` or `mtkcompile`.
66+
67+
## New problem and constructors
68+
69+
Instead of `XProblem(sys, u0map, tspan, pmap)` for time-dependent problems and
70+
`XProblem(sys, u0map, pmap)` for time-independent problems, the syntax has changed to
71+
`XProblem(sys, op, tspan)` and `XProblem(sys, op)` respectively. `op` refers to the
72+
operating point, and is a variable-value mapping containing both unknowns and parameters.
73+
74+
`XFunction` constructors also no longer accept the list of unknowns and parameters as
75+
positional arguments.
76+
77+
## Removed `DelayParentScope`
78+
79+
The outdated `DelayParentScope` has been removed.
80+
81+
## Removed `XProblemExpr` and `XFunctionExpr`
82+
83+
The old `XProblemExpr` and `XFunctionExpr` constructors used to build an `Expr` that
84+
constructs `XProblem` and `XFunction` respectively are now removed. This functionality
85+
is now available by passing `expression = Val{true}` to any problem or function constructor.
86+
87+
## Renaming of `generate_*` and `calculate_*` methods
88+
89+
Several `generate_*` methods have been renamed, along with some `calculate_*` methods.
90+
The `generate_*` methods also no longer accept a list of unknowns and/or parameters. Refer
91+
to the documentation for more information.
92+
93+
## New behavior of `getproperty` and `setproperty!`
94+
95+
Using `getproperty` to access fields of a system has been deprecated for a long time, and
96+
this functionality is now removed. `setproperty!` previously used to update the default
97+
of the accessed symbolic variable. This is not supported anymore. Defaults can be updated by
98+
mutating `ModelingToolkit.get_defaults(sys)`.
99+
100+
## New behavior of `@constants`
101+
102+
`@constants` now creates parameters with the `tunable = false` metadata by default.
103+
104+
## Removed `FunctionalAffect`
105+
106+
`FunctionalAffect` is now removed in favor of the new `ImperativeAffect`. Refer to the
107+
documentation for more information.
108+
109+
## Improved system metadata
110+
111+
Instead of an empty field that can contain arbitrary data, the `System` type stores metadata
112+
identically to `SymbolicUtils.BasicSymbolic`. Metadata is stored in an immutable dictionary
113+
keyed by a user-provided `DataType` and containing arbitrary values. `System` supports the
114+
same `SymbolicUtils.getmetadata` and `SymbolicUtils.setmetadata` API as symbolic variables.
115+
Refer to the documentation of `System` and the aforementioned functions for more information.
116+
117+
## Moved `connect` and `Connector` to ModelingToolkit
118+
119+
Previously ModelingToolkit used the `connect` function and `Connector` type defined in
120+
Symbolics.jl. These have now been moved to ModelingToolkit along with the experimental
121+
state machine API. If you imported them from Symbolics.jl, it is recommended to import from
122+
ModelingToolkit instead.
123+
124+
## Always wrap with `ParentScope` in `@named`
125+
126+
When creating a system using `@named`, any symbolic quantities passed as keyword arguments
127+
to the subsystem are wrapped in `ParentScope`. Previously, this would only happen if the
128+
variable wasn't already wrapped in a `ParentScope`. However, the old behavior had issues
129+
when passing symbolic quantities down multiple levels of the hierarchy. The `@named` macro
130+
now always performs this wrapping.
131+
1132
# ModelingToolkit v9 Release Notes
2133

3134
### Upgrade guide

0 commit comments

Comments
 (0)