Giter VIP home page Giter VIP logo

fmi4cpp's People

Contributors

gitter-badger avatar kbaluev avatar kuhnovic avatar markaren avatar prudhomm avatar traversaro avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

fmi4cpp's Issues

Program will always crash if a prior run crashed without deleting the temporal folder.

Program will always crash if a prior run crashed without deleting the temporal folder.
If the folder is manually deleted from the temp directory (fmi4cpp generated folders are prefixed with fmi4cpp_), things will start working again.

I don't understand why this is happening as folders are generated per FMU and should not affect independent program runs..

Improve logging

Logging is clumsy and should be improved.

Today it's like this:

#if FMI4CPP_DEBUG_LOGGING_ENABLED
    cout << "Hello world!'" << endl;
#endif

FMI4CPP_DEBUG_LOGGING_ENABLED can be misspelled and the message is only printed in debug mode and cannot be turned off. A logging framework provided more control should probably be used.

There are probably some best practices in the C++ that should be followed?

Use boosts optional in public headers

Long ago, boost/optional was replaced with (c++17) optional (in public headers) in order to not publicly have boost as a project dependency. This was before boost-odeint was added. With that module enabled, boost must be present in public headers anyway, so we might just use boost optional.

This might fix #61

Support FMI 3.0

Just FYI, FMI 3.0 will be supported in the future.
Some refactoring is underway to accommodate this, but the actual FMI 3.0 support will not come before it's officially released.

FMI export support

Hi @markaren,
thanks for the great work on the library!

I had a small question, as I was not able to find this info in the README. At the moment the library provides support for importing FMUs, but I was wondering if you have planned/are interested in providing facilities/support for implementing FMU in C++, in a sense providing support for "FMI export".

Adding C headers

It would be great if you could provide C headers also, to access the library FMI4cpp. I would like to call this library from the D Programming Language. D can easily access libraries which has a C headers (and to a specific degree also C++ headers, but here I failed).

ValueReference is only unique within in a base class

I thought a valueReference was a unique identifier to scalarVariable (or a list of scalarVariable that are aliases). But it seems you can have the same valueReference for a integer/real/boolean/string/enumeration.

That means the getByValueReference function is wrong, as it will return the first occurence.

Visual studio NOMINMAX

It's not really an bug from fmi4cpp.
But under visual studio I get syntax error at line 104 of fmi2/xml/typed_scalar_variable.hpp when I try to include fmi4cpp.hpp in my project.
The problem is caused by the minwindef.h that define min and max macros, which break the bounded_scalar_variable::min().
One of the solution is to include fmi4cpp.hpp earlier or define NOMINMAX as suggest here

Though I put a message here in case it help others like me that were not familiar with this windows macro.

Discontinue ME wrapper

I'm not sure this feature is even used, and I cannot vouch for it's validity.
I Believe this feature is best implemented by users themselves.

To be clear, the ME API will persist, but fmi4cpp will not provide a way to wrap ME models as CS ones.

canBeInstantiatedOnlyOncePerProcess is not handled propely

The current approach is to reload the shared library if canBeInstantiatedOnlyOncePerProcess=true, otherwise re-use it. E.g for fmi2CoSimulationFmu:

unique_ptr<fmi2CoSimulationSlave> fmi2CoSimulationFmu::newInstance(const bool visible, const bool loggingOn) {
    shared_ptr<fmi2CoSimulationLibrary> lib = nullptr;
    string modelIdentifier = modelDescription_->modelIdentifier();
    if (modelDescription_->canBeInstantiatedOnlyOncePerProcess()) {
        lib = make_shared<fmi2CoSimulationLibrary>(modelIdentifier, resource_);
    } else {
        if (lib_ == nullptr) {
            lib_ = make_shared<fmi2CoSimulationLibrary>(modelIdentifier, resource_);
        }
        lib = lib_;
    }
    fmi2Component c = lib->instantiate(modelIdentifier, fmi2CoSimulation, guid(),
                                       resource_->getResourcePath(), visible, loggingOn);
    return make_unique<fmi2CoSimulationSlave>(c, lib, modelDescription_);
}

Apparently this approach is flawed and won't work.

Compilation error during conan create .

Thank you for providing this package.
Some error messages (Cf later in the post) during compilation after the command :
conan create . FMI4cpp/testing while I am in the /Documents/FMI/FMI4cpp-conan$ directory.

My current system is the following :
Linux 4.9.0-8-amd64 #1 SMP Debian 4.9.130-2 (2018-10-27) x86_64 GNU/Linux
I also add to manually install cmake to this version as the Debian distro doesn't provide it.
cmake version 3.14.2

Could you be so kind as to providing some advices for me to solve this issue?
Thank you for your help.

.....

Here is one of the error messages ....
/ModelDescription.hpp:29:20: fatal error: optional: No such file or directory
#include
....
Following is a detailed description of the error message ending with the previous lines.
[ 31%] Building CXX object src/CMakeFiles/fmi4cpp.dir/fmi4cpp/fmi2/import/fmi2Fmu.cpp.o
[ 36%] Building CXX object src/CMakeFiles/fmi4cpp.dir/fmi4cpp/fmi2/import/fmi2CoSimulationLibrary.cpp.o
[ 42%] Building CXX object src/CMakeFiles/fmi4cpp.dir/fmi4cpp/fmi2/import/fmi2Library.cpp.o
In file included from /home/frederic/.conan/data/FMI4cpp/0.6.1/FMI4cpp/testing/build/2ddc3fb6da02007e31c4d4885b23776a2dab579a/FMI4cpp/src/../include/fmi4cpp/fmi2/fmi2.hpp:29:0,
from /home/frederic/.conan/data/FMI4cpp/0.6.1/FMI4cpp/testing/build/2ddc3fb6da02007e31c4d4885b23776a2dab579a/FMI4cpp/src/../include/fmi4cpp/fmi4cpp.hpp:28,
from /home/frederic/.conan/data/FMI4cpp/0.6.1/FMI4cpp/testing/build/2ddc3fb6da02007e31c4d4885b23776a2dab579a/FMI4cpp/src/../include/fmi4cpp/common/driver/fmu_driver.hpp:31,
from /home/frederic/.conan/data/FMI4cpp/0.6.1/FMI4cpp/testing/build/2ddc3fb6da02007e31c4d4885b23776a2dab579a/FMI4cpp/src/fmi4cpp/common/driver/fmu_driver.cpp:29:
/home/frederic/.conan/data/FMI4cpp/0.6.1/FMI4cpp/testing/build/2ddc3fb6da02007e31c4d4885b23776a2dab579a/FMI4cpp/src/../include/fmi4cpp/fmi2/xml/ModelDescription.hpp:29:20: fatal error: optional: No such file or directory
#include
^

Discontinue driver

In order to keep this repository slimmer for easier maintenance, I've decided to remove the driver application. I have not used i myself and don't know others that have either.

Wrap ME models as CS ones

Allow ME models to be wrapped as CS models. Requires solvers. Sundials are available through vcpkg. But I have to check that linux is supported. If not I should add the support to the port file myself.

make install fails

Hello,

When doing make install, the following error is thrown :

CMake Error at cmake_install.cmake:68 (file): file INSTALL cannot find "/root/FMI4cpp/cmake/FindCURL_.cmake".

Best,

Benjamin

init() is to simple

While FmuSlave::init(start, stop) is easy to use, bu it introduces some issues:

  • Tolerance cannot be set
  • Start values cannot be set

Solution: Let the user call the three functions (setupExperiment, enterInitializationMode and exitInitializationMode) that init calls internally manually.

Feedback from users

Hi,
I would very much like to hear from you, the person reading this.
Why are you interested in this project, have you tried it?
What is unclear, what can be improved?

Note that it is also possible to chat on gitter!

unzip is not unzipping subdirectories

in fmu::fmu, unzip is called, and it finds the appropriate files. However, those in the subdirectories (e.g. binaries/win64) are not written to the uncompressed temp location. I see logic in unzipper
if (sb.size == 0) {
fs::create_directories(newFile);
} else {
that is meant to catch the directories and create them, but it never executed. Is there a specific compression method needed so that libzip finds the directories first? I used normal windows compressed folder creation and 7zip without success.

Solve compile errors cause by typed_scalar_variable.hpp

When compiling with Visual Studio 2019 errors occur in typed_scalar_variable.hpp since the min and max member functions of bounded_scalar_variable.
This can be solved by undefining the old min and max macros via:

#ifdef max
#undef max
#endif

#ifdef min
#undef min
#endif

Exception when trying to load an FMU generated from MATLAB Simulink

I'm trying to write a little program that needs to load an example FMU generated from Simulink (a multiplier). It works using PyFMI but not in FMI4cpp, and specifically it's throwing an exception when trying to create a new instance.

  fmi4cpp::fmi2::fmu multiplier("multiplier.fmu");

  auto cs_fmu = multiplier.as_cs_fmu();
  auto cs_md = multiplier.get_model_description();
  auto step_size = cs_md->default_experiment->stepSize;
  auto stop_time = cs_md->default_experiment->stopTime;

  auto int1 = cs_md->get_variable_by_name("int1").as_real();
  auto int2 = cs_md->get_variable_by_name("int2").as_real();
  auto outv = cs_md->get_variable_by_name("out").as_real();

  auto slave = cs_fmu->new_instance(); // exception

The exception is:

Unable to load dynamic library '/tmp/fmi4cpp_multiplier_23920508/binaries/linux64/multiplier.so'! /tmp/fmi4cpp_multiplier_23920508/binaries/linux64/multiplier.so: cannot open shared object file: No such file or directory
terminate called after throwing an instance of 'std::runtime_error'
  what():  Unable to load dynamic library '/tmp/fmi4cpp_multiplier_23920508/binaries/linux64/multiplier.so'! /tmp/fmi4cpp_multiplier_23920508/binaries/linux64/multiplier.so: cannot open shared object file: No such file or directory

Am I missing something or it's a bug?

Release 0.8.0

Guess it's time to release 0.8.0.
0.8.0 is not backwards compatible with 0.7.0 and removes some features.
Master branch has been based on 0.8.0 for a long long time.

Add port to vcpkg

Add vcpkg port. Should be straight forward, but I want to wait a little while to allow the API to settle.

Build dynamic library

Hello,

Is it possible to add a cmake option to create a dynamic (shared) library instead of a static one ?

Best,

Benjamin

FmuResource::getResourcePath() returns wrong path?

When using the current master of omc to generate an FMU, the file <model>_info.json is put directly into the resources folder inside the FMU. However, FMI4cpp looks for it in the folder "resources" + getOs() + "/" + getLibExt(), which for me is resources/linux64/.so and thus cannot find the file.
Is this a bug? When I remove adding getOs() and getLibExt() everything works as expected.

read() and write() on typed_scalar_variable be marked as const?

Should read() and write() on typed_scalar_variable be marked as const? Unless they are it seems problematic to make the example code work because as_integer() as_real() and friends return a const type. This makes templating with this type require the use of std::remove_const and an intermediate copy of the underlying description object.

virtual bool read(fmu_reader& reader, T& ref) = 0;

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.