akreon-control
Optimal and robust control and state estimation in C++26.
Loading...
Searching...
No Matches
control::PlantModel< SS, InputPorts, OutputPorts > Struct Template Reference

Forward declaration of PlantModel. More...

#include <plant_model.hpp>

Public Types

using StateSpace = linalg::remove_cvref_t< SS >
 
using InputPortsT = linalg::remove_cvref_t< InputPorts >
 
using OutputPortsT = linalg::remove_cvref_t< OutputPorts >
 
using Model = PlantModel< StateSpace, InputPortsT, OutputPortsT >
 
using T = plant_type_t< Model >
 

Public Member Functions

constexpr PlantModel (const StateSpace &ss)
 Copy a state-space model using the template-specified layouts.
 
constexpr PlantModel (const StateSpace &ss, const InputPortsT &, const OutputPortsT &)
 Copy a model with layout arguments supplied for type deduction.
 
constexpr auto dynamics_matrix () const
 Return A (StateDim x StateDim), without changing the time domain.
 
constexpr auto exogenous_matrix () const
 Return B_w (StateDim x ExogenousDim), for disturbance/reference/noise inputs.
 
constexpr auto control_matrix () const
 Return B_u (StateDim x ControlDim), for actuator inputs.
 
constexpr auto performance_matrix () const
 Return C_z (PerformanceDim x StateDim), for regulated outputs.
 
constexpr auto measurement_matrix () const
 Return C_y (MeasurementDim x StateDim), for measured outputs.
 
template<PortRole OutRole, PortRole InRole>
constexpr auto feedthrough () const
 Extract D blocks from the selected input role to output role.
 

Public Attributes

SS state_space
 Owned full model; accessors reflect its current matrices.
 

Static Public Attributes

static constexpr std::size_t StateDim = plant_traits<Model>::StateDim
 
static constexpr std::size_t InputDim = plant_traits<Model>::InputDim
 
static constexpr std::size_t OutputDim = plant_traits<Model>::OutputDim
 

Detailed Description

template<StateSpaceLike SS, typename InputPorts, typename OutputPorts>
struct control::PlantModel< SS, InputPorts, OutputPorts >

Forward declaration of PlantModel.

State-space model with compile-time input and output port roles.

The underlying equations are xdot = A*x + B*v (continuous) or x[k+1] = A*x[k] + B*v[k] (discrete), with o = C*x + D*v. Input ports identify exogenous channels w and control channels u in v; output ports identify performance channels z and measurements y in o. The full matrices retain their original channel ordering.

Each Port<Role, Offset, Size> selects a contiguous, zero-based range: inputs select B/D columns and outputs select C/D rows. Ranges must be nonempty, in bounds, and nonoverlapping within each layout; these checks occur at compile time. Layouts need not cover every channel. Callers choose appropriate input/output roles and satisfy each synthesis formulation's additional assumptions; this wrapper does not check stabilizability, detectability, or physical units.

Accessors concatenate matching ports in layout declaration order, not ascending matrix offset. A missing role produces a zero-width input matrix or zero-height output matrix. All returned matrices are values, not views. Layouts are types and require no runtime storage; state_space owns a copy of the supplied model, including its time domain and optional D matrix.

For a model with inputs [w, u] and outputs [z, y], one channel each:

// SS has two input columns and two output rows.
const auto B_u = plant.control_matrix();
const auto D_yu = plant.feedthrough<PortRole::MEASUREMENT,
constexpr bool is_continuous_v
check if continuous or not
@ CONTROL
u: controller input to the plant
@ MEASUREMENT
y: measured output available for feedback/estimation
Port layout over either the state-space input or output axis.
Port specification.
Template Parameters
SSContinuous or discrete StateSpaceLike model.
InputPortsPortLayout describing the full input axis.
OutputPortsPortLayout describing the full output axis.

Definition at line 56 of file plant_model.hpp.

Member Typedef Documentation

◆ InputPortsT

template<StateSpaceLike SS, typename InputPorts , typename OutputPorts >
using control::PlantModel< SS, InputPorts, OutputPorts >::InputPortsT = linalg::remove_cvref_t<InputPorts>

Definition at line 58 of file plant_model.hpp.

◆ Model

template<StateSpaceLike SS, typename InputPorts , typename OutputPorts >
using control::PlantModel< SS, InputPorts, OutputPorts >::Model = PlantModel<StateSpace, InputPortsT, OutputPortsT>

Definition at line 60 of file plant_model.hpp.

◆ OutputPortsT

template<StateSpaceLike SS, typename InputPorts , typename OutputPorts >
using control::PlantModel< SS, InputPorts, OutputPorts >::OutputPortsT = linalg::remove_cvref_t<OutputPorts>

Definition at line 59 of file plant_model.hpp.

◆ StateSpace

template<StateSpaceLike SS, typename InputPorts , typename OutputPorts >
using control::PlantModel< SS, InputPorts, OutputPorts >::StateSpace = linalg::remove_cvref_t<SS>

Definition at line 57 of file plant_model.hpp.

◆ T

template<StateSpaceLike SS, typename InputPorts , typename OutputPorts >
using control::PlantModel< SS, InputPorts, OutputPorts >::T = plant_type_t<Model>

Definition at line 61 of file plant_model.hpp.

Constructor & Destructor Documentation

◆ PlantModel() [1/2]

template<StateSpaceLike SS, typename InputPorts , typename OutputPorts >
constexpr control::PlantModel< SS, InputPorts, OutputPorts >::PlantModel ( const StateSpace &  ss)
inlineexplicitconstexpr

Copy a state-space model using the template-specified layouts.

Parameters
ssFull model whose matrix ordering matches the port offsets.

Definition at line 75 of file plant_model.hpp.

◆ PlantModel() [2/2]

template<StateSpaceLike SS, typename InputPorts , typename OutputPorts >
constexpr control::PlantModel< SS, InputPorts, OutputPorts >::PlantModel ( const StateSpace &  ss,
const InputPortsT &  ,
const OutputPortsT &   
)
inlineconstexpr

Copy a model with layout arguments supplied for type deduction.

Parameters
ssFull state-space model. The layout arguments carry types only; no layout objects are stored.

Definition at line 81 of file plant_model.hpp.

Member Function Documentation

◆ control_matrix()

template<StateSpaceLike SS, typename InputPorts , typename OutputPorts >
constexpr auto control::PlantModel< SS, InputPorts, OutputPorts >::control_matrix ( ) const
inlineconstexpr

Return B_u (StateDim x ControlDim), for actuator inputs.

Definition at line 95 of file plant_model.hpp.

References control::is_continuous_v.

◆ dynamics_matrix()

template<StateSpaceLike SS, typename InputPorts , typename OutputPorts >
constexpr auto control::PlantModel< SS, InputPorts, OutputPorts >::dynamics_matrix ( ) const
inlineconstexpr

Return A (StateDim x StateDim), without changing the time domain.

Definition at line 86 of file plant_model.hpp.

References control::PlantModel< SS, InputPorts, OutputPorts >::state_space.

◆ exogenous_matrix()

template<StateSpaceLike SS, typename InputPorts , typename OutputPorts >
constexpr auto control::PlantModel< SS, InputPorts, OutputPorts >::exogenous_matrix ( ) const
inlineconstexpr

Return B_w (StateDim x ExogenousDim), for disturbance/reference/noise inputs.

Definition at line 90 of file plant_model.hpp.

References control::is_continuous_v.

◆ feedthrough()

template<StateSpaceLike SS, typename InputPorts , typename OutputPorts >
template<PortRole OutRole, PortRole InRole>
constexpr auto control::PlantModel< SS, InputPorts, OutputPorts >::feedthrough ( ) const
inlineconstexpr

Extract D blocks from the selected input role to output role.

Template Parameters
OutRoleOutput role selecting rows in C/D.
InRoleInput role selecting columns in B/D.
Returns
Matrix with total_size<OutRole>() rows and total_size<InRole>() columns. Matching row/column blocks follow their respective layout order. If the model has no D, return zeros of the same shape. A missing role yields the corresponding zero dimension.

Definition at line 119 of file plant_model.hpp.

References control::is_continuous_v, and control::PlantModel< SS, InputPorts, OutputPorts >::state_space.

◆ measurement_matrix()

template<StateSpaceLike SS, typename InputPorts , typename OutputPorts >
constexpr auto control::PlantModel< SS, InputPorts, OutputPorts >::measurement_matrix ( ) const
inlineconstexpr

Return C_y (MeasurementDim x StateDim), for measured outputs.

Definition at line 105 of file plant_model.hpp.

References control::is_continuous_v.

◆ performance_matrix()

template<StateSpaceLike SS, typename InputPorts , typename OutputPorts >
constexpr auto control::PlantModel< SS, InputPorts, OutputPorts >::performance_matrix ( ) const
inlineconstexpr

Return C_z (PerformanceDim x StateDim), for regulated outputs.

Definition at line 100 of file plant_model.hpp.

References control::is_continuous_v.

Member Data Documentation

◆ InputDim

template<StateSpaceLike SS, typename InputPorts , typename OutputPorts >
constexpr std::size_t control::PlantModel< SS, InputPorts, OutputPorts >::InputDim = plant_traits<Model>::InputDim
staticconstexpr

Definition at line 64 of file plant_model.hpp.

◆ OutputDim

template<StateSpaceLike SS, typename InputPorts , typename OutputPorts >
constexpr std::size_t control::PlantModel< SS, InputPorts, OutputPorts >::OutputDim = plant_traits<Model>::OutputDim
staticconstexpr

Definition at line 65 of file plant_model.hpp.

◆ state_space

template<StateSpaceLike SS, typename InputPorts , typename OutputPorts >
SS control::PlantModel< SS, InputPorts, OutputPorts >::state_space

Owned full model; accessors reflect its current matrices.

Definition at line 129 of file plant_model.hpp.

Referenced by control::PlantModel< SS, InputPorts, OutputPorts >::dynamics_matrix(), and control::PlantModel< SS, InputPorts, OutputPorts >::feedthrough().

◆ StateDim

template<StateSpaceLike SS, typename InputPorts , typename OutputPorts >
constexpr std::size_t control::PlantModel< SS, InputPorts, OutputPorts >::StateDim = plant_traits<Model>::StateDim
staticconstexpr

Definition at line 63 of file plant_model.hpp.


The documentation for this struct was generated from the following files: