Public API
This page lists exported symbols of CTFlows.MultiPhase.
From CTFlows.MultiPhase
CTFlows.MultiPhase [Module]
CTFlows.MultiPhase Module
MultiPhaseMulti-phase flow concatenation and sequential integration.
This module provides types and operators for concatenating flows with switching times and optional jumps, implementing exact sequential integration.
AnyMultiPhaseFlow [Struct]
CTFlows.MultiPhase.AnyMultiPhaseFlow Type
struct MultiPhaseFlow{TD<:CTBase.Traits.TimeDependence, VD<:CTBase.Traits.VariableDependence, D<:CTBase.Traits.AbstractDynamicsTrait, FS<:Tuple, ST<:(Vector{<:Real}), J<:(Vector)} <: CTFlows.Flows.AbstractFlow{TD<:CTBase.Traits.TimeDependence, VD<:CTBase.Traits.VariableDependence, D<:CTBase.Traits.AbstractDynamicsTrait}Type alias for any multi-phase flow.
See also: CTFlows.MultiPhase.MultiPhaseStateFlow, CTFlows.MultiPhase.MultiPhaseHamiltonianFlow.
MultiPhaseFlow [Struct]
CTFlows.MultiPhase.MultiPhaseFlow Type
struct MultiPhaseFlow{TD<:CTBase.Traits.TimeDependence, VD<:CTBase.Traits.VariableDependence, D<:CTBase.Traits.AbstractDynamicsTrait, FS<:Tuple, ST<:(Vector{<:Real}), J<:(Vector)} <: CTFlows.Flows.AbstractFlow{TD<:CTBase.Traits.TimeDependence, VD<:CTBase.Traits.VariableDependence, D<:CTBase.Traits.AbstractDynamicsTrait}Concrete multi-phase flow combining multiple flows of the same dynamics family with switching times and optional jumps.
The dynamics axis is encoded in D, following the same pattern as Flow:
D = StateDynamics→ state multi-phase flow (aliasMultiPhaseStateFlow)D = HamiltonianDynamics→ Hamiltonian multi-phase flow (aliasMultiPhaseHamiltonianFlow)
flows is a heterogeneous tuple, lifting the previous homogeneous-S/I constraint: phases may wrap systems and integrators of different concrete types.
Type Parameters
TD <: TimeDependence: Time dependence trait (Autonomous or NonAutonomous)VD <: VariableDependence: Variable dependence trait (Fixed or NonFixed)D <: AbstractDynamicsTrait: Dynamics trait (StateDynamicsorHamiltonianDynamics)FS <: Tuple: Tuple ofAbstractFlow{TD,VD,D}(heterogeneous allowed)ST <: Vector{<:Real}: Type of the switching times vectorJ <: Vector{<:Any}: Type of the jumps vector
Fields
flows::FS: Tuple of flows for each phaseswitching_times::ST: Switching times between phasesjumps::J: Optional jump functions applied at switching times
See also: CTFlows.MultiPhase.MultiPhaseStateFlow, CTFlows.MultiPhase.MultiPhaseHamiltonianFlow, CTFlows.Flows.Flow.
MultiPhaseHamiltonianFlow [Struct]
CTFlows.MultiPhase.MultiPhaseHamiltonianFlow Type
struct MultiPhaseFlow{TD<:CTBase.Traits.TimeDependence, VD<:CTBase.Traits.VariableDependence, CTBase.Traits.HamiltonianDynamics, FS<:Tuple, ST<:(Vector{<:Real}), J<:(Vector)} <: CTFlows.Flows.AbstractFlow{TD<:CTBase.Traits.TimeDependence, VD<:CTBase.Traits.VariableDependence, CTBase.Traits.HamiltonianDynamics}Alias for Hamiltonian multi-phase flows: MultiPhaseFlow{TD,VD,HamiltonianDynamics,FS,ST,J}.
See also: CTFlows.MultiPhase.MultiPhaseFlow, CTFlows.MultiPhase.MultiPhaseStateFlow.
MultiPhaseStateFlow [Struct]
CTFlows.MultiPhase.MultiPhaseStateFlow Type
struct MultiPhaseFlow{TD<:CTBase.Traits.TimeDependence, VD<:CTBase.Traits.VariableDependence, CTBase.Traits.StateDynamics, FS<:Tuple, ST<:(Vector{<:Real}), J<:(Vector)} <: CTFlows.Flows.AbstractFlow{TD<:CTBase.Traits.TimeDependence, VD<:CTBase.Traits.VariableDependence, CTBase.Traits.StateDynamics}Alias for state multi-phase flows: MultiPhaseFlow{TD,VD,StateDynamics,FS,ST,J}.
See also: CTFlows.MultiPhase.MultiPhaseFlow, CTFlows.MultiPhase.MultiPhaseHamiltonianFlow.
jumps [Function]
CTFlows.MultiPhase.jumps Function
jumps(_::CTFlows.Flows.AbstractFlow) -> VectorReturn the jumps of a flow: empty for a single flow; for a multi-phase flow, the jump applied at the switching time after phase i is jumps(f)[i] (nothing for no jump).
Arguments
f: a flow, single-phase or multi-phase.
Returns
AbstractVector: the jumps.
See also: CTFlows.MultiPhase.switching_times, CTFlows.MultiPhase.phase_flows.
n_phases [Function]
CTFlows.MultiPhase.n_phases Function
n_phases(mpf::CTFlows.MultiPhase.MultiPhaseFlow) -> Int64Return the number of phases of a flow: 1 for a single flow, the number of concatenated flows for a multi-phase flow.
Arguments
f: a flow, single-phase or multi-phase.
Returns
Int: the number of phases.
See also: CTFlows.MultiPhase.phase_flows, CTFlows.MultiPhase.switching_times.
phase_flows [Function]
CTFlows.MultiPhase.phase_flows Function
phase_flows(f::CTFlows.Flows.AbstractFlow) -> TupleReturn the flows of the phases of a flow, in order: a 1-tuple for a single flow, the concatenated flows for a multi-phase flow. The flow of phase i is phase_flows(f)[i].
Arguments
f: a flow, single-phase or multi-phase.
Returns
Tuple: the flows of the phases.
See also: CTFlows.MultiPhase.n_phases, CTFlows.MultiPhase.switching_times, CTFlows.MultiPhase.jumps.
phase_labels [Function]
CTFlows.MultiPhase.phase_labels Function
phase_labels(
f::CTFlows.Flows.AbstractFlow
) -> Vector{String}Return the labels of the phases of a flow, one per phase ("" for a phase with no label), given with Flow(...; label="bang"). Concatenation keeps the phases' flows, so their labels are kept in order.
This is a method of CTModels.Solutions.phase_labels, the function that reads the labels of the phases of a solution.
Example
using CTFlows: Flows, MultiPhase
f1 = Flows.Flow(ocp, u_max; label="bang+")
f2 = Flows.Flow(ocp, u_min; label="bang-")
MultiPhase.phase_labels(f1 * (0.5, f2)) # ["bang+", "bang-"]See also: CTFlows.Flows.label, CTFlows.MultiPhase.phase_flows.
switching_times [Function]
CTFlows.MultiPhase.switching_times Function
switching_times(
_::CTFlows.Flows.AbstractFlow
) -> Vector{<:Real}Return the switching times of a flow: empty for a single flow; for a multi-phase flow, the time between phase i and phase i + 1 is switching_times(f)[i].
This is a method of CTModels.Solutions.switching_times, the function that reads the switching times of a solution: the same name for a flow and for what it returns. The times keep their type (a ForwardDiff.Dual while a shooting function is differentiated).
Arguments
f: a flow, single-phase or multi-phase.
Returns
AbstractVector{<:Real}: the switching times.
See also: CTFlows.MultiPhase.n_phases, CTFlows.MultiPhase.jumps.