Skip to main content

OpenTD .NET4 reference 2025 R2

OpenTD.UnitsData Class Reference

Last update: 16.07.2025

Describes a system of units. Can be inconsistent. More...

Inheritance diagram for OpenTD.UnitsData:
OpenTD.ITdDerived

Public Types

enum  FlocadOutputUnitsType { SI , ENG }
 FloCAD/FLUINT units system types. More...
 
enum  UnitsType {
  DIMENSIONLESS = -1 , ORBIT_LENGTH , MODEL_LENGTH , TIME ,
  ENERGY , TEMP , MASS , PRESSURE ,
  ANGLE , COND_PER_LENGTH , COND_PER_AREA , DENSITY ,
  SPEC_HEAT , VOLUME , THERMAL_MASS , AREA ,
  COND , HEAT_RATE , FLUX , VOLUME_Q ,
  MASS_FLOWRATE , VOLUME_FLOWRATE , MASS_PER_LENGTH , TEMP_ABS ,
  ENERGY_PER_MASS , GRAVITY , ENERGY_PER_LENGTH , VELOCITY ,
  UNITS_NOT_SET , VOLTS_PER_TEMP , VISCOSITY , FORCE ,
  SURFACE_TENSION , ENTHALPY , ENTROPY , INERTIAL ,
  PRESSUREPERVOLUME , MULTIUNITS , MASS_FLUX , ENERGY_PER_AREA ,
  INVERSE_VOLUME , ROTATION , MOMENTOFINERTIA , TORQUE ,
  HEAT_RATE_PER_DEG , VOLTAGE , CURRENT , RESISTANCE ,
  RESISTIVITY , INVERSE_PRESSURE , MASS_FLOWRATE_PER_PRESSURE , MASS_FLOWRATE_PER_ENTHALPY
}
 Physical dimensions. More...
 
enum  OrbitLength {
  KM , FT , M , MILE ,
  NM
}
 Length units to describe orbital distances. More...
 
enum  ModelLength {
  MET , CM , MM , FEET ,
  INCH
}
 Length units to describe model dimensions. More...
 
enum  Time { SEC , MIN , HR }
 Time units. More...
 
enum  Energy {
  J , KJ , BTU , MILLI_J ,
  WATT_HOUR
}
 Energy units. More...
 
enum  Temp { K , C , F , R }
 Temperature units. More...
 
enum  Mass { KG , GRAM , LBM , SLUG }
 Mass units. More...
 
enum  Pressure {
  PA , PSI , PSF , ATM ,
  TORR , INHG , INH2O , BAR ,
  KPA , MPA , GPA , MPSI ,
  PSIG
}
 Pressure units. More...
 
enum  Angle { DEGREES , RADIANS }
 Angle units. More...
 
enum  Force { N , LBF }
 Force units. More...
 
enum  Current { AMPS , MILLI_AMPS , MICRO_AMPS }
 Current units. More...
 
enum  Voltage { VOLTS , MILLI_VOLTS , MICRO_VOLTS }
 Voltage units. More...
 
enum  Resistance { OHM , MILLI_OHM , MICRO_OHM }
 Electrical resistance units. More...
 

Public Member Functions

 UnitsData ()
 
 UnitsData (string unitsExpression)
 Initializes a new instance of the UnitsData class by parsing the supplied units expression string. Use with basic units (m, hr, Btu, etc.) or compound units expressions (Btu/hr/ft^2/F, kg/m-s, etc.). Recognizes strings in the same format output by TD. Accepted operators : ( ) / - ^ Exponents denoted with optional ^, e.g. m^3 and m3 are both valid W can be substituted for J/s 1 can be used, as in 1/m^3 Revolution can be used, as in Revolution/s Case-insensitive For overlapping model length and orbit length units (m and ft), assumes model length.
 
 UnitsData (long TdUnits, long TdUnits2)
 Initializes a new instance of the UnitsData class, using integers written to save files or CSR's by SINDA.
 
 UnitsData (UnitsData source)
 Copy constructor.
 
string GetUnitsName (UnitsType type)
 
string GetTitle (UnitsType type)
 
void SetToSI ()
 
void SetToEng ()
 
void SetFrom (UnitsData source)
 
void SetFromDataset (long TdUnits, long TdUnits2)
 Set this units system based on 64-bit integers written to a save file or CSR by Sinda.
 
bool SetFromUnitsExpression (string str)
 Sets this UnitsData using the supplied string. Use with basic units (m, hr, Btu, etc.) or compound units expressions (Btu/hr/ft^2/F, kg/m-s, etc.). For basic units, SetFromBasicUnit(string str) will be more efficient. Recognizes strings in the same format output by TD. Accepted operators : ( ) / - ^ Exponents denoted with optional ^, e.g. m^3 and m3 are both valid W can be substituted for J/s 1 can be used, as in 1/m^3 Revolution can be used, as in Revolution/s Case-insensitive For overlapping model length and orbit length units (m and ft), assumes model length.
 
override string ToString ()
 
bool Equals (UnitsData x)
 
override bool Equals (object obj)
 
override int GetHashCode ()
 

Static Public Member Functions

static string GetName (UnitsType type)
 
static string Text (OrbitLength units)
 
static string Text (ModelLength units)
 
static string Text (Time units)
 
static string Text (Energy units)
 
static string Text (Temp units)
 
static string Text (Mass units)
 
static string Text (Pressure units)
 
static string Text (Angle units)
 
static string Text (Force units)
 
static string Text (Current units)
 
static string Text (Voltage units)
 
static string Text (Resistance units)
 
static bool operator== (UnitsData x1, UnitsData x2)
 
static bool operator!= (UnitsData x1, UnitsData x2)
 

Properties

FlocadOutputUnitsType FlocadOutputUnits [get, set]
 
OrbitLength orbitLength [get, set]
 
ModelLength modelLength [get, set]
 
Time time [get, set]
 
Energy energy [get, set]
 
Temp temp [get, set]
 
Mass mass [get, set]
 
Pressure pressure [get, set]
 
Angle angle [get, set]
 
Force force [get, set]
 
Current current [get, set]
 
Voltage voltage [get, set]
 
UnitsDefData def [get, set]
 Use def to create arbitrary combinations of units (advanced).
 

Detailed Description

Describes a system of units. Can be inconsistent.

Member Enumeration Documentation

◆ Angle

Angle units.

Enumerator
DEGREES 
RADIANS 

◆ Current

Current units.

Enumerator
AMPS 
MILLI_AMPS 
MICRO_AMPS 

◆ Energy

Energy units.

Enumerator
KJ 
BTU 
MILLI_J 
WATT_HOUR 

◆ FlocadOutputUnitsType

FloCAD/FLUINT units system types.

Enumerator
SI 
ENG 

◆ Force

Force units.

Enumerator
LBF 

◆ Mass

Mass units.

Enumerator
KG 
GRAM 
LBM 
SLUG 

◆ ModelLength

Length units to describe model dimensions.

Enumerator
MET 
CM 
MM 
FEET 
INCH 

◆ OrbitLength

Length units to describe orbital distances.

Enumerator
KM 
FT 
MILE 
NM 

◆ Pressure

Pressure units.

Enumerator
PA 
PSI 
PSF 
ATM 
TORR 
INHG 
INH2O 
BAR 
KPA 
MPA 
GPA 
MPSI 
PSIG 

◆ Resistance

Electrical resistance units.

Enumerator
OHM 
MILLI_OHM 
MICRO_OHM 

◆ Temp

Temperature units.

Enumerator

◆ Time

Time units.

Enumerator
SEC 
MIN 
HR 

◆ UnitsType

Physical dimensions.

Enumerator
DIMENSIONLESS 
ORBIT_LENGTH 
MODEL_LENGTH 
TIME 
ENERGY 
TEMP 
MASS 
PRESSURE 
ANGLE 
COND_PER_LENGTH 
COND_PER_AREA 
DENSITY 
SPEC_HEAT 
VOLUME 
THERMAL_MASS 
AREA 
COND 
HEAT_RATE 
FLUX 
VOLUME_Q 
MASS_FLOWRATE 
VOLUME_FLOWRATE 
MASS_PER_LENGTH 
TEMP_ABS 
ENERGY_PER_MASS 
GRAVITY 
ENERGY_PER_LENGTH 
VELOCITY 
UNITS_NOT_SET 
VOLTS_PER_TEMP 
VISCOSITY 
FORCE 
SURFACE_TENSION 
ENTHALPY 
ENTROPY 
INERTIAL 
PRESSUREPERVOLUME 
MULTIUNITS 
MASS_FLUX 
ENERGY_PER_AREA 
INVERSE_VOLUME 
ROTATION 
MOMENTOFINERTIA 
TORQUE 
HEAT_RATE_PER_DEG 
VOLTAGE 
CURRENT 
RESISTANCE 
RESISTIVITY 
INVERSE_PRESSURE 
MASS_FLOWRATE_PER_PRESSURE 
MASS_FLOWRATE_PER_ENTHALPY 

◆ Voltage

Voltage units.

Enumerator
VOLTS 
MILLI_VOLTS 
MICRO_VOLTS 

Constructor & Destructor Documentation

◆ UnitsData() [1/4]

OpenTD.UnitsData.UnitsData ( )
inline

◆ UnitsData() [2/4]

OpenTD.UnitsData.UnitsData ( string unitsExpression)
inline

Initializes a new instance of the UnitsData class by parsing the supplied units expression string. Use with basic units (m, hr, Btu, etc.) or compound units expressions (Btu/hr/ft^2/F, kg/m-s, etc.). Recognizes strings in the same format output by TD. Accepted operators : ( ) / - ^ Exponents denoted with optional ^, e.g. m^3 and m3 are both valid W can be substituted for J/s 1 can be used, as in 1/m^3 Revolution can be used, as in Revolution/s Case-insensitive For overlapping model length and orbit length units (m and ft), assumes model length.

◆ UnitsData() [3/4]

OpenTD.UnitsData.UnitsData ( long TdUnits,
long TdUnits2 )
inline

Initializes a new instance of the UnitsData class, using integers written to save files or CSR's by SINDA.

◆ UnitsData() [4/4]

OpenTD.UnitsData.UnitsData ( UnitsData source)
inline

Copy constructor.

Member Function Documentation

◆ Equals() [1/2]

override bool OpenTD.UnitsData.Equals ( object obj)
inline

◆ Equals() [2/2]

bool OpenTD.UnitsData.Equals ( UnitsData x)
inline

◆ GetHashCode()

override int OpenTD.UnitsData.GetHashCode ( )
inline

◆ GetName()

static string OpenTD.UnitsData.GetName ( UnitsType type)
inlinestatic

◆ GetTitle()

string OpenTD.UnitsData.GetTitle ( UnitsType type)
inline

◆ GetUnitsName()

string OpenTD.UnitsData.GetUnitsName ( UnitsType type)
inline

◆ operator!=()

static bool OpenTD.UnitsData.operator!= ( UnitsData x1,
UnitsData x2 )
inlinestatic

◆ operator==()

static bool OpenTD.UnitsData.operator== ( UnitsData x1,
UnitsData x2 )
inlinestatic

◆ SetFrom()

void OpenTD.UnitsData.SetFrom ( UnitsData source)
inline

◆ SetFromDataset()

void OpenTD.UnitsData.SetFromDataset ( long TdUnits,
long TdUnits2 )
inline

Set this units system based on 64-bit integers written to a save file or CSR by Sinda.

Exceptions
OpenTD.OpenTDExceptionProblem decoding TdUnits. or Problem decoding TdUnits2.

◆ SetFromUnitsExpression()

bool OpenTD.UnitsData.SetFromUnitsExpression ( string str)
inline

Sets this UnitsData using the supplied string. Use with basic units (m, hr, Btu, etc.) or compound units expressions (Btu/hr/ft^2/F, kg/m-s, etc.). For basic units, SetFromBasicUnit(string str) will be more efficient. Recognizes strings in the same format output by TD. Accepted operators : ( ) / - ^ Exponents denoted with optional ^, e.g. m^3 and m3 are both valid W can be substituted for J/s 1 can be used, as in 1/m^3 Revolution can be used, as in Revolution/s Case-insensitive For overlapping model length and orbit length units (m and ft), assumes model length.

◆ SetToEng()

void OpenTD.UnitsData.SetToEng ( )
inline

◆ SetToSI()

void OpenTD.UnitsData.SetToSI ( )
inline

◆ Text() [1/12]

static string OpenTD.UnitsData.Text ( Angle units)
inlinestatic

◆ Text() [2/12]

static string OpenTD.UnitsData.Text ( Current units)
inlinestatic

◆ Text() [3/12]

static string OpenTD.UnitsData.Text ( Energy units)
inlinestatic

◆ Text() [4/12]

static string OpenTD.UnitsData.Text ( Force units)
inlinestatic

◆ Text() [5/12]

static string OpenTD.UnitsData.Text ( Mass units)
inlinestatic

◆ Text() [6/12]

static string OpenTD.UnitsData.Text ( ModelLength units)
inlinestatic

◆ Text() [7/12]

static string OpenTD.UnitsData.Text ( OrbitLength units)
inlinestatic

◆ Text() [8/12]

static string OpenTD.UnitsData.Text ( Pressure units)
inlinestatic

◆ Text() [9/12]

static string OpenTD.UnitsData.Text ( Resistance units)
inlinestatic

◆ Text() [10/12]

static string OpenTD.UnitsData.Text ( Temp units)
inlinestatic

◆ Text() [11/12]

static string OpenTD.UnitsData.Text ( Time units)
inlinestatic

◆ Text() [12/12]

static string OpenTD.UnitsData.Text ( Voltage units)
inlinestatic

◆ ToString()

override string OpenTD.UnitsData.ToString ( )
inline

Property Documentation

◆ angle

Angle OpenTD.UnitsData.angle
getset

◆ current

Current OpenTD.UnitsData.current
getset

◆ def

UnitsDefData OpenTD.UnitsData.def
getset

Use def to create arbitrary combinations of units (advanced).

◆ energy

Energy OpenTD.UnitsData.energy
getset

◆ FlocadOutputUnits

FlocadOutputUnitsType OpenTD.UnitsData.FlocadOutputUnits
getset

◆ force

Force OpenTD.UnitsData.force
getset

◆ mass

Mass OpenTD.UnitsData.mass
getset

◆ modelLength

ModelLength OpenTD.UnitsData.modelLength
getset

◆ orbitLength

OrbitLength OpenTD.UnitsData.orbitLength
getset

◆ pressure

Pressure OpenTD.UnitsData.pressure
getset

◆ temp

Temp OpenTD.UnitsData.temp
getset

◆ time

Time OpenTD.UnitsData.time
getset

◆ voltage

Voltage OpenTD.UnitsData.voltage
getset

The documentation for this class was generated from the following file:
  • C:/Users/mgarrett/source/repos/BuildsTdSuite/builds/TDDEV_ALPHA/buildXX/OpenTD/UnitsData.cs

Connect with Ansys