PyAMS  (the software under revision)

FM Voltage


Ideal linear electrical voltage source

Information

Frequency Modulated Sinusoidal Voltage Source Model based or described by the following formula:

V(t) = VO + VA sin[2pfct + m sin(2pfst)]

Parameters

NameDefaultDescription
Va15.0Amplitude of Vfm [Volt]
m1.0Modulation index
fc1KhzCarrier frequency [hz]
fs100.0hzSignal frequency [hz]

PyAMS definition

from PyAMS import Signal,RealTime
from math  import sin,pi
 
class SourceVfm:
     def __init__(self, p, n):
         #Signal
         self.Vfm = Signal('out','potential',p,n)
         #Paramatres
         self.Va=15.0      #Amplitude of Vfm
         self.m=1.0        #Modulation index
         self.fc=1000.0    #Carrier frequency
         self.fs=100.0     #Signal frequency
         self.Offset=0.0
         self.StartTime=0.0
     def StepTime(self):
          return min(1/self.fc,1/self.fs)
     def analog(self):
         time=RealTime()
         self.Vfm+=self.Offset
         if time>=self.StartTime:
          self.Vfm+=self.Va*sin(2*pi*self.fc*time+self.m*sin(2*pi*self.fs*time))

Documentation generated by PyAMS