to_g function
Requirements.Units.Conversions.to_g
ยท source
Convert from kilogram to gram
Extends Modelica.Units.Icons.Conversion
Convert from kilogram to gram: g := kg*1000. The input kg is the value in kilogram (type Modelica.Units.SI.Mass), the output g the value in gram (type NonSI.Mass_g). The inverse is from_g.
The conversion is a multiplication by a constant factor, without offset, so it converts differences and rates alike; it is exact up to floating-point rounding and has no limits on the input. The function is inlined. A check model uses it to give a variable of the model in the unit in which the requirement states it; see Conversions. Examples.Elementary.Units.Conversions asserts it through the round trip to_g(from_g(7)).
Copyright © 2026 Model Based Innovation LLC. All rights reserved.
Inputs
| Name | Type | Description |
|---|---|---|
kg input | SI.Mass | Value in kilogram |
Outputs
| Name | Type | Description |
|---|---|---|
g output | NonSI.Mass_g | Value in gram |