Token Ring Network

Generated by GenServerVirtualTime โ€ข Mermaid Flowchart

๐Ÿ“ˆ Simulation Summary

Virtual Time
1500ms
Real Time
15ms
Speedup
100.0x
Termination
โฑ Max Time

๐Ÿ“Š Actor Topology

flowchart LR actor1("actor1
๐Ÿ“ค Sent: 15
๐Ÿ“ฅ Recv: 15") actor2("actor2
๐Ÿ“ค Sent: 15
๐Ÿ“ฅ Recv: 15") actor0("actor0
๐Ÿ“ค Sent: 15
๐Ÿ“ฅ Recv: 15") actor3("actor3
๐Ÿ“ค Sent: 15
๐Ÿ“ฅ Recv: 15") actor4("actor4
๐Ÿ“ค Sent: 15
๐Ÿ“ฅ Recv: 15") actor5("actor5
๐Ÿ“ค Sent: 15
๐Ÿ“ฅ Recv: 15") actor6("actor6
๐Ÿ“ค Sent: 15
๐Ÿ“ฅ Recv: 15") actor0 -->|:token
every 100ms| actor1 actor1 -->|:token
10/s| actor2 actor2 -->|:token
10/s| actor3 actor3 -->|:token
10/s| actor4 actor4 -->|:token
10/s| actor5 actor5 -->|:token
10/s| actor6 actor6 -->|:token
10/s| actor0 style actor1 fill:#e8f5e9,stroke:#388e3c style actor2 fill:#e8f5e9,stroke:#388e3c style actor0 fill:#e8f5e9,stroke:#388e3c style actor3 fill:#e8f5e9,stroke:#388e3c style actor4 fill:#e8f5e9,stroke:#388e3c style actor5 fill:#e8f5e9,stroke:#388e3c style actor6 fill:#e8f5e9,stroke:#388e3c

Node Shapes (Actor Type)

flowchart TD legend_processor("Processor
(send & receive)") style legend_processor fill:#ffffff,stroke:#666666,stroke-width:2px

Node Colors (Activity Level)

flowchart LR activity_0["๐ŸŸข Medium Activity (10-50 msgs)"] style activity_0 fill:#e8f5e9,stroke:#388e3c

๐Ÿ“‰ Detailed Statistics

Actor Sent Received Send Rate Receive Rate Activity
actor1 15 15 10.0 msg/s 10.0 msg/s 30 total
actor2 15 15 10.0 msg/s 10.0 msg/s 30 total
actor0 15 15 10.0 msg/s 10.0 msg/s 30 total
actor3 15 15 10.0 msg/s 10.0 msg/s 30 total
actor4 15 15 10.0 msg/s 10.0 msg/s 30 total
actor5 15 15 10.0 msg/s 10.0 msg/s 30 total
actor6 15 15 10.0 msg/s 10.0 msg/s 30 total
Summary: Total messages: 210 โ€ข Duration: 1500ms โ€ข Actors: 7

๐Ÿ’ป Model Source Code

This is the Elixir code that defines the actor simulation model:

# Create a ring of 7 actors passing a token every 100ms
simulation =
  ActorSimulation.new()
  |> ActorSimulation.add_actor(:actor0,
    send_pattern: {:periodic, 100, :token},
    targets: [:actor1]
  )
  |> ActorSimulation.add_actor(:actor1,
    on_match: [
      {:token, fn state -> {:send, [{:actor2, :token}], state} end}
    ]
  )
  |> ActorSimulation.add_actor(:actor2,
    on_match: [
      {:token, fn state -> {:send, [{:actor3, :token}], state} end}
    ]
  )
  |> ActorSimulation.add_actor(:actor3,
    on_match: [
      {:token, fn state -> {:send, [{:actor4, :token}], state} end}
    ]
  )
  |> ActorSimulation.add_actor(:actor4,
    on_match: [
      {:token, fn state -> {:send, [{:actor5, :token}], state} end}
    ]
  )
  |> ActorSimulation.add_actor(:actor5,
    on_match: [
      {:token, fn state -> {:send, [{:actor6, :token}], state} end}
    ]
  )
  |> ActorSimulation.add_actor(:actor6,
    on_match: [
      {:token, fn state -> {:send, [{:actor0, :token}], state} end}
    ]
  )
  |> ActorSimulation.run(duration: 1500)

# Generate the report
html = MermaidReportGenerator.generate_report(simulation,
  title: "Token Ring Network",
  layout: "LR",
  model_source: model_source
)