WOLFRAM SYSTEM MODELER

withUnit

Create measurement by attaching unit to a value

Wolfram Language

In[1]:=
SystemModel["SystemModelerExtras.Experimental.Units.withUnit"]
Out[1]:=

Information

The call withUnit(u, unit) constructs a value of quantity from the numerical value u and the unit unit. The numerical value u must have empty unit. The argument unit must be an evaluable String expression (typically a String literal) with valid unit syntax.

The resulting value of quantity is obtained by attaching the unit to to the numerical value u.

The optional argument absoluteValue determines the interpretation of unit offsets, similar to the absoluteValue-annotation. For the default unknown, the unit system provides an interpretation based on the unit, similar to when there is no absoluteValue-annotation for a component declaration.

Using withUnit only attaches translation-time information for the unit handling system, and does not introduce any arithmetic on the numerical value u.

Syntax

amount = withUnit(value, unit, absoluteValue)

Inputs (3)

value

Type: Real

Description: Value of measurement expressed in 'unit'

unit

Type: String

Description: Unit for expressing measurement

absoluteValue

Default Value: __Wolfram_unknown

Type: __Wolfram_Ternary

Description: Interpretation of unit offsets

Outputs (1)

amount

Type: Real

Description: Measurement, expressed in 'unit'