Child of Autopoietic_System_Final_Project-Nicolas_Pelaez

No preview image

1 collaborator

Default-person Nicolas Pelaez (Author)

Tags

(This model has yet to be categorized with any tags)
Model group EECS-372 Spring 2009 | Visible to everyone | Changeable by group members (EECS-372 Spring 2009)
Model was written in NetLogo 4.1beta3 • Viewed 311 times • Downloaded 11 times • Run 9 times
Download the 'Child of Autopoietic_System_Final_Project-Nicolas_Pelaez' modelDownload this modelEmbed this model

Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)


WHAT IS IT?

This section could give a general understanding of what the model is trying to show or explain.

HOW IT WORKS

This section could explain what rules the agents use to create the overall behavior of the model.

HOW TO USE IT

This section could explain how to use the model, including a description of each of the items in the interface tab.

THINGS TO NOTICE

This section could give some ideas of things for the user to notice while running the model.

THINGS TO TRY

This section could give some ideas of things for the user to try to do (move sliders, switches, etc.) with the model.

EXTENDING THE MODEL

This section could give some ideas of things to add or change in the procedures tab to make the model more complicated, detailed, accurate, etc.

NETLOGO FEATURES

This section could point out any especially interesting or unusual features of NetLogo that the model makes use of, particularly in the Procedures tab. It might also point out places where workarounds were needed because of missing features.

RELATED MODELS

This section could give the names of models in the NetLogo Models Library or elsewhere which are of related interest.

CREDITS AND REFERENCES

This section could contain a reference to the model's URL on the web if it has one, as well as any other necessary credits or references.

Comments and Questions

Please start the discussion about this model! (You'll first need to log in.)

Click to Run Model

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;COMPUTATIONAL AUTOPOIESIS;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

turtles-own
 [ partner 
 ]
; There are 3 cehmical species in the model: A, B and M 
breed [ As A ] ; A is the catalyst of the reaction converting B into M
breed [ Bs B ] ; B is the substrate that is converted into M (see reactions below)
breed [ Ms M ] ; M is the component of the Membrane and can spontaneously be 
; degraded back into B (see reactions below)
breed [ LMs LM ] ; LMs represent the Linked Membrane components. There were separated as a 
; different breed form Ms to facilitate coding but represent the same molecular species.

to setup
   clear-all
   ;set-default-shape As to "molecule1" ; REMEMBER TO CHANGE THE SHAPES OF THE TURTLES
   ;set-default-shape Bs to "molecule2"  ; REMMBER TO CHANGE THE SHAPES OF THE TURTLES
   create-As Number_A-Catalysts
     [ setxy 0 0;random-xcor random-ycor 
       set color blue 
     ] 
   
   create-Bs Number_B-Substrates 
     [ setxy random-xcor random-ycor 
       set color red 
     ]
     tick
     ask turtles [ set partner nobody ]; this resets partnerships form previous runs. 
   create-ordered-LMs Initial_Number_LMs ; use 40 LMs as initial number!!!!!
     [ ; this is to create the initial membrane components required to start the simulation
            let i 1
            foreach sort LMs [
            ask ? [
      ;show ?
      ;show i
      create-link-with (item i sort LMs)
         ]
         set i (i + 1) mod count LMs 
         ]
         layout-circle sort LMs 5; (count LMs / 8); (count LMs / 8))
        ask links [ tie ]
        set color pink
     ] 
;      ask LMs 
;       [
;         if any? other (LMs in-radius 0.5 )
;         [ set partner one-of other turtles-here with [partner = nobody]
;            ;create-link-with parter ; 
;            ; restrict number of partners to two.....
;             create-link-with one-of other LMs 
;        ]
;       ]  
; sort is not ordered. it creates a list [ ]
;ask? refers to a dude in the lost. ? means to pick some one in the list. 
;beause i is 1 at the begining of list and. mod is like the colck arithmetic to wrapp around in  the list 
; create-links-with turltles with  [count link-neighbors = 1 ]
end 

to go
  tick
  move-turtles
   if (count As <= 0) or (count Bs <= 0) or (count Ms >= 300)
    [ stop ] 
    ask turtles
     [ 
        if (breed = As)    
           [ synthesize-M ] ; do the M synthesis reaction
        if (breed = Ms)  
           [ 
             disintegrate-Ms
             disintegrate-LMs
             link-Ms
             link-LMs
             ] ; do M spontaneous disintegration reaction         
     ]
     do-plot
end 

to move-turtles
  ask turtles
   [ 
     if breed = As [
       left random 40 right random 40
       forward 0.1
       let nearbyMembraneMs (LMs in-radius 0.5) ;with [ any? link-neighbors ] 
       if any? nearbyMembraneMs 
       [
         face one-of nearbyMembraneMs
         right 180 ; this makes the As stay away form the Ms. This property is required in   
         fd 0.1    ; order to achive impermeability of As through the membrane.
       ]
     ]
     if breed = Bs [
       left random 40 right random 40
       forward 0.1
     ]
     if breed = Ms [
       left random 40 right random 40
       forward 0.1
       let nearbyMembraneMs (other LMs in-radius 0.5) ;with [ any? link-neighbors ] 
       if any? nearbyMembraneMs 
       [
         face one-of nearbyMembraneMs
         right 180
         fd 0.1
       ]
     ]
;     if breed = LMs [  ; this is to move the circle
;        ask LMs [ rt random 1 lt random 1 fd 0.1 ]
;     ]
   ]
end 

to synthesize-M ; synthesis of M is given by the rule: if 1A + 2Bs come close enough this gives 1M an A and the Bs dissapear
  ;self is an A particle
  if synthesize-M? ; this turns on and off the synthesis reaction according to a switch
  [
    ; how do I ask only one breed. the catalysts As to do this, and not any other breed???
    if (count Bs in-radius reaction-range) >= 2; QUESTION: if I want to match 1 A with 2 Bs do I use As or A and a number?
     [ 
       let reacting-Bs n-of 2 Bs in-radius reaction-range
       ask reacting-Bs [ die ]
       hatch-Ms 1 [ set color green ] 
     ]
  ]    
end 

to disintegrate-Ms ; some few Ms once formed disintegrate spontaneously and give back 2Bs 
  if disintegrate-M? ; this turns on and off the disintegration reaction according to a switch
   [ 
     if random-float 100 <= Probability_M-disintegration ; QUESTION: check this to see if it correctly coded!
     [ hatch-Bs 2 [set color yellow ]
       die 
     ]
     
   ]
end   

to disintegrate-LMs
  if disintegrate-LM?
  [
    if random-float 1000 <= Probability_LM-disintegration; 
    [ hatch-Ms 1 [ set color green ]       
     ask one-of LMs [die] ;QUESTION: when there are no more LMs I get an error message 
                   ;because NetLogo gets an empty agent set (Nobody). how can I solve that?
    ]    
  ]
end 

to link-Ms   ; this is to link the formed Ms
;  if any? other (Ms in-radius 0.1)
;  [
;  create-link-with one-of other Ms
;  ]
end 

to link-LMs ; this links the formed Ms to prelinked MS called LMs
  ; the procedure intends to repair the membrane when it has gaps between to adjacent single linked LMs.
   ask LMs
   [
     ask LMs with [ count link-neighbors < 2 ] 
      [
       set color yellow
       let linking-targets (LMs in-radius 1 with [count link-neighbors < 2 ])
       if (any? LMs in-radius 1 with [count link-neighbors < 2 ] ) and (any? Ms in-radius 0.9) 
         [ set color orange
          ask Ms in-radius 0.9  [ die ]
          hatch-LMs 1 
;             [ 
;                ; this is to create the initial membrane components required to start the simulation
;            let i 1
;            foreach sort LMs [
;            ask ? [
;      ;show ?
;      ;show i
;      create-link-with (item i sort LMs)
;         ]
;         set i (i + 1) mod count LMs 
;         ]
;         layout-circle sort LMs 5 
;        ask links [ tie ]
;        set color pink
;     ] 
;               
               layout-circle LMs 5; (count LMs / 8) 
               ;setxy mean [xcor] of linking-targets mean [ycor] of linking-targets
               print linking-targets
               ;print self 
               set color gray ; this is not working, the color thing, and I don't know why.....
             ]
          ;hatch-LMs 1 
         ]
         
       ;if any? MLs in-radius 0.5   
      ]
   ;let unlinked-LMs LMs with [ count link-neighbors < 2 ]
     ;show unlinked-LMs
     ;ask unlinked-LMs [ set color yellow ] 
   ;if any? LMs in-radius 1 with  [count link-neighbors < 2 ]
    ;[hatch 1
    ;hatch 1 print self
    ;set breed LMs
    ;create-links-with (LMs in-radius 1)
    ;setxy mean [xcor] of link-neighbors ; or use layout circle......  or face the dud on your right and average of....
          ;mean [ycor] of link-neighbors 
         ;set heading
         ;die  
         ;; JOHSE"S IDEA: LMS own cordinates for the guys that are nearby me....
       
    ;SUGGESTIONS:  at beggining let them know how far away they are from each other....
;    is-list? 1
;    count my-links ;< 2 ;with-max [ 1 ];link-neighbors = 1  ] 
  ;ask LMs [ if in-link-neighbors = 1   
  
;     if any? linked-neighbor other (Ms in-radius 0.1)
;  create-link-with one-of other Ms
end 

to setup-plot
  set-current-plot "Molecule Concentrations"
  ;set-plot-y-range 0 Number-Molecules-APol
end  

to do-plot ; plot concentrations of of the three chemical species
  set-current-plot "Molecule Concentrations"
  set-current-plot-pen "A Catalysts"
  plot count As
  set-current-plot-pen "B Substrates"
  plot count Bs
  set-current-plot-pen "M Product"
  plot count Ms
  set-current-plot-pen "Linked Ms (LMs)"
  plot count LMs
end  

;QUESTIONS:
;-how can I represent the membrane
;-how can I restrict the movement within a bounded structure: coding options? 
;-how can I represent the links between M-M-Ms?
;SUGGESTIONS
;ADD ANOTHER RULE, M'S CAN ONLY HAVE 2 LINKS.also: 
; IF THERE IS ANY M WITHIN A GIVE NEIGHBORHOOD THEN they can CREATE A LINK. 

There are 5 versions of this model.

Uploaded by When Description Download
Nicolas Pelaez almost 9 years ago Autopoietic system including membrane Download this version
Nicolas Pelaez almost 9 years ago New sliders for permeability, rates and probabilities Download this version
Nicolas Pelaez almost 9 years ago Code cleaned colors agents changed model improved Download this version
Nicolas Pelaez almost 9 years ago Almost finished version Download this version
Nicolas Pelaez almost 9 years ago Almost finished version Download this version

Attached files

No files

Parent: Autopoietic_System_Final_Project-Nicolas_Pelaez

This model does not have any descendants.

Graph of models related to 'Child of Autopoietic_System_Final_Project-Nicolas_Pelaez'