




版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領
文檔簡介
1、智能控制概論報告模糊控制器設計原堯槃08010439目錄、設計要求 TOC o 1-5 h z HYPERLINK l bookmark64 o Current Document 二、控制器設計3確定模糊控制器輸入輸出變量3確定各輸入輸出變量的變化范圍、量化等級和量化因子3在各輸入和輸出語言變量的量化域內定義模糊子集4模糊控制規則的確定5求模糊控制表5三、程序設計四、測試與仿真Simulink 搭建2.比例因子K3對響應曲線的影響五、總結10六、使用方法10七、代碼附錄11一、設計要求:已知被控對象模型,給定階躍響應幅值為30,系統初值為0,完成以下內 容:(a)設計常規的模糊邏輯控制器;(b
2、)當通過改變模糊邏輯控制器比例因子時,分析系統響應有什么變化?(c)聯系、結合模糊邏輯控制器設計過程(結構設計、模糊化設計、規則設計、精確化設計) 以及控制系統響應情況,談談本人對模糊邏輯控制系統的一些認識和看法。要求:(1)先進行系統分析,然后給出完整詳細的設計過程,可參見P59-61頁直流調速系統的模 糊邏輯控制器設計過程;(2)提交完整的報告,包括:封面(題目、個人學號姓名等信息)、目錄、任務要求敘述、 系統分析及控制設計原理(包括控制系統原理圖及文字分析)、完整的設計實現過程(包 括模糊控制器每部分的選擇與實現、計算、原理過程等)、仿真驗證(算法流程圖、軟 件實現手段介紹、系統參數選擇
3、、響應曲線圖、結合調參對響應曲線的影響給出必要 的分析)、討論與分析,其中對(b)(c)部分的分析字數要求在500-2000字以內。(3)提交可運行的軟件程序,計算機上可檢驗結果;必須在根目錄卜附軟件/程序使用說明, 運行說明(可能的話,附那些參數可調及具體效果的說明)二、控制器設計確定模糊控制器輸入輸出變量本控制器設計參考中文書P54叩61中的二維控制器設計,輸入為偏差E和偏差變化量ES來 進行調節。另外模糊控制器通過查表法實現。控制表方式的模糊邏輯控制器基本結構圖圖2確定各輸入輸出變量的變化范圍、量化等級和量化因子取三個語言變量的量化等級都為7級,即x, y, z, = -3,-2,-1,
4、 0,1, 2, 3 。由于在設計控制器 的時候己經把量化因子涵蓋在程序中了,所以三個量化因子并沒有出現在simulink當中。 初始設定誤差e的論域為-30,30,誤差變化de的論域為-60,60,控制輸出u的論域為-9,9, 此處的u是控制變化量。Kl=3/30=0.l, K2=3/60, K3=9/3=3在各輸入和輸出語言變量的量化域內定義模糊子集這里采用5個模糊子集,包括:PB, PS, ZE, NS, NBo模糊子集通過隸屬度函數來定義。這里 采用非線性量化以提高控制精度。誤差Qe-30-15-5051530-3-2-10123NB10. 500000NS00. 50. 50000Z
5、E000. 510. 500PS00000. 50.50PB000000.51表21誤差率dede-60-20-5052060-3-2-10123NB10. 500000NS00. 50. 250000ZE000. 7510. 7500PS00000. 250.50PB000000.51表22控制變化量uuT-4.5-1.501.54.59-3-2-10123NB10. 500000NS00. 50. 50000ZE000. 510. 500PS00000. 50.50PB000000.51表23模糊控制規則的確定根據模糊控制規則可得出控制規則庫,如卜.表所示。控制規則表UNBNSZEPSPB
6、NB*PBPBPSNBNSPBPSPSZENBZEPBPSZENSNBPSPBZENSNSNBPB?BNSNBNB:表24求模糊控制表通過模糊控制表,模糊控制器可以快速地通過判斷輸入量的等級來得出相應的輸出量,從而 避免了影響實時控制的復雜計算。比如當系統無處e的量化值為 假設系統誤差e的量化值為1、誤差變化de的量化值為2。則由控制規則表2-4可得出相應 的隸屬度值,如:對于誤差 e, Unb(-2)=0.5Uns(-2)=0.5;誤差變化 de, Uze(0)=l通過查表可知,對應NB和ZE的控制輸出為PB;對應NS和ZE的控制輸出為PS;由模糊邏輯推理可得:Upb(-2,0)=min(0
7、.5,l)=0.5/即 Ul=0.5/PB;Ups(-2/0)=min(0.5/l)=0.5, 即 U2z=0.5/PS;最終通過并運算得到輸出量u最后通過重心法得出UJ空竺竺竺=2U=urVU2=0.5/PB + 0.5/PS0.5 4-0.5+0.5同理可得其他輸出等級U,如下表模糊控制表-3-2-10123-32. 672.52.52. 672-0. 5-2. 67-22.52221-0. 5-2.5-12.62. 140. 50. 25-0. 22-1. 375-2. 602. 6720. 50-0. 5-2-2. 6712.61.3750. 22-0. 25-0. 5-2. 14-2
8、. 622.50. 5-1-2-2-2-2.532. 670.5-2-2. 67-2.5-2.5-2. 67表2.5通過找到輸出等級后再乘以相應的量化因子K3即可得出實際的輸出量。三、程序設計程序設計流程圖3-1圖31四、測試與仿真l.Simulink 搭建比例因子K3對響應曲線的影響這里PID控制器選取的P=l, 1=1, D=0o通過控制PID數值來研究比例因子K3對系統的影響。 由于這里采取的是非線性量化,所以輸出將由一組分段函數構成。r9 (degree 3)x degree + 4. 5 (3 degree 2)3 x degree + 1.5 (2 degree 1)(1)1. 5
9、 x degree ( 1 degree 0)x degree (0 degree 1)3 x degree 1.5 (1 degree 2)x degree 4,5 (2 degree 3)4540-,卜 i j; TOC o 1-5 h z I I; 1:Z5 I ;號?:?: ?: -II I I :20 I ? :- :- -II ;:;:;:.:JjJ:Jj-II1 葉 j?:?:? 5. .; ; :; ;J111;0? ?% a) 406003100120140 1ED Iffl 200Fimc of018 (degree 3)9 x degree + 9 (3 degree 2
10、)6 x degree + 3 (2 degree 1)3 x degree ( 1 degree 0)3 x degree (0 degree 1)6 x degree 3 (1 degree 2)9 x degree 9(2 degree 3)nmcorrset 030 (degree 3)15 x degree + 15 (3 degree 2)10 x degree + 5 (2 degree 1)(3) u = 5 x degree ( 1 degree 0)5 x degree (0 degree 1)10 x degree 5 (1 degree 2)15 x degree 15
11、(2 degree 3)36 degree 3)18 x degree + 18 (3 degree 2)12 x degree + 6 (2 degree 1)6 x degree ( 1 degree 0)6 x degree (0 degree 1)12 x degree 6 (1 degree 2)18 x degree 18(2 degree 3)42 (degree 3)21 x degree + 21 (3 degree 2)14 x degree + 7 (2 degree 1)(5) u =7 x degree ( 1 degree 0)7 x degree (0 degre
12、e 1)14 x degree 7 (1 degree 2)21 x degree 21(2 degree 3)如果進一步增大量化因子K3值,響應曲線將會變得越來越不穩定。因此最終數值K3取第(4)、 個分段函數比較好,響應速度快,其中tp和都相對于不加模糊控制器的曲線小,并且超 調量也比不加模糊控制器的系統小。五、總結這次上機編程實驗主要目的是模糊控制器的實現,把理論知識轉換為實際仿真運算。由于畢 竟是仿真實驗,與實際操作仍不相同,在一些數值選取,比如論域、隸屬度函數的確定,都 是通過主觀意愿而不是實際經驗來操作的。但是關鍵部分的運算比如模糊控制表的生成的確 增強了我對模糊控制的理解。通過仿
13、真可以發現增加了模糊控制器的系統的確比單純地PID 調節有著更強的控制效果,這也是學習的成果和目標之一。由于個人較為熟悉C語言,所以這次是用s-function中的C語言來實現模糊控制器的。以后 可以是用.m文件來進行編程,以利用matlab自帶的強大功能。六、使用方法用 simulink 打開 Artificial_Control_Design再在Matlab的Command Window中選取將要導入s-function中的.C文件所在的文件,如 下圖。(這里的.c文件是fuzzy_controlc)DesktopWindow Help| D:StudyV;四上課件熠融制概論-1 What
14、s New 編譯 fuzzy_controlc,在 Command Window 中輸入 mex fuzzycontrol.c,等待編譯完成雙擊 sinmulink 中的 s-function 模塊,在 s-function name 中輸入 fuzzy_control,然后點擊 確定 保存,并編譯由運行雙擊示波器觀測波形七、代碼附錄/* 1st: mex fuzzy_control.c2nd: save simulink3rd: compile simulink and run/* sfuntmpl_basic.c: Basic f CT template for a level 2 S-f
15、unction.* I See matlabroot/simulink/src/sfuntmpl_doc.c for a more detailed template |Copyright 1990-2002 The MathWorks, Inc.SRevision: 1.27.4.2 $/*You must specify the S_F UN CT I ON_N AM E as the name of your S-f unction(i.e. replace sfuntmpl_basic with the name of your S-function)./#define S_FUNCT
16、ION_NAME fuzzy_control /modified name#define S_FUNCTION_LEVEL 2 /*Need to include simstruc. h for the definition of the SimStruct andits associated macro definitions./#inclucle rrsimst rue. hchar degree_e=0/degree_de=0;double degree_u=0,delta_u=0; /delta_u: the variable added to the controlled varia
17、bledouble fuzzy_table7 7= 3,3,25,2. 67, 0.5/2 67)r2.5,oo1/0.5z2.5z2.6,2. 14,0.5,0.25f-0.22, 一1.375, 一26,2.67,o0.5,0,-0.5, -2,-2.7z2.6,2.5,2.67,1.375, 0.220.5,0.5,-2,-0.25,一2 67,-。.5, -2匕,-2.5, 一 3,14, -2.6,-2.5,-3 ;ErrorhandlingYou should use thefollowing techniqueto report errors encounteredwithina
18、nS-function:ssSetErrorStatus (Sz f,Error encountered duetoreturn;Notethat the 2nd argument to ssSetErrorStatusmust be persistentmemory.It cannot be a local variable. For example the unpredictable errors:following will causemdlOutputs ()char msg256;msg256;”(ILLEGAL: to fix use static charsprintf (msg
19、f nError due to %s ,rz string); ssSetErrorStatus (Sz msg);return;* Seemat labroot/ simulink/src/sfuntmpl_cloc. c for more details .* S-function methods */* Function: mdllnitializeSizes* Abstract:The sizes information is used by Simulink. to determine the S-functionblock1s characteristics (number of
20、inputs, outputsf states, etc.)./staticvoid mdllnitializeSizes(SimStruct *S)/* See sfuntmpl_doc.c for more details on the macros below */ssSetNumSFcnParams(Sz 0); /* Number of expected parameters */MODIFIEDif (ssGetNumSFcnParams (S) != ssGetSFcnParamsCount(S) (/* Return if number of expected != numbe
21、r of actual parameters / return;ssSetNumContStates(S, 0);ssSetNumDiscStates(S, 0);if (!ssSetNumlnputPorts(Sz 3) return; /modified original:1 ssSetlnputPortwidth(Sz 0z 1); /demension of input0;ss Set Input Po rt Requi redCont iguous (S r 0, true) ; /*clirect input signal access*/ssSetlnputPortwidth (
22、Sz lz 1) ; /demension of input1;ss Set Input Po rt Requi redCont iguous (S r 1, true) ; /*clirect input signal access*/ssSetlnputPortwidth (Sz 2/ 1) ; /demension of inputZ;ss Set Input Po rt Requi redCont iguous (S r 1, true) ; /*clirect input signal access*/*Set direct feedthrough flag (l=yes, 0=no
23、).A port has direct feedthrough if the input is used in eitherthe mdlOutputs or mdlGetTimeOfNextVarHit functions.* See matlabroot/simulink/src/sfuntmpl_directfeed.txt */0/ 1);1/ 1);2, 1);ssSetlnputPortDirectFeedThrough(Sz ssSetlnputPortDirectFeedThrough (Sz ssSetlnputPortDirectFeedThrough(Szif (!ssS
24、etNumOutputPorts(Sz 1) return;ssSetOutputPortwidth(Sf 0f 1);ssSetNumSampleTimes(Sz 0.1); /SAMPLE T工ME!ssSetNumRWork(Sf 0);ssSetNumlWork(Sf 0);ssSetNumPWork(Sf 0);ssSetNumModes(Sf 0);ssSetNumNonsampledZCs(Sf 0);as a built-in block */* Specify the sim state compliance to be samessSetSimStateCompliance
25、 (Sf USE_DEFAULT_S:M_STATE);ssSetOptions (S, 0);)/Abstract:In this function, you should initialize the continuous and discretestates for your S-function block. The initial states are placedin the state vector, ssGetCont States(S) or ssGetRealDiscStates(S)You can also perforin any other initializatio
26、n activities that yourS-function may require. Note, this routine will be called at thestart of simulation and if it is present in an enabled subsystemconfigured to reset states, it will be call when the enabled subsystemrestarts execution to reset the states.*/staticvoicl mdllnitializeConditions (Si
27、mStruct *S)(#endif/* MDL INITIALIZE CONDITIONS */ Function: mdllnitializeSampleTimesAbstract:This function is used to specify the sample time (s) for yourS-function. You must register the same number of sample times asspecified in ssSetNumSampleTimes./staticvoicl mdllnitializeSampleTimes (SimStruct
28、*S) (ssSetSampleTime (S, 0, CONTINUOUS_SAMPLE_TIME);ssSetOffsetTime (S, 0f 0.0);)#define MDL_INITIALIZE_CONDITIONS / Change to #undef to remove function */#if defined(MDL_INITIALIZE_CONDITIONS)/* Function: mdllnitializeConditions#define MDL_START /* Change to #undef to remove function */ #if defined
29、(MDL_START)/* Function: mdlStartAbstract:This function is called once at start of model execution. If youhave states that should be initialized oncer this is the placeto do it.*/staticvoid mdlStart(SimStruct *S)(#endif/* MDL_START */* Function: mdlOutputsAbstract:In this function, you compute the ou
30、tputs of your S-functionblock./staticvoid mdlOutputs (SimStruct *SZ int_T tid)(/real_T *paral = mxGetPr(ssGetSFcnParam(Sz 0);/real_T *para2 = mxGetPr(ssGetSFcnParam(Sz1);/real_T *para3 = mxGetPr(ssGetSFcnParam(Sz 2);const real_T*ul=(constreal_T*)ssGetlnputPortSignal(Sz 0);const real_T*u2=(constreal_
31、T*)ssGetlnputPortSignal(Sz1);const real_T*u3=(constreal_T*)ssGetlnputPortSignal(Sz 2);real_T *y = ssGetOutputPortSignal (S,0);/convert the input e into the degree of control*/ if (ul0 0)(if (ul0 5) degree_e = 1;/5else (if (ul0 15) degree_e = 2;/15else degree_e = 3;else if (ul0 -5) degree_e = -1;else
32、 (if (ul0 -15) degree_e = -2;else degree_e = -3;else degree_e = 0; /convert the input de into the degree of control*/ if (u20 0) if (u20 5) degree_de = 1;/5 elseif (u20 20) degreede = 2;/20 else degree_de = 3;else if (u20 -5)elseif (u20 degree_de = -1;-20) degree_de = -2;else degree_de = -3;else deg
33、ree_de = 0;degree_u = fuzzy_tabledegree_de + 3 degree_e + 3;if (degree_u 0)(/delta_u=3*degree_u;/18.15if(degree_u 1) delta_u = 20*degree_u;/1.5* degree_u;/6*degree_u;/7 * degree_u;/3*degree_u;/5 * degree_u; /1.5 * degree_u;elseif(degree_u 2) delta_u =40*degree_u-20;/3 * degree_u -1.5;/12*degree_u-6;
34、/14 * degree_u - 7;/ 6*degree_u-3;/10 * degree_u - 5;/3 * degree_u - 1.5;elseif (degree_u -1) delta_u = 20 * degree_u;/7 * clegree_u;/ 3*degree_u;/5 Abstract:In this function, you compute the S-function block1s derivatives.The derivatives are placed in the derivative vector, ssGetdX(S) degree_u;/1.5
35、 * degree_u;elseif(degree_u -2) delta_u = 40 * degree_u + 20;/14 * degree_u + 7; / /6*degree_u+3; / /10 * clegree_u + 5 ;/3 * degree_u + 1.5;elseif (degree_u -3) delta_u = 60 * degree_u + 60;/18*degree_u+18;/21 * degree_u + 21;/ 9*degree_u+5;/15 * degree_u + 15;/4.5 * degree_u + 4.5;else delta_u = -120;/-42;/-18;/-9;y0 = u30 + delta_u;/+20;/*degree_e=0;degree_de=0;degree_u=0;delta_u=0;/)#define MDL_U
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經權益所有人同意不得將文件中的內容挪作商業或盈利用途。
- 5. 人人文庫網僅提供信息存儲空間,僅對用戶上傳內容的表現方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
- 6. 下載文件中如有侵權或不適當內容,請與我們聯系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 25年公司安全管理人員安全培訓考試試題附參考答案(達標題)
- 2024-2025新員工入職安全培訓考試試題附完整答案(必刷)
- 2024-2025公司、項目部、各個班組三級安全培訓考試試題及參考答案(新)
- 2025年心內一老年護理專業認證培訓計劃
- 小學體育活動中投擲游戲設計計劃
- 五年級下冊天文科學教學計劃
- 悼念父親的音樂作品范文
- “教會、勤練、常賽”視域下高中排球教學設計及效果研究
- 基于區域蒸餾與偽標簽的遙感增量地物分類
- N銀行個人住房貸款信用風險管理優化研究
- (完整)中醫癥候積分量表
- 教職工電信詐騙培訓方案
- 全國國家級園區名單
- 初中數學七年級下冊 加減消元法 全國一等獎
- 眼科病人的心理護理支持與疏導學習
- 相鄰權糾紛知識講座
- 利用智能垃圾分類系統促進資源回收利用
- 《天然氣取樣導則》課件
- 測爆、測氧儀操作規程
- 煙花爆竹生產企業安全生產風險監測預警系統建設方案
- 職業暴露與安全防護ppt
評論
0/150
提交評論