Computer science Netlogo编程问题-化学平衡温度和压力的实现
我试图在Netlogo中编写一些代码。我正在使用现有的化学平衡模型,并试图实现以下内容: 乌龟自有[速度] 问海龟 [ 设置速度(环境温度=30) 速度 如果温度>40[“速度”增加海龟] ifelse温度<30[海龟速度降低] ] ;;临时 但它似乎不起作用 (当温度超过40度时,海龟的速度会加快 如果温度低于30度,海龟的速度会降低) 温度是模型上的滑块 压力也是一样 问海龟 [Computer science Netlogo编程问题-化学平衡温度和压力的实现,computer-science,simulation,netlogo,chemistry,Computer Science,Simulation,Netlogo,Chemistry,我试图在Netlogo中编写一些代码。我正在使用现有的化学平衡模型,并试图实现以下内容: 乌龟自有[速度] 问海龟 [ 设置速度(环境温度=30) 速度 如果温度>40[“速度”增加海龟] ifelse温度50,则海龟的速度会增加 ;如果压力小于50,则海龟的速度降低 ] ;;施压 谢谢我想你想做的是这样的: turtles-own [speed] to setup ca create-turtles 50 [ set speed 1 ] end to go a
;;如果压力>50,则海龟的速度会增加
;如果压力小于50,则海龟的速度降低
]
;;施压
谢谢我想你想做的是这样的:
turtles-own [speed]
to setup
ca
create-turtles 50 [
set speed 1
]
end
to go
ask turtles [
if (temperature > 40) [
set speed min (list (speed + 1) 100) ;cap the speed at 100 otherwise it will shoot to infinity
]
if (temperature < 30) [
set speed max (list (speed - 1) 0); min speed is 0
]
;move
forward speed
]
end
海龟拥有[速度]
设置
ca
创造海龟50[
设定速度1
]
结束
外带
问海龟[
如果(温度>40)[
设置最小速度(列表(速度+1)100);将速度限制为100,否则它将射向无穷远
]
如果(温度<30)[
将最大速度(列表(速度-1)设置为0;最小速度为0
]
移动
前进速度
]
结束
我必须加上最小和最大速度(分别为0和100),否则速度将很快达到无限。另外,“温度”在我的模型中是一个滑块
;; if pressure > 50 then speed increases of turtles
;; if pressure < 50 then speed decreases of turtles
turtles-own [speed]
to setup
ca
create-turtles 50 [
set speed 1
]
end
to go
ask turtles [
if (temperature > 40) [
set speed min (list (speed + 1) 100) ;cap the speed at 100 otherwise it will shoot to infinity
]
if (temperature < 30) [
set speed max (list (speed - 1) 0); min speed is 0
]
;move
forward speed
]
end