No input/output terminals to FMU block

9 views (last 30 days)
Akhtar Zeb
Akhtar Zeb on 10 Sep 2019
Edited: Michael Taylor on 3 Apr 2020
Hello,
I am able to export Simulink’s FMU and it works fine in OMEdit (OpenModelica Connection Editor). However, while importing a FMU to the Simulink enviornment using the Simulink’s FMU Block, there are no input & output terminals to the block (model in figure) for visualizing the results or connecting it to the other blocks/components.
Do you have any ideas how does this work?FUM block terminals.jpg
Sincerely, Akhtar

Answers (1)

Abhilash Padma
Abhilash Padma on 6 Nov 2019
I think you are using a different block. Use “FMU import” block from “Simulink Extras” library. Refer the following documentation to know more about this block: https://in.mathworks.com/help/simulink/ref_extras/fmu.html
  2 Comments
Danielle Masse
Danielle Masse on 23 Jan 2020
I have encountered the same problem as the original poster, using the FMU import block from the Simulink Extras library. There is very litte additional information in the link you provide. Here are the steps I followed:
  1. Export .fmu from OpenModelica
  2. Launch MATLAB, then Simulink
  3. In SImulink Start Page, select Blank Model
  4. In the instantiated untitled model, select Library Browser
  5. Navigate to Simulink Extras > FMU Import, then drag and drop FMU block onto model editor
  6. Double-click FMU block, which is followed by the Block Parameters: FMU diaglog
  7. Select file folder broswer, and navigate to desired .fmu file
  8. When prompted, add path so that selected file can be appropriately accessed
  9. Select OK, FMU block updates with model name
  10. Double-click FMU block - Block Parameters: FMU dialog opens again, now with correct model Parameters
However, the Input/Output tabs state that "This block contains no structured input/output ports."
How can these ports be added? My model simulates and displayes output variables in OpenModelica. What needs to be done for the FMU to work the same in MATLAB/Simulink?
Michael Taylor
Michael Taylor on 3 Apr 2020
Edited: Michael Taylor on 3 Apr 2020
Hi Danielle,
In case you are still trying to resolve this, or for anyone else also stuck at this point:-
You are able to provide input and output ports by adding input or output connectors to the OpenModelica model, e.g. those from Modelica.Blocks.Interfaces or connectors that inherit from these. These are added in OpenModelica before carrying out the steps as listed above. It seems as though editing the block structure should preferably be done pre-export, rather than making amendments to the FMU itself. Another thing to note is that open connectors in sub-models do not seem to be picked up by Simulink. If you want these to be accessible as ports in Simulink, you can connect them to connecters added to the top-level model that you are exporting.
Also, if you find that the FMU import takes an age to complete or just hangs, it might be because Simulink is trying to save a lot of information to a network drive as part of the import process. Try setting your current directory as a local drive. I nearly gave up on the entire FMU process before realising that this was causing the problem!

Sign in to comment.

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!