Grid Sim
GridSim-Distribuited simulates a small electrical grid — houses, solar panels, batteries and the cables connecting them — as a genuinely distributed, tick-driven system rather than as a single-process program. On the backend, every grid entity and every running simulation is an independent, event-sourced Apache Pekko actor: cluster sharding gives each one a stable identity regardless of which node currently hosts it, and Pekko Persistence lets it recover its exact state by replaying its event log. Because that log is kept in a Redis store shared by every backend node, rather than inside the node that hosts the actor, a simulation survives not only an actor restart but also the crash of a whole node, resuming on a surviving one. Each simulated tick is a scatter/gather exchange between a simulation’s orchestrating actor and its entities, guarded by a timeout; a timed-out tick is retried with exponential backoff, the retry is idempotent with respect to the at-least-once delivery a distributed system has to assume, and a run of repeated failures is reported to clients as a degraded status rather than silently retried forever. A Split Brain Resolver, configured with a keep-majority strategy, gives the cluster a deterministic response to a network partition. A separate ScalaFX desktop client, structured with an MVVM architecture, drives the simulation’s lifecycle through a synchronous HTTP API and observes its progress through Protobuf-encoded telemetry published over Apache Kafka, a channel that lets several GUI instances watch the same simulation at once without the backend tracking who is listening. Grid topologies are authored through a small internal Scala DSL with accumulating validation, from which the system’s four built-in scenario presets are built. This report documents the requirements, architecture, implementation and validation of the system.