Skip to content

Latest commit

 

History

History
10 lines (9 loc) · 2.41 KB

README.md

File metadata and controls

10 lines (9 loc) · 2.41 KB

elec_toolkit

Library, that is designed for tuition of signal-theory in electrical engineering. Each class-instance represents a physical value, that can be combined with others. The classes support basic mathematical operations on each other and always contain a unit and a description. Instances provide interface for plotting the results with "Matplotlib".

classes:

  • Phys_unit:
    real-valued, supports basic mathematical operations, callable (returns value (int or float) of itself), printable (returns formatted string with description, value and unit)

  • Complex_phys_unit:
    complex-valued, subclass of Phys_unit-class, supports basic mathematical operations, printable (returns formatted string with description, formatted complex value as complex representation and as amount-phase-representation with units).
    Instances are callable with positional argument to return value of the delayed sine for a specific time

    Instances can be constructed from complex value (real, imaginary) or from amount-phase-representation (magnitude/phase of the resulting sine).
    The class provides classmethods to convert between complex- or amount-phase-representation (complex_to_polar() / polar_to_complex()).

    Plot the complex vector-diagram with the plot() method.

  • Loc_Curve :
    provides interface for subclasses to plot locus-curves by defining a calculation rule in subclass-definition. The mutable variable has to be defined as a list and is a parameter of the calculation-rule.
    The instances are configurable with all parameters used in the calculation-rule and provide a plot_complex() function to plot the locus-curve as a mapping from the real number space to the complex depending on the mutable variable. To plot the Bode-diagram as a mapping from the real to the real number space the plot_magn() and the plot_phase() functions are provided.

  • Signal:
    defines signal (mapping of time to physical value), subclass of Phys_unit-class, supports basic mathematical operations, instances provide plot() function. The mapping can be defined by a calculation rule defined in subclass (Signal.from_calc_rule() constructor) or as a overlay of multiple harmonics (Signal.from_harmonics() constructor). The harmonics are instances of Complex_phys_unit and are stored as a list.