def receive_simple( self, signal): # receives simple signal and draws phasor cloud self.signal = signal p = Phasor() p.draw_cloud(signal, title='Deviated bits phasor cloud - %s' % self.mode.upper())
def impedance(self, frequency: float) -> Phasor: return Phasor.scale(Phasor.from_radius_and_phase(1, math.pi / 2), self.inductance * frequency)
def impedance(self, frequency: float) -> Phasor: return Phasor.reciprocal( Phasor.scale(Phasor.from_radius_and_phase(1, math.pi / 2), self.capacitance * frequency))
def impedance(self, frequency: float) -> Phasor: return Phasor.from_rect(self.resistance, 0)
def impedance(self, frequency: float) -> Phasor: imp = Phasor.from_rect(0, 0) for element in self.elements: imp = Phasor.add(imp, element.impedance(frequency)) return imp
def voltage(self, current: Sinusoid) -> Sinusoid: return Sinusoid.from_phasor( Phasor.multiply(current.to_phasor(), self.impedance(current.angular_frequency)), current.angular_frequency, )
def current(self, voltage: Sinusoid) -> Sinusoid: return Sinusoid.from_phasor( Phasor.divide(voltage.to_phasor(), self.impedance(voltage.angular_frequency)), voltage.angular_frequency, )
def to_phasor(self) -> Phasor: return Phasor.from_radius_and_phase(self.amplitude, self.phase)