FMI (Functional Mock-up Interface): Matlab / Simulink import/export - simulation

I would like to use the FMI interface for coupling Matlab and Simulink with other programs. My question: are there openSource FMU import/export packages available? I just find https://www.fmi-standard.org/tools.
Thank you vey much!

To my knowledge there are no add-ons that import FMUs into MATLAB/Simulink that are open source. For a "free" alternative you can use the Pilot package from the MathWorks. It requires MATLAB/Simulink 2015a or later, https://se.mathworks.com/matlabcentral/answers/181642-can-i-integrate-functional-mockup-units-fmu-with-simulink.
Update September 2017: MathWorks now provide FMU import (but not export) as a part of Simulink 2017b: https://www.mathworks.com/help/simulink/in-product-solutions

Related

Matlab Simulink and Reinforcement Learning Approach

I would like to create a project using a Matlab simulink environment model to find optimal parameters using reinforcement learning. Is it possible to export the environment data from matlab simulink and incorporate it into a python script or to create an interface to matlab simulink in order to train interactively with it? Or is there a better approach?
Unfortunately, this is rather vague, so I'm sorry, as I do not know what the matlab model will look like. It would also be helpful for me to see an example project or something along the lines of accessing Matlab Simulink data and reinforcement learning.
Thank you very much.
To create an interface with python script and the Simulink simulation, you can use MATLAB Engine for Python.
I could find a sample implementation in this blog. You can extend the simulate function in this example with an RL Agent to determine an action.
You can use simulink and generate coder from simulink. You must download simulink coder, matlab coder packages to generate code.

How to perform local sensitivity analysis in modelica

I want to do local senstivity analysis in Dymola to evaluate different parameters affecting the energy consumption in a building (for multi-familyhouse).
Can anyone give me some suggestions, how to do it in Dymola (Modelica) software?
You could export you model as FMU and then follow one of many the different paths for sensitivity analysis with FMUs:
PyFMI + SAlib Sensitivity Analysis using PyFMI - FMU in for-loop
FMI Toolbox for Excel by Modelon http://www.modelon.com/products/modelon-deployment-suite/fmi-add-in-for-excel/
openTURNS + FMI https://www.researchgate.net/publication/321624302_A_Probabilistic_take_on_system_modeling_with_Modelica_and_Python, https://github.com/openturns/otfmi, http://www.openturns.org/
...
Did you take a look at the "Design" library that comes with Dymola? It contains functions to sweep and perturb parameters.
You can load it in File -> Libraries -> Design. Some examples on how to apply the library can be found in the first chapers of the Dymola Manual 2. From the question I guess the Calibration package should be most useful for you.
One approach could be to do the modelling in Dymola (or OpenModelica, Simulation X, whatever), and then do the parameter sweep, pre- and post-processing, plotting, optimization and so on from Python. Dymola has a Python interface, so you can start simulation, read results, change parameters and so on from Python. Everything that can be done from the GUI is in theory also possible from the Python interface.
A Matlab interface and a Javascript interface are also available.

Generating c++ Code from *.slx

I have a question regarding generating C++ code from a Simulink diagrams (*.slx file). I know that one could generate c/c++ and header files using Simulink Coder toolbox. Is there any other way to generate c/c++ file from a Simulink diagrams? Maybe Embedded Coder?(I have tested codegen, but does not work, since it generate c++ code from an M-file)
You have to get a license for the Simulink Coder. You may take a look at the alternatives I mentioned in my comment, but as long as the Simulink Coder satisfies your requirements, it's the cheapest option.

Which version of Matlab Simulink Control System Toolbox include LQR

I have tried some matlab version (2011a, 2012b, and 2015a). The 2012b doesn't include the Control System Toolbox inside Simulink Library. The 2011a and 2015a do include the Control System Toolbox inside Simulink Library. But these Control System Toolboxes don't include LQR.
Do you know which version of Matlab that has the LQR in the Simulink Control System Toolbox?
Thank you!
For the MAthworks On-line Documentation, LQR is available in Matlab 2015a. Have a look at this
Edit31.03.2015
Well, what you can do is build it yourself. just drug and drop the basic blocks to build the control structure, create a subsystem and in the mask, you can initialize to to automatically calculate the LQR.
What you are saying doesn't make sense. There is no such thing (and never has been) as an LQR block. Can you show us which block you're talking about?
You need to compute your LQR controller in MATLAB using functions such as lqr, which have been part of the Control System Toolbox for ages, and then use the LTI block to include your controller into your Simulink model.
Note: what toolbox is and is not included in a release depends on your license, not on the release. What you are saying about R2012b not including the Control System Toolbox in Simulink doesn't make sense.

Is simulink part of Matlab product or a standalone product by itself?

I am not really sure on this one. I wanted to know simulink is part of matlab software or if it is a product that can be bought and installed by itself.
Here's the relevant product dependency documentation. If you scroll down the list to Simulink, it states
Simulink
Requires MATLAB
Requires Fixed-Point Designer for simulating fixed-point data types
Some features require the use of a C Compiler. ...
Simulink cannot be run as standalone software, it requires MATLAB to be installed.