electronics.electric_power

Classes

Result

Functions

electric_power(→ tuple)

This function can calculate any one of the three (voltage, current, power),

Module Contents

class electronics.electric_power.Result

Bases: NamedTuple

name: str
value: float
electronics.electric_power.electric_power(voltage: float, current: float, power: float) tuple

This function can calculate any one of the three (voltage, current, power), fundamental value of electrical system. examples are below: >>> electric_power(voltage=0, current=2, power=5) Result(name=’voltage’, value=2.5) >>> electric_power(voltage=2, current=2, power=0) Result(name=’power’, value=4.0) >>> electric_power(voltage=-2, current=3, power=0) Result(name=’power’, value=6.0) >>> electric_power(voltage=2, current=4, power=2) Traceback (most recent call last):

ValueError: Only one argument must be 0 >>> electric_power(voltage=0, current=0, power=2) Traceback (most recent call last):

ValueError: Only one argument must be 0 >>> electric_power(voltage=0, current=2, power=-4) Traceback (most recent call last):

ValueError: Power cannot be negative in any electrical/electronics system >>> electric_power(voltage=2.2, current=2.2, power=0) Result(name=’power’, value=4.84)