鍦 Codesys 涓娇鐢 ST 璇█鐨 IF 璇彞-CODESYS璧勬簮涓嬭浇鍖-閰峰痉缃 - CoDeSys杞欢鏁欑▼涓嬭浇,CoDeSys宸ユ帶璧勮闂ㄦ埛
HSC6490-cn涓浗鍒堕狅紝涓浗鑺瘇
鏌ョ湅: 61|鍥炲: 0

鍦 Codesys 涓娇鐢 ST 璇█鐨 IF 璇彞

[澶嶅埗閾炬帴]
  • TA鐨勬瘡鏃ュ績鎯
    寮蹇
    2017-11-20 22:07
  • 绛惧埌澶╂暟: 2 澶

    [LV.1]鍒濇潵涔嶅埌

    鍙戣〃浜 2025-3-14 09:03:25 | 鏄剧ず鍏ㄩ儴妤煎眰 |闃呰妯″紡

    寮曡█

    鍦ㄥ伐涓氳嚜鍔ㄥ寲棰嗗煙锛孭LC锛堝彲缂栫▼閫昏緫鎺у埗鍣級琚箍娉涘簲鐢ㄤ簬鎺у埗鍜岀洃娴嬫満姊板拰宸ヨ壓娴佺▼銆侰odesys 鏄父鐢ㄧ殑 PLC 缂栫▼鐜锛屾敮鎸佸绉嶇紪绋嬭瑷锛屽寘鎷粨鏋勫寲鏂囨湰锛圫T锛夎瑷銆係T 璇█绫讳技浜庨珮绾ц瑷锛屾彁渚涗簡寮哄ぇ鐨勬帶鍒剁粨鏋勩傛湰鏂囧皢浠嬬粛 ST 璇█涓殑 IF 璇彞锛屽府鍔╁ぇ瀹剁悊瑙e拰搴旂敤杩欎竴鍩烘湰鎺у埗缁撴瀯銆
    1  璇彞浠嬬粛
    IF 璇彞鏄竴绉嶅熀鏈殑鏉′欢鎺у埗缁撴瀯锛岀敤浜庢牴鎹潯浠剁殑鐪熷亣鎵ц涓嶅悓鐨勪唬鐮佸潡銆傚叾鍩烘湰璇硶濡備笅锛
    [AppleScript] 绾枃鏈煡鐪 澶嶅埗浠g爜
    IF condition THEN
        (* Statements if condition is true *)
    ELSIF another_condition THEN
        (* Statements if another_condition is true *)
    ELSE
        (* Statements if none of the above conditions are true *)
    END_IF
    鍦ㄤ笂杩扮粨鏋勪腑锛宑ondition 鏄渶瑕佸垽鏂殑鏉′欢銆侲LSIF 鍜 ELSE 閮ㄥ垎鏄彲閫夌殑锛岀敤浜庡鐞嗗叾浠栨儏鍐点
    2  IF 鍜 ELSIF 鐨勫尯鍒
    • IF 璇彞锛氱敤浜庡垽鏂涓涓潯浠躲傚鏋滄潯浠朵负鐪燂紝鎵ц鐩稿簲鐨勪唬鐮佸潡銆
    • ELSIF 璇彞锛氱敤浜庡湪鍓嶄竴涓 IF 鎴 ELSIF 鏉′欢涓嶆垚绔嬫椂锛屽垽鏂笅涓涓潯浠躲傚彲浠ユ湁澶氫釜 ELSIF 璇彞锛屾寜椤哄簭渚濇鍒ゆ柇銆
    鍏抽敭鍖哄埆鍦ㄤ簬锛欼F 鏄涓潯浠跺垽鏂紝ELSIF 鏄悗缁殑鏉′欢鍒ゆ柇銆侷F 璇彞鍜 ELSIF 璇彞鏈川涓婃槸浜掓枼鐨勶紒涔熷氨鏄锛屼竴鏃 IF 璇彞寰楀埌浜嗘墽琛岋紝绋嬪簭浼氳烦杩 ELSIF 璇彞銆備竴娈靛寘鍚 IF 璇彞鍜屽涓 ELSIF 璇彞鐨勭▼搴忥紝鍙細鎵ц鍏朵腑鐨勪竴涓潯浠讹紙绗竴涓弧瓒崇殑鏉′欢锛夛紝濡傛灉閮戒笉婊¤冻锛屾墽琛 ELSE 銆
    3  IF 缂栫▼鎬濊矾
    浣跨敤 IF 璇彞鏃讹紝闇瑕佹竻鏅板湴瑙勫垝鏉′欢鍜屽搴旂殑鎿嶄綔銆備互涓嬫槸缂栫▼鎬濊矾鐨勫嚑涓鐐癸細
    • 纭畾鏉′欢锛氭槑纭渶瑕佸垽鏂殑鏉′欢锛屽苟灏介噺绠鍖栨潯浠惰〃杈惧紡銆
    • 澶勭悊鍒嗘敮锛氫负姣忎釜鏉′欢鍒嗘敮瀹氫箟鍏蜂綋鐨勬搷浣滐紝纭繚閫昏緫姝g‘銆
    • 鑰冭檻椤哄簭锛欼F 璇彞鎸夐『搴忓垽鏂潯浠讹紝鍥犳搴旀寜浼樺厛绾ф帓鍒楁潯浠躲
    • 浼樺寲浠g爜锛氶伩鍏嶉噸澶嶄唬鐮侊紝淇濇寔浠g爜绠娲併佹槗璇汇
    4  鍏稿瀷妗堜緥浠嬬粛
    鍋囪鎴戜滑闇瑕佹牴鎹俯搴︿紶鎰熷櫒鐨勮鏁版潵鎺у埗涓涓姞鐑櫒銆傚満鏅涓嬶細
    • 娓╁害浣庝簬 20掳C锛氬姞鐑櫒鎵撳紑
    • 娓╁害鍦 20掳C 鍒 25掳C 涔嬮棿锛氫繚鎸佸綋鍓嶇姸鎬
    • 娓╁害楂樹簬 25掳C锛氬姞鐑櫒鍏抽棴
    浠ヤ笅鏄娇鐢 IF 璇彞鐨勫疄鐜扮ず渚嬶細
    [AppleScript] 绾枃鏈煡鐪 澶嶅埗浠g爜
    VAR
        temperature : REAL; (* 娓╁害浼犳劅鍣ㄨ鏁 *)
        heaterOn : BOOL;    (* 鍔犵儹鍣ㄧ姸鎬 *)
    END_VAR
    
    IF temperature < 20.0 THEN
        heaterOn := TRUE;  (* 鎵撳紑鍔犵儹鍣 *)
    ELSIF temperature > 25.0 THEN
        heaterOn := FALSE; (* 鍏抽棴鍔犵儹鍣 *)
    ELSE
        (* 淇濇寔褰撳墠鐘舵侊紝涓嶆敼鍙 heaterOn *)
    END_IF
    鍦ㄨ繖涓緥瀛愪腑锛屾牴鎹俯搴︾殑涓嶅悓鑼冨洿鎺у埗鍔犵儹鍣ㄧ殑鐘舵侊紝纭繚娓╁害缁存寔鍦ㄥ悎閫傜殑姘村钩銆

    鎬荤粨

    IF 璇彞鏄 ST 璇█涓殑鍩烘湰鎺у埗缁撴瀯锛岄傜敤浜庣畝鍗曠殑鏉′欢鍒ゆ柇鍜屽垎鏀搷浣溿傞氳繃鍚堢悊浣跨敤 IF 鍜 ELSIF 璇彞锛屽伐绋嬪笀鍙互缂栧啓鍑洪昏緫娓呮櫚銆佹槗浜庣淮鎶ょ殑浠g爜銆傚湪鏃ュ父寮鍙戜腑锛屾帉鎻¤繖浜涜鍙ョ殑浣跨敤灏嗘湁鍔╀簬楂樻晥鍦拌В鍐冲悇绉嶆帶鍒堕棶棰樸傚笇鏈涙湰鏂囪兘甯姪鎮ㄦ洿濂藉湴鐞嗚В鍜屽簲鐢 IF 璇彞銆

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

    浣跨敤閬撳叿 涓炬姤

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

    鏈増绉垎瑙勫垯

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

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

    GMT+8, 2025-4-5 04:04 , Processed in 0.136253 second(s), 55 queries .

    閰峰痉缃

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

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