Unit systems#

class ansys.units.systems.UnitSystem(base_units: Mapping[BaseDimensions, Literal['kg', 'g', 'lb', 'lbm', 'slug', 'm', 'cm', 'ft', 'inch', 'in', 's', 'A', 'mol', 'slugmol', 'cd', 'sr', 'radian', 'degree', 'K', 'C', 'F', 'R', 'delta_K', 'delta_C', 'delta_F', 'delta_R', 'N', 'Pa', 'W', 'J', 'V', 'farad', 'H', 'S', 'Wb', 'T', 'dyne', 'erg', 'h', 'pdl', 'psi', 'lbf', 'psf', 'ohm', 'Hz', 'l', 'gal', 'BTU', 'cal', 'coulomb']] | None = None, system: Literal['SI', 'CGS', 'BT'] = 'SI', copy_from: UnitSystem | None = None)#

Bases: object

A class representing base units for a unit system.

Predefined unit systems work automatically and are configured when the package is initialized, whereas you can add user-defined systems at any time.

Parameters:
base_units: dict, optional

Units mapped to base dimensions types.

system: str, Unit, optional

Predefined unit system.

copy_from: UnitSystem, optional

Make a copy of a unit system.

Attributes:
MASS

Mass unit of the unit system.

LENGTH

Length unit of the unit system.

TIME

Time unit of the unit system.

TEMPERATURE

Temperature unit of the unit system.

TEMPERATURE_DIFFERENCE

Temperature unit of the unit system.

ANGLE

Angle unit of the unit system.

CHEMICAL_AMOUNT

Chemical Amount unit of the unit system.

LIGHT

Light unit of the unit system.

CURRENT

Current unit of the unit system.

SOLID_ANGLE

Solid Angle unit of the unit system.

property ANGLE: Literal['radian', 'degree']#

Angle unit of the unit system.

property CHEMICAL_AMOUNT: Literal['mol', 'slugmol']#

Chemical Amount unit of the unit system.

property CURRENT: Literal['A']#

Current unit of the unit system.

property LENGTH: Literal['m', 'cm', 'ft', 'inch', 'in']#

Length unit of the unit system.

property LIGHT: Literal['cd']#

Light unit of the unit system.

property MASS: Literal['kg', 'g', 'lb', 'lbm', 'slug']#

Mass unit of the unit system.

property SOLID_ANGLE: Literal['sr']#

Solid Angle unit of the unit system.

property TEMPERATURE: Literal['K', 'C', 'F', 'R']#

Temperature unit of the unit system.

property TEMPERATURE_DIFFERENCE: Literal['delta_K', 'delta_C', 'delta_F', 'delta_R']#

Temperature unit of the unit system.

property TIME: Literal['s']#

Time unit of the unit system.

update(base_units: Mapping[BaseDimensions, Literal['kg', 'g', 'lb', 'lbm', 'slug', 'm', 'cm', 'ft', 'inch', 'in', 's', 'A', 'mol', 'slugmol', 'cd', 'sr', 'radian', 'degree', 'K', 'C', 'F', 'R', 'delta_K', 'delta_C', 'delta_F', 'delta_R', 'N', 'Pa', 'W', 'J', 'V', 'farad', 'H', 'S', 'Wb', 'T', 'dyne', 'erg', 'h', 'pdl', 'psi', 'lbf', 'psf', 'ohm', 'Hz', 'l', 'gal', 'BTU', 'cal', 'coulomb']])#

Change the units of the unit system.

Parameters:
base_units: dict

Units mapped to base dimensions types.

exception ansys.units.systems.IncorrectUnitType(unit, unit_type)#

Bases: ValueError

Raised when a unit is provided that does not have a valid type of base unit.

exception ansys.units.systems.InvalidUnitSystem(sys)#

Bases: ValueError

Raised when a unit system is initialized with an unsupported unit system.

exception ansys.units.systems.NotBaseUnit(unit)#

Bases: ValueError

Raised when a unit system unit is not a configured base unit.