Difference between revisions of "User:DukeEgr93/RL Example"
(Created page with "This page is a sandbox to go over an example of how to analyze a non-unity feedback system with proportional control. This will include stability analysis, steady-state error...") |
|||
(6 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | This page is a sandbox to go over an example of how to analyze a non-unity feedback system with proportional control. This will include stability analysis, steady-state error determination, sketching a basic root locus plot, using computational tools to gather information for a more refined sketch, using MATLAB to generate a root locus plot, and finally using Maple or MATLAB to satisfy certain design criteria using the concept of a root locus plot. | + | This page is a sandbox to go over an example of how to analyze a non-unity feedback system with proportional control. This will include stability analysis, steady-state error determination, sketching a basic root locus plot, using computational tools to gather information for a more refined sketch, using MATLAB to generate a root locus plot, and finally using Maple or MATLAB to satisfy certain design criteria using the concept of a root locus plot. This page is based on MATLAB R2024a and Maple 2019. |
== Introduction == | == Introduction == | ||
Line 5: | Line 5: | ||
* The overall transfer function is: $$T=\frac{KG}{1+KGH}$$; this is the system we will use to determine stability and transient characteristics. | * The overall transfer function is: $$T=\frac{KG}{1+KGH}$$; this is the system we will use to determine stability and transient characteristics. | ||
* The equivalent forward path for an equivalent unity feedback system is: $$G_{eq}=\frac{KG}{1+KGH-KG}$$; this is the system we will use to determine steady state error. | * The equivalent forward path for an equivalent unity feedback system is: $$G_{eq}=\frac{KG}{1+KGH-KG}$$; this is the system we will use to determine steady state error. | ||
+ | |||
+ | MATLAB will need to have the Control Systems toolbox. To see if you have it, start MATLAB and type <code>ver</code> in the Command Window; if something called "Control System Toolbox" is there, you are all set. If not: | ||
+ | * Make sure you are in the Home tab | ||
+ | * Click the down arrow under the Add-Ons logo | ||
+ | * Select Get Add-Ons | ||
+ | * In the Add-On Explorer search box, search for Control System | ||
+ | * Click on the Control System Toolbox link and install it | ||
+ | |||
+ | == Specific Processes == | ||
+ | === Creating Transfer Functions in MATLAB === | ||
+ | * Generally, start with <code>s = tf('s')</code> to define a variable that has the Control Systems Toolbox definition of the frequency variable. | ||
+ | * Use <code>s</code> to create the transfer function. Alternately, use the <code>tf</code> or <code>zpk</code> commands. | ||
+ | |||
+ | === Importing Transfer Functions to SISOtool === | ||
+ | You can start SISOtool with arguments that provide values to the four transfer functions in the default architecture. The following startup commands work: | ||
+ | <source> | ||
+ | sisotool | ||
+ | sisotool(G) | ||
+ | sisotool(G, C) | ||
+ | sisotool(G, C, H, F) | ||
+ | </source> | ||
+ | Any unspecified transfer function is a 1. You can also change transfer functions once SISOtool is running: | ||
+ | * Click the "Edit Architecture" icon in the "Control System" tab at the top | ||
+ | * Replace the Value entry for the particular transfer function you want to change with either a command that creates your desired transfer function or a variable name containing the transfer function. | ||
+ | |||
+ | === Getting Controller Value === | ||
+ | To get the gain, double-click the compensator $$C$$ from the '''Controllers and Fixed Blocks''' portion of the '''Data Browser''' at the far left or, in the Root Locus Editor, right-click in the white space and select Edit Compensator. The gain $$K$$ will be the value of the block. If you have a more complicated controller, clicking on $$C$$ will show you the whole controller. | ||
+ | |||
+ | === Getting Overall System Poles and Zeros === | ||
+ | To get information about the overall system: | ||
+ | * Click the Export icon in the Control System tab | ||
+ | * Export the <code>IOTransfer_r2y</code> transfer function - you may need to make the selection box wider to see the full names of the transfer functions. Note that <code>IOTransfer_r2y</code> will be exported as a state space definition. | ||
+ | * To see the overall transfer function as a transfer function, in the command window type one of the following commands: | ||
+ | :<source> | ||
+ | tf(IOTransfer_r2y) | ||
+ | zpk(IOTransfer_r2y) | ||
+ | </source> | ||
+ | : to see the overall transfer function as a ratio of polynomials or as factored polynomials. | ||
+ | * To see the zeros and poles of the transfer function, in the command window, type: | ||
+ | :<source> | ||
+ | zero(IOTransfer_r2y) | ||
+ | pole(IOTransfer_r2y) | ||
+ | </source> | ||
+ | : to get the zeros and poles, respectively | ||
+ | |||
+ | === Breakaway / Break-in === | ||
+ | * MATLAB and SISOtoool: | ||
+ | ** Make the root locus plot | ||
+ | ** Move a pole to a location where it meets another pole (i.e. a critical pole) | ||
+ | ** Get the gain and find the pole and zero locations as shown above. | ||
+ | * Maple: | ||
+ | ** Tell Maple to assume that a variable called sigma is real | ||
+ | ** Define Kr as -1/GH using sigma as the frequency variable | ||
+ | ** Solve for the value of sigma where the derivative of Kr is 0 | ||
+ | ** Find the corresponding K value by substituting it into -1/GH | ||
+ | ** Here is code showing all this for Nise 8e Example 8.3. | ||
+ | ::<source> | ||
+ | G := (s - 3)*(s - 5)/((s + 1)*(s + 2)); | ||
+ | H := 1; | ||
+ | assume(sigma, real); | ||
+ | Kr := subs(s = sigma, -1/(G*H)); | ||
+ | breaks := evalf(solve(diff(Kr, sigma) = 0)); | ||
+ | breaks := 3.816613954, -1.452977590 | ||
+ | subs(s = breaks[1], -1/(G*H)); | ||
+ | 28.99137673 | ||
+ | subs(s = breaks[2], -1/(G*H)); | ||
+ | 0.008623253810 | ||
+ | </source> | ||
+ | |||
+ | |||
+ | === Specific Design Criteria with SISOtool === | ||
+ | * Make the root locus plot | ||
+ | * Right click in the white space of the Root Locus Editor plot, go to Design Requirements, add a new one, then enter the nature and value of the design requirement. Once you click OK, there will be a dark line showing where a pole needs to be to satisfy that condition. | ||
+ | * If possible, move a pole to a location where it satisfies that condition. | ||
+ | * Get the gain and find the pole and zero locations as shown above. | ||
+ | * If you need to change a design requirement, right click the gold part of its graphical representation on screen and select Edit. | ||
+ | |||
+ | === Specific Design Criteria with Maple === | ||
+ | This is more complicated than with SISOtool because each design criterion gives you some, but not all, information about a pole. You will need to figure out how to get Maple to solve for a very particular situation. | ||
+ | |||
+ | * To find the gain for a particular %OS or damping ratio: | ||
+ | ** Find the angle $$\theta=180^o-\acos(\zeta)$$ that your pole needs to make with with positive real axis, | ||
+ | |||
+ | === Examining Transient Characteristics === | ||
+ | * The Step Response plot shows the step response for the system. | ||
+ | * Right-click in that plot and select the Characteristics sub-menu. | ||
+ | * Choose what you want to have displayed - when you pick a characteristic, that location on the graph on which that characteristic is based will show up as a dot on the plot. | ||
+ | * If you want to look at the value, for a characteristic, hover over the dot. | ||
+ | * If you want the info box to remain, left-click the dot. You can now also drag the info box into one of four different locations relative to the dot. | ||
+ | * If you want the box to go away, left-click the dot (or really anywhere in the plot other than the infobox itself). | ||
+ | |||
+ | |||
+ | == References == | ||
+ | [https://www.mathworks.com/help/releases/R2020a/control/ref/controlsystemdesigner-app.html?searchHighlight=controlSystemDesigner&s_tid=doc_srchtitle Control System Designer R2020a] documentation from MATLAB |
Latest revision as of 01:51, 8 November 2024
This page is a sandbox to go over an example of how to analyze a non-unity feedback system with proportional control. This will include stability analysis, steady-state error determination, sketching a basic root locus plot, using computational tools to gather information for a more refined sketch, using MATLAB to generate a root locus plot, and finally using Maple or MATLAB to satisfy certain design criteria using the concept of a root locus plot. This page is based on MATLAB R2024a and Maple 2019.
Contents
- 1 Introduction
- 2 Specific Processes
- 2.1 Creating Transfer Functions in MATLAB
- 2.2 Importing Transfer Functions to SISOtool
- 2.3 Getting Controller Value
- 2.4 Getting Overall System Poles and Zeros
- 2.5 Breakaway / Break-in
- 2.6 Specific Design Criteria with SISOtool
- 2.7 Specific Design Criteria with Maple
- 2.8 Examining Transient Characteristics
- 3 References
Introduction
This page will use the system as shown in Figure 8.1 of Nise 8e. Sections 8.1-8.3 develop the mathematics behind a root locus plot. The keys are as follows:
- The overall transfer function is: $$T=\frac{KG}{1+KGH}$$; this is the system we will use to determine stability and transient characteristics.
- The equivalent forward path for an equivalent unity feedback system is: $$G_{eq}=\frac{KG}{1+KGH-KG}$$; this is the system we will use to determine steady state error.
MATLAB will need to have the Control Systems toolbox. To see if you have it, start MATLAB and type ver
in the Command Window; if something called "Control System Toolbox" is there, you are all set. If not:
- Make sure you are in the Home tab
- Click the down arrow under the Add-Ons logo
- Select Get Add-Ons
- In the Add-On Explorer search box, search for Control System
- Click on the Control System Toolbox link and install it
Specific Processes
Creating Transfer Functions in MATLAB
- Generally, start with
s = tf('s')
to define a variable that has the Control Systems Toolbox definition of the frequency variable. - Use
s
to create the transfer function. Alternately, use thetf
orzpk
commands.
Importing Transfer Functions to SISOtool
You can start SISOtool with arguments that provide values to the four transfer functions in the default architecture. The following startup commands work:
sisotool
sisotool(G)
sisotool(G, C)
sisotool(G, C, H, F)
Any unspecified transfer function is a 1. You can also change transfer functions once SISOtool is running:
- Click the "Edit Architecture" icon in the "Control System" tab at the top
- Replace the Value entry for the particular transfer function you want to change with either a command that creates your desired transfer function or a variable name containing the transfer function.
Getting Controller Value
To get the gain, double-click the compensator $$C$$ from the Controllers and Fixed Blocks portion of the Data Browser at the far left or, in the Root Locus Editor, right-click in the white space and select Edit Compensator. The gain $$K$$ will be the value of the block. If you have a more complicated controller, clicking on $$C$$ will show you the whole controller.
Getting Overall System Poles and Zeros
To get information about the overall system:
- Click the Export icon in the Control System tab
- Export the
IOTransfer_r2y
transfer function - you may need to make the selection box wider to see the full names of the transfer functions. Note thatIOTransfer_r2y
will be exported as a state space definition. - To see the overall transfer function as a transfer function, in the command window type one of the following commands:
tf(IOTransfer_r2y) zpk(IOTransfer_r2y)
- to see the overall transfer function as a ratio of polynomials or as factored polynomials.
- To see the zeros and poles of the transfer function, in the command window, type:
zero(IOTransfer_r2y) pole(IOTransfer_r2y)
- to get the zeros and poles, respectively
Breakaway / Break-in
- MATLAB and SISOtoool:
- Make the root locus plot
- Move a pole to a location where it meets another pole (i.e. a critical pole)
- Get the gain and find the pole and zero locations as shown above.
- Maple:
- Tell Maple to assume that a variable called sigma is real
- Define Kr as -1/GH using sigma as the frequency variable
- Solve for the value of sigma where the derivative of Kr is 0
- Find the corresponding K value by substituting it into -1/GH
- Here is code showing all this for Nise 8e Example 8.3.
G := (s - 3)*(s - 5)/((s + 1)*(s + 2)); H := 1; assume(sigma, real); Kr := subs(s = sigma, -1/(G*H)); breaks := evalf(solve(diff(Kr, sigma) = 0)); breaks := 3.816613954, -1.452977590 subs(s = breaks[1], -1/(G*H)); 28.99137673 subs(s = breaks[2], -1/(G*H)); 0.008623253810
Specific Design Criteria with SISOtool
- Make the root locus plot
- Right click in the white space of the Root Locus Editor plot, go to Design Requirements, add a new one, then enter the nature and value of the design requirement. Once you click OK, there will be a dark line showing where a pole needs to be to satisfy that condition.
- If possible, move a pole to a location where it satisfies that condition.
- Get the gain and find the pole and zero locations as shown above.
- If you need to change a design requirement, right click the gold part of its graphical representation on screen and select Edit.
Specific Design Criteria with Maple
This is more complicated than with SISOtool because each design criterion gives you some, but not all, information about a pole. You will need to figure out how to get Maple to solve for a very particular situation.
- To find the gain for a particular %OS or damping ratio:
- Find the angle $$\theta=180^o-\acos(\zeta)$$ that your pole needs to make with with positive real axis,
Examining Transient Characteristics
- The Step Response plot shows the step response for the system.
- Right-click in that plot and select the Characteristics sub-menu.
- Choose what you want to have displayed - when you pick a characteristic, that location on the graph on which that characteristic is based will show up as a dot on the plot.
- If you want to look at the value, for a characteristic, hover over the dot.
- If you want the info box to remain, left-click the dot. You can now also drag the info box into one of four different locations relative to the dot.
- If you want the box to go away, left-click the dot (or really anywhere in the plot other than the infobox itself).
References
Control System Designer R2020a documentation from MATLAB