Ejemplo n.º 1
0
 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())
Ejemplo n.º 2
0
 def impedance(self, frequency: float) -> Phasor:
     return Phasor.scale(Phasor.from_radius_and_phase(1, math.pi / 2),
                         self.inductance * frequency)
Ejemplo n.º 3
0
 def impedance(self, frequency: float) -> Phasor:
     return Phasor.reciprocal(
         Phasor.scale(Phasor.from_radius_and_phase(1, math.pi / 2),
                      self.capacitance * frequency))
Ejemplo n.º 4
0
 def impedance(self, frequency: float) -> Phasor:
     return Phasor.from_rect(self.resistance, 0)
Ejemplo n.º 5
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
Ejemplo n.º 6
0
 def voltage(self, current: Sinusoid) -> Sinusoid:
     return Sinusoid.from_phasor(
         Phasor.multiply(current.to_phasor(),
                         self.impedance(current.angular_frequency)),
         current.angular_frequency,
     )
Ejemplo n.º 7
0
 def current(self, voltage: Sinusoid) -> Sinusoid:
     return Sinusoid.from_phasor(
         Phasor.divide(voltage.to_phasor(),
                       self.impedance(voltage.angular_frequency)),
         voltage.angular_frequency,
     )
Ejemplo n.º 8
0
 def to_phasor(self) -> Phasor:
     return Phasor.from_radius_and_phase(self.amplitude, self.phase)