to_percent function
Requirements.Units.Conversions.to_percent
ยท source
Convert from a ratio (unit 1) to percent
Extends Modelica.Units.Icons.Conversion
Convert from a ratio (unit 1) to percent: percent := r*100. The input r is a dimensionless ratio (type Real(unit="1")), the output percent the same ratio in percent (type NonSI.Percent), e.g. an efficiency of 0.92 becomes 92 %. The inverse is from_percent.
The conversion is a multiplication by a constant factor, without offset; it is exact up to floating-point rounding and has no limits on the input (a ratio above 1 gives more than 100 %). The function is inlined. A check model uses it to give a ratio of the model in percent when the requirement states it so; see Conversions. Examples.Elementary.Units.Conversions asserts it through the round trip to_percent(from_percent(7)).
Copyright © 2026 Model Based Innovation LLC. All rights reserved.
Inputs
| Name | Type | Description |
|---|---|---|
r input | Real | Value as a ratio |
Outputs
| Name | Type | Description |
|---|---|---|
percent output | NonSI.Percent | Value in percent |