State

Index

Warning

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 error

must 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.componentsMethod
components(
    model::CTModels.StateModelSolution
) -> Vector{String}

Get the components names of the state from the state model solution.

CTModels.componentsMethod
components(model::CTModels.StateModel) -> Vector{String}

Get the components names of the state from the state model.

CTModels.dimensionMethod
dimension(model::CTModels.StateModelSolution) -> Int64

Get the dimension of the state from the state model solution.

CTModels.dimensionMethod
dimension(model::CTModels.StateModel) -> Int64

Get the dimension of the state from the state model.

CTModels.nameMethod
name(model::CTModels.StateModelSolution) -> String

Get the name of the state from the state model solution.

CTModels.nameMethod
name(model::CTModels.StateModel) -> String

Get the name of the state from the state model.

CTModels.state!Method
state!(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.

Note

You must use state! only once to set the state dimension.

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.valueMethod
value(
    model::CTModels.StateModelSolution{TS<:Function}
) -> Function

Get the state function from the state model solution.