Help with modelling - create-monitor micro-behaviour

3 views
Skip to first unread message

howard...@gmail.com

unread,
Aug 28, 2009, 8:56:11 AM8/28/09
to The Modelling4All Project
Hello,

I am unsure how to use the micro-behaviour "CREATE-MONITOR". I've
copied it to:
http://modelling4all.nsms.ox.ac.uk/Resources/Composer/en/MB.2/CREATE-MONITOR.html#changes=F_NyP04-9FOyyW4vCSSh5f

in this model:
http://modelling4all.nsms.ox.ac.uk/ModelTest/?frozen=5_FrEuqNDd3uZrv69U7E7b&MforAllModel=1

and I get the error "you can't use the my-hour-in-day in the observer
context because it is a turtle only"

the way I want to create the monitor seems to work in the previous
model I used:
http://users.ox.ac.uk/~howardn/projects/lowcarbonict/models/latest_model/LowCarbonICT58.html

is this something to do with the way variables are declared in the
Behaviour Composer?

Thanks, H

Ken Kahn

unread,
Aug 28, 2009, 10:14:31 AM8/28/09
to modell...@googlegroups.com
Hi.

This is because NetLogo monitors only run in the observer context. To NetLogo's command line you can't run "show my-hour-in-day" and the monitor works similarly.

If you make your monitor follow

[my-hour-in-day] of Object 0

instead of

my-hour-in-day

then this works fine. But referring to Object 0 is a bit of a hack (it works because Time is the leftmost prototype). It would be better to monitor

[my-hour-in-day] of any-of-kind "Time"

but that runs up against a limitation in the Behaviour Composer's implementation of create-monitor, namely the way it handles quoted elements. I just posted this as an issue: http://code.google.com/p/modelling4all/issues/detail?id=309

Perhaps the Behaviour Composer should be changed so that the monitor is always "of <the agent who has this micro-behaviour>" so the system converts my-hour-in-day automatically.

Best,

howard...@gmail.com

unread,
Aug 28, 2009, 10:21:16 AM8/28/09
to The Modelling4All Project
i think your last suggestion would be the easiest conceptually e.g.
allow people to easily monitor a named attribute in a similar way that
it is done in netlogo e.g. all I need to do is add a monitor micro-
behaviour and add the name of the attribute i want to display. in
netlogo i just add the UI monitor component and do the same.

On Aug 28, 3:14 pm, Ken Kahn <toont...@googlemail.com> wrote:
> Hi.
> This is because NetLogo monitors only run in the observer context. To
> NetLogo's command line you can't run "show my-hour-in-day" and the monitor
> works similarly.
>
> If you make your monitor follow
>
> [my-hour-in-day] of Object 0
>
> instead of
>
> my-hour-in-day
>
> then this works fine. But referring to Object 0 is a bit of a hack (it works
> because Time is the leftmost prototype). It would be better to monitor
>
> [my-hour-in-day] of any-of-kind "Time"
>
> but that runs up against a limitation in the Behaviour Composer's
> implementation of create-monitor, namely the way it handles quoted elements.
> I just posted this as an issue:http://code.google.com/p/modelling4all/issues/detail?id=309
>
> Perhaps the Behaviour Composer should be changed so that the monitor is
> always "of <the agent who has this micro-behaviour>" so the system converts
> my-hour-in-day automatically.
>
> Best,
>
> -ken
>
> 2009/8/28 howard.no...@gmail.com <howard.no...@gmail.com>
>
>
>
> > Hello,
>
> > I am unsure how to use the micro-behaviour "CREATE-MONITOR". I've
> > copied it to:
>
> >http://modelling4all.nsms.ox.ac.uk/Resources/Composer/en/MB.2/CREATE-...
>
> > in this model:
>
> >http://modelling4all.nsms.ox.ac.uk/ModelTest/?frozen=5_FrEuqNDd3uZrv6...
>
> > and I get the error "you can't use the my-hour-in-day in the observer
> > context because it is a turtle only"
>
> > the way I want to create the monitor seems to work in the previous
> > model I used:
>
> >http://users.ox.ac.uk/~howardn/projects/lowcarbonict/models/latest_mo...

Ken Kahn

unread,
Aug 28, 2009, 10:39:42 AM8/28/09
to modell...@googlegroups.com
I agree it would be easier. There is a question of what should happen if the prototype is copied. One monitor for each instance?

But "easily monitor a named attribute in a similar way that it is done in netlogo" is not true -- NetLogo monitors don't know what agent they are monitoring -- monitors are typically used for global information. That is what the NetLogo error message was trying to explain. If you want to monitor an agent's attributes you need to explicitly use OF.

Best,

-ken
Reply all
Reply to author
Forward
0 new messages