How to use the Vortex unit system in Unity

 

In order to support both the US and metric unit systems, users can now convert values into the Unity system that has been selected for the simulator. This page contains a description of the methods and enums used as parameter that are currently available.

UnitSystem utility class

The static UnitSystem class is available to help in this goal. Its methods can be used for converting units or getting a unit symbol. They use the PhysicalDimension and DimensionHint enums, described below:

PhysicalDimension

Here are the available enum values for the PhysicalDimension

Name

Example with units

Name

Example with units

None

 

Length

Meter $m$

Volume

Meter^3 $m^3$

Mass

Kilogram $kg$

Time

Second $sec$

Angle

Radian $rd$

LinearSpeed

Meter per Second $m/sec$

LinearAcceleration

Meter per Second^2 $m/sec^2$

AngularSpeed

Radian per Second $rd/sec$

AngularAcceleration

Radian per Second^2 $rd/sec^2$

Force

Newton $N$

Torque

Newton Meter $N.m$

Energy

Joule $J$

Work

Joule $J$

Power

Watt $W$

MomentInertia

Kilogram Meter^2 $Kg.m^2$

SpringConstant

Newton per Meter $N/m$

SpringDamping

Mass per Second $Kg/sec$

SpringConstantUnitLength

Newton $N$

SpringDampingUnitLength

Mass Meter per Second $Kg.m/sec$

KineticLoss

Second per Mass $sec/Kg$

Percentage

Percentage 0 to 100

Normalize

Normalize 0 - 1

SpringConstantAngular

Newton Meter per radian $N.m/rd$

SpringDampingAngular

Mass Meter^2 per Second radian $Kg.m^2/(sec.rd)$

SpringConstantAngularUnitLength

Newton Meter^2 per radian $N.m^2/rd$

SpringDampingAngularUnitLength

Mass Meter^3 per Second radian $Kg.m^3/(sec.rd)$

DampingLinearVelocity

Kg/sec

DampingAngularVelocity

Kg*m^2/sec

Density

Kg/m^3

LinearDensity

Kg/m

Momentum

Kg*m/sec

Count

Real physical dimension i.e. Number of containers

DynamicTransformationMatrix

4x4 matrix with translation and rotation, no scaling

FullTransformationMatrix

4x4 matrix with translation, rotation, and scaling

Pressure

Pascal or $N/m^2$

Scale

A scaling factor applied to another quantity : this is unitless.

SpringCompliance

Meter per Force $m/N$

SpringComplianceAngular

Radian per Newton Meter $rd/N.m$

Frequency

Hertz

SurfaceDensity

Unit per Hectare $unit/ha$

AngularKineticLoss

Seconds per kilograms per meters squared $sec/(kg.m^2)$

Area

Meter^2 $m^2$

VolumeFlowRate

Meter^3/sec $m^3/sec$

CubicMeterPerSecond

Same as VolumeFlowRate

LiquidVolume

Liters $L$

LiquidVolumeRate

Liters per hour $L/h$

RotationRate

Revolutions per minute $RPM$

BucketEfficiencyFuel

Mass per liquid volume $kg/liter$

BucketEfficiencyTime

Mass per second $kg/s$

BladeEfficiency

$kg*m/liter$

Temperature

Temperature $degree Celsius$

DimensionHint

Here are the available enum values for the DimensionHint

Name

Description

Name

Description

Standard

Use the standard display for this unit

LinearSpeedKmh

Kilometer per hour $km/h$ stored as kLinearSpeed in m/s

MassTon

Ton $t$ stored as kMass in kg

PowerKilowatt

Kilowatt $kW$ stored as kPower in watt

PressureKilopascal

Kilopascal $kPa$ stored as kPressure in pascal

BucketEfficiencyTonPerLiter

Ton per liter $t/L$ stored as kBucketEfficiencyFuel in kg/L

BucketEfficiencyTonPerHour

Ton per hour $t/h$ stored as kBucketEfficiencyTime in kg/s

LinearSpeedMmin

Meter per minute $m/min$ stored as kLinearSpeed in m/s

BladeEfficiencyKgKmL

Kilogram-kilometer per liter $kgkm/L$ stored as kBladeEfficiency in kgm/L

BladeEfficiencyTonKmL

Ton-kilometer per liter $tkm/L$ stored as kBladeEfficiency in kgm/L

LengthKm

Kilometer $km$ stored as kLength in m

LengthMm

Millimeter $mm$ stored as kLength in m

PressureBar

Bar $bar$ stored as kPressure in pascal

LengthCm

Centimeter $cm$ stored as kLength in m

Methods

/// Convert a basic value in the given physical dimension to the preferred unit system /// public static double ConvertToPreferred(double value, PhysicalDimension unit, DimensionHint display = DimensionHint.Standard) => VortexRuntime.ConvertToPreferred(value, unit, display); /// Get the unit abbreviation for the given physical dimension in the preferred unit system /// public static string GetPreferredUnitSymbol(PhysicalDimension unit, DimensionHint display = DimensionHint.Standard) => VortexRuntime.GetPreferredUnitSymbol(unit, display);

Code example

// All examples assume the application is using the metric system ExampleConvertToPreferredMethod() { double angleValue = UnitSystem.ConvertToPreferred(1.0, PhysicalDimension.Angle); // angleValue will be 57.2957795 double massTonValue = UnitSystem.ConvertToPreferred(1500.0, PhysicalDimension.Mass, DimensionHint.MassTon); // massTonValue will be 1.5 } ExampleGetPreferredUnitSymbolMethod() { string lengthString = UnitSystem.GetPreferredUnitSymbol(PhysicalDimension.Length); // lengthString will be "m" string powerString = UnitSystem.GetPreferredUnitSymbol(PhysicalDimension.Power, DimensionHint.PowerKilowatt); // powerString will be "kW" }