PyAMS  (the software under revision)

Sine Voltage


Sine voltage source

Modelica.Electrical.Analog.Sources.SineVoltage

Parameters

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

PyAMS definition

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

#Sine voltage source
class SourceVsin:
     def __init__(self, a, b):
         self.Vsin = Signal('out','voltage',a,b)
         self.Fr=100.0  #Frequency of sine wave
         self.Va=8.0    #Amplitude of sine wave
         self.Ph=0.0    #Phase of sine wave
         self.Voff=0.0  #Voltage offset
     def StepTime(self):
          return 1/self.Fr
     def analog(self):
          self.Vsin+=self.Va*sin(pi*2.0*self.Fr*RealTime()+self.Ph)+self.Voff

Documentation generated by PyAMS