You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
all(1.≤ integrator_outputs .≤ sys.ny) ||throw(ArgumentError("All integrator_outputs must be valid output indices"))
662
+
length(integrator_outputs) ==0&&throw(ArgumentError("At least one output must have an integrator"))
663
+
664
+
size(Q1, 1) == sys.nx+length(integrator_outputs) ||throw(ArgumentError("Q1 must have size $(sys.nx+length(integrator_outputs))×$(sys.nx+length(integrator_outputs))"))
665
+
size(Q2, 1) == sys.nu ||throw(ArgumentError("Q2 must have size $(sys.nu)×$(sys.nu)"))
Return an LQI controller with reference and measurement inputs `[r; y]` designed for the LQI problem where the plant state `x` is augmented with output-error integrators to form the augmented state `x_a = [x; e_i]`.
676
+
677
+
- `Q1`: Penalty matrix for the augmented state (must be positive semi-definite)
678
+
- `Q2`: Penalty matrix for the control input (must be positive definite)
679
+
- `obs`: An observer for `G` constructed using `observer_predictor(G, ..., output_state=true)`
680
+
681
+
Example:
682
+
```
683
+
G = ss([0 32;-31.25 -0.4],[0; 2.236068],[0.0698771 0],0)
684
+
Q = diagm([0,5])
685
+
R = [1.0;;]
686
+
K = kalman(G,Q,R)
687
+
obs = observer_predictor(G, K; output_state=true)
688
+
689
+
Q1 = diagm([0.488,0,100])
690
+
Q2 = [1/100;;]
691
+
L = lqi(G,Q1,Q2)
692
+
C = lqi_controller(G, obs, Q1, Q2)
693
+
694
+
Gn = named_ss(G)
695
+
H = feedback(C, Gn, w1 = :y_plant_r, z2=Gn.y, u1=:y_plant, pos_feedback=true)
696
+
plot(
697
+
plot(step(H, 50)),
698
+
gangoffourplot(G, -C[:, 2])
699
+
)
700
+
```
701
+
"""
702
+
functionlqi_controller(G, obs, Q1, Q2, args...)
703
+
L =named_ss(ss(lqi(G, Q1, Q2, args...)), name="L", x=:x_L, y=:y_L, u=:u_L)
704
+
G isa NamedStateSpace || (G =named_ss(G, name="plant", x=:x_plant, y=:y_plant, u=:u_plant))
705
+
obs isa NamedStateSpace || (obs =named_ss(obs, name="observer", x=:x_observer, y=:y_observer, u=:u_observer))
unit_gain =named_ss(ss(I(nr), te), u=G.y) # The plant output is not available as input in any of the components, so we introduce this unit gain to introduce a component with a plant-input input. This is then fed into multiple places
Note: numerical integration is subject to numerical drift. If the output of the system corresponds to, e.g., a velocity reference and the integral to position reference, consider methods for mitigating this drift.
0 commit comments