Hello,
Use System Modeller a good deal yet need to use the Fluid Library too - this is not included in SM12.1 Modelica 3.2.3 yet is in most versions of 3.2.3.
The workaround seems to be to create a FMU in OMEdit Modelica and then export a FMU to System Modeller (Sim Center). Yet when I import even a simple model (Rotational, not even Fluid), I get the following:
*Error: Assertion triggered during translation: "Imported FMU does not support the current platform (as determined by ModelicaServices.target=Default), supported platforms: x86_64-pc-win32"
Build finished at 19:56:20 (took 00:00).*
Is there a known method to allow importation of an FMU to SM?
it looks like you are using a 64-bit FMU but building 32-bit simulations, you need to make them match. You can change to build 64-bit simulations by going to Options > Global > Compiler and select a 64-bit compiler configuration instead.
I’m still not having any luck, so here is some more detail if this helps:
In Model Center I have two complier options:
GCC/G++ with x86_64
Glang++ 11.0.3 64bit with x86_64
I have imported the simple rotation model via System Modeller as both Model Exchange and Co_simulation.
As a .mo, both work fine in both OMEdit on W10 and System Modeller/Model Centre on my Mac.
I used the .mo in OMEdit to create a FMU:
mingw32-make: Entering directory ‘C:/Users/Chris/AppData/Local/Temp/OPENMO~1/OMEdit/Rotation’
rm -f Rotation.fmutmp/sources/Rotation_init.xml
cp -a “C:/Program Files/OpenModelica1.14.1-64bit//share/omc/runtime/c/fmi/buildproject/” Rotation.fmutmp/sources
cp -a Rotation_FMU.libs Rotation.fmutmp/sources/
mingw32-make: Leaving directory ‘C:/Users/Chris/AppData/Local/Temp/OPENMO~1/OMEdit/Rotation’
RESULT: 0*
I then tried to simulate them both in Model Centre, and both resulted in:
Error: Assertion triggered during translation: “Imported FMU does not support the current platform (as determined by ModelicaServices.target=Default), supported platforms: x86_64-pc-win32”
While the link below gave great hope in being able to use SystemModeller for Fluids, I have run into this.
You need to generate the FMU on the same platform as you are running SystemModeler, so if you use SystemModeler on macOS you need to export the FMU on macOS as well.
I just want to confirm that both of these (System Modeller, OMEdit) running on one OS, namely Windows 10, that the FMU 32bit vs. 64bit is solved. I will have to purchase an additional Wolfram license and don’t want to do so unless this is a path forward.
With this I will create Fluids models in SM for ease of editing and such, then move the .mo to OMEdit, create the run it, edit as required, then export the working model to FMU. Then open in SM on Windows.
from what I understand of what you are saying this should work?
I then plan to call is as a model in Mathematica for optimisation and data work. Do you foresee this as also requiring a Windows version of Mathematica?
In most cases the FMU is a binary so it’s tied to the OS it was built for. There are some support in the standard for source code FMUs but that’s not supported by SystemModeler. However, what you could do is export it as a source code FMU from OpenModelica (if they support it) and then compile the binary manually on macOS so that you get binary FMU for macOS.
I thought the OpenModelica was available on macOS, so you shouldn’t need to move to Windows.
Thank you for the help. In the longer term I will get OMEdit on my Mac side as it seems the solution. Yet due to some complexities (having openFoam CFD on my Mac side), the installation is problematic. I think I found a work around in the Windows environment.
I realise this is likely not for public consumption, but does it look like System Modeller might support fully Fluids in the next version - Spring 2021? I do have my hopes.
You are right I won’t comment on release plans here.
I see from you old posts that you have tried to use Fluid in the past, have you tried i lately? Might be worth a shot, there is no particular Modelica construct that Fluid needs that SystemModeler doesn’t support. It’s more that in many cases the resulting equation systems require more symbolic processing to be easily solvable and that you can workaround to some extent while modeling.
I have tried Fluid models in SM. For a long time did try building models in SM, yet past the basic editing, there were always errors that I believe had to do with the Flow connectors. I built the same models in OMEdit and they run. With those working models, I then try them in SM, but no luck. The models are not complicated: a sink and source (ideal gas), two valves, and a volumetric compressor. Even using only standard Modelica 3.2.3 elements, it does not work. I tried with with SM12 and SM12.1. Often they seem ok in SM yet fail in compiling in MC or fail the run.
This is unfortunate since the SM environment is much nicer to work in and the integration with Mathematica is great. Yet I must say that OMEdit is getting much better and has several advantages over SM:
- being able to arrange and move plots around - while SM has a nice presentation, they are a fixed stack order, meaning if you want to change this, you must rebuild the work
(yet OMEdit doesn’t save plot settings, so each has its own issues)
- Optimaztion is much better in OMEdit:
1) It is easier to do parameter sweeps in OMEdit and appears to be faster than the SM->Mathematic path
2) The OMOtim package of OMEdit allows system optimisation of the system - it is much faster than the parametric optimisation of SM->M.
I do have great hope for SM13 with learning all the tricks of OMEdit and of course Fluids.
For now I am working OMEdit for my fluid projects an then → .xls → Mathematica for post-processing.
This is unfortunate since the SM environment is much nicer to work in and the integration with Mathematica is great. Yet I must say that OMEdit is getting much better and has several advantages over SM: - being able to arrange and move plots around - while SM has a nice presentation, they are a fixed stack order, meaning if you want to change this, you must rebuild the work (yet OMEdit doesn’t save plot settings, so each has its own issues).
Are you referring to the tabbed interface here? It is still possible to switch to an MDI interface SimulationCenter>Preferences>SimulationCenter (or Tools>Options>SimulationCenter if you are on Windows/Linux) and select MDI.
Thank you for that bit of knowledge - the MDI vs TDI displays. That goes a long way as it saves the plots. When working one type of model, it is helpful to see a parametric and a group y-time plots.
so for my mechanical models (rotational…), this is much better - being OMEdit, yet for Fluids… perhaps SM13.
On a side question, is it possible to save the plot settings - ie, the shading and line width, axis labels. While one can save the plot data selection, plot improvements beyond that do not save (at least with the knowledge I have).
Thank you for that bit of knowledge - the MDI vs TDI displays. That goes a long way as it saves the plots. When working one type of model, it is helpful to see a parametric and a group y-time plots. - so for my mechanical models (rotational…), this is much better - being OMEdit, yet for Fluids… perhaps SM13.
Is the reason that you want the MDI that you want to see a parametric and a time plot at the same time? That’s actually possible, but perhaps not that obvious. If you use the Plot > Plot Data Setup Dialog you can add a parametric plot to a X(T) plot window, see attached plot for an example.
On a side question, is it possible to save the plot settings - ie, the shading and line width, axis labels. While one can save the plot data selection, plot improvements beyond that do not save (at least with the knowledge I have).
No cosmetic changes are saved when saving as a model plot (Plot > Add Plot To Model), but there is a global setting for the the default line width.
The saving of the line settings does help in a minor way. What I have ended up doing is just pulling the data to Mathematica where I can have width, dashing, filling, colour all saved. It works, but is two steps. In future SM, it would be great if something similar were possible. For example, being able to save a preset for a plot to meet a certain publication standard (colours, Labels, width, etc) would be great. For now, Sm-> Mathematica works.
For now, working with Modelica Fluids, I do this:
design and edit in SM
to OMEdit for final edit and running the model
.mat to SM MC for an easy import/conversion to .csv
Import[] to Mathematica then to post-processing and plots .
Eventually I will parse the .Mat directly in Mathematic. It works, but painful.
For example, being able to save a preset for a plot to meet a certain publication standard (colours, Labels, width, etc) would be great. For now, Sm-> Mathematica works.
Yes that would indeed be useful.
For now, working with Modelica Fluids, I do this: - design and edit in SM - to OMEdit for final edit and running the model - .mat to SM MC for an easy import/conversion to .csv - Import[] to Mathematica then to post-processing and plots .
Then you simplify the process by opening the mat file directly in Mathematica, note that it will take ownership of the file and will delete int when you quit so you probably want to wrap that function with something that makes a temporary copy of the original file.
Thank you. This allows the full power of Mathematica to be easily applied to a external simulation.
I had assumed that the model would need to exist in SM, but almost all the functionally exist with just the imported .mat data file. I have never seen that advertised anywhere.