PyAMS  (the software under revision)

Sine Current


Sine Current source

Modelica.Electrical.Analog.Sources.SineCurrent

Parameters

NameDefaultDescription
Ia8.0Amplitude of sine wave [V]
Ph0.0Phase of sine wave [rad]
Fr100.0Frequency of sine wave [Hz]
Voff0.0Current offset [V]

PyAMS definition

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

#Sine Current source
class SourceIsin:
     def __init__(self, a, b):
         self.Isin = Signal('out','current',a,b)
         self.Fr=100.0  #Frequency of sine wave
         self.Ia=8.0    #Amplitude of sine wave
         self.Ph=0.0    #Phase of sine wave
         self.Ioff=0.0  #Current offset
     def StepTime(self):
          return 1/self.Fr
     def analog(self):
          self.Isin+=self.Ia*sin(pi*2.0*self.Fr*RealTime()+self.Ph)+self.Ioff

Documentation generated by PyAMS .