PyAMS  (the software under revision)

ExpSine Current


Exponentially damped sine Current source

Parameters

NameDefaultDescription
Amp5.0Amplitude of sine wave [A]
Fr100Frequency of sine wave [Hz]
Ph0Phase of sine wave [rad]
Damping1Damping coefficient of sine wave [s-1]
Offset0Current offset [A]
StartTime0Time offset [s]

PyAMS definition

from PyAMS import RealTime,Signal
from math import exp,sin,pi

#Generate exponentially damped sine Current
class SourceIExpSine:
     def __init__(self, a, b):
         self.Ie = Signal('out','current',a,b)
         self.Amp=5.0     #Amplitude of ExpSin
         self.Fr=100.0    #Frequency of sine wave    
         self.Ph=0.0       #Phase of sine wave
         self.Damping=1   #Damping coefficient of sine wave
         self.Offset=0.0
         self.StartTime=0.0
     def analog(self):
         time=RealTime()
         self.Ie+=self.Offset
         if time>=self.StartTime:
             self.Ie+=self.Amp*exp(-(time -self.StartTime)*self.Damping)*sin(2*3.14*self.Fr*(time -self.StartTime) +self.Ph);
         

Documentation generated by PyAMS