{"id":20175589,"url":"https://github.com/Ecos-platform/fmu4cpp","last_synced_at":"2025-05-07T01:34:59.012Z","repository":{"id":39997399,"uuid":"491497875","full_name":"Ecos-platform/fmu4cpp","owner":"Ecos-platform","description":"Build FMUs using modern C++","archived":false,"fork":false,"pushed_at":"2025-05-01T08:15:46.000Z","size":602,"stargazers_count":11,"open_issues_count":2,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-01T09:25:37.755Z","etag":null,"topics":["cmake","co-simulation","cpp17","fmi","fmi-standard","fmu","github-actions"],"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/Ecos-platform.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,"zenodo":null}},"created_at":"2022-05-12T12:08:21.000Z","updated_at":"2025-04-25T21:08:32.000Z","dependencies_parsed_at":"2024-11-14T14:25:46.393Z","dependency_job_id":"01c58050-7efa-4f12-91ad-00583263f75a","html_url":"https://github.com/Ecos-platform/fmu4cpp","commit_stats":{"total_commits":59,"total_committers":2,"mean_commits":29.5,"dds":0.423728813559322,"last_synced_commit":"288e35a6dbec67cda40c6ec208830ceded72ef8f"},"previous_names":[],"tags_count":0,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ecos-platform%2Ffmu4cpp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ecos-platform%2Ffmu4cpp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ecos-platform%2Ffmu4cpp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ecos-platform%2Ffmu4cpp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Ecos-platform","download_url":"https://codeload.github.com/Ecos-platform/fmu4cpp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252796401,"owners_count":21805554,"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":["cmake","co-simulation","cpp17","fmi","fmi-standard","fmu","github-actions"],"created_at":"2024-11-14T02:00:50.835Z","updated_at":"2025-05-07T01:34:59.002Z","avatar_url":"https://github.com/Ecos-platform.png","language":"C++","funding_links":[],"categories":["FMI 2"],"sub_categories":["Libraries"],"readme":"# FMU4cpp\n\nFMU4cpp is a GitHub template repository that allows you to easily create cross-platform FMUs \ncompatible with [FMI 2.0](https://fmi-standard.org/downloads/) \u0026 [FMI 3.0](https://fmi-standard.org/docs/3.0/) for Co-simulation using CMake and C++.\n\nThe framework generates the required `modelDescription.xml` and further packages \nthe necessary content into a ready-to-use FMU archive.\n\n### How do I get started?\n\n1. Change the value of the `modelIdentifier` variable in `CMakeLists.txt` to something more appropriate.\n2. Select between FMI 2 or FMI 3 export.\n3. Edit the content of [model.cpp](src/model.cpp).\n4. Build.\n\nAn FMU named `\u003cmodelIdentifier\u003e.fmu` is now located in a folder `\\\u003cmodelIdentifier\u003e` within your build folder.\n\n### Example (BouncingBall)\n\n```cpp\n#include \u003cfmu4cpp/fmu_base.hpp\u003e\n\nusing namespace fmu4cpp;\n\n\nclass BouncingBall : public fmu_base {\n\npublic:\n    BouncingBall(const fmu_data\u0026 data)\n        : fmu_base(data) {\n\n        register_variable(\n                real(\n                        \"height\", \u0026height)\n                        .setCausality(causality_t::OUTPUT)\n                        .setVariability(variability_t::CONTINUOUS))\n                        .setInitial(initial_t::EXACT));\n\n        register_variable(\n                real(\n                        \"velocity\", \u0026velocity)\n                        .setCausality(causality_t::LOCAL)\n                        .setVariability(variability_t::CONTINUOUS));\n\n        register_variable(\n                real(\n                        \"gravity\", \u0026gravity)\n                        .setCausality(causality_t::PARAMETER)\n                        .setVariability(variability_t::FIXED));\n\n        register_variable(\n                real(\n                        \"bounceFactor\", \u0026bounceFactor)\n                        .setCausality(causality_t::PARAMETER)\n                        .setVariability(variability_t::FIXED));\n\n\n        BouncingBall::reset();\n    }\n\n    bool do_step(double dt) override {\n        // Update velocity with gravity\n        velocity += gravity * dt;\n        // Update height with current velocity\n        height += velocity * dt;\n\n        // Check for bounce\n        if (height \u003c= 0.0f) {\n            height = 0.0f;                      // Reset height to ground level\n            velocity = -velocity * bounceFactor;// Reverse velocity and apply bounce factor\n        }\n\n        return true;\n    }\n\n    void reset() override {\n        height = 10;\n        velocity = 0;\n        gravity = -9.81f;\n        bounceFactor = 0.6f;\n    }\n\nprivate:\n    double height{};      // Current height of the ball\n    double velocity{};    // Current velocity of the ball\n    double gravity{};     // Acceleration due to gravity\n    double bounceFactor{};// Factor to reduce velocity on bounce\n};\n\nmodel_info fmu4cpp::get_model_info() {\n    model_info info;\n    info.modelName = \"BouncingBall\";\n    info.description = \"A bouncing ball model\";\n    info.modelIdentifier = FMU4CPP_MODEL_IDENTIFIER;\n    return info;\n}\n\nFMU4CPP_INSTANTIATE(BouncingBall);\n\n```\n\n\n#### Cross-compilation\n\nCross-compilation (64-bit linux/windows) occurs automatically when you push your changes to GitHub. \nSimply rename the produced `model.zip` to `\u003cmodelName\u003e.fmu`.\n\n\nSuch easy, such wow.\n\n\n### Requirements\n* C++17 compiler\n* CMake \u003e= 3.15\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FEcos-platform%2Ffmu4cpp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FEcos-platform%2Ffmu4cpp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FEcos-platform%2Ffmu4cpp/lists"}