2014-01-14 91 views
2

我有一個動物在風景中移動的NetLogo模型。我想隨機放置虛擬的「相機陷阱」(使用紅外光束拍攝動物照片的野外相機),在相距一定距離的地方進行拍攝。然後,當其中一隻動物在相機陷阱的某個半徑內行走時,將記錄關於動物的刻度號和信息。請參閱下面的說明性示例。基於插圖,我想報告那些與相機陷阱周圍的淺藍色區域相交的動物(星星)的勾號和動物信息。我不知道如何做到這一點。任何建議都會非常有幫助。謝謝。在NetLogo中創建虛擬陷阱

enter image description here

回答

3

這僅僅是一些代碼,讓你開始,有幾個方法可以做到你需要什麼,這只是其中之一。在這個有兩個品種,相機品種(你可能不需要使用一個品種,你可以問一些補丁設置一個變量真正的使他們相機點,然後他們可以有一個記錄),相機點記錄蜱和動物這是通過在半徑2(你可以用它距離原太)

breed [Animals animal] 
breed [Cameras Camera] 
Cameras-own [records] 

to setup 
let Zone 2 
    clear-all 
    reset-ticks 
    resize-world 0 20 0 20 
    set-patch-size 20 
    set-default-shape animals "wolf" 
    set-default-shape cameras "star" 

create-Cameras 5 [ 
    set records [] 
    setxy random max-pxcor random max-pycor 
    set color white 
    ask patches in-radius Zone 
    [ 
    Set pcolor 88 
    ] 
    ] 
Create-animals 10 [move-to one-of patches] 
end 



end 
to go 
ask animals 
[ 
    animals-walk 
    ] 


tick 
end 

to animals-walk 
    rt random 10 
    fd 1 
    if any? cameras in-radius 2 [ 

    ask one-of cameras in-radius 2 [ 
     set records lput (list ticks myself) records 
    ]] 

end 

enter image description here

observer> ask camera 4 [ print records] 
    [[0 (animal 10)] [0 (animal 11)] [1 (animal 10)] [1 (animal 6)] [2 (animal 10)] 
    [2 (animal 6)] [3 (animal 10)] [3 (animal 6)] [4 (animal 6)] [10 (animal 7)] 
    [11 (animal 7)] [12 (animal 7)] [13 (animal 7)]] 

更新: 這一個不使用品種的相機,而不是使用的貼片:

breed [Animals animal] 

patches-own [records is-camera-point?] 
Globals [Cameras] 

    to setup 
    let Zone 2 
     clear-all 
     reset-ticks 
     resize-world 0 20 0 20 
     set-patch-size 20 
     set-default-shape animals "wolf" 
    setup-world 

    Create-animals 10 [move-to one-of patches] 
    end 

    to setup-world 
    ask patches [ 
     set pcolor white 
     set records [] 
     set is-camera-point? false 
    ] 

    ask n-of 5 patches [ 
     set is-camera-point? true 
     set records [] 

     set pcolor red] 

    set Cameras patches with [is-camera-point?] 
    end 
    to go 
    ask animals 
    [ 
     animals-walk 
     ] 


    tick 
    end 

    to animals-walk-with-Radius 
     rt random 10 
     fd 1 
     if any? cameras in-radius 2 [ 

     ask one-of cameras in-radius 2 [ 
      set records lput (list ticks myself) records 
     ] 
     ] 

    end 
    to animals-walk ; with distance 
     rt random 10 
     fd 1 
     if any? cameras with [distance myself < 2] [ 

     ask one-of cameras with [distance myself < 2] [ 
      set records lput (list ticks myself) records 
     ] 
     ] 

    end 
+1

馬上工作吧!謝謝! – user2359494

+0

@ user2359494可以請您提供完整的模型給我,我想延長它,請發送到我的電子郵件:)我的電子郵件:[email protected]在先感謝#look有趣 –