how to embed a schedule within another one?

Skip to first unread message

Yaniv Proselkov

Feb 4, 2021, 8:57:57 PMFeb 4
to ProjectMesa
Hi all,
I'm very new to mesa (<1 month). I'm trying to make a network system with an infection process and sensors at each node.

The infection happens randomly, while the sensors are always on. With that in mind, I wwant to randomly activate 1 infection step, and then simultaneously activate all sensors. 1 infection, all sensors, 1 infection, all sensors.

I've tried this:
        self.infection_schedule = RandomActivation(self)
        self.detection_schedule = BaseScheduler(self)
        def step(self):
            for i in range(len(self.num_nodes)):

but apparently self.schedule is a key term.

Can anyone think of how to manage this? please?

Jeremy Foote

Feb 5, 2021, 9:38:21 AMFeb 5
to Yaniv Proselkov, ProjectMesa

If all that the sensors are doing is gathering information about the nodes, then the simplest is to just create data collectors instead of putting this logic on the nodes themselves. Data collecting really is basically a simultaneous sensing step.

The second simplest is to not use a scheduler at all.

You could just do something like define a data-gathering method in the node Class like get_data(), and then something like:

    nodes = []
    n = Node()
        def step(self):
            for node in nodes:

Finally, there is a way to have nodes do different things at different times - StagedActivation (

In order to do a random step followed by a simultaneous step, you'd need three stages defined for each node:
- an infection stage which would run the infection
- a staging stage which would calculate and store the results from the sensing method
- an activation stage which would move the results from the staging stage into the instance attribute where you want to store them

Good luck!,

Project repos:
You received this message because you are subscribed to the Google Groups "ProjectMesa" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To view this discussion on the web visit

Yaniv Proselkov

Feb 5, 2021, 10:24:58 AMFeb 5
to ProjectMesa
Thank you so much! This is excellent.
Reply all
Reply to author
0 new messages