⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 robotarm.fbk

📁 MATLAB遗传代码的源码 具体如何使用?希望能受到指点
💻 FBK
字号:
FEEDBACK Fdbck

CYCLE_TIME      0.05

!        Name      MIN   MAX
INOUT Movement (-50.0, 50.0)
IN    Current  (-1.0, 1.0)
INOUT Position (0.0, 70.0)
OUT   Pos_error(-70.0, 70.0)
IN    Reference(0.0, 70.0)
LOCAL Last_move(-50.0, 50.0)

INITIALIZATION
    Pos_error =  0;
    Last_move = Movement;
    Position  = 0;
    Movement  = 0;
BEGIN
    Pos_error = Reference - Position;
    Position = DELTA_TIME * ( Movement + Last_move ) / 2 + Position;
    Last_move = Movement;
END;

PRESET  ! 0
!    Reference = 70;
    Position  = 0;
END;

PRESET  ! 1
!    Reference = 35;
    Position  = 40;
END;

PRESET  ! 2
!    Reference = 35;
    Position  = 0;
END;

PRESET  ! 3
!    Reference = 35;
    Position  = 70;
END;

PRESET  ! 4
!    Reference = 35;
    Position  = 25;
END;

!        Name                     Below    Low   High  Above  Max_truth
Symbol   Very_low    OF Position (  0.0,   0.0,   3.0,   8.0,   1.0)
Symbol   Low         OF Position (  0.0,   0.0,  25.0,  30.0,   1.0)
Symbol   Medium_low  OF Position ( 25.0,  30.0,  30.0,  35.0,   1.0)
Symbol   Medium      OF Position ( 30.0,  35.0,  35.0,  40.0,   1.0)
Symbol   Medium_high OF Position ( 35.0,  40.0,  40.0,  45.0,   1.0)
Symbol   High        OF Position ( 40.0,  45.0,  70.0,  70.0,   1.0)
Symbol   Very_High   OF Position ( 60.0,  65.0,  70.0,  70.0,   1.0)

!        Name                     Below    Low   High  Above  Truth  Center
Symbol   Down_large  OF Movement (-50.0, -50.0, -20.0, -10.0,   1.0, -50.0) 
Symbol   Down_small  OF Movement (-20.0, -10.0, -10.0,   0.0,   1.0) 
Symbol   Zero        OF Movement (-10.0,   0.0,   0.0,  10.0,   1.0) 
Symbol   Up_small    OF Movement (  0.0,  10.0,  10.0,  20.0,   1.0) 
Symbol   Up_large    OF Movement ( 10.0,  20.0,  50.0,  50.0,   1.0,  50.0)

Symbol   Down_medium OF Movement (-25.0, -15.0, -15.0,  -5.0,   1.0)
Symbol   Down_creep  OF Movement (-10.0,  -5.0,  -5.0,   0.0,   1.0)
Symbol   Up_creep    OF Movement (  0.0,   5.0,   5.0,  10.0,   1.0)
Symbol   Up_medium   OF Movement (  5.0,  15.0,  15.0,  25.0,   1.0)

!        Name            Below    Low   High  Above  Truth   Center
Symbol   Negative_large ( -1.0,  -1.0,  -0.4,  -0.2,   1.0,  -1.0)
Symbol   Negative_small ( -0.4,  -0.2,  -0.2,   0.0,   1.0)
Symbol   Zero           ( -0.2,   0.0,   0.0,   0.2,   1.0)
Symbol   Positive_small (  0.0,   0.2,   0.2,   0.4,   1.0)
Symbol   Positive_large (  0.2,   0.4,   1.0,   1.0,   1.0,   1.0)

Symbol   Negative       ( -1.0,  -1.0,   0.0,   0.0,   1.0)
Symbol   Positive       (  0.0,   0.0,   1.0,   1.0,   1.0)

!!!!! Rules for output movement
!
!      -------------- Current --------------
!       -L      -S      ZERO    +S      +L
!-----|-------------------------------------
!  UL | ZERO    US      UL      UM      UL  
!  US | DS      ZERO    US      US      UM
!  Z  | DS      DS      ZERO    US      US  
!  DS | DM      DS      DS      ZERO    US  
!  DL | DL      DM      DL      DS      ZERO
!

IF Position IS Very_low AND Current IS Positive
THEN Movement IS Up_creep

IF Position IS Very_low AND Current IS Negative
THEN Movement IS Down_creep

IF Position IS Very_high AND Current IS Positive
THEN Movement IS Up_creep

IF Position IS Very_high AND Current IS Negative
THEN Movement IS Down_creep

IF Movement IS up_large AND Current IS Negative_large
THEN Movement IS Zero

IF Movement IS up_large AND Current IS Negative_small
THEN Movement IS Up_small

! this rule will cause a peak Movement
!IF Movement IS up_large AND Current IS Zero
!THEN Movement IS Up_large

IF Movement IS up_large AND Current IS Positive_small
THEN Movement IS Up_medium

IF Movement IS up_large AND Current IS Positive_large
THEN Movement IS Up_large

IF Movement IS Up_small AND Current IS Negative_large
THEN Movement IS Down_small

IF Movement IS Up_small AND Current IS Negative_small
THEN Movement IS Zero

IF Movement IS Up_small AND Current IS Zero
THEN Movement IS Up_small

IF Movement IS Up_small AND Current IS Positive_small
THEN Movement IS Up_small

IF Movement IS Up_small AND Current IS Positive_large
THEN Movement IS Up_medium

IF Movement IS Zero AND Current IS Negative_large
THEN Movement IS Down_creep

IF Movement IS Zero AND Current IS Negative_small
THEN Movement IS Down_creep

IF Movement IS Zero AND Current IS Zero
THEN Movement IS Zero

IF Movement IS Zero AND Current IS Positive_small
THEN Movement IS Up_creep

IF Movement IS Zero AND Current IS Positive_large
THEN Movement IS Up_small

IF Movement IS Down_small AND Current IS Negative_large
THEN Movement IS Down_medium

IF Movement IS Down_small AND Current IS Negative_small
THEN Movement IS Down_small

IF Movement IS Down_small AND Current IS Zero
THEN Movement IS Down_small

IF Movement IS Down_small AND Current IS Positive_small
THEN Movement IS Zero

IF Movement IS Down_small AND Current IS Positive_large
THEN Movement IS Up_small

IF Movement IS Down_large AND Current IS Negative_large
THEN Movement IS Down_large

IF Movement IS Down_large AND Current IS Negative_small
THEN Movement IS Down_medium

IF Movement IS Down_large AND Current IS Zero
THEN Movement IS Down_large

IF Movement IS Down_large AND Current IS Positive_small
THEN Movement IS Down_small

IF Movement IS Down_large AND Current IS Positive_large
THEN Movement IS Zero

END Fdbck;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -