Message Boards Message Boards


Non-SI units and conversions in SystemModeler

Posted 3 years ago
2 Replies
4 Total Likes

Hello everybody,

I'm currently struggling using not pre-defined units within the SystemModeler. I'd specifically like to give the user the possibility to choose between ml/min and l/min (within the other, built-in options) for a volume flow rate input parameter and use mbar as unit for the simulated result. I can do the output by converting the unit in my code and giving the variable the attribute 'unit="mbar"', but I guess somehow SystemModeler can do it automatically like for m and mm. I couldn't find anywhere if or how I might achieve this. I've defined types and conversion functions, but am not able to 'teach' them to the SystemModeler.

Another issue is that SystemModeler doesn't seem to recognize prefixes. Considering again my example from above, SystemModeler doesn't convert ml/min in m3/s at all, this works for me only for built-in units like mm.

Thanks in advance,


2 Replies


SystemModeler has built in units for VolumeFlowRate so you can get the same functionality that is built in for mm with volumeflowrates. You need to declare your parameter or variable as follows:

parameter Modelica.SIunits.VolumeFlowRate vol(displayUnit = "m3/min") "Volume Flow";

or for a variable:

Modelica.SIunits.VolumeFlowRate vv;

-- VolumeFlowRate is a data type.

That is the good news.

The bad news is that WSM only seems to support units of m^3/s, m^3/min, m^3/hour, m^3/day, or l/s. If you want l/min or ml/min you will need to request it from the MathCore people in Sweden -- However, they have been responsive in the past and I have had them add units for me (ie mW and kW in Power for example).



User-defined unit conversions have been implemented since the release of SystemModeler 5.1 and will be available in the upcoming release. It will let you define and add your own unit conversions which will automatically be picked up and made available in models.

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract