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
Copy file name to clipboardExpand all lines: SysReg_crashcourse_FreqDomain_BlockB.py
+47-44Lines changed: 47 additions & 44 deletions
Original file line number
Diff line number
Diff line change
@@ -810,7 +810,7 @@ def animate(t):
810
810
# FS & -PS & -S
811
811
# \end{bmatrix} \begin{bmatrix} r \\ d \\ n \end{bmatrix} ,$$
812
812
# where $S=\frac{1}{1+PC}=\frac{1}{1+L}$ is called the sensitivity function and $T=\frac{PC}{1+PC}=\frac{L}{1+L}=SL$ is called the complementary sensitivity function. They're called complements because
813
-
# $$ S + T = \frac{1}{1+PC} + \frac{PC}{1+PC} = I.$$
813
+
# $$ S + T = \frac{1}{1+PC} + \frac{PC}{1+PC} = 1.$$
814
814
#
815
815
# ## What about the performance?
816
816
# Fun fact: you can derive the effectiveness of feedback control from that transfer matrix. Looking at the last row which represents the transfers from the reference and disturbances
@@ -821,7 +821,7 @@ def animate(t):
821
821
# - $|S(s)| > 1 \rightarrow $ disturbances are amplified (this is bad).
822
822
#
823
823
# We've looked at controller performance before with the gain, phase, and stability margins. Of course these are still valid and we'll build further on this. Just to reframe that theory, we have to define
824
-
# the cross-over frequencies $\omega_\text{gc}\leftarrow|L(\omega_\text{gc})|=1$ and $\omega_\text{pc}\leftarrow\angle L(\omega_\text{pc})=\pm 180^\circ$ for the gain and phase cross-overs (you know $L=PC$).
824
+
# the cross-over frequencies $\omega_\text{gc}\leftarrow|L(\omega_\text{gc})|=1$ and $\omega_\text{pc}\leftarrow\angle L(\omega_\text{pc})=\pm 180^\circ$ for the gain and phase cross-overs.
825
825
# Then the gain margin GM $=1/|L(\omega_\text{pc})|$ and phase margin PM $=180^\circ - |\angle L(\omega_\text{gc})|$.
826
826
#
827
827
# With our new theory we can also define the closed loop bandwidth, $\omega_\text{B}$, of our controlled system! This is a measure of until what frequency we can reject disturbances and it's defined as the
@@ -948,34 +948,10 @@ def animate(t):
948
948
# is unitary gain for constant input, i.e. unscaled reference tracking.
949
949
#
950
950
# ## Easier said...
951
-
# So lets run an example and you'll understand better (I hope). This will be very much a Plato-style of explanation (coincidentally my favourite style). We start with a unitary
951
+
# So lets run an example and you'll understand better (I hope). We start with a unitary
952
952
# feedback controller and see what plant we're dealing with.
# Notes: our PM is very large, as well as our GM. In this case we can decrease both of these with the gain. Lets aim for $35^\circ$ PM, looking at the phase plot that happens at 50 or so rad/s, the
995
+
# Notes: our PM is not super big, GM is massive however. In this case we can fix both of these with the gain. Lets aim for $35^\circ$ PM, looking at the phase plot that happens at 50 or so rad/s, the
1020
996
# magnitude there now is $5E-4$. *Therefore*, our gain can be $2E3$:
1021
997
1022
998
# %%
1023
-
SYS.Cgain=2e2
999
+
SYS.Cgain=2e3
1000
+
1001
+
[a.cla() forainax]
1002
+
SYS.plot_LS(ax)
1003
+
display(fig)
1004
+
1005
+
# %% [markdown]
1006
+
# That's a bit too much overshoot to my liking, and our stability margin is a little too small: so let's pull back a little on that gain to increase the PM (generally reduces overshoot (not always)) and
1007
+
# increase the stability margin.
1008
+
1009
+
# %%
1010
+
SYS.Cgain=1.25e3
1024
1011
1025
1012
[a.cla() forainax]
1026
1013
SYS.plot_LS(ax)
1027
-
display(fig, np.pi/3)
1014
+
display(fig)
1028
1015
1029
1016
# %% [markdown]
1030
-
# Honestly I suck at loop shaping.
1017
+
# Now that's a nice looking controller!
1031
1018
#
1032
1019
# ## Feedforward control
1033
1020
# We've been ignoring the feedforward block up to now, but really it's very powerful when you can measure the output noise.
@@ -1053,23 +1040,39 @@ def animate(t):
1053
1040
# to take some magnitude in S away, it has to come back at other frequencies.
1054
1041
#
1055
1042
# ## Time delays
1056
-
# Time delays are annoying, because they put a hard limit on your bandwidth. Why? Well, a time delay $e^{-\theta s}$, has an idealized $T(s)=e^{-\theta s}$.
1057
-
# The bandwidth is defined as $|T(i\omega_\text{B})| = \frac{1}{\sqrt2}$. Also
# Time delays are annoying, because they put a hard limit on your bandwidth. Why? Well, I really tried to explain it nicely, but to be honest it's just hard.
1044
+
# Therefore I'm going for the most boring option and I'm going to paraphrase Skogestad Ch. 5.5 and 5.6. Reading that is honestly better.
1045
+
#
1046
+
# For any plant with a time delay $\theta \rightarrow e^{-\theta s}$, the perfect controller can be at most as fast as the time delay. After all, the perfect control will only affect
1047
+
# the output after the time delay. Therefore, an absolute perfect control is limited to a complementary sensitivity function of
1048
+
# $T(s)=e^{-\theta s}$. The ideal sensitivity function is therefore $S(s) = 1 - T(s)$. Then a lot of maths,
# Also we need to realise what the perfect sensitivity function is: $|S| = |L^{-1}T|$ (I would love to be able to explain why). As we saw above: $|T|=1$, so
1055
+
# $|S| = \frac{1}{|L|}$. That means that $|S(i\Omega)| = 1 \rightarrow |L(i\Omega)| = 1$ and therefore $\Omega$ is the crossover frequency.
1056
+
# Now your controller will never be absolutely perfect, because we live in the real world. So your crossover frequency will be lower than this value, making
1057
+
# it an upper bound on your crossover frequency and controller speed. Now the slides say delays give a limit on your bandwidth and I'm not sure why.
1058
+
# ## RHP zeros
1059
+
# Read Skogestad 5.6, I'm sorry.
1060
+
#
1061
+
# Now just to show *something*, here's $S = 1 - e^{-\theta s},\;\theta=5$
0 commit comments