How heal-research/simsharp works
Project type and purpose
• SimSharp is an open-source .NET library (a port and extension of Python’s SimPy) for process-based discrete-event simulation.
• It targets .NET Framework 4.5 and .NET Standard 2.0 and is distributed via NuGet.
• It provides core simulation primitives (Environment, Events, Resources), data structures (priority queues), random number generators, and monitoring/analysis tools.
File structure
• Top-level solution (SimSharp.sln) contains four main sub-projects under src/:
• SimSharp (the core library)
• Samples (example simulations that consume the library)
• Benchmark (performance tests against sample models)
• Tests (unit and integration tests of the core API)
• Within the SimSharp project:
• Core: simulation engine (Environment, ActiveObject, Events, Resources)
• Collections: high-speed priority queues and utility data structures
• Random: multiple RNG implementations and distributions
• Analysis: monitors and reporting facilities
• Auxiliary: formatting and helpers
• CI/configuration files: AppVeyor YAML, .gitignore, .gitattributes, VSCode settings, NuGet packaging metadata (SimSharp.snk).
README for additional insights
• Describes the API design: process‐based models yield Event objects.
• Notes the dual API for time units (DateTime/TimeSpan vs. double‐API).
• Mentions monitoring capabilities, preemption, extensibility, and performance benchmarks.
• References external dependencies: .NET runtimes and the high-speed priority queue origin.
a. Main components
• SimSharp Core Library
• Core Engine
• Collections Module
• Random Module
• Analysis Module
• Auxiliary Helpers
• Consumers of the library
• Samples Project (example simulators)
• Benchmark Project (performance harness)
• Test Project (automated tests)
• External/Infrastructure
• .NET Runtime (.NET Framework / .NET Standard)
• NuGet Package Repository
• CI Server (AppVeyor)
• Source Control (Git/GitHub)
• Documentation (docs/ folder, docs site)
b. Relationships and interactions
• The Core Engine depends on Collections (for event queues) and Random (for sampling).
• Analysis hooks into Core and Resources to collect metrics.
• Auxiliary is a helper library used by all other modules.
• Samples, Benchmark, and Tests each reference the SimSharp Core project.
• CI pulls code from Git, builds solution, runs Tests, publishes NuGet and Docs.
c. Architectural patterns and principles
• Modular design: clear separation of concerns (Engine vs. Data Structures vs. RNG vs. Analysis).
• Process‐based discrete‐event simulation pattern (yielding events).
• Dependency inversion: consumers depend on abstractions (interfaces IRandom, IMonitor).
• Extensibility: pluggable RNGs, custom monitors, user‐defined processes.
d. Key technologies and frameworks
• C#, .NET Framework 4.5, .NET Standard 2.0
• NuGet packaging
• AppVeyor CI
• High-speed priority queue (adapted from BlueRaja)
• xUnit (or built-in test runner) for unit tests
Elements
• Labels: name every module, project, and external system explicitly.
• From CI → GitHub (source) → build solution → run Tests → publish package/docs.
• From Samples/Benchmark/Tests → SimSharp Core.
• From Core → Collections, Random, Analysis, Auxiliary.
Detail
• Interfaces (e.g., IDistribution, IRandom, IMonitor) and their implementations.
• High-speed priority queue origin and license files if licensing compliance needs visibility.