Skip to content

Commit 34d264f

Browse files
committed
Merge remote-tracking branch 'origin' into add-metadata-getters
master
2 parents df0ee8a + 35c8f4c commit 34d264f

Some content is hidden

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

60 files changed

+3088
-923
lines changed

.github/workflows/Downstream.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ jobs:
3737
- {user: SciML, repo: MethodOfLines.jl, group: Interface}
3838
- {user: SciML, repo: MethodOfLines.jl, group: 2D_Diffusion}
3939
- {user: SciML, repo: MethodOfLines.jl, group: DAE}
40-
- {user: ai4energy, repo: Ai4EComponentLib.jl, group: Downstream}
4140
steps:
4241
- uses: actions/checkout@v4
4342
- uses: julia-actions/setup-julia@v1

.github/workflows/Tests.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ jobs:
3838
- Extensions
3939
- Downstream
4040
- RegressionI
41+
- FMI
4142
uses: "SciML/.github/.github/workflows/tests.yml@v1"
4243
with:
4344
julia-version: "${{ matrix.version }}"

Project.toml

Lines changed: 9 additions & 6 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.60.0"
4+
version = "9.62.0"
55

66
[deps]
77
AbstractTrees = "1520ce14-60c1-5f80-bbc7-55ef81b5835c"
@@ -64,6 +64,7 @@ Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d"
6464
BifurcationKit = "0f109fa4-8a5d-4b75-95aa-f515264e7665"
6565
ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
6666
DeepDiffs = "ab62b9b5-e342-54a8-a765-a90f495de1a6"
67+
FMI = "14a09403-18e3-468f-ad8a-74f8dda2d9ac"
6768
HomotopyContinuation = "f213a82b-91d6-5c5d-acf7-10f1c761b327"
6869
InfiniteOpt = "20393b10-9daf-11e9-18c9-8db751c92c57"
6970
LabelledArrays = "2ee39098-c373-598a-b85f-a56591580800"
@@ -72,6 +73,7 @@ LabelledArrays = "2ee39098-c373-598a-b85f-a56591580800"
7273
MTKBifurcationKitExt = "BifurcationKit"
7374
MTKChainRulesCoreExt = "ChainRulesCore"
7475
MTKDeepDiffsExt = "DeepDiffs"
76+
MTKFMIExt = "FMI"
7577
MTKHomotopyContinuationExt = "HomotopyContinuation"
7678
MTKInfiniteOptExt = "InfiniteOpt"
7779
MTKLabelledArraysExt = "LabelledArrays"
@@ -106,6 +108,7 @@ FindFirstFunctions = "1"
106108
ForwardDiff = "0.10.3"
107109
FunctionWrappers = "1.1"
108110
FunctionWrappersWrappers = "0.1"
111+
FMI = "0.14"
109112
Graphs = "1.5.2"
110113
HomotopyContinuation = "2.11"
111114
InfiniteOpt = "0.5"
@@ -123,7 +126,7 @@ NonlinearSolve = "4.3"
123126
OffsetArrays = "1"
124127
OrderedCollections = "1"
125128
OrdinaryDiffEq = "6.82.0"
126-
OrdinaryDiffEqCore = "1.13.0"
129+
OrdinaryDiffEqCore = "1.15.0"
127130
OrdinaryDiffEqDefault = "1.2"
128131
OrdinaryDiffEqNonlinearSolve = "1.3.0"
129132
PrecompileTools = "1"
@@ -132,7 +135,7 @@ RecursiveArrayTools = "3.26"
132135
Reexport = "0.2, 1"
133136
RuntimeGeneratedFunctions = "0.5.9"
134137
SCCNonlinearSolve = "1.0.0"
135-
SciMLBase = "2.68.1"
138+
SciMLBase = "2.72.1"
136139
SciMLStructures = "1.0"
137140
Serialization = "1"
138141
Setfield = "0.7, 0.8, 1"
@@ -142,9 +145,9 @@ SpecialFunctions = "0.7, 0.8, 0.9, 0.10, 1.0, 2"
142145
StaticArrays = "0.10, 0.11, 0.12, 1.0"
143146
StochasticDiffEq = "6.72.1"
144147
StochasticDelayDiffEq = "1.8.1"
145-
SymbolicIndexingInterface = "0.3.36"
146-
SymbolicUtils = "3.10"
147-
Symbolics = "6.22.1"
148+
SymbolicIndexingInterface = "0.3.37"
149+
SymbolicUtils = "3.10.1"
150+
Symbolics = "6.27"
148151
URIs = "1"
149152
UnPack = "0.1, 1.0"
150153
Unitful = "1.1"

docs/pages.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ pages = [
3232
"basics/InputOutput.md",
3333
"basics/MTKLanguage.md",
3434
"basics/Validation.md",
35+
"basics/Debugging.md",
3536
"basics/DependencyGraphs.md",
3637
"basics/Precompilation.md",
3738
"basics/FAQ.md"],

docs/src/basics/Debugging.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Debugging
2+
3+
Every (mortal) modeler writes models that contain mistakes or are susceptible to numerical errors in their hunt for the perfect model.
4+
Debugging such errors is part of the modeling process, and ModelingToolkit includes some functionality that helps with this.
5+
6+
For example, consider an ODE model with "dangerous" functions (here ``):
7+
8+
```@example debug
9+
using ModelingToolkit, OrdinaryDiffEq
10+
using ModelingToolkit: t_nounits as t, D_nounits as D
11+
12+
@variables u1(t) u2(t) u3(t)
13+
eqs = [D(u1) ~ -√(u1), D(u2) ~ -√(u2), D(u3) ~ -√(u3)]
14+
defaults = [u1 => 1.0, u2 => 2.0, u3 => 3.0]
15+
@named sys = ODESystem(eqs, t; defaults)
16+
sys = structural_simplify(sys)
17+
```
18+
19+
This problem causes the ODE solver to crash:
20+
21+
```@repl debug
22+
prob = ODEProblem(sys, [], (0.0, 10.0), []);
23+
sol = solve(prob, Tsit5());
24+
```
25+
26+
This suggests *that* something went wrong, but not exactly *what* went wrong and *where* it did.
27+
In such situations, the `debug_system` function is helpful:
28+
29+
```@repl debug
30+
dsys = debug_system(sys; functions = [sqrt]);
31+
dprob = ODEProblem(dsys, [], (0.0, 10.0), []);
32+
dsol = solve(dprob, Tsit5());
33+
```
34+
35+
Now we see that it crashed because `u1` decreased so much that it became negative and outside the domain of the `` function.
36+
We could have figured that out ourselves, but it is not always so obvious for more complex models.
37+
38+
```@docs
39+
debug_system
40+
```

docs/src/basics/MTKLanguage.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ equations.
2323

2424
`@mtkmodel` definition contains begin blocks of
2525

26+
- `@description`: for describing the whole system with a human-readable string
2627
- `@components`: for listing sub-components of the system
2728
- `@constants`: for declaring constants
2829
- `@defaults`: for passing `defaults` to ODESystem
@@ -42,20 +43,23 @@ using ModelingToolkit
4243
using ModelingToolkit: t
4344
4445
@mtkmodel ModelA begin
46+
@description "A component with parameters `k` and `k_array`."
4547
@parameters begin
4648
k
4749
k_array[1:2]
4850
end
4951
end
5052
5153
@mtkmodel ModelB begin
54+
@description "A component with parameters `p1` and `p2`."
5255
@parameters begin
5356
p1 = 1.0, [description = "Parameter of ModelB"]
5457
p2 = 1.0, [description = "Parameter of ModelB"]
5558
end
5659
end
5760
5861
@mtkmodel ModelC begin
62+
@description "A bigger system that contains many more things."
5963
@icon "https://github.com/SciML/SciMLDocs/blob/main/docs/src/assets/logo.png"
6064
@constants begin
6165
c::Int = 1, [description = "Example constant."]
@@ -91,6 +95,10 @@ end
9195
end
9296
```
9397

98+
#### `@description`
99+
100+
A documenting `String` that summarizes and explains what the model is.
101+
94102
#### `@icon`
95103

96104
An icon can be embedded in 3 ways:

docs/src/tutorials/acausal_components.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ end
8484
end
8585
8686
@mtkmodel RCModel begin
87+
@description "A circuit with a constant voltage source, resistor and capacitor connected in series."
8788
@components begin
8889
resistor = Resistor(R = 1.0)
8990
capacitor = Capacitor(C = 1.0)
@@ -251,6 +252,7 @@ make all of our parameter values 1.0. As `resistor`, `capacitor`, `source` lists
251252

252253
```@example acausal
253254
@mtkmodel RCModel begin
255+
@description "A circuit with a constant voltage source, resistor and capacitor connected in series."
254256
@components begin
255257
resistor = Resistor(R = 1.0)
256258
capacitor = Capacitor(C = 1.0)

0 commit comments

Comments
 (0)