Skip to content

Commit 9dad7db

Browse files
committed
up doc
1 parent 0321045 commit 9dad7db

10 files changed

Lines changed: 80 additions & 39 deletions

File tree

docs/make.jl

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,30 @@ end
1717

1818
repo_url = "github.com/control-toolbox/CTModels.jl"
1919

20+
API_PAGES = [
21+
"constraints.md",
22+
"control.md",
23+
"ctmodels.md",
24+
"default.md",
25+
"definition.md",
26+
"dual_model.md",
27+
"dynamics.md",
28+
"init.md",
29+
"jld.md",
30+
"json.md",
31+
"model.md",
32+
"objective.md",
33+
"plot.md",
34+
"print.md",
35+
"solution.md",
36+
"state.md",
37+
"time_dependence.md",
38+
"times.md",
39+
"types.md",
40+
"utils.md",
41+
"variable.md"
42+
]
43+
2044
makedocs(;
2145
remotes=nothing,
2246
warnonly=[:cross_references, :autodocs_block],
@@ -32,29 +56,7 @@ makedocs(;
3256
),
3357
pages=[
3458
"Introduction" => "index.md",
35-
"API" => [
36-
"constraints.md",
37-
"control.md",
38-
"ctmodels.md",
39-
"default.md",
40-
"definition.md",
41-
"dual_model.md",
42-
"dynamics.md",
43-
"init.md",
44-
"jld.md",
45-
"json.md",
46-
"model.md",
47-
"objective.md",
48-
"plot.md",
49-
"print.md",
50-
"solution.md",
51-
"state.md",
52-
"time_dependence.md",
53-
"times.md",
54-
"types.md",
55-
"utils.md",
56-
"variable.md",
57-
]
59+
"API" => API_PAGES,
5860
],
5961
checkdocs=:none,
6062
)

docs/src/constraints.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
```@index
66
Pages = ["constraints.md"]
7-
Modules = [CTModels]
7+
Modules = [CTModels, Base]
88
Order = [:module, :constant, :type, :function, :macro]
99
```
1010

docs/src/ctmodels.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
```@index
66
Pages = ["ctmodels.md"]
7-
Modules = [CTModels]
7+
Modules = [CTModels, RecipesBase]
88
Order = [:module, :constant, :type, :function, :macro]
99
```
1010

docs/src/index.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,11 @@
22

33
The `CTModels.jl` package is part of the [control-toolbox ecosystem](https://github.com/control-toolbox).
44

5-
The root package is [OptimalControl.jl](https://github.com/control-toolbox/OptimalControl.jl) which aims to provide tools to model and solve optimal control problems with ordinary differential equations by direct and indirect methods.
5+
The root package is [OptimalControl.jl](https://github.com/control-toolbox/OptimalControl.jl) which aims to provide tools to model and solve optimal control problems with ordinary differential equations by direct and indirect methods.
6+
7+
**API Documentation**
8+
9+
```@contents
10+
Pages = Main.API_PAGES
11+
Depth = 1
12+
```

docs/src/jld.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
```@index
66
Pages = ["jld.md"]
7-
Modules = [CTModelsJLD]
7+
Modules = [CTModels, CTModelsJLD]
88
Order = [:module, :constant, :type, :function, :macro]
99
```
1010

docs/src/json.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
```@index
66
Pages = ["json.md"]
7-
Modules = [CTModelsJSON]
7+
Modules = [CTModels, CTModelsJSON]
88
Order = [:module, :constant, :type, :function, :macro]
99
```
1010

docs/src/plot.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,6 @@ Order = [:module, :constant, :type, :function, :macro]
1010

1111
## Documentation
1212

13-
```@docs
14-
plot(::CTModels.Solution, ::Symbol...)
15-
```
16-
1713
```@autodocs
1814
Modules = [CTModelsPlots]
1915
Order = [:module, :constant, :type, :function, :macro]

docs/src/print.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
```@index
66
Pages = ["print.md"]
7-
Modules = [CTModels]
7+
Modules = [CTModels, Base]
88
Order = [:module, :constant, :type, :function, :macro]
99
```
1010

docs/src/solution.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
```@index
66
Pages = ["solution.md"]
7-
Modules = [CTModels]
7+
Modules = [CTModels, Base]
88
Order = [:module, :constant, :type, :function, :macro]
99
```
1010

src/time_dependence.jl

Lines changed: 41 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,50 @@
1-
function time_dependence!(ocp::PreModel; autonomous::Bool)::Nothing
1+
"""
2+
$(TYPEDSIGNATURES)
3+
4+
Set the time dependence of the optimal control problem `ocp`.
5+
6+
# Arguments
7+
- `ocp::PreModel`: The optimal control problem being defined.
8+
- `autonomous::Bool`: Indicates whether the system is autonomous (`true`) or time-dependent (`false`).
9+
10+
# Preconditions
11+
- The time dependence must not have been set previously.
212
3-
# checkings
13+
# Behavior
14+
This function sets the `autonomous` field of the model to indicate whether the system's dynamics
15+
explicitly depend on time. It can only be called once.
16+
17+
# Errors
18+
Throws `CTBase.UnauthorizedCall` if the time dependence has already been set.
19+
20+
# Example
21+
```julia-repl
22+
julia> ocp = PreModel(...)
23+
julia> time_dependence!(ocp; autonomous=true)
24+
```
25+
"""
26+
function time_dependence!(ocp::PreModel; autonomous::Bool)::Nothing
427
@ensure !__is_autonomous_set(ocp) CTBase.UnauthorizedCall(
528
"the time dependence has already been set."
629
)
7-
8-
# set the state
930
ocp.autonomous = autonomous
10-
1131
return nothing
1232
end
1333

34+
"""
35+
$(TYPEDSIGNATURES)
36+
37+
Check whether the system is autonomous.
38+
39+
# Arguments
40+
- `ocp::PreModel`: The optimal control problem.
41+
42+
# Returns
43+
- `Bool`: `true` if the system is autonomous (i.e., does not explicitly depend on time), `false` otherwise.
44+
45+
# Example
46+
```julia-repl
47+
julia> is_autonomous(ocp) # returns true or false
48+
```
49+
"""
1450
is_autonomous(ocp::PreModel) = ocp.autonomous

0 commit comments

Comments
 (0)