Skip to content

Commit 9c73a9e

Browse files
committed
update docstrings and sens functions for MIMO
1 parent a944da3 commit 9c73a9e

File tree

2 files changed

+25
-9
lines changed

2 files changed

+25
-9
lines changed

src/lqg.jl

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -317,10 +317,12 @@ d₁────+──┴──► P ├─────┬──►e₄
317317
│e₃
318318
319319
```
320-
- Input sensitivity is the transfer function from d₁ to e₁, (I + CP)⁻¹
321-
- Output sensitivity is the transfer function from d₂ to e₃, (I + PC)⁻¹
322-
- Input complementary sensitivity is the transfer function from d₁ to e₂, CP(I + CP)⁻¹
323-
- Output complementary sensitivity is the transfer function from d₂ to e₄, PC(I + PC)⁻¹
320+
- [`input_sensitivity`](@ref) is the transfer function from d₁ to e₁, (I + CP)⁻¹
321+
- [`output_sensitivity`](@ref) is the transfer function from d₂ to e₃, (I + PC)⁻¹
322+
- [`input_comp_sensitivity`](@ref) is the transfer function from d₁ to e₂, (I + CP)⁻¹CP
323+
- [`output_comp_sensitivity`](@ref) is the transfer function from d₂ to e₄, (I + PC)⁻¹PC
324+
- [`G_PS`](@ref) is the transfer function from d₁ to e₄, (1 + PC)⁻¹P
325+
- [`G_CS`](@ref) is the transfer function from d₂ to e₂, (1 + CP)⁻¹C
324326
"""
325327

326328
"""
@@ -339,14 +341,28 @@ function comp_sensitivity(args...) # Complementary sensitivity function
339341
return output_comp_sensitivity(args...)
340342
end
341343

342-
G_PS(P, C) = P*input_sensitivity(P, C)
344+
"""
345+
G_PS(P, C)
346+
347+
The closed-loop transfer function from load disturbance to plant output.
348+
Technically, it's `(1 + PC)⁻¹P` so `SP` would be a better, but nonstandard name.
349+
$sensdoc
350+
"""
351+
G_PS(P, C) = output_sensitivity(P, C)*P
343352
function G_PS(l::LQGProblem) # Load disturbance to output
344-
return system_mapping(l) * input_sensitivity(l)
353+
return output_sensitivity(l) * system_mapping(l)
345354
end
346355

347-
G_CS(P, C) = C*output_sensitivity(P, C)
356+
"""
357+
G_CS(P, C)
358+
359+
The closed-loop transfer function from (-) measurement noise or (+) reference to control signal.
360+
Technically, it's `(1 + CP)⁻¹C` so `SC` would be a better, but nonstandard name.
361+
$sensdoc
362+
"""
363+
G_CS(P, C) = input_sensitivity(P, C)*C
348364
function G_CS(l::LQGProblem) # Noise to control signal
349-
return observer_controller(l) * output_sensitivity(l)
365+
return input_sensitivity(l) * observer_controller(l)
350366
end
351367

352368
# loopgain(P,C) = P*C

test/test_lqg.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,4 +360,4 @@ Ti = ss(ATi, BTi, CTi, 0)
360360

361361

362362
Gfbc = RobustAndOptimalControl.feedback_control(P, C)
363-
@test norm(dcgain(Gfbc - [output_comp_sensitivity(P,C); G_CS(P,C)])) < 1e-10 # numerical problems calculating a reduced model for the difference. They should be equal everywhere
363+
@test linfnorm((Gfbc - [output_comp_sensitivity(P,C); G_CS(P,C)]))[1] < 1e-10 # numerical problems calculating a reduced model for the difference. They should be equal everywhere

0 commit comments

Comments
 (0)