CODESYS涓璖M3_Math搴撲腑鐨勫悜閲忚繍绠-CODESYS璧勬簮涓嬭浇鍖-閰峰痉缃 - CoDeSys杞欢鏁欑▼涓嬭浇,CoDeSys宸ユ帶璧勮闂ㄦ埛
HSC6490-cn涓浗鍒堕狅紝涓浗鑺瘇
鏌ョ湅: 4429|鍥炲: 2

CODESYS涓璖M3_Math搴撲腑鐨勫悜閲忚繍绠

[澶嶅埗閾炬帴]
  • TA鐨勬瘡鏃ュ績鎯
    鎿︽睏
    2019-8-13 14:13
  • 绛惧埌澶╂暟: 32 澶

    [LV.5]甯镐綇灞呮皯I

    鍙戣〃浜 2020-6-17 10:45:16 | 鏄剧ず鍏ㄩ儴妤煎眰 |闃呰妯″紡
    SMC_VECTOR3D
    SMC_VECTOR3D鏄疭M3_Math搴撲腑鐨3缁村悜閲忔暟鎹粨鏋勶紝褰㈠紡濡備笅锛
    [C] 绾枃鏈煡鐪 澶嶅埗浠g爜
    TYPE SMC_VECTOR3D :
    STRUCT
        dX:LREAL;
        dY:LREAL;
        dZ:LREAL;
    END_STRUCT
    END_TYPE
    SMC_V3_Add (FUN)
    鍔熻兘锛氫袱涓3缁村悜閲忕殑鍔犳硶
    鍙傛暟锛
    bVbGD9g.jpg
    绀轰緥锛
    澹版槑閮ㄥ垎锛
    [C] 绾枃鏈煡鐪 澶嶅埗浠g爜
    PROGRAM PLC_PRG
    VAR
        vDst: SM3M.SMC_Vector3D;
        vLhs: SM3M.SMC_Vector3D:=(dX := 1, dY := 3, dZ := 5);
        vRhs: SM3M.SMC_Vector3D:=(dX := 2, dY := 4, dZ := 6);
    END_VAR
    瀹炵幇閮ㄥ垎锛
    [C] 绾枃鏈煡鐪 澶嶅埗浠g爜
    SMC_V3_Add(vDst:= vDst, vLhs:= vLhs, vRhs:= vRhs);
    鎵ц缁撴灉锛
    bVbGD9J.jpg
    SMC_V3_Angle (FUN)
    鍔熻兘锛氳绠椾袱涓3缁村悜閲忎箣闂寸殑瑙掑害锛堜互寮у害涓哄崟浣嶏級銆傛敞鎰忥細濡傛灉鍚戦噺涔嬩竴鐨勯暱搴︿负闆讹紝鍒欑粨鏋滀负闆躲傝繑鍥炵殑鍊煎湪[0 .. pi]鑼冨洿鍐呫
    鍙傛暟锛
    bVbGEix.jpg
    绀轰緥锛
    澹版槑閮ㄥ垎锛
    [C] 绾枃鏈煡鐪 澶嶅埗浠g爜
    PROGRAM PLC_PRG
    VAR
        v1: SM3M.SMC_Vector3D:=(dX := 1, dY := 0, dZ := 0);
        v2: SM3M.SMC_Vector3D:=(dX := 0, dY := 1, dZ := 0);
        angle: LREAL;
    END_VAR
    瀹炵幇閮ㄥ垎锛
    [C] 绾枃鏈煡鐪 澶嶅埗浠g爜
    angle:=SMC_V3_Angle(v1:= v1, v2:= v2);
    鎵ц缁撴灉锛
    bVbGEi4.jpg
    SMC_V3_CloseRel (FUN)
    鍔熻兘锛氬垽鏂袱涓悜閲廰鍜宐鐨勭浉瀵瑰樊鏄惁鏈澶т负epsilon锛屽嵆|a-b|<= eps * MAX(|a|,|b|)鏄惁鎴愮珛銆倈.| 琛ㄧず娆у嚑閲屽緱鑼冩暟銆
    鍙傛暟锛
    bVbGEki.jpg
    绀轰緥锛
    澹版槑閮ㄥ垎锛
    [C] 绾枃鏈煡鐪 澶嶅埗浠g爜
    PROGRAM PLC_PRG
    VAR
        a: SM3M.SMC_Vector3D:=(dX := 1, dY := 0, dZ := 0);
        b: SM3M.SMC_Vector3D:=(dX := 0.99, dY := 0.01, dZ := 0);
        result: BOOL;
    END_VAR
    瀹炵幇閮ㄥ垎锛
    [C] 绾枃鏈煡鐪 澶嶅埗浠g爜
    result:= SMC_V3_CloseRel(a:= a, b:= b, eps:= 0.1);
    鎵ц缁撴灉锛
    bVbGEkI.jpg
    SMC_V3_Cross (FUN)
    鍔熻兘锛3缁村悜閲忕殑鍙変箻锛屽嵆姹傚悓鏃跺瀭鐩翠袱涓悜閲忕殑鍚戦噺锛歷Dst锛= vLhs x vRhs銆
    鍙傛暟锛
    bVbGW1o.jpg
    绀轰緥锛
    澹版槑閮ㄥ垎锛
    [C] 绾枃鏈煡鐪 澶嶅埗浠g爜
    PROGRAM PLC_PRG
    VAR
        vDst: SM3M.SMC_Vector3D;
        vLhs: SM3M.SMC_Vector3D:=(dX := 1, dY := 3, dZ := 5);
        vRhs: SM3M.SMC_Vector3D:=(dX := 2, dY := 4, dZ := 6);
    END_VAR
    瀹炵幇閮ㄥ垎锛
    [C] 绾枃鏈煡鐪 澶嶅埗浠g爜
    SMC_V3_Sub(vDst:= vDst, vLhs:= vLhs, vRhs:= vRhs);
    鎵ц缁撴灉锛
    bVbGW3c.jpg
    SMC_V3_DistE (FUN)
    鍔熻兘锛氳绠椾袱涓悜閲忕殑娆у紡璺濈銆
    鍙傛暟锛
    bVbGW52.jpg
    绀轰緥锛
    澹版槑閮ㄥ垎锛
    [C] 绾枃鏈煡鐪 澶嶅埗浠g爜
    PROGRAM PLC_PRG
    VAR
        v0: SM3M.SMC_Vector3D:=(dX := 1, dY := 3, dZ := 5);
        v1: SM3M.SMC_Vector3D:=(dX := 2, dY := 4, dZ := 6);
        DistE:LREAL;
    END_VAR
    瀹炵幇閮ㄥ垎锛
    [C] 绾枃鏈煡鐪 澶嶅埗浠g爜
    DistE := SMC_V3_DistE(v0:= v0, v1:= v1);
    鎵ц缁撴灉锛
    bVbGXe0.jpg
    SMC_V3_Dot (FUN)
    鍔熻兘锛氳绠椾袱涓悜閲忕偣涔樸
    鍙傛暟锛
    bVbGXga.jpg
    绀轰緥锛
    澹版槑閮ㄥ垎锛
    [C] 绾枃鏈煡鐪 澶嶅埗浠g爜
    PROGRAM PLC_PRG
    VAR
        v1: SM3M.SMC_Vector3D:=(dX := 1, dY := 3, dZ := 5);
        v2: SM3M.SMC_Vector3D:=(dX := 2, dY := 4, dZ := 6);
        Dot:LREAL;
    END_VAR
    瀹炵幇閮ㄥ垎锛
    [C] 绾枃鏈煡鐪 澶嶅埗浠g爜
    Dot := SMC_V3_Dot(v1:= v1, v2:= v2);
    鎵ц缁撴灉锛
    bVbGXgN.jpg
    SMC_V3_DotSq (FUN)
    鍔熻兘锛氳绠楀悜閲忎笌鑷韩鐨勭偣涔樸
    鍙傛暟锛
    bVbGXhq.jpg
    绀轰緥锛
    澹版槑閮ㄥ垎锛
    [C] 绾枃鏈煡鐪 澶嶅埗浠g爜
    PROGRAM PLC_PRG
    VAR
        v: SM3M.SMC_Vector3D:=(dX := 1, dY := 3, dZ := 5);
        DotSq:LREAL;
    END_VAR
    瀹炵幇閮ㄥ垎锛
    [C] 绾枃鏈煡鐪 澶嶅埗浠g爜
    DotSq := SMC_V3_DotSq(v:= v);
    鎵ц缁撴灉锛
    bVbGXhw.jpg
    SMC_V3_IsScalarMultiple
    鍔熻兘锛氬垽鏂槸鍚﹀瓨鍦ㄥ疄鏁發ambda锛屼娇寰梫 = lambda * u锛屽嵆鍒ゆ柇涓や釜鍚戦噺鏄惁鍏辩嚎銆傦紙璇锋敞鎰忥紝lambda鍙互涓洪浂鎴栬礋鍊笺傦級
    鍙傛暟锛
    bVbGXkz.jpg
    绀轰緥锛
    澹版槑閮ㄥ垎锛
    [C] 绾枃鏈煡鐪 澶嶅埗浠g爜
    PROGRAM PLC_PRG
    VAR
        u: SM3M.SMC_Vector3D:=(dX := 1, dY := 3, dZ := 5);
        v: SM3M.SMC_Vector3D:=(dX := 2, dY := 6, dZ := 9.9);
        dEps:BOOL;
    END_VAR
    瀹炵幇閮ㄥ垎锛
    [C] 绾枃鏈煡鐪 澶嶅埗浠g爜
    dEps :=SMC_V3_IsScalarMultiple(u:= u, v:= v, dEps:= 0.1);
    鎵ц缁撴灉锛
    bVbGXl8.jpg
    SMC_V3_Lint (FUN)
    鍔熻兘锛氬湪涓や釜鍚戦噺涔嬮棿绾挎у唴鎻掞細vDst锛= vLhs *锛1-lambda锛+ vRhs * lambda銆
    鍙傛暟锛
    bVbG35X.jpg
    绀轰緥锛
    澹版槑閮ㄥ垎锛
    [C] 绾枃鏈煡鐪 澶嶅埗浠g爜
    PROGRAM PLC_PRG
    VAR
        vDst: SM3M.SMC_Vector3D;
        vLhs: SM3M.SMC_Vector3D:=(dX := 1, dY := 3, dZ := 5);
        vRhs: SM3M.SMC_Vector3D:=(dX := 2, dY := 4, dZ := 6);
    END_VAR
    瀹炵幇閮ㄥ垎锛
    [C] 绾枃鏈煡鐪 澶嶅埗浠g爜
    SMC_V3_Lint(vDst:= vDst, vLhs:= vLhs, vRhs:= vRhs, lambda:= 0.1);
    鎵ц缁撴灉锛
    bVbG36p.jpg
    SMC_V3_MAdd (FUN)
    鍔熻兘锛氬悜閲忎笌鏁颁箻鍚戦噺鐨勫姞娉曪細vDst := vLhs + d * vRhs.
    鍙傛暟锛
    bVbGEce.jpg
    绀轰緥锛
    澹版槑閮ㄥ垎锛
    [C] 绾枃鏈煡鐪 澶嶅埗浠g爜
    PROGRAM PLC_PRG
    VAR
        vDst: SM3M.SMC_Vector3D;
        vLhs: SM3M.SMC_Vector3D:=(dX := 1, dY := 3, dZ := 5);
        vRhs: SM3M.SMC_Vector3D:=(dX := 2, dY := 4, dZ := 6);
    END_VAR
    瀹炵幇閮ㄥ垎锛
    [C] 绾枃鏈煡鐪 澶嶅埗浠g爜
    SMC_V3_MAdd(vDst:= vDst, vLhs:= vLhs, vRhs:= vRhs,d:=d);
    鎵ц缁撴灉锛
    bVbGEck.jpg
    SMC_V3_Max_Cmp (FUN)
    鍔熻兘锛氳绠椾袱涓悜閲忕殑鎸夊垎閲忔渶澶у笺備袱涓悜閲忓繀椤诲叿鏈夌浉鍚岀殑缁村害銆
    鍙傛暟锛
    bVbG37k.jpg
    绀轰緥锛
    澹版槑閮ㄥ垎锛
    [C] 绾枃鏈煡鐪 澶嶅埗浠g爜
    PROGRAM PLC_PRG
    VAR
        vDst: SM3M.SMC_Vector3D;
        vLhs: SM3M.SMC_Vector3D:=(dX := 1, dY := 3, dZ := 5);
        vRhs: SM3M.SMC_Vector3D:=(dX := 3, dY := 5, dZ := 1);
    END_VAR
    瀹炵幇閮ㄥ垎锛
    [C] 绾枃鏈煡鐪 澶嶅埗浠g爜
    SMC_V3_Max_Cmp(vDst:= vDst, v0:= v0, v1:= v1);
    鎵ц缁撴灉锛
    bVbG38j.jpg
    SMC_V3_Min_Cmp (FUN)
    鍔熻兘锛氳绠椾袱涓悜閲忕殑鎸夊垎閲忔渶灏忓笺 涓や釜鍚戦噺蹇呴』鍏锋湁鐩稿悓鐨勭淮搴︺
    鍙傛暟锛
    bVbG37k.jpg
    绀轰緥锛
    澹版槑閮ㄥ垎锛
    [C] 绾枃鏈煡鐪 澶嶅埗浠g爜
    PROGRAM PLC_PRG
    VAR
        vDst: SM3M.SMC_Vector3D;
        vLhs: SM3M.SMC_Vector3D:=(dX := 1, dY := 3, dZ := 5);
        vRhs: SM3M.SMC_Vector3D:=(dX := 3, dY := 5, dZ := 1);
        d:LREAL:=2;
    END_VAR
    瀹炵幇閮ㄥ垎锛
    [C] 绾枃鏈煡鐪 澶嶅埗浠g爜
    SMC_V3_Min_Cmp(vDst:= vDst, v0:= v0, v1:= v1);
    鎵ц缁撴灉锛
    bVbG4aY.jpg
    SMC_V3_Mult (FUN)
    鍔熻兘锛氬皢鍚戦噺涔樹互鏍囬噺锛歷Dst锛= d * vSrc銆
    鍙傛暟锛
    bVbG4tF.jpg
    绀轰緥锛
    澹版槑閮ㄥ垎锛
    [C] 绾枃鏈煡鐪 澶嶅埗浠g爜
    PROGRAM PLC_PRG
    VAR
        vDst: SM3M.SMC_Vector3D;
        vSrc: SM3M.SMC_Vector3D:=(dX := 1, dY := 3, dZ := 5);    
        d: LREAL:=2;
    END_VAR
    瀹炵幇閮ㄥ垎锛
    [C] 绾枃鏈煡鐪 澶嶅埗浠g爜
    SMC_V3_Mult(vDst:= vDst, vSrc:= vSrc, d:= d);
    鎵ц缁撴灉锛
    bVbG4us.jpg
    SMC_V3_NormE (FUN)
    鍔熻兘锛氳绠楀悜閲忕殑娆у嚑閲屽緱鑼冩暟
    鍙傛暟锛
    bVbG4ve.jpg
    绀轰緥锛
    澹版槑閮ㄥ垎锛
    [C] 绾枃鏈煡鐪 澶嶅埗浠g爜
    PROGRAM PLC_PRG
    VAR
        v: SM3M.SMC_Vector3D:=(dX := 1, dY := 3, dZ := 5);    
        NormE: LREAL;
    END_VAR
    瀹炵幇閮ㄥ垎锛
    [C] 绾枃鏈煡鐪 澶嶅埗浠g爜
    NormE:=SMC_V3_NormE(v:= v);
    鎵ц缁撴灉锛
    bVbG4vy.jpg
    SMC_V3_NormMax (FUN)
    鍔熻兘锛氳绠楀悜閲忕殑鏈澶ц寖鏁般
    鍙傛暟锛
    bVbG4wG.jpg
    绀轰緥锛
    澹版槑閮ㄥ垎锛
    [C] 绾枃鏈煡鐪 澶嶅埗浠g爜
    PROGRAM PLC_PRG
    VAR
        v: SM3M.SMC_Vector3D:=(dX := 1, dY := 3, dZ := 5);    
        NormMax: LREAL;
    END_VAR
    瀹炵幇閮ㄥ垎锛
    [C] 绾枃鏈煡鐪 澶嶅埗浠g爜
    NormMax:=SMC_V3_NormMax(v:= v);
    鎵ц缁撴灉锛
    bVbG4w3.jpg
    SMC_V3_Serialize (FUN)
    鍔熻兘锛氬悜閲忓簭鍒楀寲銆
    鍙傛暟锛
    bVbG4ye.jpg
    绀轰緥锛
    澹版槑閮ㄥ垎锛
    [C] 绾枃鏈煡鐪 澶嶅埗浠g爜
    PROGRAM PLC_PRG
    VAR
        v: SM3M.SMC_Vector3D:=(dX := 1, dY := 3, dZ := 5);    
        stream: SM3M.SM0.OutStringStream;
        result:BOOL;
    END_VAR
    瀹炵幇閮ㄥ垎锛
    [C] 绾枃鏈煡鐪 澶嶅埗浠g爜
    result:=SMC_V3_Serialize(stream:= stream, v:= v);
    鎵ц缁撴灉锛
    bVbG4x6.jpg
    SMC_V3_Sub (FUN)
    鍔熻兘锛氫袱涓3缁村悜閲忕殑鍑忔硶
    鍙傛暟锛
    bVbGEag.jpg
    绀轰緥锛
    澹版槑閮ㄥ垎锛
    [C] 绾枃鏈煡鐪 澶嶅埗浠g爜
    PROGRAM PLC_PRG
    VAR
        vDst: SM3M.SMC_Vector3D;
        vLhs: SM3M.SMC_Vector3D:=(dX := 1, dY := 3, dZ := 5);
        vRhs: SM3M.SMC_Vector3D:=(dX := 2, dY := 4, dZ := 6);
    END_VAR
    瀹炵幇閮ㄥ垎锛
    [C] 绾枃鏈煡鐪 澶嶅埗浠g爜
    SMC_V3_Sub(vDst:= vDst, vLhs:= vLhs, vRhs:= vRhs);
    鎵ц缁撴灉锛
    bVbGEaI.jpg
    鏈畬寰呯画銆傘傘

    +11
    涓嶈禐涓涓紵

    鏈杩戣皝璧炶繃

    鎵撹祻榧撳姳涓涓嬶紒
    鍥炲

    浣跨敤閬撳叿 涓炬姤

  • TA鐨勬瘡鏃ュ績鎯

    2022-4-11 22:35
  • 绛惧埌澶╂暟: 35 澶

    [LV.5]甯镐綇灞呮皯I

    鍙戣〃浜 2020-7-7 15:11:07 | 鏄剧ず鍏ㄩ儴妤煎眰
    涓昏鍝噷鐢ㄥ埌锛岀┖闂翠笁缁村悜閲忕殑杩愮畻浼氱敤鍦ㄥ摢閲岋紵
    +10
    涓嶈禐涓涓紵
    鎵撹祻榧撳姳涓涓嬶紒

    璇ョ敤鎴蜂粠鏈鍒

    鍙戣〃浜 2021-4-17 23:09:05 | 鏄剧ず鍏ㄩ儴妤煎眰
    寮遍棶涓涓嬶紝Codesys杩欎簺搴撶殑鍑芥暟瀹炵幇锛屾槸鐢ㄤ粈涔堣瑷鍐欑殑锛
    涔熸槸鐢⊿T璇█鍚楋紝杩樻槸鐢–璇█缂栬瘧鎴恉ll璋冪敤鐨勫憿锛
    +10
    涓嶈禐涓涓紵
    鎵撹祻榧撳姳涓涓嬶紒
    鎮ㄩ渶瑕佺櫥褰曞悗鎵嶅彲浠ュ洖甯 鐧诲綍 | 绔嬪嵆娉ㄥ唽 鏂版氮寰崥鐧婚檰

    鏈増绉垎瑙勫垯

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

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

    GMT+8, 2024-11-23 20:31 , Processed in 0.208655 second(s), 71 queries .

    閰峰痉缃

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

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