State
Index
CTModels.componentsCTModels.componentsCTModels.dimensionCTModels.dimensionCTModels.nameCTModels.nameCTModels.state!CTModels.value
In the examples in the documentation below, the methods are not prefixed by the module name even if they are private.
julia> using CTModels
julia> x = 1
julia> private_fun(x) # throw an errormust be replaced by
julia> using CTModels
julia> x = 1
julia> CTModels.private_fun(x)However, if the method is reexported by another package, then, there is no need of prefixing.
julia> module OptimalControl
import CTModels: private_fun
export private_fun
end
julia> using OptimalControl
julia> x = 1
julia> private_fun(x)Documentation
CTModels.components — Methodcomponents(
model::CTModels.StateModelSolution
) -> Vector{String}
Get the components names of the state from the state model solution.
CTModels.components — Methodcomponents(model::CTModels.StateModel) -> Vector{String}
Get the components names of the state from the state model.
CTModels.dimension — Methoddimension(model::CTModels.StateModelSolution) -> Int64
Get the dimension of the state from the state model solution.
CTModels.dimension — Methoddimension(model::CTModels.StateModel) -> Int64
Get the dimension of the state from the state model.
CTModels.name — Methodname(model::CTModels.StateModelSolution) -> String
Get the name of the state from the state model solution.
CTModels.name — Methodname(model::CTModels.StateModel) -> String
Get the name of the state from the state model.
CTModels.state! — Methodstate!(ocp::CTModels.PreModel, n::Int64)
state!(
ocp::CTModels.PreModel,
n::Int64,
name::Union{String, Symbol}
)
state!(
ocp::CTModels.PreModel,
n::Int64,
name::Union{String, Symbol},
components_names::Array{T2<:Union{String, Symbol}, 1}
)
Define the state dimension and possibly the names of each component.
Examples
julia> state!(ocp, 1)
julia> state_dimension(ocp)
1
julia> state_components(ocp)
["x"]
julia> state!(ocp, 1, "y")
julia> state_dimension(ocp)
1
julia> state_components(ocp)
["y"]
julia> state!(ocp, 2)
julia> state_dimension(ocp)
2
julia> state_components(ocp)
["x₁", "x₂"]
julia> state!(ocp, 2, :y)
julia> state_dimension(ocp)
2
julia> state_components(ocp)
["y₁", "y₂"]
julia> state!(ocp, 2, "y")
julia> state_dimension(ocp)
2
julia> state_components(ocp)
["y₁", "y₂"]
julia> state!(ocp, 2, "y", ["u", "v"])
julia> state_dimension(ocp)
2
julia> state_components(ocp)
["u", "v"]
julia> state!(ocp, 2, "y", [:u, :v])
julia> state_dimension(ocp)
2
julia> state_components(ocp)
["u", "v"]CTModels.value — Methodvalue(
model::CTModels.StateModelSolution{TS<:Function}
) -> Function
Get the state function from the state model solution.