fmi4cpp

FMI 2.0 implementation written in modern C++.

https://github.com/ntnu-ihb/fmi4cpp

Science Score: 62.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
    1 of 8 committers (12.5%) from academic institutions
  • Institutional organization owner
    Organization ntnu-ihb has institutional domain (www.ntnu.edu)
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (9.5%) to scientific vocabulary

Keywords

cmake co-simulation cpp17 fmi-standard model-exchange

Keywords from Contributors

pde
Last synced: 6 months ago · JSON representation ·

Repository

FMI 2.0 implementation written in modern C++.

Basic Info
  • Host: GitHub
  • Owner: NTNU-IHB
  • License: mit
  • Language: C++
  • Default Branch: master
  • Homepage:
  • Size: 3.95 MB
Statistics
  • Stars: 103
  • Watchers: 6
  • Forks: 40
  • Open Issues: 7
  • Releases: 21
Topics
cmake co-simulation cpp17 fmi-standard model-exchange
Created over 7 years ago · Last pushed 12 months ago
Metadata Files
Readme License Citation

README.md

FMI4cpp (work in progress)

License: MIT contributions welcome Join the chat at https://gitter.im/NTNU-IHB/FMI4cpp

GitHub Actions

FMI4cpp is a cross-platform FMI 2.0 implementation written in modern C++.

Influenced by its spiritual brother FMI4j, it aims to be an easy to install, easy to use, object-oriented and fast FMI implementation for C++.

FMI4cpp supports both Co-simulation and Model Exchange.

Build instructions

Refer to BUILDING.md

API

```cpp

include

include

using namespace fmi4cpp;

const double stop = ...; const double stepSize = ...;

int main() { fmi2::fmu fmu("path/to/fmu.fmu");

auto cs_fmu = fmu.as_cs_fmu();
auto me_fmu = fmu.as_me_fmu();

auto cs_md = cs_fmu->get_model_description(); //smart pointer to a cs_model_description instance
std::cout << "model_identifier=" << cs_md->model_identifier << std::endl;

auto me_md = me_fmu->get_model_description(); //smart pointer to a me_model_description instance
std::cout << "model_identifier=" << me_md->model_identifier << std::endl;

auto var = cs_md->get_variable_by_name("my_var").as_real();
std::cout << "Name=" << var.name() <<  ", start=" << var.start().value_or(0) << std::endl;

auto slave = cs_fmu->new_instance();

slave->setup_experiment();
slave->enter_initialization_mode();
slave->exit_initialization_mode();

double t;
double value;
auto vr = var.valueReference();
while ( (t = slave->get_simulation_time()) <= stop) {

    if (!slave->step(stepSize)) {
        std::cerr << "Error! step() returned with status: " << to_string(slave->last_status()) << std::endl;
        break;
    }

    if (!slave->read_real(vr, value)) {
        std::cerr << "Error! step() returned with status: " << to_string(slave->last_status()) << std::endl;
        break;
    }
    std::cout << "t=" << t << ", " << var.name() << "=" << value << std::endl;

}

slave->terminate();

return 0;

} ```


Would you rather simulate FMUs in Java? Check out FMI4j!
Would you like to build JVM based FMUs? Check out FMU4j!
Perhaps you want to build FMUs using plain Python? Check out PythonFMU!
Need to distribute your FMUs? FMU-proxy to the rescue!

Owner

  • Name: NTNU - Department of Ocean Operations and Civil Engineering
  • Login: NTNU-IHB
  • Kind: organization
  • Location: Ålesund

Citation (CITATION.cff)

cff-version: 1.2.0
title: FMI4cpp
message: >-
  If you use FMI4cpp in your research, please cite it using
  the following metadata.
type: software
authors:
  - family-names: Hatledal
    given-names: Lars Ivar
    orcid: 'https://orcid.org/0000-0001-6436-7213'
    email: larsivarhatledal@gmail.com
    affiliation: 'NTNU Aalesund, Norway'
repository-code: 'https://github.com/NTNU-IHB/FMI4cpp'
url: 'https://github.com/NTNU-IHB/FMI4cpp'
abstract: >-
  FMI4cpp is a modern C++ library that provides support for
  the Functional Mock-up Interface (FMI) 2.0 standard. It
  enables the integration and simulation of Functional
  Mock-up Units (FMUs) within C++ applications, facilitating
  model exchange and co-simulation.
keywords:
  - FMI
  - FMU
  - C++
  - Simulation
  - Co-simulation
  - Model Exchange
  - Functional Mock-up Interface
license: MIT
commit: 1c6f77b
version: 0.8.3
date-released: '2022-06-29'

GitHub Events

Total
  • Issues event: 8
  • Watch event: 8
  • Issue comment event: 24
  • Push event: 14
  • Pull request event: 8
  • Fork event: 5
  • Create event: 1
Last Year
  • Issues event: 8
  • Watch event: 8
  • Issue comment event: 24
  • Push event: 14
  • Pull request event: 8
  • Fork event: 5
  • Create event: 1

Committers

Last synced: 9 months ago

All Time
  • Total Commits: 839
  • Total Committers: 8
  • Avg Commits per committer: 104.875
  • Development Distribution Score (DDS): 0.501
Past Year
  • Commits: 15
  • Committers: 3
  • Avg Commits per committer: 5.0
  • Development Distribution Score (DDS): 0.267
Top Committers
Name Email Commits
Lars Ivar Hatledal l****t@n****o 419
Lars Ivar Hatledal l****t@h****o 407
Silvio Traversaro s****o@t****t 5
WeilongWen 8****n 3
Christophe Prud'homme c****e@c****r 2
The Gitter Badger b****r@g****m 1
Kuhnovic 6****c 1
KBaluev w****e@g****m 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 57
  • Total pull requests: 69
  • Average time to close issues: 3 months
  • Average time to close pull requests: 17 days
  • Total issue authors: 31
  • Total pull request authors: 6
  • Average comments per issue: 3.35
  • Average comments per pull request: 0.72
  • Merged pull requests: 61
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 6
  • Pull requests: 14
  • Average time to close issues: 13 days
  • Average time to close pull requests: 7 days
  • Issue authors: 5
  • Pull request authors: 4
  • Average comments per issue: 2.17
  • Average comments per pull request: 1.5
  • Merged pull requests: 9
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • markaren (19)
  • prudhomm (3)
  • mycrocs (3)
  • bcamus (2)
  • Number-One-Intern (2)
  • netpay2007 (2)
  • firefall123 (2)
  • mcleantom (1)
  • andre2007 (1)
  • ghorwin (1)
  • Buckskin (1)
  • Shannon-John (1)
  • Thantalos (1)
  • kepakiano (1)
  • fresh-ji (1)
Pull Request Authors
  • markaren (54)
  • WeilongWen (6)
  • prudhomm (6)
  • Kuhnovic (1)
  • FDzhang (1)
  • KBaluev (1)
Top Labels
Issue Labels
bug (7) enhancement (4) conan (2) help wanted (2) invalid (1) vcpkg (1) continuous integration (1)
Pull Request Labels

Packages

  • Total packages: 2
  • Total downloads: unknown
  • Total dependent packages: 0
    (may contain duplicates)
  • Total dependent repositories: 0
    (may contain duplicates)
  • Total versions: 2
  • Total maintainers: 1
spack.io: fmi4cpp

FMI4cpp is a cross-platform FMI 2.0 implementation written in modern C++. FMI4cpp supports both Co-simulation and Model Exchange.

  • Versions: 0
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Average: 28.3%
Dependent packages count: 56.5%
Maintainers (1)
Last synced: 7 months ago
conda-forge.org: fmi4cpp
  • Versions: 2
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Forks count: 29.0%
Dependent repos count: 34.0%
Stargazers count: 34.7%
Average: 37.2%
Dependent packages count: 51.2%
Last synced: 6 months ago

Dependencies

.github/workflows/config.yml actions
  • actions/checkout v2 composite
.github/workflows/upload.yml actions
  • actions/checkout v2 composite