⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bodepidcompare.html

📁 这是一个PID自动调节的程序
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
                "http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
  <title>Description of bodePIDcompare</title>
  <meta name="keywords" content="bodePIDcompare">
  <meta name="description" content="BODEPIDCOMPARE  Comparison of Bode Diagrams with different autotuning">
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  <meta name="generator" content="m2html &copy; 2003 Guillaume Flandin">
  <meta name="robots" content="index, follow">
  <link type="text/css" rel="stylesheet" href="m2html.css">
</head>
<body>
<table border=0 width="100%" cellpadding=0 cellspacing=0><tr>
<td valign=baseline bgcolor="#ffe4b0"><b>AutotunerPID Toolkit</b></td>
<td valign=baseline bgcolor="#ffe4b0" align=right><a href="autogui.html"><img src="b_prev.gif" alt="Previous page" border=0></a>&nbsp;&nbsp;&nbsp;<a href="butterdesign.html"><img src="b_next.gif" alt="Next Page" border=0></a></td>
</tr>
</table>

<h1>bodePIDcompare</h1>

<h2><a name="_name"></a>PURPOSE <a href="#_top"><img alt="^" border="0" src="up.png"></a></h2>
<div class="box"><strong>Comparison of Bode Diagrams with different autotuning method.</strong></div>

<h2><a name="_synopsis"></a>SYNOPSIS <a href="#_top"><img alt="^" border="0" src="up.png"></a></h2>
<div class="box"><strong>function bodePIDcompare(num,den,tau) </strong></div>

<h2><a name="_description"></a>DESCRIPTION <a href="#_top"><img alt="^" border="0" src="up.png"></a></h2>
<div class="fragment"><pre class="comment">BODEPIDCOMPARE Comparison of Bode Diagrams with different autotuning
   methods
   
   The function is typically called through the GUI in AutotunerPID.mdl
   and provides a graphical comparison of four different autotuning
   methods (STEP/ZN(OL), STEP/KT, STEP/IMC, RELAY/ZN(CL)) in frequency
   domain. 
   By default the parameter Ms is set to 2 in KT methods, while the
   parameter lambda is set 1/5 of the settling time of the plant.
   
   
   BODEPIDCOMPARE(NUM,DEN,TAU) performs the comparative analysis directly
   considering the plant described by the transfer function
              NUM(s)
      P(s) = -------- * exp(-TAU*s)
              DEN(s)

   See also STEPPID

   Author:    William Spinelli (wspinell@elet.polimi.it)
   Copyright  2004 W.Spinelli
   $Revision: 1.0 $  $Date: 2004/02/27 12:00:00 $</pre></div>

<!-- crossreference -->
<h2><a name="_cross"></a>CROSS-REFERENCE INFORMATION <a href="#_top"><img alt="^" border="0" src="up.png"></a></h2>
This function calls:
<ul style="list-style-image:url(matlabicon.gif)">
<li><a href="idareas.html" class="code" title="function model = idareas(y,As,Ts)">idareas</a>	IDAREAS Identification of a FOPDT model using the method of the</li><li><a href="pid_tuning.html" class="code" title="function [K,Ti,Td,N,b] = pid_tuning(model,method,param,regStruct,As)">pid_tuning</a>	PID_TUNING Tune the parameters of a ISA-PID regulator with some</li></ul>
This function is called by:
<ul style="list-style-image:url(matlabicon.gif)">
<li><a href="envgui.html" class="code" title="function [sys,x0,str,ts] = envgui(t,x,u,flag,NoiseBlock,LoadDistBlock)">envgui</a>	ENVGUI S-function for making a simple PID GUI</li></ul>
<!-- crossreference -->


<h2><a name="_source"></a>SOURCE CODE <a href="#_top"><img alt="^" border="0" src="up.png"></a></h2>
<div class="fragment"><pre>0001 <a name="_sub0" href="#_subfunctions" class="code">function bodePIDcompare(num,den,tau)</a>
0002 <span class="comment">%BODEPIDCOMPARE  Comparison of Bode Diagrams with different autotuning</span>
0003 <span class="comment">%   methods</span>
0004 <span class="comment">%</span>
0005 <span class="comment">%   The function is typically called through the GUI in AutotunerPID.mdl</span>
0006 <span class="comment">%   and provides a graphical comparison of four different autotuning</span>
0007 <span class="comment">%   methods (STEP/ZN(OL), STEP/KT, STEP/IMC, RELAY/ZN(CL)) in frequency</span>
0008 <span class="comment">%   domain.</span>
0009 <span class="comment">%   By default the parameter Ms is set to 2 in KT methods, while the</span>
0010 <span class="comment">%   parameter lambda is set 1/5 of the settling time of the plant.</span>
0011 <span class="comment">%</span>
0012 <span class="comment">%</span>
0013 <span class="comment">%   BODEPIDCOMPARE(NUM,DEN,TAU) performs the comparative analysis directly</span>
0014 <span class="comment">%   considering the plant described by the transfer function</span>
0015 <span class="comment">%              NUM(s)</span>
0016 <span class="comment">%      P(s) = -------- * exp(-TAU*s)</span>
0017 <span class="comment">%              DEN(s)</span>
0018 <span class="comment">%</span>
0019 <span class="comment">%   See also STEPPID</span>
0020 <span class="comment">%</span>
0021 <span class="comment">%   Author:    William Spinelli (wspinell@elet.polimi.it)</span>
0022 <span class="comment">%   Copyright  2004 W.Spinelli</span>
0023 <span class="comment">%   $Revision: 1.0 $  $Date: 2004/02/27 12:00:00 $</span>
0024 
0025 <span class="keyword">global</span> PIDPARAMETERS
0026 
0027 <span class="comment">% Bode diagram of the real plant model</span>
0028 P = tf(num,den,<span class="string">'IODelay'</span>,tau);
0029 [m,f,w] = bode(P);
0030 w = logspace(log10(w(1)),log10(w(end)),512);
0031 s = j*w;
0032 
0033 <span class="comment">% compute step response</span>
0034 [y,t] = step(P);
0035 Ts = min(real(abs(pole(P))))/50;
0036 [y,t] = step(P,0:Ts:t(end));
0037 Tf = t(end);
0038 
0039 <span class="comment">% identify a FOPDT model</span>
0040 modelFOPDT = <a href="idareas.html" class="code" title="function model = idareas(y,As,Ts)">idareas</a>(y,1,Ts);
0041 
0042 <span class="comment">% identify the point of the frequency response with omega_n = -pi</span>
0043 [Gm,Pm,Wcg,Wcp] = margin(P);
0044 modelPI.A = 2/Gm;
0045 modelPI.T = 2*pi/Wcg;
0046 
0047 <span class="comment">% evaluate the frequency response of the plant</span>
0048 P = squeeze(freqresp(P,w)).';
0049 
0050 <span class="comment">% Create new figure</span>
0051 Lfig = figure(<span class="keyword">...</span>
0052    <span class="string">'Name'</span>,               <span class="string">'Bode diagram - Open loop function'</span>,<span class="keyword">...</span>
0053    <span class="string">'NumberTitle'</span>,        <span class="string">'off'</span>,<span class="keyword">...</span>
0054    <span class="string">'MenuBar'</span>,            <span class="string">'figure'</span>);
0055 Ffig = figure(<span class="keyword">...</span>
0056    <span class="string">'Name'</span>,               <span class="string">'Bode diagram - Complementary sensitivity'</span>,<span class="keyword">...</span>
0057    <span class="string">'NumberTitle'</span>,        <span class="string">'off'</span>,<span class="keyword">...</span>
0058    <span class="string">'MenuBar'</span>,            <span class="string">'figure'</span>);
0059 Sfig = figure(<span class="keyword">...</span>
0060    <span class="string">'Name'</span>,               <span class="string">'Bode diagram - Sensitivity'</span>,<span class="keyword">...</span>
0061    <span class="string">'NumberTitle'</span>,        <span class="string">'off'</span>,<span class="keyword">...</span>
0062    <span class="string">'MenuBar'</span>,            <span class="string">'figure'</span>);
0063 
0064 <span class="comment">% Bode diagrams with different autotuner</span>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -