---
url: /dyad/stable/analyses/pole_placement.md
description: >-
  Design an observer-based state-feedback controller using pole placement
  techniques with optional integral action.
---

# Pole Placement Analysis {#PolePlacementAnalysis}

Download as a Dyad projectPolePlacementAnalysis.zipOpen in Dyad Studio›

The pole placement analysis is used to design observer-based state-feedback controllers through linearization and pole placement techniques. The analysis linearizes the plant model at a specified operating point and designs both controller and observer gains to achieve desired closed-loop pole locations with specified damping and bandwidth characteristics.

## Method Overview {#Method-Overview}

The pole placement analysis in DyadControlSystems follows a systematic approach to controller design:

1. **Linearization**: The plant is linearized at the specified operating point with optional loop openings

2. **Plant Augmentation**: If integral action is requested, the plant is augmented with integrating disturbance models using `add_low_frequency_disturbance`

3. **Discretization**: If discrete-time control is specified, the plant is discretized using the chosen method

4. **Controller Pole Design**: Poles are modified to meet minimum damping and bandwidth constraints

5. **Observer Pole Design**: Observer poles are placed to be faster than controller poles

6. **Controller Synthesis**: State feedback gain `L` and observer gain `K` are computed using pole placement

7. **Final Controller**: An observer-based controller is constructed combining state feedback and state estimation

## Integral Action {#Integral-Action}

The analysis supports integral action through plant augmentation with integrating disturbances. This is achieved by:

* Specifying `integrator_indices` to indicate which control inputs should have integral action

* Providing `integrator_poles` to set the observer poles for the integrator states

* The plant is automatically augmented using `add_low_frequency_disturbance`

This approach provides disturbance rejection and eliminates steady-state errors for constant references and disturbances.

## Example Definition {#Example-Definition}

The following example demonstrates pole placement controller design for a DC motor system with integral action:

Since the analysis opens the loop at both `y` and `r`, the variables `controller.u_s` and `controller.u_m` are disconnected during linearization. We set `w_motor = 0` to avoid controller saturation and provide initial conditions so the operating point is well-defined:&#xA;

```dyad
component DCMotorForPolePlacement
  extends DyadExampleComponents.TestDCMotorLoadControlled(w_motor = 0)
relations
  guess controller.u_s = 0
  guess controller.u_m = 0
  guess motor.R1.v = 0
  guess motor.emf.tau = 0
  guess motor.emf.rotor.tau = 0
  guess motor.emf.rotor.phi = 0
  guess motor.emf.p.i = 0
  guess motor.friction.phi_rel = 0
  guess load.phi = 0
  guess controller.add_pid.y = 0
  guess controller.derivative.y = 0
end

analysis DCMotorPolePlacementAnalysis
  extends DyadControlSystems.PolePlacementAnalysis(
    measurement = ["y"],
    control_input = ["u"], 
    loop_openings = ["y", "r"],
    min_damping = 0.707,
    controller_speed_factor = 2.0,
    observer_speed_factor = 5.0,
    integrator_indices = [1],
    integrator_poles = [-10.0],
    duration = 1.0
  )

  model = DCMotorForPolePlacement()

end
```

```julia
using DyadExampleComponents, DyadInterface
solution = DCMotorPolePlacementAnalysis()
```

```ansi
┌ Warning: The initialization system is structurally singular. Guess values may significantly affect the initial values of the ODE. The problematic variables are SymbolicUtils.BasicSymbolicImpl.var"typeof(BasicSymbolicImpl)"{SymReal}[controller₊derivative₊x(t), motor₊emf₊rotor₊phiˍt(t), motor₊L1₊i(t), motor₊L1₊iˍt(t)].
│
│ Note that the identification of problematic variables is a best-effort heuristic.
└ @ ModelingToolkitBase ~/.julia/packages/ModelingToolkitBase/N5KVH/src/problems/initializationproblem.jl:140
┌ Warning: Initialization system is underdetermined. 1 equations for 5 unknowns. Initialization will default to using least squares. `SCCNonlinearProblem` can only be used for initialization of fully determined systems and hence will not be used here.
│
│
│ Call `analyze_initialization_jacobian(prob)` on the constructed problem to see which unknowns are underdetermined (and which equations, if any, are redundant).
│
│ To suppress this warning, pass `warn_initialize_determined = false`. To turn this warning into an error, pass `fully_determined = true`.
└ @ ModelingToolkit ~/.julia/packages/ModelingToolkit/ZgEKM/src/initialization.jl:25
┌ Warning: Got exception SingularException(6), returning Inf
└ @ ControlSystemsBase ~/.julia/packages/ControlSystemsBase/VzfgY/src/freqresp.jl:286
┌ Warning: Connected signals have different names
│  ##y#725 -> ##u#727
└ @ RobustAndOptimalControl ~/.julia/packages/RobustAndOptimalControl/wUkdf/src/named_systems2.jl:446
```

```julia
using Plots
using DyadInterface: artifacts
fig_step = artifacts(solution, :StepResponse)
```

![](gzsjjhm.svg)

```julia
fig_gang = artifacts(solution, :GangOfFour)
```

![](nscoljf.svg)

```julia
fig_bode = artifacts(solution, :BodePlot)
```

![](kbnpkfo.svg)

```julia
fig_pz = artifacts(solution, :PZMaps)
```

![](rhickom.svg)

We can examine the controller and observer gains:

```julia
L = artifacts(solution, :ControllerGain)
K = artifacts(solution, :ObserverGain)
L, K
```

```ansi
(3×1 DataFrame
 Row │ u1
     │ Float64
─────┼─────────
   1 │ 1.51995
   2 │ 0.50225
   3 │ 1.0, 1×3 DataFrame
 Row │ x1       x2       x3
     │ Float64  Float64  Float64
─────┼───────────────────────────
   1 │  1014.5  7157.56    510.0)
```

## Analysis Arguments {#Analysis-Arguments}

The following arguments define a pole placement analysis:

#### Required Arguments {#Required-Arguments}

* `model`: The system model to be controlled.

* `measurement::Vector{String}`: Names of the measured output signals.

* `control_input::Vector{String}`: Names of the control input signals.

#### Controller Design Parameters {#Controller-Design-Parameters}

* `min_damping::Real = 0.707`: Minimum damping ratio for controller poles. Poles with lower damping will be modified.

* `controller_speed_factor::Real = 1.0`: Factor by which to speed up controller poles after damping modification.

* `observer_speed_factor::Real = 5.0`: Factor by which observer poles are faster than controller poles.

* `min_bandwidth::Real = -1.0`: Minimum bandwidth below which poles are moved to this bandwidth. Set to -1 for no limit.

* `max_bandwidth::Real = -1.0`: Maximum bandwidth beyond which poles are not modified. Set to -1 for no limit.

* `direct_controller::Bool = false`: Whether or not to use direct feedthrough in the controller.

#### Integral Action Parameters {#Integral-Action-Parameters}

* `integrator_indices::Vector{Int} = []`: Indices of control inputs that should be augmented with integrating disturbances for integral action. This is a vector of integers corresponding to the indices of `control_input`.

* `integrator_poles::Vector{Real} = []`: Observer poles for the integrator states. Must have the same length as `integrator_indices`.

#### System Parameters {#System-Parameters}

* `loop_openings::Vector{String} = []`: Names of loop openings to break feedback loops during linearization.

* `t::Real = 0.0`: The time at which to perform the linearization of the system.

#### Discretization Parameters {#Discretization-Parameters}

* `disc::String = "cont"`: Discretization method. Use "cont" for continuous-time, or "zoh", "tustin", "foh" for discrete-time.

* `Ts::Real = -1.0`: Sampling time for discretization. Required when `disc != "cont"`. Set to -1 for automatic selection.

#### Analysis Parameters {#Analysis-Parameters}

* `wl::Real = -1`: The lower frequency bound for analysis plots. Set to -1 for automatic selection.

* `wu::Real = -1`: The upper frequency bound for analysis plots. Set to -1 for automatic selection.

* `num_frequencies::Int = 3000`: The number of frequencies to be used in frequency-domain analysis.

* `duration::Real = -1.0`: The duration of the step-response analysis. Set to -1 for automatic selection.

## Pole Placement Algorithm {#Pole-Placement-Algorithm}

The controller design follows this systematic approach:

1. **Linearization**: The plant is linearized at the specified operating point with loop openings

2. **Plant Augmentation**: If `integrator_indices` is specified, the plant is augmented with integrating disturbances using `add_low_frequency_disturbance` to provide integral action

3. **Discretization**: If `disc != "cont"`, the plant is discretized using the specified method and sampling time

4. **Pole Analysis**: Original poles are computed and analyzed for damping characteristics

5. **Controller Pole Design**:
   * Poles below `min_bandwidth` are moved to the minimum bandwidth (if specified)

   * Poles with damping below `min_damping` are modified to have the specified minimum damping

   * Well-damped poles are left unchanged (poles with damping ≥ `min_damping`)

   * Poles above `max_bandwidth` are ignored (if specified)

   * All poles are then scaled by `controller_speed_factor`

6. **Observer Pole Design**: Observer poles are set to be `observer_speed_factor` times faster than controller poles, with additional poles from `integrator_poles` for the augmented disturbance states

7. **Controller Synthesis**: State feedback gain `L` and observer gain `K` are computed using `place`

8. **Final Controller**: An observer-controller is created using `observer_controller`

## Controller Design Considerations {#Controller-Design-Considerations}

### Damping and Bandwidth {#Damping-and-Bandwidth}

* **Minimum Damping**: Ensures adequate transient response by modifying poorly damped complex poles

* **Bandwidth Constraints**: `min_bandwidth` moves slow poles to improve response speed, while `max_bandwidth` preserves high-frequency poles for robustness

* **Speed Factors**: Allow independent tuning of controller and observer dynamics

### Integral Action {#Integral-Action-2}

* **Disturbance Rejection**: Integral action eliminates steady-state errors from constant disturbances

* **Reference Tracking**: Provides zero steady-state error for step references

* **Observer Poles**: Integrator states require separate observer pole specification for proper estimation

## Artifacts {#Artifacts}

A PolePlacementAnalysis returns the following artifacts:

#### Standard Plots {#Standard-Plots}

* `:StepResponse`: Step response showing reference tracking, disturbance rejection, and control input response.

* `:GangOfFour`: Gang of four transfer functions (S, PS, CS, T) showing closed-loop sensitivity properties.

* `:BodePlot`: Bode plot of the open-loop transfer function showing gain and phase characteristics.

* `:PZMaps`: Pole-zero maps of the open-loop and closed-loop systems.

#### Tables {#Tables}

* `:ControllerGain`: DataFrame of the state feedback gain matrix L.

* `:ObserverGain`: DataFrame of the observer gain matrix K.

## Design Guidelines {#Design-Guidelines}

* Avoid making fast process poles slower to avoid high sensitivity.

* Slow process zeros should be matched by closed-loop poles to avoid high sensitivity.

* Significant movement of high-frequency poles may lead to poor robustness due to high-frequency model uncertainty.

* Slow unstable zeros and fast unstable poles lead to fundamental limitations on the performance.

See ["Pole placement" by Bo Bernharsson and Karl Johan Åström](https://www.control.lth.se/fileadmin/control/Education/DoctorateProgram/ControlSystemsSynthesis/2016/PolePlacement.pdf) for more details.

## Notes {#Notes}

* The system must be controllable and observable for pole placement to work

* Complex conjugate pairs are handled as single entities.

* High-frequency poles can be preserved by setting `max_bandwidth` for robustness against high-frequency uncertainty.

* For exact manual pole placement, use Dyad Studio and call [`place`](https://juliacontrol.github.io/ControlSystems.jl/stable/lib/synthesis/#ControlSystemsBase.place) manually.

## Further Reading {#Further-Reading}

* [Pole Placement (Wikipedia)](https://en.wikipedia.org/wiki/Pole_placement)

* [Observer-Controller Design (Wikipedia)](https://en.wikipedia.org/wiki/State_observer)

* [Ackermann's Formula (Wikipedia)](https://en.wikipedia.org/wiki/Ackermann%27s_formula)

* [Integral Action Documentation](https://help.juliahub.com/dyad/DyadControlSystems.jl/dev/integral_action/)

* [ControlSystems.jl Documentation](https://juliacontrol.github.io/ControlSystems.jl/dev/)
