50 lines
639 B
Python
50 lines
639 B
Python
|
|
import numpy as np
|
|
import measurements
|
|
|
|
|
|
# to do
|
|
# Need a zero-cross algorithem to comply with 61000-4-30
|
|
|
|
|
|
|
|
def main():
|
|
time = 0
|
|
delta_t = 1e-6
|
|
t_stop = 1.2
|
|
|
|
ADC_sample_frequency = 50e3
|
|
ADC_sample_period = 1/ADC_sample_frequency
|
|
ADC_timer = 0
|
|
|
|
|
|
|
|
amplitude = 1
|
|
base_freq = 60
|
|
|
|
Meas_ADC = measurements.measurements(fs=ADC_sample_frequency)
|
|
|
|
|
|
for i in range(0, int(t_stop/delta_t)+1):
|
|
|
|
|
|
Ph1 = np.sin(2*np.pi*time*base_freq)
|
|
|
|
|
|
if time - ADC_timer >= ADC_sample_period:
|
|
ADC_timer += ADC_sample_period
|
|
|
|
Meas_ADC.Interupt(Ph1)
|
|
|
|
|
|
|
|
time += delta_t
|
|
|
|
Meas_ADC.print()
|
|
Meas_ADC.plot()
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
main() |