Skip to content

Commit c82be20

Browse files
docs: fix doc pages
1 parent ae96038 commit c82be20

19 files changed

+91
-110
lines changed

docs/Project.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ Attractors = "f3fd9213-ca85-4dba-9dfd-7fc91308fec7"
33
BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
44
BifurcationKit = "0f109fa4-8a5d-4b75-95aa-f515264e7665"
55
CairoMakie = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0"
6+
CommonSolve = "38540f10-b2f7-11e9-35d8-d573e4eb0ff2"
67
ControlSystemsBase = "aaaaaaaa-a6ca-5380-bf3e-84a91bcd477e"
78
DataInterpolations = "82cc6244-b520-54b8-b5a6-8a565e85f1d0"
89
DiffEqDevTools = "f3b72e0c-5b89-59e1-b016-84e28bfd966d"
@@ -13,6 +14,7 @@ FMI = "14a09403-18e3-468f-ad8a-74f8dda2d9ac"
1314
FMIZoo = "724179cf-c260-40a9-bd27-cccc6fe2f195"
1415
InfiniteOpt = "20393b10-9daf-11e9-18c9-8db751c92c57"
1516
Ipopt = "b6b21f68-93f8-5de0-b562-5493be1d77c9"
17+
JumpProcesses = "ccbc3e58-028d-4f4c-8cd5-9ae44345cda5"
1618
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
1719
ModelingToolkit = "961ee093-0014-501f-94e3-6117800e7a78"
1820
ModelingToolkitStandardLibrary = "16a59e39-deab-5bd0-87e4-056b12336739"

docs/make.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
using Documenter, ModelingToolkit
22
using ModelingToolkit: SciMLBase
3+
# To load docstring from extension
4+
import FMI, CommonSolve, JumpProcesses
35

46
# Make sure that plots don't throw a bunch of warnings / errors!
57
ENV["GKSwstype"] = "100"

docs/src/API/System.md

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ or analysis points of the hierarchical system.
3232
ModelingToolkit.has_eqs
3333
ModelingToolkit.get_eqs
3434
equations
35-
equations_toplevel
35+
ModelingToolkit.equations_toplevel
3636
full_equations
3737
ModelingToolkit.has_noise_eqs
3838
ModelingToolkit.get_noise_eqs
@@ -44,17 +44,17 @@ ModelingToolkit.get_constraints
4444
constraints
4545
ModelingToolkit.has_costs
4646
ModelingToolkit.get_costs
47-
costs
47+
cost
4848
ModelingToolkit.has_consolidate
4949
ModelingToolkit.get_consolidate
5050
ModelingToolkit.has_unknowns
5151
ModelingToolkit.get_unknowns
5252
unknowns
53-
unknowns_toplevel
53+
ModelingToolkit.unknowns_toplevel
5454
ModelingToolkit.has_ps
5555
ModelingToolkit.get_ps
5656
parameters
57-
parameters_toplevel
57+
ModelingToolkit.parameters_toplevel
5858
tunable_parameters
5959
ModelingToolkit.has_brownians
6060
ModelingToolkit.get_brownians
@@ -77,19 +77,20 @@ defaults
7777
ModelingToolkit.has_guesses
7878
ModelingToolkit.get_guesses
7979
guesses
80+
ModelingToolkit.get_systems
8081
ModelingToolkit.has_initialization_eqs
8182
ModelingToolkit.get_initialization_eqs
8283
initialization_equations
8384
ModelingToolkit.has_continuous_events
8485
ModelingToolkit.get_continuous_events
8586
continuous_events
86-
continuous_events_toplevel
87+
ModelingToolkit.continuous_events_toplevel
8788
ModelingToolkit.has_discrete_events
8889
ModelingToolkit.get_discrete_events
89-
discrete_events_toplevel
90+
ModelingToolkit.discrete_events_toplevel
9091
ModelingToolkit.has_assertions
9192
ModelingToolkit.get_assertions
92-
assertions
93+
ModelingToolkit.assertions
9394
ModelingToolkit.has_metadata
9495
ModelingToolkit.get_metadata
9596
SymbolicUtils.getmetadata(::ModelingToolkit.AbstractSystem, ::DataType, ::Any)
@@ -144,8 +145,8 @@ has_diff_equations
144145
has_alg_equations
145146
diff_equations
146147
alg_equations
147-
is_alg_equation
148-
is_diff_equation
148+
ModelingToolkit.is_alg_equation
149+
ModelingToolkit.is_diff_equation
149150
```
150151

151152
## String parsing
@@ -167,6 +168,18 @@ ModelingToolkit.dump_parameters
167168
ModelingToolkit.dump_variable_metadata
168169
```
169170

171+
## Inputs and outputs
172+
173+
```@docs
174+
ModelingToolkit.inputs
175+
ModelingToolkit.outputs
176+
ModelingToolkit.bound_inputs
177+
ModelingToolkit.unbound_inputs
178+
ModelingToolkit.bound_outputs
179+
ModelingToolkit.unbound_outputs
180+
ModelingToolkit.is_bound
181+
```
182+
170183
## Debugging utilities
171184

172185
```@docs

docs/src/API/codegen.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ ModelingToolkit.generate_rhs
88
ModelingToolkit.generate_diffusion_function
99
ModelingToolkit.generate_jacobian
1010
ModelingToolkit.generate_tgrad
11-
ModelingToolkit.generate_hessian
1211
ModelingToolkit.generate_W
1312
ModelingToolkit.generate_dae_jacobian
1413
ModelingToolkit.generate_history
@@ -21,6 +20,7 @@ ModelingToolkit.generate_constraint_jacobian
2120
ModelingToolkit.generate_constraint_hessian
2221
ModelingToolkit.generate_control_jacobian
2322
ModelingToolkit.build_explicit_observed_function
23+
ModelingToolkit.generate_control_function
2424
```
2525

2626
For functions such as jacobian calculation which require symbolic computation, there
@@ -43,3 +43,9 @@ ModelingToolkit.calculate_constraint_jacobian
4343
ModelingToolkit.calculate_constraint_hessian
4444
ModelingToolkit.calculate_control_jacobian
4545
```
46+
47+
All code generation eventually calls `build_function_wrapper`.
48+
49+
```@docs
50+
build_function_wrapper
51+
```

docs/src/API/dynamic_opt.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ JuMPCollocation
2828
InfiniteOptCollocation
2929
CasADiCollocation
3030
PyomoCollocation
31-
solve(::AbstractDynamicOptProblem)
31+
CommonSolve.solve(::AbstractDynamicOptProblem)
3232
```
3333

3434
### Problem constructors

docs/src/API/model_building.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ Similar to the `stream` and `flow` keyword arguments in the specification, Model
8181
allows specifying how variables in a connector behave in a connection.
8282

8383
```@docs
84-
Equality
84+
ModelingToolkit.Equality
8585
Flow
8686
Stream
8787
```
@@ -168,7 +168,6 @@ Symbolic affects are handled using equations as described in the [Events](@ref e
168168
section of the documentation. User-defined functions can be used via `ImperativeAffect`.
169169

170170
```@docs
171-
ModelingToolkit.AffectSystem
172171
ModelingToolkit.ImperativeAffect
173172
```
174173

docs/src/API/problems.md

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -9,46 +9,46 @@ code for a variety of such numerical problems.
99
## Dynamical systems
1010

1111
```@docs
12-
ODEFunction(::System, args...)
13-
ODEProblem(::System, args...)
14-
DAEFunction(::System, args...)
15-
DAEProblem(::System, args...)
16-
SDEFunction(::System, args...)
17-
SDEProblem(::System, args...)
18-
DDEFunction(::System, args...)
19-
DDEProblem(::System, args...)
20-
SDDEFunction(::System, args...)
21-
SDDEProblem(::System, args...)
22-
JumpProblem(::System, args...)
23-
BVProblem(::System, args...)
24-
DiscreteProblem(::System, args...)
25-
ImplicitDiscreteProblem(::System, args...)
12+
SciMLBase.ODEFunction
13+
SciMLBase.ODEProblem
14+
SciMLBase.DAEFunction
15+
SciMLBase.DAEProblem
16+
SciMLBase.SDEFunction
17+
SciMLBase.SDEProblem
18+
SciMLBase.DDEFunction
19+
SciMLBase.DDEProblem
20+
SciMLBase.SDDEFunction
21+
SciMLBase.SDDEProblem
22+
JumpProcesses.JumpProblem
23+
SciMLBase.BVProblem
24+
SciMLBase.DiscreteProblem
25+
SciMLBase.ImplicitDiscreteProblem
2626
```
2727

2828
## Nonlinear systems
2929

3030
```@docs
31-
NonlinearFunction(::System, args...)
32-
NonlinearProblem(::System, args...)
33-
SCCNonlinearProblem(::System, args...)
34-
NonlinearLeastSquaresProblem(::System, args...)
35-
SteadyStateProblem(::System, args...)
36-
IntervalNonlinearFunction(::System, args...)
37-
IntervalNonlinearProblem(::System, args...)
31+
SciMLBase.NonlinearFunction
32+
SciMLBase.NonlinearProblem
33+
SciMLBase.SCCNonlinearProblem
34+
SciMLBase.NonlinearLeastSquaresProblem
35+
SciMLBase.SteadyStateProblem
36+
SciMLBase.IntervalNonlinearFunction
37+
SciMLBase.IntervalNonlinearProblem
3838
ModelingToolkit.HomotopyContinuationProblem
39-
HomotopyNonlinearFunction(::System, args...)
39+
SciMLBase.HomotopyNonlinearFunction
4040
```
4141

4242
## Optimization and optimal control
4343

4444
```@docs
45-
OptimizationFunction(::System, args...)
46-
OptimizationProblem(::System, args...)
47-
ODEInputFunction(::System, args...)
48-
JuMPDynamicOptProblem(::System, args...)
49-
InfiniteOptDynamicOptProblem,(::System, args...)
50-
CasADiDynamicOptProblem(::System, args...)
51-
DynamicOptSolution
45+
SciMLBase.OptimizationFunction
46+
SciMLBase.OptimizationProblem
47+
SciMLBase.ODEInputFunction
48+
ModelingToolkit.JuMPDynamicOptProblem
49+
ModelingToolkit.InfiniteOptDynamicOptProblem
50+
ModelingToolkit.CasADiDynamicOptProblem
51+
ModelingToolkit.DynamicOptSolution
5252
```
5353

5454
## The state vector and parameter object
@@ -102,7 +102,7 @@ There are also utilities for manipulating the results of these analyses in a sym
102102

103103
```@docs
104104
ModelingToolkit.similarity_transform
105-
ModelingToolkit.reorder_unknnowns
105+
ModelingToolkit.reorder_unknowns
106106
```
107107

108108
### Analysis point transformations

docs/src/API/variables.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Symbolic variables and variable metadata
1+
# [Symbolic variables and variable metadata](@id symbolic_metadata)
22

33
ModelingToolkit uses [Symbolics.jl](https://docs.sciml.ai/Symbolics/stable/) for the symbolic
44
manipulation infrastructure. In fact, the `@variables` macro is defined in Symbolics.jl. In
@@ -85,7 +85,7 @@ hasconnect
8585
getconnect
8686
```
8787

88-
```@docs; canonical = false
88+
```@docs; canonical=false
8989
Flow
9090
Stream
9191
```
@@ -165,7 +165,7 @@ getguess
165165
When a system is constructed, the guesses of the involved variables are stored in a `Dict`
166166
in the system. After this point, the guess metadata of the variable is irrelevant.
167167

168-
```@docs; canonical = false
168+
```@docs; canonical=false
169169
guesses
170170
```
171171

@@ -315,7 +315,7 @@ b = getbounds(sys) # Operating on the system, we get a dict
315315

316316
See also:
317317

318-
```@docs; canonical = false
318+
```@docs; canonical=false
319319
tunable_parameters
320320
ModelingToolkit.dump_unknowns
321321
ModelingToolkit.dump_parameters

docs/src/basics/Debugging.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,6 @@ dprob[ModelingToolkit.ASSERTION_LOG_VARIABLE] = false;
6868
solve(dprob, Tsit5());
6969
```
7070

71-
```@docs
71+
```@docs; canonical = false
7272
debug_system
7373
```

docs/src/basics/Events.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -249,11 +249,11 @@ par = @parameters g = 9.8
249249
bb_eqs = [D(x) ~ v
250250
D(v) ~ -g]
251251
252-
function bb_affect!(integ, u, p, ctx)
253-
integ.u[u.v] = -integ.u[u.v]
252+
function bb_affect!(mod, obs, integ, ctx)
253+
return (; v = -mod.v)
254254
end
255255
256-
reflect = [x ~ 0] => (bb_affect!, [v], [], [], nothing)
256+
reflect = [x ~ 0] => (bb_affect!, (; v))
257257
258258
@mtkcompile bb_sys = System(bb_eqs, t, sts, par,
259259
continuous_events = reflect)

docs/src/basics/FAQ.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ Strings are not considered symbolic variables, and thus cannot directly be used
8888
indexing. However, ModelingToolkit does provide a method to parse the string representation of
8989
a variable, given the system in which that variable exists.
9090

91-
```@docs
91+
```@docs; canonical = false
9292
ModelingToolkit.parse_variable
9393
```
9494

@@ -260,14 +260,14 @@ D = Differential(x)
260260
Tunable parameters are floating point parameters, not used in callbacks and not marked with `tunable = false` in their metadata. These are expected to be used with AD
261261
and optimization libraries. As such, they are stored together in one `Vector{T}`. To obtain the ordering of tunable parameters in this buffer, use:
262262

263-
```@docs
263+
```@docs; canonical = false
264264
tunable_parameters
265265
```
266266

267267
If you have an array in which a particular dimension is in the order of tunable parameters (e.g. the jacobian with respect to tunables) then that dimension of the
268268
array can be reordered into the required permutation using the symbolic variables:
269269

270-
```@docs
270+
```@docs; canonical = false
271271
reorder_dimension_by_tunables!
272272
reorder_dimension_by_tunables
273273
```

docs/src/basics/InputOutput.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ u = [rand()]
7575

7676
## Generating an output function, ``g``
7777

78-
ModelingToolkit can also generate a function that computes a specified output of a system, the function ``y = g(x, u, p, t)`` above. This is done using the function [`build_explicit_observed_function`](@ref). When generating an output function, the user must specify the output variable(s) of interest, as well as any inputs if inputs are relevant to compute the output.
78+
ModelingToolkit can also generate a function that computes a specified output of a system, the function ``y = g(x, u, p, t)`` above. This is done using the function [`ModelingToolkit.build_explicit_observed_function`](@ref). When generating an output function, the user must specify the output variable(s) of interest, as well as any inputs if inputs are relevant to compute the output.
7979

8080
The order of the user-specified output variables determines the order of the output vector ``y``.
8181

@@ -93,7 +93,7 @@ See [Linearization](@ref linearization).
9393
Pages = ["InputOutput.md"]
9494
```
9595

96-
```@docs
96+
```@docs; canonical=false
9797
ModelingToolkit.generate_control_function
9898
ModelingToolkit.build_explicit_observed_function
9999
```

docs/src/basics/Linearization.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ Also see [ControlSystemsMTK.jl](https://juliacontrol.github.io/ControlSystemsMTK
153153
Pages = ["Linearization.md"]
154154
```
155155

156-
```@docs
156+
```@docs; canonical = false
157157
linearize
158158
ModelingToolkit.linearize_symbolic
159159
ModelingToolkit.linearization_function

docs/src/internals.md

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -3,44 +3,3 @@
33
This is a page for detailing some of the inner workings to help future
44
contributors to the library.
55

6-
## Observables and Variable Elimination
7-
8-
In the variable “elimination” algorithms, what is actually done is that variables
9-
are removed from being unknowns and equations are moved into the `observed` category
10-
of the system. The `observed` equations are explicit algebraic equations which
11-
are then substituted out to completely eliminate these variables from the other
12-
equations, allowing the system to act as though these variables no longer exist.
13-
14-
However, a user may want to interact with such variables, for example,
15-
plotting their output. For this reason, these relationships are stored,
16-
and are then used to generate the `observed` equation found in the
17-
`SciMLFunction` interface, so that `sol[x]` lazily reconstructs the observed
18-
variable when necessary. In this sense, there is an equivalence between
19-
observables and the variable elimination system.
20-
21-
The procedure for variable elimination inside [`mtkcompile`](@ref) is
22-
23-
1. [`ModelingToolkit.initialize_system_structure`](@ref).
24-
2. [`ModelingToolkit.alias_elimination`](@ref). This step moves equations into `observed(sys)`.
25-
3. [`ModelingToolkit.dae_index_lowering`](@ref) by means of [`pantelides!`](@ref) (if the system is an [`System`](@ref)).
26-
4. [`ModelingToolkit.tearing`](@ref).
27-
28-
## Preparing a system for simulation
29-
30-
Before a simulation or optimization can be performed, the symbolic equations stored in an [`AbstractSystem`](@ref) must be converted into executable code. This step typically occurs after the simplification explained above, and is performed when an instance of a [`SciMLBase.AbstractSciMLProblem`](@ref), such as a [`ODEProblem`](@ref), is constructed.
31-
The call chain typically looks like this, with the function names in the case of an `System` indicated in parentheses
32-
33-
1. Problem constructor ([`ODEProblem`](@ref))
34-
2. Build an `DEFunction` ([`process_DEProblem`](@ref) -> [`ODEFunction`](@ref)
35-
3. Write actual executable code ([`generate_function`](@ref) or [`generate_custom_function`](@ref))
36-
37-
Apart from [`generate_function`](@ref), which generates the dynamics function, `ODEFunction` also builds functions for observed equations (`build_explicit_observed_function`) and Jacobians (`generate_jacobian`) etc. These are all stored in the `ODEFunction`.
38-
39-
## Creating an `MTKParameters` object
40-
41-
It may be useful to create a parameter object without creating the problem. For this
42-
purpose, the `MTKParameters` constructor is exposed as public API.
43-
44-
```@docs
45-
MTKParameters
46-
```

0 commit comments

Comments
 (0)