Yogogourt

No preview image

1 collaborator

Default-person Bryan Guo (Author)

Tags

(This model has yet to be categorized with any tags)
Model group LS426_2013 | Visible to everyone | Changeable by everyone
Model was written in NetLogo 5.0.3 • Viewed 268 times • Downloaded 26 times • Run 0 times
Download the 'Yogogourt' 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?

(a general understanding of what the model is trying to show or explain)

HOW IT WORKS

(what rules the agents use to create the overall behavior of the model)

HOW TO USE IT

(how to use the model, including a description of each of the items in the Interface tab)

THINGS TO NOTICE

(suggested things for the user to notice while running the model)

THINGS TO TRY

(suggested things for the user to try to do (move sliders, switches, etc.) with the model)

EXTENDING THE MODEL

(suggested things to add or change in the Code tab to make the model more complicated, detailed, accurate, etc.)

NETLOGO FEATURES

(interesting or unusual features of NetLogo that the model uses, particularly in the Code tab; or where workarounds were needed for missing features)

RELATED MODELS

(models in the NetLogo Models Library and elsewhere which are of related interest)

CREDITS AND REFERENCES

(a reference to the model's URL on the web if it has one, as well as any other necessary credits, citations, and links)

Comments and Questions

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

Click to Run Model

;NetLogo Lab Project "Yogogourt" for LS_426 Winter 2013
; Copyright 2013 Bryan Guo & Tristan Sokol.


extensions [gogo]


globals [serial-port acidity temperature] 
breed [caseins casein]
breed [bacteria bacterium]
bacteria-own [bact-energy acid age bact-timer]  
caseins-own [destablized? cas-timer]

to add-milk
  set sugar 1000
  create-caseins 100
[
  set color white 
  set size 2
  set cas-timer 6000
  set shape "dot"
  set destablized? false
  setxy random-xcor random-ycor
  ]
end 

to stir
  if temperature < 600 [
    gogo:talk-to-output-ports [ "b" ]
    gogo:output-port-on
    ]
    gogo:talk-to-output-ports [ "a" ]
    gogo:output-port-off
    gogo:talk-to-output-ports [ "b" ]
    gogo:output-port-off
end 

to brownian  
ask caseins [
  ifelse count caseins-on neighbors >= 1 
  [
    rt random 360 fd 2]
  [lt random 360 fd 1 bk 1]
]
end 

to coagulate 
ask caseins [
    ifelse count caseins-on neighbors < 1
    [rt random 360 fd 1]
    [lt random 360 fd 1 bk 1
      if cas-timer = 0 [
      create-link-with one-of caseins-on neighbors]
      set cas-timer cas-timer - 1
      ] 
  ]
end 

to be-caseins 
    ask caseins [
      ifelse destablized? = 1
      [coagulate]
      [brownian]
    ]
end 

to setup
    ifelse length (gogo:ports) > 0
    [ set serial-port user-one-of "Select a port:" gogo:ports ]
    [ user-message "There is a problem with the connection. Check if the board is on, and if the cable is connected. Otherwise, try to quit NetLogo, power cycle the GoGo Board, and open NetLogo again. For more information on how to fix connection issues, refer to the NetLogo documentation or the info tab of this model"
      stop ]
  gogo:open serial-port
  repeat 5
  [ if not gogo:ping
    [ user-message "There is a problem with the connection. Check if the board is on, and if the cable is connected. Otherwise, try to quit NetLogo, power cycle the GoGo Board, and open NetLogo again. For more information on how to fix connection issues, refer to the NetLogo documentation or the info tab of this model"] ]
  gogo:talk-to-output-ports [ "a" "b" "c" "d"]
  set temperature gogo:sensor 1
  set temperature 600 ; test
  ca
  reset-ticks
  add-milk
end 

to go
  display
  ask caseins [be-caseins]
  ask bacteria [
    set acidity acidity + 1
    move
    reproduce
    ]
  if acidity > 1024 [
    ask caseins [set color yellow set destablized? 1]
    ]
  stir
  tick
end 

to move
  rt random 50
  lt random 50
  fd random 3
  set age age + 1 
  set acidity acidity + 1 
  if age > 12 [die]
end 

to add-bacteria
    create-bacteria 1 [
      set age 0
      set shape "dot" 
      set color red 
      set bact-timer temperature / 10 
      setxy random-xcor random-ycor
      set acidity 1
    ] 
end 

to reproduce 
ask bacteria [
if bact-timer = 0 [
  hatch 1 rt random 360 fd 1
;  set acidity acidity + 1
  ]
set bact-timer bact-timer - 1
]
end 

There is only one version of this model, created over 12 years ago by Bryan Guo.

Attached files

No files

This model does not have any ancestors.

This model does not have any descendants.