{"id":19289882,"url":"https://github.com/fschuetz04/simcpp20","last_synced_at":"2025-04-22T05:31:59.799Z","repository":{"id":42080055,"uuid":"351400102","full_name":"fschuetz04/simcpp20","owner":"fschuetz04","description":"Discrete-event simulation in C++20 using coroutines","archived":false,"fork":false,"pushed_at":"2025-02-26T11:26:50.000Z","size":165,"stargazers_count":57,"open_issues_count":1,"forks_count":12,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-02-26T12:29:31.527Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fschuetz04.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-03-25T10:47:00.000Z","updated_at":"2025-02-26T11:26:53.000Z","dependencies_parsed_at":"2025-02-26T12:24:41.877Z","dependency_job_id":null,"html_url":"https://github.com/fschuetz04/simcpp20","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fschuetz04%2Fsimcpp20","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fschuetz04%2Fsimcpp20/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fschuetz04%2Fsimcpp20/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fschuetz04%2Fsimcpp20/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fschuetz04","download_url":"https://codeload.github.com/fschuetz04/simcpp20/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250175072,"owners_count":21387133,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-09T22:17:23.824Z","updated_at":"2025-04-22T05:31:59.785Z","avatar_url":"https://github.com/fschuetz04.png","language":"C++","readme":"# SimCpp20\n\n[![Linux](https://github.com/fschuetz04/simcpp20/actions/workflows/linux.yml/badge.svg)](https://github.com/fschuetz04/simcpp20/actions/workflows/linux.yml)\n[![Windows](https://github.com/fschuetz04/simcpp20/actions/workflows/windows.yml/badge.svg)](https://github.com/fschuetz04/simcpp20/actions/workflows/windows.yml)\n\nSimCpp20 is a discrete-event simulation framework for C++20.\nIt is similar to SimPy and aims to be easy to set up and use.\n\nProcesses are defined as functions receiving `simcpp20::simulation\u003c\u003e \u0026` as their\nfirst argument and returning `simcpp20::process\u003c\u003e`.\nEach process is executed as a coroutine.\nThus, this framework requires C++20.\nA short example simulating two clocks ticking in different time intervals looks like\nthis:\n\n```c++\n#include \u003ccstdio\u003e\n\n#include \"fschuetz04/simcpp20.hpp\"\n\nsimcpp20::process\u003c\u003e clock_proc(simcpp20::simulation\u003c\u003e \u0026sim, char const *name,\n                             double delay) {\n  while (true) {\n    printf(\"[%.0f] %s\\n\", sim.now(), name);\n    co_await sim.timeout(delay);\n  }\n}\n\nint main() {\n  simcpp20::simulation\u003c\u003e sim;\n  clock_proc(sim, \"slow\", 2);\n  clock_proc(sim, \"fast\", 1);\n  sim.run_until(5);\n}\n```\n\nWhen run, the following output is generated:\n\n```text\n[0] slow\n[0] fast\n[1] fast\n[2] slow\n[2] fast\n[3] fast\n[4] slow\n[4] fast\n```\n\nOther examples can be found in the `examples/` folder.\n\nThis project uses CMake.\nTo build and execute the clocks example, run the following commands:\n\n```shell\ncmake -B build\ncmake --build build\nbuild/examples/clocks\n```\n\nThe CMake configuration has been tested with GCC (version 10 or later), Clang (version\n14 or later) and MSVC.\nIf such a version is available under a different name (for example `g++-10`), you\ncan try `CXX=g++-10 cmake -B build` instead of just `cmake -B build` to set the C++\ncompiler command.\nWhen using an MSVC compiler, it must be of version 19.28 or later (Visual Studio\n2019 version 16.8 or later).\nContributions to improve compiler support are welcome!\n\nIf you want to use SimCpp20 in your project, the easiest option is to use CMake with\nFetchContent.\nA simple configuration looks like this:\n\n```cmake\ncmake_minimum_required(VERSION 3.14)\n\nproject(my_app)\n\ninclude(FetchContent)\n\nFetchContent_Declare(fschuetz04_simcpp20\n    GIT_REPOSITORY https://github.com/fschuetz04/simcpp20\n    GIT_TAG        ad975317db40d81dbe4c45c5db4edcd8ec6e2de8) # replace with latest revision\n\nFetchContent_MakeAvailable(fschuetz04_simcpp20)\n\nadd_executable(app app.cpp)\ntarget_link_libraries(app PRIVATE fschuetz04::simcpp20)\n```\n\nReplace the commit hash with the latest commit hash of SimCpp20 accordingly.\n\n## License\n\nLicensed under the MIT License.\nSee the [licence file](LICENSE) for details.\n","funding_links":[],"categories":["Uncategorized"],"sub_categories":["Uncategorized"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffschuetz04%2Fsimcpp20","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffschuetz04%2Fsimcpp20","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffschuetz04%2Fsimcpp20/lists"}