Child of Climate Change

No preview image

1 collaborator

Default-person Miklavz Sef (Author)

Tags

(This model has yet to be categorized with any tags)
Child of model Climate Change preview imageClimate Change
Model group CCL | Visible to everyone | Changeable by group members (CCL)
Model was written in NetLogo 5.0.5 • Viewed 440 times • Downloaded 29 times • Run 0 times
Download the 'Child of Climate Change' modelDownload this modelEmbed this model

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


Info tab cannot be displayed because of an encoding error

Comments and Questions

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

Click to Run Model

globals [
  sky-top      ;; y koordinata vrha neba
  earth-top    ;; y koordinata vrha zemlje
  temperature  ;; temperatura
]

breed [rays ray]     ;; količina sončne svetlobe
breed [IRs IR]       ;; količina IR
breed [heats heat]   ;; količina toplotne energije
breed [CO2s CO2]     ;; količina CO2

breed [clouds cloud]
clouds-own [cloud-speed cloud-id]

;;
;; potek začetnih nastavitev
;;

to setup
  clear-all
  set-default-shape rays "ray"
  set-default-shape IRs "ray"
  set-default-shape clouds "cloud"
  set-default-shape heats "dot"
  set-default-shape CO2s "CO2-molecule"
  setup-world
  set temperature 12
  reset-ticks
end 

to setup-world
  set sky-top max-pycor - 5
  set earth-top 0
  ask patches [  ;; nastavo barve sveta
    if pycor > sky-top [  ;; vesolje
      set pcolor scale-color white pycor 22 15
    ]
    if pycor <= sky-top and pycor > earth-top [ ;; nebo
      set pcolor scale-color blue pycor -20 20
    ]
    if pycor < earth-top
      [ set pcolor red + 3 ] ;; zemlja
    if pycor = earth-top ;; površina zemlje
      [ update-albedo ]
  ]
end 

;;
;; Potek izvajanja
;;

to go
  ask clouds [ fd cloud-speed ]  ; premikaj oblake
  run-sunshine   ;; koraki svetlobe
  ;; ob spremembi odbojnosti spremeni barvo površine zemlje
  ask patches with [pycor = earth-top]
    [ update-albedo ]
  run-heat  ;; koraki temperature
  run-IR    ;; koraki IR
  run-CO2   ;; koraki CO2
  tick
end 

to update-albedo 
  set pcolor scale-color green Odboj_svetlobe 0 1
end 

to add-cloud            ;; pobriše vse oblake in jih naredi na novo - 1 oblak
  let sky-height sky-top - earth-top
  ;; izbere naključno višino
  ;; in poskrbi da je v ozračju
  let y earth-top + (random-float (sky-height - 4)) + 2
  ;; hitrost oblaka ne sme biti 0
  let speed (random-float 0.1) + 0.01
  let x random-xcor
  let id 0
  ;; ne zanima nas kakšen je oblak dokler
  ;; vse želvice nimajo istega
  ;; id
  if any? clouds
  [ set id max [cloud-id] of clouds + 1 ]

  create-clouds 3 + random 20
  [
    set cloud-speed speed
    set cloud-id id
    ;; vse želvice, ki predstavljajo oblak
    ;; so si blizu
    setxy x + random 9 - 4
          ;; oblaki se generirajo
          ;; lahko pride do sprememb
          y + 2.5 + random-float 2 - random-float 2
    set color white
    ;; različne velikosti so samo za izgled
    ;; saj gledamo samo trke
    set size 2 + random 2
    set heading 90
  ]
end 

to remove-cloud       ;; pobriše vse oblake in jih naredi na novo - 1 oblak
  if any? clouds [
    let doomed-id one-of remove-duplicates [cloud-id] of clouds
    ask clouds with [cloud-id = doomed-id]
      [ die ]
  ]
end 

to run-sunshine
  ask rays [
    if not can-move? 0.3 [ die ]  ;; ustavi jih na robu
    fd 0.3                        ;; drugače naj se premikajo
  ]
  create-sunshine  ;; sončni žarki pridejo z vrha
  reflect-rays-from-clouds  ;; preveri odboj oblakov
  encounter-earth   ;; preveli absorbcijo in odboj zemlje
end 

to create-sunshine
  ;; ni potrebo narediti žarka za vsak dogodek
  ;; ob večji svetlobi jih naredi več
  if 10 * moc_sonca > random 50 [
    create-rays 1 [
      set heading 160
      set color yellow
      ;; žarek pride skozi majhno območje
      ;; blizu površja zemlje
      setxy (random 10) + min-pxcor max-pycor
    ]
  ]
end 

to reflect-rays-from-clouds
 ask rays with [any? clouds-here] [  
   set heading 180 - heading   ;; obrni okoli
 ]
end 

to encounter-earth
  ask rays with [ycor <= earth-top] [
    ;; glede na odbojnost
    ;; zemlja vpije ali pa odbije
    ifelse 100 * Odboj_svetlobe > random 100
      [ set heading 180 - heading  ] ;; odboj
      [ rt random 45 - random 45 ;; absorbcija v zemljo
        set color red - 2 + random 4
        set breed heats ]
  ]
end 

to run-heat    ;; napredovanje toplotnih želvic
  ;; temperatura je odvisna od števila temperaturnih želvic
  set temperature 0.99 * temperature + 0.01 * (12 + 0.1 * count heats)
  ask heats
  [
    let dist 0.5 * random-float 1
    ifelse can-move? dist
      [ fd dist ]
      [ set heading 180 - heading ] ;; ko zadaneš rob sveta se obrni
    if ycor >= earth-top [  ;; če se usmeri nazaj v nebo
      ifelse temperature > 20 + random 40
              ;; toplota uide le skozi majhno območje
              ;; to naredi model lepši vendar prispeva k
              ;; stopnji izgube toplote
              and xcor > 0 and xcor < max-pxcor - 8
        [ set breed IRs                    ;; nekaj IR mora iti skozi
          set heading 20
          set color magenta ]
        [ set heading 100 + random 160 ] ;; obrni proti zemlji
    ]
  ]
end 

to run-IR
  ask IRs [
    if not can-move? 0.3 [ die ]
    fd 0.3
    if ycor <= earth-top [   ;; pretvori v toploto če se ponovno zadane v zemljo
      set breed heats
      rt random 45
      lt random 45
      set color red - 2 + random 4
    ]
    if any? CO2s-here    ;; preveri za trk z CO2
      [ set heading 180 - heading ]
  ]
end 

to add-CO2  ;; naključno dodaj 25 molekul CO2
  let sky-height sky-top - earth-top
  create-CO2s 25 [
    set color green
    ;; naključno izberi pozicijo v ozračju
    setxy random-xcor
          earth-top + random-float sky-height
  ]
end 

to remove-CO2 ;; naključno odstrani 25 molekul CO2
  repeat 25 [
    if any? CO2s [
      ask one-of CO2s [ die ]
    ]
  ]
end 

to run-CO2
  ask CO2s [
    rt random 51 - 25 ;; malo obrni
    let dist 0.05 + random-float 0.1
    ;; obdrži CO2 v ozračju
    if [not shade-of? blue pcolor] of patch-ahead dist
      [ set heading 180 - heading ]
    fd dist ;; malo premakni naprej
  ]
end 


; Copyright 2007 Uri Wilensky.
; See Info tab for full copyright and license.

There is only one version of this model, created over 10 years ago by Miklavz Sef.

Attached files

No files

Parent: Climate Change

This model does not have any descendants.

Graph of models related to 'Child of Climate Change'