summaryrefslogtreecommitdiff
path: root/Linear_Control_Systems_by_B_S_Manke/8-COMPENSATION_OF_CONTROL_SYSTEMS.ipynb
diff options
context:
space:
mode:
Diffstat (limited to 'Linear_Control_Systems_by_B_S_Manke/8-COMPENSATION_OF_CONTROL_SYSTEMS.ipynb')
-rw-r--r--Linear_Control_Systems_by_B_S_Manke/8-COMPENSATION_OF_CONTROL_SYSTEMS.ipynb210
1 files changed, 210 insertions, 0 deletions
diff --git a/Linear_Control_Systems_by_B_S_Manke/8-COMPENSATION_OF_CONTROL_SYSTEMS.ipynb b/Linear_Control_Systems_by_B_S_Manke/8-COMPENSATION_OF_CONTROL_SYSTEMS.ipynb
new file mode 100644
index 0000000..cb76d62
--- /dev/null
+++ b/Linear_Control_Systems_by_B_S_Manke/8-COMPENSATION_OF_CONTROL_SYSTEMS.ipynb
@@ -0,0 +1,210 @@
+{
+"cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Chapter 8: COMPENSATION OF CONTROL SYSTEMS"
+ ]
+ },
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 8.6_1: design_suitable_compensator.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//caption:design_suitable_compensator\n",
+"//example 8.6.1\n",
+"//page 339\n",
+"s=%s;\n",
+"clf();\n",
+"syms K;\n",
+"g=(K/(s*(1+0.2*s)));\n",
+"Kv=limit(s*g,s,0);//static velocity error coefficient\n",
+"//since Kv=10\n",
+"K=10;\n",
+"g=(10/(s*(1+0.2*s)));\n",
+"G=syslin('c',g)\n",
+"fmin=0.01; \n",
+"fmax=100; \n",
+"bode(G, fmin, fmax) \n",
+"show_margins(G)\n",
+"xtitle('uncompensated system')\n",
+"[gm,freqGM]=g_margin(G);\n",
+"[pm,freqPM]=p_margin(G);\n",
+"disp(gm,'gain_margin=');\n",
+"disp((freqGM*2*%pi),'gain_margin_freq=');\n",
+"disp(pm,'phase_margin=');\n",
+"disp((freqPM*2*%pi),'phase_margin_freq_or_gain_cross_over_frequency=');\n",
+"disp('since P.M is less than desired value so we need phase lead network ')\n",
+"disp('selecting zero of lead compensating network at w=5.5rad/sec and pole at w=13.8rad/sec and applying gain to account attenuatin factor .')\n",
+"gc=(1+0.18*s)/(1+0.072*s)\n",
+"Gc=syslin('c',gc)\n",
+"disp(Gc,'transfer function of lead compensator=');\n",
+"G1=G*Gc\n",
+"disp(G1,'overall transfer function=');\n",
+"fmin=0.01; \n",
+"fmax=100; \n",
+"figure();\n",
+"bode(G1, fmin, fmax);\n",
+"show_margins(G1)\n",
+"xtitle('compensated system')\n",
+"[gm,freqGM]=g_margin(G1);\n",
+"[pm,freqPM]=p_margin(G1);\n",
+"disp(pm,'phase_margin_of_compensated_system=');\n",
+"disp((freqPM*2*%pi),'gain_cross_over_frequency=');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 8.6_2: design_phase_lead_compensator.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//caption:design_phase_lead_compensator\n",
+"//example 8.6.2\n",
+"//page 340\n",
+"clc;\n",
+"s=%s;\n",
+"clf();\n",
+"syms K;\n",
+"g=(K/(s^2*(1+0.05*s)));\n",
+"Ka=limit(s^2*g,s,0);//static acceleration error coefficient\n",
+"//since Ka=100\n",
+"K=100;\n",
+"g=(100/(s^2*(1+0.05*s)));\n",
+"G=syslin('c',g)\n",
+"fmin=0.01; \n",
+"fmax=100; \n",
+"bode(G, fmin, fmax) \n",
+"show_margins(G)\n",
+"xtitle('uncompensated system')\n",
+"[gm,freqGM]=g_margin(G);\n",
+"[pm,freqPM]=p_margin(G);\n",
+"disp(gm,'gain_margin=');\n",
+"disp((freqGM*2*%pi),'gain_margin_freq=');\n",
+"disp(pm,'phase_margin=');\n",
+"disp((freqPM*2*%pi),'phase_margin_freq_or_gain_cross_over_frequency=');\n",
+"disp('since P.M is negaative so system is unstable ')\n",
+"disp('selecting zero of lead compensating network at w=5rad/sec and pole at w=54rad/sec and applying gain to account attenuatin factor .')\n",
+"gc=(1+0.2*s)/(1+0.0186*s)\n",
+"Gc=syslin('c',gc)\n",
+"disp(Gc,'transfer function of lead compensator=');\n",
+"G1=G*Gc\n",
+"disp(G1,'overall transfer function=');\n",
+"fmin=0.01; \n",
+"fmax=100; \n",
+"figure();\n",
+"bode(G1, fmin, fmax) \n",
+"show_margins(G1)\n",
+"xtitle('compensated system')\n",
+"[gm,freqGM]=g_margin(G1);\n",
+"[pm,freqPM]=p_margin(G1);\n",
+"disp(pm,'phase_margin_of_compensated_system=');\n",
+"disp((freqPM*2*%pi),'gain_cross_over_frequency=');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 8.6_3: design_suitable_compensator.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//caption:design_suitable_compensator\n",
+"//example 8.6.3\n",
+"//page 344\n",
+"clc;\n",
+"s=%s;\n",
+"clf();\n",
+"syms K;\n",
+"g=(K/(s*(1+0.5*s)*(1+0.2*s)));\n",
+"Kv=1/0.125//static velocity error coefficient(Kv=desired output velocity/steady state error)\n",
+"//since Kv=8, as system is type 1 , so K=Kv;\n",
+"K=8;\n",
+"g=(8/(s*(1+0.5*s)*(1+0.2*s)));\n",
+"G=syslin('c',g)\n",
+"fmin=0.01; \n",
+"fmax=100; \n",
+"bode(G, fmin, fmax) \n",
+"show_margins(G)\n",
+"xtitle('uncompensated system')\n",
+"[gm,freqGM]=g_margin(G);\n",
+"[pm,freqPM]=p_margin(G);\n",
+"disp(gm,'gain_margin=');\n",
+"disp((freqGM*2*%pi),'gain_margin_freq_or_phase_cross_over_frequency==');\n",
+"disp(pm,'phase_margin=');\n",
+"disp((freqPM*2*%pi),'phase_margin_freq_or_gain_cross_over_frequency=');\n",
+"disp('since gain crossover freq and phase crossover freq are very close to each other. So, system is marginally stable');\n",
+"disp('so we need phase lag network ')\n",
+"disp('selecting zero of lead compensating network at w=0.18rad/sec and pole at w=0.04rad/sec and applying gain to account attenuatin factor .')\n",
+"gc=(1+5.55*s)/(1+24.7*s)\n",
+"Gc=syslin('c',gc)\n",
+"disp(Gc,'transfer function of lead compensator=');\n",
+"G1=G*Gc\n",
+"disp(G1,'overall transfer function=');\n",
+"fmin=0.01; \n",
+"fmax=100; \n",
+"figure();\n",
+"bode(G1, fmin, fmax) \n",
+"show_margins(G1)\n",
+"xtitle('compensated system')\n",
+"[gm,freqGM]=g_margin(G1);\n",
+"[pm,freqPM]=p_margin(G1);\n",
+"disp(gm,'gain_margin=');\n",
+"disp((freqGM*2*%pi),'gain_margin_freq_or_phase_cross_over_frequency==');\n",
+"disp(pm,'phase_margin_of_compensated_system=');\n",
+"disp((freqPM*2*%pi),'gain_cross_over_frequency=');"
+ ]
+ }
+],
+"metadata": {
+ "kernelspec": {
+ "display_name": "Scilab",
+ "language": "scilab",
+ "name": "scilab"
+ },
+ "language_info": {
+ "file_extension": ".sce",
+ "help_links": [
+ {
+ "text": "MetaKernel Magics",
+ "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md"
+ }
+ ],
+ "mimetype": "text/x-octave",
+ "name": "scilab",
+ "version": "0.7.1"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 0
+}