views:

71

answers:

1

Hi

I am using an existing model in netlogo called Chemical Equilibrium and am adding some more code I want to add turtles (catalyst) which have no effect on the reaction/other turtles but speeds up the FORWARD reaction. note: forward reaction has been defined as follows

to react-forward [t]

ask t [ set color red ]

set color green

rt random-float 360

jump 2

end

I was thinking that i put a switch and a slider, make the turtles into whitemols or i do a turtles-own [catalyst] and then define that like i have done with temperature and pressure i tried the following but it didnt work

turtles-own [speed catalyst]

crt whitemols [ set color white randomize set speed 1 ]

i know the above code is incorrect but am not sure how to code this particular feature

any help will be greatly appreciated thanks

hi i wanted to also make the catalyst visible so you can see it in the simulation i tried the following code but it doesnt work

; Make catalyst visible in implementation crt catalysts 100 ask catalysts [ set color white ] show [breed] of one-of catalysts ; prints catalysts end

; prints catalyst 100 show catalyst 100 it only shows the catalyst when i press the go button and ignores my other code that i have

;; Setup Procedures to setup clear-all crt bluemols [ set color blue randomize set speed 1 ]

crt yellowmols [ set color yellow randomize set speed 1 ]

;; adjust the y-range of the plot to fit the number of molecules set-plot-y-range 0 max (list yellowmols bluemols catalysts) update-plot end

A: 

There are many ways to do this, of course. I can't tell what is going on in your program from the little snipped you include.

One way would be to have the catalyst be of a different breed:

breed [catalysts catalyst]
breed [chemical-x chemical-x]
;and so on

;then the forward reaction is sped up by the existence of catalysts

to react-forward
  let num-catalysts count catalysts
  ;speed up by num-catalysts
  ;...
end
Jose M Vidal
thank you ..i shall see if this works
and i also want to make it so that the catalyst can be switched on and off..so one can see the effects with and without the catalyst..i tried putting a switch in but catalyst has already been defined hence i didnt want to use breed otherwise the code does works