GetUnitConverted

function GetUnitConverted(SrcVal: number, SrcUnitID: string, TargetUnitID: string, RefVal: number): number

Converts value in source measurement unit to target measurement unit. If no valid conversion formula is configured in unit_config.json, the function will return source value without changing it.

Parameter

Name

Type

Description

SrcVal

number

Value to be converted.

SrcUnitID

string

Unit group ID in which source value is calculated.

TargetUnitID

string

Unit group ID into which result should be calculated.

RefVal

number

Reference value resulting in 100% if display or system unit is Percent.

Return value

Type

Description

number

Result of unit conversion.

NuGet package: Beckhoff.TwinCAT.HMI.Plastic.Controls

Available: since version 12.6.0