FCSys.Blocks.UnitConversions

Blocks to convert to or from quantities expressed in units

Information

This package contains blocks to convert quantities from the unit system in FCSys (see FCSys.Units) to quantities expressed in units or vice versa. The UnitConversion block has a parameter that configures it to convert to or from any of the supported units. All other blocks convert to or from a predefined unit.

Blocks are only included for units that involve offsets or other functions besides simple scaling. For conversions that require just a scaling factor, it is best to use the Modelica.Blocks.Math.Gain block with the appropriate factors from Units package (U). For example, to convert from potential in volts use:
Modelica.Blocks.Math.Gain from_V(k=U.V);
To convert to current in amperes use:
Modelica.Blocks.Math.Gain to_A(k=1/U.A);

Extends from Modelica.Icons.Package (Icon for standard packages).

Package Content

NameDescription
FCSys.Blocks.UnitConversions.From_degC From_degC Convert from temperature in degree Celsius to thermodynamic temperature
FCSys.Blocks.UnitConversions.To_degC To_degC Convert from thermodynamic temperature to temperature in degree Celsius
FCSys.Blocks.UnitConversions.From_kPag From_kPag Convert from gauge pressure in kilopascals to absolute pressure
FCSys.Blocks.UnitConversions.To_kPag To_kPag Convert absolute pressure to gauge pressure in kilopascals
FCSys.Blocks.UnitConversions.UnitConversion UnitConversion Generic block to convert to or from quantities expressed in units
FCSys.Blocks.UnitConversions.Partial Partial Base block to convert to or from quantities expressed in units

FCSys.Blocks.UnitConversions.From_degC FCSys.Blocks.UnitConversions.From_degC

Convert from temperature in degree Celsius to thermodynamic temperature FCSys.Blocks.UnitConversions.From_degC

Information

Please see the documentation of the UnitConversions package.

Extends from Partial (Base block to convert to or from quantities expressed in units).

Connectors

TypeNameDescription
input RealInputuReal input for value in source representation

Modelica definition

block From_degC 
  "Convert from temperature in degree Celsius to thermodynamic temperature"
  extends Partial(y(final unit="l2.m/(N.T2)", displayUnit="U.K"));

equation 
  y = U.from_degC(u);
end From_degC;

FCSys.Blocks.UnitConversions.To_degC FCSys.Blocks.UnitConversions.To_degC

Convert from thermodynamic temperature to temperature in degree Celsius FCSys.Blocks.UnitConversions.To_degC

Information

Please see the documentation of the UnitConversions package.

Extends from Partial (Base block to convert to or from quantities expressed in units).

Connectors

TypeNameDescription
output RealOutputyReal output for quantity in desired representation

Modelica definition

block To_degC 
  "Convert from thermodynamic temperature to temperature in degree Celsius"
  extends Partial(u(final unit="l2.m/(N.T2)", displayUnit="U.K"));

equation 
  y = U.to_degC(u);
end To_degC;

FCSys.Blocks.UnitConversions.From_kPag FCSys.Blocks.UnitConversions.From_kPag

Convert from gauge pressure in kilopascals to absolute pressure FCSys.Blocks.UnitConversions.From_kPag

Information

Please see the documentation of the UnitConversions package.

Extends from Partial (Base block to convert to or from quantities expressed in units).

Connectors

TypeNameDescription
input RealInputuReal input for value in source representation

Modelica definition

block From_kPag 
  "Convert from gauge pressure in kilopascals to absolute pressure"
  extends Partial(y(final unit="m/(l.T2)"));

equation 
  y = U.from_kPag(u);
end From_kPag;

FCSys.Blocks.UnitConversions.To_kPag FCSys.Blocks.UnitConversions.To_kPag

Convert absolute pressure to gauge pressure in kilopascals FCSys.Blocks.UnitConversions.To_kPag

Information

Please see the documentation of the UnitConversions package.

Extends from Partial (Base block to convert to or from quantities expressed in units).

Connectors

TypeNameDescription
output RealOutputyReal output for quantity in desired representation

Modelica definition

block To_kPag 
  "Convert absolute pressure to gauge pressure in kilopascals"
  extends Partial(u(final unit="m/(l.T2)"));

equation 
  y = U.to_kPag(u);
end To_kPag;

FCSys.Blocks.UnitConversions.UnitConversion FCSys.Blocks.UnitConversions.UnitConversion

Generic block to convert to or from quantities expressed in units FCSys.Blocks.UnitConversions.UnitConversion

Information

Please see the documentation of the UnitConversions package.

Extends from Partial (Base block to convert to or from quantities expressed in units).

Parameters

TypeNameDefaultDescription
replaceable function fU.from_degCConversion function

Connectors

TypeNameDescription
input RealInputuReal input for value in source representation
output RealOutputyReal output for quantity in desired representation
replaceable function fConversion function

Modelica definition

block UnitConversion 
  "Generic block to convert to or from quantities expressed in units"
  extends Partial;

  replaceable function f = U.from_degC constrainedby 
    Modelica.SIunits.Conversions.ConversionIcon "Conversion function";

equation 
  y = f(u);
end UnitConversion;

FCSys.Blocks.UnitConversions.Partial FCSys.Blocks.UnitConversions.Partial

Base block to convert to or from quantities expressed in units FCSys.Blocks.UnitConversions.Partial

Information

Please see the documentation of the UnitConversions package.

Extends from FCSys.Icons.Names.Top2.

Connectors

TypeNameDescription
input RealInputuReal input for value in source representation
output RealOutputyReal output for quantity in desired representation

Modelica definition

partial block Partial 
  "Base block to convert to or from quantities expressed in units"
  // extends FCSys.Icons.Blocks.ContinuousShort;
  extends FCSys.Icons.Names.Top2;

  Connectors.RealInput u "Real input for value in source representation";
  Connectors.RealOutput y "Real output for quantity in desired representation";

end Partial;