⇠ Back to the gallery

Double accelerating point mass

Example of a two accelerating point masses in codyn. This model shows how multiple nodes can be used to implement different entities.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# Global gravity, accessible from child nodes
g = 9.81

# Define a single node named n1
node "n1" {
    # Position of the point mass
    y = 20

    # Mass
    m = 0.6

    # External force, air friction
    f = "-dy"

    # Acceleration
    y'' = "-g + f / m"
}

# Define a single node named n2
node "n2" {
    # Position of the point mass
    y = 8

    # Mass
    m = 0.4

    # External force, air friction
    f = "-dy"

    # Acceleration
    y'' = "-g + f / m"
}

⌦ Open in playground