MATLAB Codesys,Matlab绋嬪簭瀵煎叆Codesys PLC鏁欑▼-CODESYS璧勬簮涓嬭浇鍖-閰峰痉缃 - CoDeSys杞欢鏁欑▼涓嬭浇,CoDeSys宸ユ帶璧勮闂ㄦ埛
HSC6490-cn涓浗鍒堕狅紝涓浗鑺瘇
鏌ョ湅: 1809|鍥炲: 0

MATLAB Codesys,Matlab绋嬪簭瀵煎叆Codesys PLC鏁欑▼

[澶嶅埗閾炬帴]
  • TA鐨勬瘡鏃ュ績鎯
    鎱垫噿
    2017-11-9 20:49
  • 绛惧埌澶╂暟: 2 澶

    [LV.1]鍒濇潵涔嶅埌

    鍙戣〃浜 2023-4-12 22:57:02 | 鏄剧ず鍏ㄩ儴妤煎眰 |闃呰妯″紡
    鍦∕atlab涓豢鐪熷ソ鐨勭▼搴忓彲浠ョ洿鎺ュ鍏ュ埌PLC涓紝鐪佸幓鎴戜滑閲嶆柊缂栫▼鐨勬椂闂达紝鏈枃灏遍氳繃涓涓畝鍗曠殑PID鎺у埗鐨勪緥瀛愭潵婕旂ず杩欎竴杩囩▼銆
    1銆Matlab涓殑鎿嶄綔
    鍦∕atlab(2019b鐗堟湰)涓偣鍑籗imulink鍥炬爣灏辫兘鐪嬪埌Simulink鐨勫惎鍔ㄩ〉闈紝鍦ㄦ悳绱㈡涓緭鍏ID鍗冲彲鎵惧埌杞欢鑷甫鐨勪緥瀛愶紝濡備笅鍥炬墍绀恒傛垜浠氨浠ユ涓轰緥杩涜璁茶В銆
    MATLAB Codesys,Matlab绋嬪簭瀵煎叆Codesys PLC鏁欑▼-1.png


    杩欎釜渚嬪瓙姣旇緝绠鍗曪紝鍙湁涓涓狿ID鎺у埗鍣ㄥ拰涓涓簩闃堕樆灏肩郴缁熶綔涓鸿鎺у璞★紝濡備笅鍥惧乏銆傛垜浠彲浠ユ坊鍔犱竴涓猄cope绀烘尝鍣ㄦ潵鏌ョ湅鎺у埗鏁堟灉锛屽涓嬪浘鍙筹紝鍙琚帶绯荤粺鐨勮緭鍑哄疄鐜颁簡瀵归樁璺冨弬鑰冧俊鍙风殑璺熻釜銆
    MATLAB Codesys,Matlab绋嬪簭瀵煎叆Codesys PLC鏁欑▼-2.png


    MATLAB Codesys,Matlab绋嬪簭瀵煎叆Codesys PLC鏁欑▼-3.png


    涓轰簡灏嗕豢鐪熷ソ鐨凱ID鎺у埗鍣ㄥ鍏ュ埌PLC涓紝涓嬮潰鎴戜滑瀵瑰叾杩涜閰嶇疆銆傞鍏堥厤缃郴缁熺殑浠跨湡鍙傛暟锛屾墦寮绯荤粺鍙傛暟閰嶇疆椤甸潰(鎸塁trl+E鎵撳紑Configuration Parameters)锛屽湪Solver selection椤逛腑灏嗕豢鐪熺被鍨婽ype鏀逛负Fixed-step銆傜劧鍚庢墦寮PID鎺у埗鍣ㄦā鍧楃殑鍙傛暟閰嶇疆椤甸潰锛屽皢Time-domain鏀逛负绂绘暎鏃堕棿锛屽涓嬪浘鎵绀恒備綘涔熷彲浠ユ牴鎹嚜宸辩殑缁忛獙淇敼PID鐨勬瘮渚嬪井鍒嗙瓑澧炵泭锛屼篃鍙互閫夋嫨鏄惁瀵瑰井鍒嗛」杩涜婊ゆ尝骞惰缃护娉㈢郴鏁帮紝鍦ㄥ叾瀹冮夐」鍗′腑杩樺彲浠ヨ缃緭鍑洪檺骞呫佹姉绉垎楗卞拰绛夐夐」銆
    MATLAB Codesys,Matlab绋嬪簭瀵煎叆Codesys PLC鏁欑▼-4.png


    閰嶇疆濂戒互鍚庯紝鎴戜滑鍥炲埌浠跨湡椤甸潰锛屽湪Controller妯″潡涓婂彸閿紝閫夋嫨PLC Code鈥>Enable 鈥淭reat as atomic unit鈥濓紝鎶娾淭reat as atomic unit鈥濆嬀閫変笂锛屽涓嬪浘鎵绀恒
    MATLAB Codesys,Matlab绋嬪簭瀵煎叆Codesys PLC鏁欑▼-5.png


    MATLAB Codesys,Matlab绋嬪簭瀵煎叆Codesys PLC鏁欑▼-6.png


    鍐嶆鍦ㄦā鍧椾笂鍙抽敭閫夋嫨PLC Code鈥>Options锛岄夋嫨浣犵殑PLC骞冲彴锛岃繖閲屾垜浣跨敤鐨勬槸Codesys锛屾垜鐨凜odesys鐗堟湰鏄疺3.5 SP13 Patch 1锛屽洜姝ゆ垜閫夋嫨鐩稿簲鐨勯夐」锛岃屼笖鍦↖DE path涓緭鍏odesys鐨勫畨瑁呬綅缃紝杈撳嚭鏂囦欢澶逛篃鍙互璁剧疆(鎴戝氨鐢ㄩ粯璁ょ殑浜咰:\Program Files\Polyspace\R2019b\bin\plcsrc)銆
    MATLAB Codesys,Matlab绋嬪簭瀵煎叆Codesys PLC鏁欑▼-7.png


    鐒跺悗杩樻槸鍦–ontroller妯″潡涓婂彸閿夋嫨PLC Code鈥>Generate code for subsystem锛屾垚鍔熺敓鎴愪唬鐮佸悗浼氳烦鍑轰互涓嬮〉闈€
    MATLAB Codesys,Matlab绋嬪簭瀵煎叆Codesys PLC鏁欑▼-8.png


    鎵撳紑杈撳嚭鏂囦欢澶瑰彲浠ョ湅鍒扮敓鎴愮殑鏂囦欢鏈変笁涓紝鍏朵腑st鏂囦欢鍜寈ml鏂囦欢鏄垜浠劅鍏磋叮鐨勩俿t鏂囦欢涓槸PID鎺у埗绋嬪簭鐨勪唬鐮侊紝鎴戜滑鍙互鐢ㄨ浜嬫湰鎵撳紑鐪嬬湅閲岄潰鐨勫唴瀹广傞櫎鍘荤箒鐞愮殑娉ㄩ噴锛岀湡姝g殑绠楁硶浠g爜寰堢畝鍗曪紝灏辨槸璁$畻姣斾緥椤广佺Н鍒嗛」銆佸井鍒嗛」锛岀劧鍚庝笁椤圭浉鍔犲緱鍒版渶缁堢殑鎺у埗閲廋ontrol銆傛垜浠繕鑳界湅鍒扮▼搴忎腑瀵瑰井鍒嗛」閲囧彇浜嗕竴闃朵綆閫氭护娉紝杩欐牱鍙互鍘婚櫎楂橀鍣0銆傝繕鍙互鐪嬪埌鏁翠釜PID鎺у埗绋嬪簭鏄綔涓轰竴涓狥unction Block绋嬪簭鍧楃殑褰㈠紡瀛樺湪锛岃繖鏂逛究浜嗘垜浠湪姝e紡椤圭洰涓皟鐢ㄥ畠銆
    MATLAB Codesys,Matlab绋嬪簭瀵煎叆Codesys PLC鏁欑▼-9.png


    2銆Codesys涓殑鎿嶄綔
    xml鏂囦欢鍙互瀵煎叆鍒癈odesys涓倄ml鏄竴绉嶆爣鍑嗙殑瀛樺偍鏍煎紡锛屽悇澶т富娴丳LC鍘傚閮芥敮鎸佽繖绉嶆牸寮忋傛墦寮Codesys鐨処DE缂栫▼鐜锛岀劧鍚庢柊寤轰竴涓淪tandard Project鈥濆伐绋嬨傚湪鈥滃伐绋嬧濊彍鍗曚腑閫夋嫨瀵煎叆xml鏂囦欢锛屽涓嬪浘鎵绀恒
    MATLAB Codesys,Matlab绋嬪簭瀵煎叆Codesys PLC鏁欑▼-10.png


    鍦≒OU鏍忎腑鍙互鎵惧埌瀵煎叆鍚庣殑绋嬪簭锛屼粠姝や互鍚庝綘灏卞彲浠ュ湪瀹為檯宸ョ▼椤圭洰涓皟鐢ㄨ繖涓狿ID鍑芥暟鍧椾簡锛屽畠鐨勫悕瀛楁槸榛樿鐨凜ontroller锛岃緭鍏ユ槸璇樊閲廍rror锛岀被鍨嬫槸LREAL锛岃緭鍑烘槸鎺у埗閲廋ontrol銆
    MATLAB Codesys,Matlab绋嬪簭瀵煎叆Codesys PLC鏁欑▼-11.png


    3銆瀵煎嚭绋嬪簭鐨勬纭ч獙璇
    涔熻浣犱細鎬鐤戯紝瀵煎嚭鐨勭▼搴忔槸鍚︿笌鎴戜滑鍦ㄤ豢鐪熶腑鐨勬晥鏋滀竴鏍峰憿锛烳atlab鏇寸墰閫肩殑鏄繕鏀寔灏嗚嚜宸变豢鐪熺殑鏁版嵁涓嶤odesys涓繍琛岀殑鏁版嵁杩涜瀵规瘮浠庤岄獙璇佸鍑虹▼搴忕殑姝g‘鎬э紝鎿嶄綔鐨勬楠ゅ涓嬨傚湪PLC Code鈥>Options閫夐」椤典腑灏咷enerate testbench for subsystem鍕鹃変笂锛屽涓嬪浘銆
    MATLAB Codesys,Matlab绋嬪簭瀵煎叆Codesys PLC鏁欑▼-12.png


    鍐嶆瀵煎叆鍒癈odesys涓悗锛屾垜浠細鍙戠幇澶氫簡涓涓猅estBench绋嬪簭鍧楋紝瀹冮噷闈㈠甫鐫浠跨湡鏁版嵁锛屽涓嬪浘鎵绀恒傛敞鎰忥紝鍦═estBench鐨勫嚱鏁板畾涔夊尯涓湁杩欐牱涓琛屼唬鐮丄BS(out_Control - cycle_Control) > (1.0E-5 * ABS(cycle_Control))锛屾樉鐒惰繖鏄湪姣旇緝out_Control鍜宑ycle_Control涓や釜鍊肩殑宸埆锛屽墠鑰呮槸Codesys涓皟鐢ㄥ嚱鏁板潡璁$畻寰楀埌鐨勬帶鍒堕噺锛屽悗鑰呮槸Matlab鍦ㄤ豢鐪熻繃绋嬩腑淇濆瓨涓嬫潵鐨勬帶鍒堕噺銆傚鏋滀簩鑰呰宸皬浜庝竴瀹氶槇鍊(绋嬪簭涓槸0.00001脳 \times脳鎵弿鍛ㄦ湡)鍒欒鏄庡鍑虹殑绋嬪簭鍧椾笌浠跨湡绋嬪簭鏄竴鑷寸殑銆備笅闈㈢浜屽箙鍥惧氨鏄疄闄呰繍琛岀殑缁撴灉锛宼estVerify鍒ゆ柇浜岃呬箣宸槸鍚﹀皬浜庨槇鍊硷紝鍥句腑瀹冧负True锛岃繖璇存槑瀵煎嚭鐨勭▼搴忎笌浠跨湡鏄竴鏍风殑銆傜敱浜嶵estBench鏄釜绋嬪簭鍧(FB)锛屾墍浠ユ垜浠鍏堝疄渚嬪寲锛岀劧鍚庤皟鐢ㄥ嵆鍙
    MATLAB Codesys,Matlab绋嬪簭瀵煎叆Codesys PLC鏁欑▼-13.png


    MATLAB Codesys,Matlab绋嬪簭瀵煎叆Codesys PLC鏁欑▼-14.png


    +10
    涓嶈禐涓涓紵
    鎵撹祻榧撳姳涓涓嬶紒
    鍥炲

    浣跨敤閬撳叿 涓炬姤

    鎮ㄩ渶瑕佺櫥褰曞悗鎵嶅彲浠ュ洖甯 鐧诲綍 | 绔嬪嵆娉ㄥ唽 鏂版氮寰崥鐧婚檰

    鏈増绉垎瑙勫垯

    椤堕儴qrcode搴曢儴
    鍏虫敞閰峰痉缃戣闃呭彿锛岃幏鍙栨洿澶氳祫璁紒

    QQ|灏忛粦灞|鎵嬫満鐗|Archiver|閰峰痉璁哄潧 ( 鑻廔CP澶16065247鍙-1 )|缃戠珯鍦板浘

    GMT+8, 2024-11-23 20:28 , Processed in 0.154965 second(s), 60 queries .

    閰峰痉缃

    © 2001-2013 Hicodesys. 鎶鏈敮鎸 by 閰峰痉缃

    蹇熷洖澶 杩斿洖椤堕儴 杩斿洖鍒楄〃