Skip to content

04. Tutorial 4

Vincent Berenz edited this page May 3, 2018 · 2 revisions

In this tutorial, we will learn how to set dynamic activation priorities to nodes.

Playful code:

program:

	display, while time_modulo_5, priority of time_sin | value="A"
	display, priority of time_cos | value="B"

This is similar to tutorial 3, with an important change: the priorities are no longer fixed, and are changing with time.

In this program, even when time_module_5 returns True, the first instance (with value 'A') does not necessarily activates: the second instance (with value 'B') may (or may not) have higher priority of access to the console resource at this time, blocking the resource.

When running the program, you may see in the terminal the values at the left of the node changing: they are the priorities as evaluated by time_sin and time_cos.

Python code:

def time_sin():

    t = time.time()
    return 1.0 + math.sin(t)


def time_cos():

    t = time.time()
    return 1.0 + math.cos(t)
Clone this wiki locally