{"id":15573052,"url":"https://github.com/ntnu-ihb/fmi4cpp","last_synced_at":"2025-04-05T05:04:33.181Z","repository":{"id":38420667,"uuid":"146611890","full_name":"NTNU-IHB/FMI4cpp","owner":"NTNU-IHB","description":"FMI 2.0 implementation written in modern C++.","archived":false,"fork":false,"pushed_at":"2025-02-28T09:09:40.000Z","size":4146,"stargazers_count":101,"open_issues_count":8,"forks_count":40,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-04-05T05:04:24.708Z","etag":null,"topics":["cmake","co-simulation","cpp17","fmi-standard","model-exchange"],"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/NTNU-IHB.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-08-29T14:25:41.000Z","updated_at":"2025-03-10T02:12:44.000Z","dependencies_parsed_at":"2024-01-14T20:16:29.624Z","dependency_job_id":"252f3d5e-cd8a-4f09-90e1-7a0a680e263f","html_url":"https://github.com/NTNU-IHB/FMI4cpp","commit_stats":{"total_commits":832,"total_committers":10,"mean_commits":83.2,"dds":0.5108173076923077,"last_synced_commit":"71d30042e4044bdd12ccf9fa756046b801e46502"},"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NTNU-IHB%2FFMI4cpp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NTNU-IHB%2FFMI4cpp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NTNU-IHB%2FFMI4cpp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NTNU-IHB%2FFMI4cpp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NTNU-IHB","download_url":"https://codeload.github.com/NTNU-IHB/FMI4cpp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247289424,"owners_count":20914464,"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-standard","model-exchange"],"created_at":"2024-10-02T18:10:18.249Z","updated_at":"2025-04-05T05:04:33.164Z","avatar_url":"https://github.com/NTNU-IHB.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# FMI4cpp (work in progress)\n\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](https://github.com/NTNU-IHB/FMU-proxy/issues)\n[![Join the chat at https://gitter.im/NTNU-IHB/FMI4cpp](https://badges.gitter.im/NTNU-IHB/FMI4cpp.svg)](https://gitter.im/NTNU-IHB/FMI4cpp?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge\u0026utm_content=badge)\n\n[![GitHub Actions](https://github.com/NTNU-IHB/FMI4cpp/workflows/Conan/badge.svg)](https://github.com/NTNU-IHB/FMI4cpp/actions)\n\nFMI4cpp is a cross-platform [FMI](https://fmi-standard.org/) 2.0 implementation written in modern C++.\n\nInfluenced by its spiritual brother [FMI4j](https://github.com/NTNU-IHB/FMI4j), it aims to be\nan easy to install, easy to use, object-oriented and fast FMI implementation for C++.    \n\nFMI4cpp supports both **Co-simulation** and **Model Exchange**. \u003cbr/\u003e\n\n\n## Build instructions\n\nRefer to [BUILDING.md](BUILDING.md)\n\n#### API\n\n```cpp\n#include \u003ciostream\u003e \n#include \u003cfmi4cpp/fmi4cpp.hpp\u003e\n\nusing namespace fmi4cpp;\n\nconst double stop = ...;\nconst double stepSize = ...;\n\nint main() \n{\n    fmi2::fmu fmu(\"path/to/fmu.fmu\");\n\n    auto cs_fmu = fmu.as_cs_fmu();\n    auto me_fmu = fmu.as_me_fmu();\n    \n    auto cs_md = cs_fmu-\u003eget_model_description(); //smart pointer to a cs_model_description instance\n    std::cout \u003c\u003c \"model_identifier=\" \u003c\u003c cs_md-\u003emodel_identifier \u003c\u003c std::endl;\n    \n    auto me_md = me_fmu-\u003eget_model_description(); //smart pointer to a me_model_description instance\n    std::cout \u003c\u003c \"model_identifier=\" \u003c\u003c me_md-\u003emodel_identifier \u003c\u003c std::endl;\n    \n    auto var = cs_md-\u003eget_variable_by_name(\"my_var\").as_real();\n    std::cout \u003c\u003c \"Name=\" \u003c\u003c var.name() \u003c\u003c  \", start=\" \u003c\u003c var.start().value_or(0) \u003c\u003c std::endl;\n              \n    auto slave = cs_fmu-\u003enew_instance();\n    \n    slave-\u003esetup_experiment();\n    slave-\u003eenter_initialization_mode();\n    slave-\u003eexit_initialization_mode();\n    \n    double t;\n    double value;\n    auto vr = var.valueReference();\n    while ( (t = slave-\u003eget_simulation_time()) \u003c= stop) {\n\n        if (!slave-\u003estep(stepSize)) {\n            std::cerr \u003c\u003c \"Error! step() returned with status: \" \u003c\u003c to_string(slave-\u003elast_status()) \u003c\u003c std::endl;\n            break;\n        }\n        \n        if (!slave-\u003eread_real(vr, value)) {\n            std::cerr \u003c\u003c \"Error! step() returned with status: \" \u003c\u003c to_string(slave-\u003elast_status()) \u003c\u003c std::endl;\n            break;\n        }\n        std::cout \u003c\u003c \"t=\" \u003c\u003c t \u003c\u003c \", \" \u003c\u003c var.name() \u003c\u003c \"=\" \u003c\u003c value \u003c\u003c std::endl;\n     \n    }\n    \n    slave-\u003eterminate();\n    \n    return 0;\n}\n```\n\n*** \n\nWould you rather simulate FMUs in Java? Check out [FMI4j](https://github.com/NTNU-IHB/FMI4j)! \u003cbr\u003e\nWould you like to build JVM based FMUs? Check out [FMU4j](https://github.com/https://github.com/Vico-platform/FMU4j)! \u003cbr\u003e\nPerhaps you want to build FMUs using plain Python? Check out [PythonFMU](https://github.com/NTNU-IHB/PythonFMU)! \u003cbr\u003e\nNeed to distribute your FMUs? [FMU-proxy](https://github.com/NTNU-IHB/FMU-proxy) to the rescue! \n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fntnu-ihb%2Ffmi4cpp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fntnu-ihb%2Ffmi4cpp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fntnu-ihb%2Ffmi4cpp/lists"}