Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/CATIA-Systems/Unity-FMI-Addon
Functional Mockup Interface (FMI) for Unity
https://github.com/CATIA-Systems/Unity-FMI-Addon
Last synced: 3 months ago
JSON representation
Functional Mockup Interface (FMI) for Unity
- Host: GitHub
- URL: https://github.com/CATIA-Systems/Unity-FMI-Addon
- Owner: CATIA-Systems
- License: other
- Created: 2018-06-13T11:49:42.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-06-19T17:07:25.000Z (over 6 years ago)
- Last Synced: 2024-06-22T14:41:08.677Z (5 months ago)
- Language: C
- Size: 302 KB
- Stars: 39
- Watchers: 17
- Forks: 14
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
Awesome Lists containing this project
- awesome-fmi - Unity-FMI-Addon - FMI support for [Unity](https://unity3d.com/), a cross-platform game engine. [BSD] (FMI 2 / Tools)
README
# Unity FMI Add-on
[Functional Mock-up Interface](https://fmi-standard.org/) for [Unity](https://unity3d.com/)
## Getting Started
Download and import the [Unity package](https://github.com/CATIA-Systems/Unity-FMI-Addon/releases). Select `Assets > Import FMU` to import the FMU.
This creates the model description in `Resources` that lists the available variables and extracts the FMU to the
`StreamingAssets` folder.Now you can use the FMU the in your scripts (see [BouncingBall.cs](Assets/SampleScenes/BouncingBall/BouncingBall.cs) for a complete example):
```csharp
public class BouncingBall : MonoBehaviour {FMU fmu;
void Start () {
fmu = new FMU2("bouncingBall");
fmu.SetupExperiment(Time.time);
fmu.EnterInitializationMode();
fmu.ExitInitializationMode();
}void FixedUpdate() {
fmu.DoStep(Time.time, Time.deltaTime);
transform.position = Vector3.up * (float)fmu.GetReal("h");
}}
```The example scene `SampleScenes/BouncingBall` shows you how to instantiate and reset the model, set input and get output.
![BouncingBall Scene](BouncingBall-Scene.png)
[Values.cs](Assets/SampleScenes/Values/Values.cs) demonstrates how to use value references and to get and set `Real`, `Integer`, `Boolean` and `String` variables.
## Limitations
Currently the FMI add-on supports only a limited subset of FMI 2.0 for co-simulation API. It runs on Mac and 64-bit Windows (make sure you select `x86_64` as architecture when exporting the player on Windows).
## Get DotNetZip.dll
If you've cloned the repository you need to download [dotnetzip.1.11.0.nupgk](https://www.nuget.org/api/v2/package/DotNetZip/1.11.0), extract it (it's a ZIP archive) and copy `DotNetZip.dll` in `lib/net20` to `Unity/Assets/FMI/Editor/Plugins`. This library is required to extract FMUs during the import. DotNetZip.dll is already included in the pre-built Unity package.
## Contributing
You've found a problem? Fantastic, a problem found is a problem fixed. Please take a moment to read the [contributing guide](CONTRIBUTING.md) before you [open an issue](https://github.com/CATIA-Systems/Unity-FMI-Addon/issues).
## License
The code is licensed under the [BSD 3-clause license](LICENSE.md). Copyright © 2018 Dassault Systèmes. All rights reserved.