NETLOGO: pass on water amount along the nodes of a river network
I would like to simulate the water flow along a river with NETLOGO. Therefore I do have many water nodes which are linked to each other; and each water node having the variable "amount_water". Every tick, the variable "amount_water" should be passed on to the next water node. At each node waterusers (various agents) can interact with the stream flow and extract some water, which would change the variable "amount_water"; but now I would like show you the modelled river flow only, without the water users.
if you have a model world with min-pycor -6 and max-pycor 6:
breed [waternodes waternode]
waternodes-own
[
amount_water
]
to setup
clear-all
reset-ticks
; create the waternodes
create-waternodes 13 [setxy 0 (who - 6) set shape "dot" set color blue]
ask waternodes
[
let neighborbelow waternodes-on neighbors4 with [pycor < [ycor] of myself]
create-links-to waternodes-on neighborbelow
]
end
to go
move-water
update-inflow
tick
end
to move-water
ask waternodes
[
ask out-link-neighbors [set amount_water [amount_water] of myself]
]
end
to update-inflow
ask waternode 12 [set amount_water ticks]
end
(in my model, the inflow is of course not the number of ticks, but it is read in from a csv-file)
My problem: With this code, the amount of water is NOT continuously passed on from node to node (and I do not know why!!) ????
And generally, I am not so sure if this network is the best idea to represent a stream flow. Can you think of other solutions?
Many thanks
netlogo
add a comment |
I would like to simulate the water flow along a river with NETLOGO. Therefore I do have many water nodes which are linked to each other; and each water node having the variable "amount_water". Every tick, the variable "amount_water" should be passed on to the next water node. At each node waterusers (various agents) can interact with the stream flow and extract some water, which would change the variable "amount_water"; but now I would like show you the modelled river flow only, without the water users.
if you have a model world with min-pycor -6 and max-pycor 6:
breed [waternodes waternode]
waternodes-own
[
amount_water
]
to setup
clear-all
reset-ticks
; create the waternodes
create-waternodes 13 [setxy 0 (who - 6) set shape "dot" set color blue]
ask waternodes
[
let neighborbelow waternodes-on neighbors4 with [pycor < [ycor] of myself]
create-links-to waternodes-on neighborbelow
]
end
to go
move-water
update-inflow
tick
end
to move-water
ask waternodes
[
ask out-link-neighbors [set amount_water [amount_water] of myself]
]
end
to update-inflow
ask waternode 12 [set amount_water ticks]
end
(in my model, the inflow is of course not the number of ticks, but it is read in from a csv-file)
My problem: With this code, the amount of water is NOT continuously passed on from node to node (and I do not know why!!) ????
And generally, I am not so sure if this network is the best idea to represent a stream flow. Can you think of other solutions?
Many thanks
netlogo
add a comment |
I would like to simulate the water flow along a river with NETLOGO. Therefore I do have many water nodes which are linked to each other; and each water node having the variable "amount_water". Every tick, the variable "amount_water" should be passed on to the next water node. At each node waterusers (various agents) can interact with the stream flow and extract some water, which would change the variable "amount_water"; but now I would like show you the modelled river flow only, without the water users.
if you have a model world with min-pycor -6 and max-pycor 6:
breed [waternodes waternode]
waternodes-own
[
amount_water
]
to setup
clear-all
reset-ticks
; create the waternodes
create-waternodes 13 [setxy 0 (who - 6) set shape "dot" set color blue]
ask waternodes
[
let neighborbelow waternodes-on neighbors4 with [pycor < [ycor] of myself]
create-links-to waternodes-on neighborbelow
]
end
to go
move-water
update-inflow
tick
end
to move-water
ask waternodes
[
ask out-link-neighbors [set amount_water [amount_water] of myself]
]
end
to update-inflow
ask waternode 12 [set amount_water ticks]
end
(in my model, the inflow is of course not the number of ticks, but it is read in from a csv-file)
My problem: With this code, the amount of water is NOT continuously passed on from node to node (and I do not know why!!) ????
And generally, I am not so sure if this network is the best idea to represent a stream flow. Can you think of other solutions?
Many thanks
netlogo
I would like to simulate the water flow along a river with NETLOGO. Therefore I do have many water nodes which are linked to each other; and each water node having the variable "amount_water". Every tick, the variable "amount_water" should be passed on to the next water node. At each node waterusers (various agents) can interact with the stream flow and extract some water, which would change the variable "amount_water"; but now I would like show you the modelled river flow only, without the water users.
if you have a model world with min-pycor -6 and max-pycor 6:
breed [waternodes waternode]
waternodes-own
[
amount_water
]
to setup
clear-all
reset-ticks
; create the waternodes
create-waternodes 13 [setxy 0 (who - 6) set shape "dot" set color blue]
ask waternodes
[
let neighborbelow waternodes-on neighbors4 with [pycor < [ycor] of myself]
create-links-to waternodes-on neighborbelow
]
end
to go
move-water
update-inflow
tick
end
to move-water
ask waternodes
[
ask out-link-neighbors [set amount_water [amount_water] of myself]
]
end
to update-inflow
ask waternode 12 [set amount_water ticks]
end
(in my model, the inflow is of course not the number of ticks, but it is read in from a csv-file)
My problem: With this code, the amount of water is NOT continuously passed on from node to node (and I do not know why!!) ????
And generally, I am not so sure if this network is the best idea to represent a stream flow. Can you think of other solutions?
Many thanks
netlogo
netlogo
asked Nov 12 at 14:40
Sayuri
647
647
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
I have solved the problem so far. It seems that when I just call the waternodes in move-water like this
to move-water
ask waternodes
[
ask out-link-neighbors [set amount_water [amount_water] of myself]
]
end
, the waternodes are not always called in order from 0 to 11.
Therfore I changed the code to
to move-water
(foreach sort-on [who] waternodes
[the-turtle -> ask the-turtle [ask out-link-neighbors [set amount_water [amount_water] of myself]]])
end
and now it is working!
1
sort-on [who] waternodes
can be shortened to justsort waternodes
– Seth Tisue
Nov 13 at 22:58
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53264470%2fnetlogo-pass-on-water-amount-along-the-nodes-of-a-river-network%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
I have solved the problem so far. It seems that when I just call the waternodes in move-water like this
to move-water
ask waternodes
[
ask out-link-neighbors [set amount_water [amount_water] of myself]
]
end
, the waternodes are not always called in order from 0 to 11.
Therfore I changed the code to
to move-water
(foreach sort-on [who] waternodes
[the-turtle -> ask the-turtle [ask out-link-neighbors [set amount_water [amount_water] of myself]]])
end
and now it is working!
1
sort-on [who] waternodes
can be shortened to justsort waternodes
– Seth Tisue
Nov 13 at 22:58
add a comment |
I have solved the problem so far. It seems that when I just call the waternodes in move-water like this
to move-water
ask waternodes
[
ask out-link-neighbors [set amount_water [amount_water] of myself]
]
end
, the waternodes are not always called in order from 0 to 11.
Therfore I changed the code to
to move-water
(foreach sort-on [who] waternodes
[the-turtle -> ask the-turtle [ask out-link-neighbors [set amount_water [amount_water] of myself]]])
end
and now it is working!
1
sort-on [who] waternodes
can be shortened to justsort waternodes
– Seth Tisue
Nov 13 at 22:58
add a comment |
I have solved the problem so far. It seems that when I just call the waternodes in move-water like this
to move-water
ask waternodes
[
ask out-link-neighbors [set amount_water [amount_water] of myself]
]
end
, the waternodes are not always called in order from 0 to 11.
Therfore I changed the code to
to move-water
(foreach sort-on [who] waternodes
[the-turtle -> ask the-turtle [ask out-link-neighbors [set amount_water [amount_water] of myself]]])
end
and now it is working!
I have solved the problem so far. It seems that when I just call the waternodes in move-water like this
to move-water
ask waternodes
[
ask out-link-neighbors [set amount_water [amount_water] of myself]
]
end
, the waternodes are not always called in order from 0 to 11.
Therfore I changed the code to
to move-water
(foreach sort-on [who] waternodes
[the-turtle -> ask the-turtle [ask out-link-neighbors [set amount_water [amount_water] of myself]]])
end
and now it is working!
answered Nov 13 at 9:39
Sayuri
647
647
1
sort-on [who] waternodes
can be shortened to justsort waternodes
– Seth Tisue
Nov 13 at 22:58
add a comment |
1
sort-on [who] waternodes
can be shortened to justsort waternodes
– Seth Tisue
Nov 13 at 22:58
1
1
sort-on [who] waternodes
can be shortened to just sort waternodes
– Seth Tisue
Nov 13 at 22:58
sort-on [who] waternodes
can be shortened to just sort waternodes
– Seth Tisue
Nov 13 at 22:58
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53264470%2fnetlogo-pass-on-water-amount-along-the-nodes-of-a-river-network%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown