Nutrition 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
;;A tick is one minute of activity, there are 3600 ticks in a day. ;;The color of the background represents how fast the body is using energy, i.e. metabolism ;; In this model, the body consumes calories and attempts to consume calories based on the body's needs ;; There are 1440 ticks in a day, each tick represents a minute ;;The 5 macronutrients. One agent represents a calorie of the nutrient breed [fats fat] breed [carbohydrates carbohydrate] breed [proteins protein] breed [fibers fiber] breed [water single-water] ;;Persistent agents, body stores breed [body-fat body-fats] globals [ basal-metabolic-rate ;;Calories/Day at rest height ;;Height in meters base-weight ;;Weight without body fat weight ;;Weight in Kilograms age ;;Age in years calorie-defecit calories-burned-today calories-consumed-today ] ;; IDEAL DIET COMPOSITION ;; These represent the ideal consumption patterns for americans, set forth by www.health.gov 2010 Dietary Guidelines to set-colors end to setup clear-all ;;In the future, BMR could be a dynamic variable set basal-metabolic-rate 2000 set calorie-defecit 0 set calories-burned-today 0 set calories-consumed-today 0 set base-weight 70 ;;Height, weight, and age are not dynamic variables in this model set-default-shape turtles "circle" ask turtles [ set size 0.5 ] ask patches [ set pcolor white ] ask patches with [ pxcor = 0 ] [ set pcolor black ] ;;http://nutrition.mcdonalds.com/nutritionexchange/nutritionfacts.pdf end to go if ( ticks mod 1400 = 0 ) [ set calories-burned-today 0 set calories-consumed-today 0 ] eat-meals digest update-plots tick end to eat-meals ;;Eat meals if ( ( ticks mod 1400 ) = 480) [ ;;Breakfast at 8 am eat-food-named "sausage-mcmuffin" eat-food-named "orange-juice" ] if (ticks mod 1400 = 720) [ ;;Lunch at 12 pm eat-food-named "big-mac" eat-food-named "large-fries" eat-food-named "orange-juice" ] if(ticks mod 1400 = 1080) [ ;;Dinner at 6 pm eat-food-named "big-mac" eat-food-named "large-coke" ] if( ticks mod 1400 = 1320 ) [ ;;10 PM snack eat-food-named "oreo-mcflurry" ] end to eat-food-named [ food-name ] if( food-name = "big-mac" ) [ eat-food 29 45 25 6 0 ;;McDonalds Big Mac ] if( food-name = "sausage-mcmuffin" ) [ eat-food 22 29 14 2 0 ;;McDonalds Sausage McMuffin ] if( food-name = "orange-juice" ) [ eat-food 0 39 3 0 0 ;;McDonalds Medium Orange Juice ] if( food-name = "diet-coke" ) [ eat-food 0 0 0 0 0;;Medium Diet Coke ] if( food-name = "coke" ) [ eat-food 0 86 0 0 0;; Large Coca-Cola ] if( food-name = "large-fries" ) [ eat-food 25 63 6 6 0 ;;McDonalds Large Fries ] if( food-name = "oreo-mcflurry" ) [ eat-food 19 89 13 3 0;;McDonalds Oreo McFlurry ] end to eat-food [ grams-fat grams-carbohydrate grams-protein grams-fiber grams-water ] create-fats ( grams-fat * 9 ) ;; 9 Calories per gram of fat [ set color yellow setxy ( ( random max-pxcor ) + 1) random-ycor set calories-consumed-today (calories-consumed-today + 1) ] create-carbohydrates ( grams-carbohydrate * 4 ) ;; 4 Calories per gram of carbs [ set color brown setxy ( ( random max-pxcor ) + 1) random-ycor set calories-consumed-today (calories-consumed-today + 1) ] create-proteins ( grams-protein * 4 ) ;; 4 calories per gram of protein [ set color red setxy ( ( random max-pxcor ) + 1) random-ycor set calories-consumed-today (calories-consumed-today + 1) ] create-fibers ( grams-fiber * 4 ) ;; 4 Calories per gram of carbs [ set color green setxy ( ( random max-pxcor ) + 1) random-ycor set calories-consumed-today (calories-consumed-today + 1) ] create-water ( grams-water ) [ set color blue setxy ( ( random max-pxcor ) + 1) random-ycor ] end to consume-nutrients ;; The calories consumed at a given tick based on BMR let calories-consumed-this-minute ( basal-metabolic-rate / 1400 ) let frac ( calories-consumed-this-minute - (floor calories-consumed-this-minute) ) ifelse(calories-consumed-this-minute < count turtles ) [ ask n-of (floor calories-consumed-this-minute) turtles [ die ] if ( ( random-float 1 ) < frac ) [ ask one-of turtles [ die ] ] ] [ ask turtles [ die ] set calorie-defecit ( calorie-defecit + calories-consumed-this-minute ) ] end to consume-nutrients-version2 ;Here, nutrients 'digest', and the body burns only nutrients in the bottom row ;Excess nutrients become fat stores. let calories-consumed-this-minute ( basal-metabolic-rate / 1400 ) end to digest let calories-consumed-this-minute ( basal-metabolic-rate / 1400 ) let frac ( calories-consumed-this-minute - (floor calories-consumed-this-minute) ) ;Compensate for fractional calories-consumed-this-minute if ( random-float 1 < frac ) [ set calories-consumed-this-minute ( calories-consumed-this-minute + 1) ] let speed ( calories-consumed-this-minute / ( max-pycor * 2 ) ) repeat calories-consumed-this-minute [ ;;Consume as many available calories as possible, on the last 5 rows. This means they are available for use. If there are not enough in ifelse( count turtles with [ ycor - 5 < min-pycor ] > 0 ) [ ;;Consume a calorie from temporary reserves. If you can't do this, consume one from body fat ifelse( count turtles with [ycor - 5 < min-pycor and xcor > 0 ] > 0) [ ask one-of turtles with [ (ycor - 5 < min-pycor ) and xcor > 0] [ set calories-burned-today ( calories-burned-today + 1 ) die ] ] [ ;;Consume a body fat turtle. ask one-of turtles with [ (ycor - 5 < min-pycor ) and xcor < 0] [ set calories-burned-today ( calories-burned-today + 1 ) die ] ] ] [ set calorie-defecit (calorie-defecit + 1) ] ] ask turtles [ ;; on the last row, the food goes into persistent storage ifelse( ycor - 1 < min-pycor ) [ setxy (( -1 * ( random max-pxcor )) - 1 ) max-pycor set color violet ] [ set ycor ( ycor - speed ) ] ] end to burn-calories end to update-plots set-current-plot "Nutrient Breakdown" set-current-plot-pen "carbohydrates" plot count carbohydrates set-current-plot-pen "fats" plot count fats set-current-plot-pen "protein" plot count proteins set-current-plot-pen "fibers" plot count fibers set-current-plot-pen "water" plot count water set-current-plot "Weight" ;;Each agent has a gram weight associated with it set weight ( base-weight + ( (count fats) / 9 + (count carbohydrates) / 4 + (count fibers) / 4 + (count proteins) / 4 ) / 1000 ) plot weight end
There is only one version of this model, created almost 13 years ago by Nate Harner.
Attached files
No files
This model does not have any ancestors.
This model does not have any descendants.