You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Plot the components of an optimal control solution.
1180
1213
1181
-
This is the main user-facing function to visualize the solution of an optimal control problem
1214
+
This is the main user-facing function to visualise the solution of an optimal control problem
1182
1215
solved with the control-toolbox ecosystem.
1183
1216
1184
1217
It generates a set of subplots showing the evolution of the state, control, costate,
@@ -1211,13 +1244,11 @@ If no symbols are provided, a default set is used based on the problem and style
1211
1244
- `:default`: Real time scale.
1212
1245
- `:normalize` or `:normalise`: Normalised to the interval [0, 1].
1213
1246
1214
-
- `solution_label::String = ""`: Label to annotate this solution in the legend. (Deprecated: use `label` instead)
1215
-
1216
1247
## Style Options (Optional)
1217
1248
1218
1249
All style-related keyword arguments can be either a `NamedTuple` of plotting attributes or the `Symbol` `:none` referring to not plot the associated element. These allow you to customise color, line style, markers, etc.
1219
1250
1220
-
- `time_style`: Style for vertical lines at initial and final time.
1251
+
- `time_style`: Style for vertical lines at initial and final times.
1221
1252
- `state_style`: Style for state components.
1222
1253
- `costate_style`: Style for costate components.
1223
1254
- `control_style`: Style for control components.
@@ -1234,7 +1265,7 @@ Use these options to customise bounds on the plots if applicable and defined in
1234
1265
1235
1266
# Returns
1236
1267
1237
-
- A `Plots.Plot` object, which can be displayed, saved, or further customized.
1268
+
- A `Plots.Plot` object, which can be displayed, saved, or further customised.
julia> sol = CTModels.import_ocp_solution(ocp; filename="solution", format=:JSON)
209
-
julia> sol = CTModels.import_ocp_solution(ocp; filename="solution", format=:JLD)
201
+
julia> using JSON3
202
+
julia> sol = import_ocp_solution(ocp; filename="solution", format=:JSON)
203
+
julia> using JLD2
204
+
julia> sol = import_ocp_solution(ocp; filename="solution", format=:JLD) # JLD is the default
210
205
```
211
206
"""
212
207
functionimport_ocp_solution(
@@ -227,38 +222,6 @@ function import_ocp_solution(
227
222
end
228
223
end
229
224
230
-
# to be extended
231
-
"""
232
-
$(TYPEDSIGNATURES)
233
-
234
-
Plot a solution from an optimal control problem.
235
-
236
-
This function dispatches on a solution type that inherits from `AbstractSolution`. It is intended to visualize various components of the solution (such as state trajectories, controls, costates, or any other variables defined in the model).
237
-
238
-
!!! note
239
-
This function requires the `Plots.jl` package to be available. If it is not loaded, a `CTBase.ExtensionError(:Plots)` is thrown.
240
-
241
-
# Arguments
242
-
- `sol::AbstractSolution`: A solution object returned by solving a control problem.
243
-
- `description::Symbol...`: Optional symbols specifying what to plot (e.g., `:state`, `:control`, `:costate`, etc.). If empty, a default set of components is plotted.
244
-
- `kwargs...`: Additional keyword arguments passed to the underlying plotting routines (e.g., `xlabel`, `ylabel`, `legend`, etc.).
245
-
246
-
# Returns
247
-
- A plot object (if `Plots.jl` is available) visualizing the selected components of the solution.
0 commit comments