CODESYS 瀹炴垬锛氬崟寮鍏抽噺浼犳劅鍣ㄥ疄鐜版棆杞熷害璁$畻-CODESYS璧勬簮涓嬭浇鍖-閰峰痉缃 - CoDeSys杞欢鏁欑▼涓嬭浇,CoDeSys宸ユ帶璧勮闂ㄦ埛
HSC6490-cn涓浗鍒堕狅紝涓浗鑺瘇
鏌ョ湅: 172|鍥炲: 0

CODESYS 瀹炴垬锛氬崟寮鍏抽噺浼犳劅鍣ㄥ疄鐜版棆杞熷害璁$畻

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

    [LV.1]鍒濇潵涔嶅埌

    鍙戣〃浜 2024-9-6 09:10:08 | 鏄剧ず鍏ㄩ儴妤煎眰 |闃呰妯″紡

    寮曡█

    鍦ㄥ伐涓氳嚜鍔ㄥ寲棰嗗煙锛屽疄鏃剁洃娴嬫満鍣ㄧ殑閫熷害瀵逛簬纭繚鐢熶骇鏁堢巼鍜屽畨鍏ㄦц嚦鍏抽噸瑕併傛湰鏂囧皢浠嬬粛濡備綍浣跨敤 CODESYS 缂栧啓涓涓棆杞熷害璁$畻鍣ㄥ姛鑳藉潡锛岄氳繃浼犳劅鍣ㄤ俊鍙疯绠楄澶囩殑杩愯閫熷害銆
    1
    绋嬪簭璁捐鎬濊矾
    鏈▼搴忕殑鏍稿績鏄牴鎹紶鎰熷櫒鐨勮Е鍙戞椂闂村樊鏉ヨ绠楅熷害銆傞氳繃妫娴嬩紶鎰熷櫒淇″彿鐨勪笂鍗囨部锛岃褰曟椂闂达紝骞跺埄鐢ㄤ袱娆′紶鎰熷櫒瑙﹀彂鐨勬椂闂村樊璁$畻閫熷害銆
    2
    绋嬪簭浠g爜
    [AppleScript] 绾枃鏈煡鐪 澶嶅埗浠g爜
    FUNCTION_BLOCK PM_RotationSpeedCalculator
    VAR_INPUT
        Sensor : BOOL;       // 鎰熷簲浼犳劅鍣ㄤ俊鍙
        RunLength : REAL := 10;   // 杩愯闀垮害锛堝崟浣嶏細绫筹級
    END_VAR
    VAR_OUTPUT
        Speed : REAL;        // 閫熷害锛堝崟浣嶏細绫/绉掞級
    END_VAR
    VAR
        LastTime : TIME;     // 涓婁竴娆℃娴嬪埌浼犳劅鍣ㄧ殑鏃堕棿
        CurrentTime : TIME;  // 褰撳墠妫娴嬪埌浼犳劅鍣ㄧ殑鏃堕棿
        TimeElapsed : REAL;  // 涓ゆ妫娴嬬殑鏃堕棿宸紙鍗曚綅锛氱锛
        SensorTriggered : BOOL; // 浼犳劅鍣ㄨЕ鍙戠姸鎬
    END_VAR
    
    (*
    鐗堟湰璁板綍锛
    鐗堟湰          鏃ユ湡          浣滆
     V1         2024-1-13     宸ユ帶鑰佺帇
    *)
    
    IF Sensor AND NOT SensorTriggered THEN
        CurrentTime := TIME(); // 璁板綍褰撳墠鏃堕棿
        IF LastTime <> T#0s THEN
            TimeElapsed := TIME_TO_REAL(CurrentTime - LastTime) / 1000.0; // 璁$畻鏃堕棿宸苟杞崲涓虹
            IF TimeElapsed > 0 THEN
                Speed := RunLength / TimeElapsed; // 璁$畻閫熷害
            END_IF
        END_IF
        LastTime := CurrentTime; // 鏇存柊涓婁竴娆℃椂闂
        SensorTriggered := TRUE;
    ELSIF NOT Sensor THEN
        SensorTriggered := FALSE;
    END_IF

    3
    浠g爜瑙i噴
    鍙橀噺瀹氫箟锛
    • Sensor锛氭娴嬩紶鎰熷櫒淇″彿鐨勫竷灏旇緭鍏ャ
    • RunLength锛氳澶囩殑杩愯闀垮害锛屽崟浣嶄负绫炽
    • Speed锛氳緭鍑洪熷害锛屽崟浣嶄负绫/绉掋
    • LastTime鍜孋urrentTime锛氬垎鍒褰曚笂涓娆″拰褰撳墠鐨勪紶鎰熷櫒瑙﹀彂鏃堕棿銆
    • TimeElapsed锛氳绠椾袱娆′紶鎰熷櫒瑙﹀彂鏃堕棿鐨勫樊鍊笺
    • SensorTriggered锛氶槻姝㈣繛缁娆℃娴嬪共鎵拌鏃躲
    鏍稿績閫昏緫锛
    • 妫娴嬩紶鎰熷櫒淇″彿鐨勪笂鍗囨部锛岃褰曞綋鍓嶆椂闂淬
    • 璁$畻涓庝笂涓娆¤Е鍙戞椂闂寸殑宸硷紝寰楀埌鏃堕棿闂撮殧銆
    • 浣跨敤鏃堕棿闂撮殧鍜岃繍琛岄暱搴﹁绠楅熷害銆

    绋嬪簭杩愯灞曠ず

    640?wx_fmt=png&from=appmsg.jpg
    璁剧疆璁惧鐨勮繍琛岄暱搴︿负10绫筹紝浼犳劅鍣ㄨ缃负10绉掔殑鑴夊啿锛岃绠楀嚭缁撴灉涓0.998m/s銆傚洜涓哄瓨鍦 PLC 鎵弿鍛ㄦ湡鐨勫奖鍝嶏紝璁$畻缁撴灉骞朵笉鏄1m/s銆備絾瀵逛簬鍦ㄤ綆閫熷簲鐢ㄥ満鏅繖涓熷害璇樊褰卞搷涓嶅ぇ銆
    4
    搴旂敤鍦烘櫙
    璇ュ姛鑳藉潡閫傜敤浜庨渶瑕佺矖鐣ョ洃娴嬮熷害鐨勫満鍚堬紝绮剧‘妫娴嬭浣跨敤缂栫爜鍣ㄣ傚浼犻佸甫銆佹棆杞満姊扮瓑銆傞氳繃瀵逛紶鎰熷櫒淇″彿鐨勬娴嬶紝鍙互瀹炴柦鐩戞帶璁惧鐨勮繍琛岀姸鎬侊紝閫氳繃閫熷害鐨勫彉鍖栵紝涔熷彲浠ユ劅鐭ュ埌璐熻浇鐨勫彉鍖栥傚綋寮傚父鏃跺彲浠ヨ緭鍑烘姤璀︼紝纭繚璁惧鐨勭ǔ瀹氭у拰瀹夊叏鎬с
    5
    寮婧愮増鏈鏄
    璇ョ▼搴忛伒寰紑婧愬師鍒欙紝浠讳綍浜洪兘鍙互浣跨敤銆佷慨鏀瑰拰鍒嗗彂姝や唬鐮併傚湪浣跨敤鍓嶅簲杩涜鍏呭垎鐨勬祴璇曪紝淇敼浠g爜鏃讹紝璇风鎸佸垎浜簿绁烇紝灏嗘偍鐨勬敼杩涘拰鎴愭灉杩涜鍒嗕韩锛屼互渚挎洿澶氫汉鍙楃泭銆

    鎬荤粨

    閫氳繃 CODESYS 缂栧啓鐨勬棆杞熷害璁$畻鍣ㄥ姛鑳藉潡锛岃兘澶熺矖鐣ュ湴閫氳繃浼犳劅鍣ㄤ俊鍙疯绠楄澶囩殑杩愯閫熷害銆傝鏂规硶绠鍗曢珮鏁堬紝瀹炵幇鎴愭湰浣庯紝閫傜敤浜庡绉嶅伐涓氳嚜鍔ㄥ寲鍦烘櫙銆

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

    浣跨敤閬撳叿 涓炬姤

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

    鏈増绉垎瑙勫垯

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

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

    GMT+8, 2024-11-23 20:13 , Processed in 0.148867 second(s), 61 queries .

    閰峰痉缃

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

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