Current¶
- class Current(value: float | int, unit: str)¶
Bases:
UnitBaseCurrentobject.Attributes¶
Methods¶
to()It converts actual
valueto a new value computed usingtarget_unitas the reference unit of measurement.
- to(target_unit: str, inplace: bool = False) Current¶
It converts actual
valueto a new value computed usingtarget_unitas the reference unit of measurement.If
inplaceisTrue, it overrides actualvalueandunit, otherwise it returns a new instance with the convertedvalueand thetarget_unitasunit.Parameters¶
Returns¶
CurrentConverted electrical current.
Raises
Examples
Currentinstantiation.>>> from gearpy.units import Current >>> i = Current(1, 'A') >>> i 1 A
Conversion from ampere to milli-ampere with
inplace=Falseby default, so it does not override the current value.>>> i.to('mA') 1000.0 mA >>> i 1 A
Conversion from ampere to milli-ampere with
inplace=True, in order to override the current value.>>> i.to('mA', inplace=True) 1000.0 mA >>> i 1000.0 mA