Yogogourt
No preview image
Model was written in NetLogo 5.0.3
•
Viewed 473 times
•
Downloaded 38 times
•
Run 0 times
Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)
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 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 ifelse gogo:sensor 1 < 580 [ 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 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 are 2 versions of this model.
Attached files
No files
This model does not have any ancestors.
This model does not have any descendants.