LLNL

No preview image

1 collaborator

Default-person Michelle Saksena (Author)

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by the author
Model was written in NetLogo 5.0.4 • Viewed 202 times • Downloaded 30 times • Run 0 times
Download the 'LLNL' modelDownload this modelEmbed this model

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

globals [n data cumulative_hazard]

turtles-own [h_i lambda eta theta xi1 xi2 xi3 xi4 xi5 xi6 xi7 c1 c2 c3 c4 c5 c6 c7]; x's are covariates between the ith component and the jth component

links-own []

to setup
  ca
  ask patches [ set pcolor white ]
  load-data
  setup-nodes
  ask turtles 
  [
    assign-component-data
    create-network
  ]
   
  reset-ticks
end 

to go
  tick
  ask turtles [update-hazards]
  if ticks = 5000
  [stop]
end 

to load-data

  ifelse ( file-exists? "data.txt" )
  [
    
    set data []
    file-open "data.txt"
    set n 0
    while [ not file-at-end? ]
    [
      set data sentence data (list (list file-read file-read file-read file-read file-read file-read file-read file-read file-read file-read file-read file-read file-read n ) )
      set n n + 1
    ]    
    user-message "File read. Please wait. A message will let you know when the data are loaded."
    ; done reading - close
    file-close
  ] 
  [ user-message "File not found" ]
  show n
end 

to setup-nodes
  crt n
  layout-circle sort turtles n
  ask turtles
  [
  set label-color black
  if  who = 0
  [set label "electrical"]
  if who = 1
  [set label "HVAC"]
  if who = 2
  [set label "Fire"]
  if who = 3
  [set label "Plumbing"]
  if who = 4
  [set label "Roof"]
  set shape "dot"
  set color [255 0 0 125]
  ]
end 

to assign-component-data
  ifelse ( is-list? data )
   [ foreach data 
       [ ask turtles with [ who = last ? ]
        [ 
        set lambda first ?
        set eta item 1 ?
        set theta item 2 ?
        set xi1 item 3 ?
        set xi2 item 4 ?
        set xi3 item 5 ?
        set xi4 item 6 ?
        set xi5 item 7 ? 
        
        set c1 item 8 ?
        set c2 item 9 ?
        set c3 item 10 ?
        set c4 item 11 ?
        set c5 item 12 ?
        ]
       ]
   ]
   [user-message "You need to load in data first" ]
end 

to create-network
  if c1 != 0
  [ create-links-to other turtles with [c1 = 1] ]
    if c2 != 0
  [ create-links-to other turtles with [c2 = 2]]
    if c3 != 0
  [ create-links-to other turtles with [c3 = 3]]
    if c4 != 0
  [ create-links-to other turtles with [c4 = 4]]
    if c5 != 0
  [ create-links-to other turtles with [c5 = 5]]
    if c6 != 0
  [ create-links-to other turtles with [c6 = 6]]
    if c7 != 0
  [ create-links-to other turtles with [c7 = 7]]
  
  ask links [set color blue - 2 + random 7]
end 

to update-hazards
  set h_i lambda * exp ( - lambda * eta ) * ticks ^ (lambda - 1)
  set size h_i  
end 


  
  

There is only one version of this model, created about 12 years ago by Michelle Saksena.

Attached files

File Type Description Last updated
data.txt data data file about 12 years ago, by Michelle Saksena Download

This model does not have any ancestors.

This model does not have any descendants.