26 lines
1.0 KiB
Python
26 lines
1.0 KiB
Python
|
import numpy as np
|
||
|
import random
|
||
|
|
||
|
def generar_paquete_ejemplo(fs, size):
|
||
|
|
||
|
t = np.arange(0, size/fs, 1/fs)
|
||
|
|
||
|
# Generación de las ondas
|
||
|
V1 = 200 * np.sin(2 * np.pi * 50 * t ) + 100 * np.sin(2 * np.pi * 100 * t) + 50 * np.sin(2 * np.pi * 150 * t) + 10*np.random.normal(0,1,size= size)
|
||
|
I1 = 30* np.sin(2 * np.pi * 50 * t + np.radians(60)) + 10*np.random.normal(0,1,size= size) # Desfase de 90º
|
||
|
V2 = 200 * np.sin(2 * np.pi * 50 * t + np.radians(random.randint(0,90))) + 10*np.random.normal(0,1,size= size) # Desfase de 30º con V1
|
||
|
I2 = 30* np.sin(2 * np.pi * 50 * t + np.radians(random.randint(0,90))) + 10*np.random.normal(0,1,size= size)# Desfase de 30º con I1 y 90º de V1
|
||
|
T1 = 3*t*random.randint(0,3)
|
||
|
T2 = 2*t
|
||
|
|
||
|
# Empaquetado en Diccionario
|
||
|
data = {
|
||
|
"V1": np.array(V1.tolist()),
|
||
|
"V2": np.array(V2.tolist()),
|
||
|
"I1": np.array(I1.tolist()),
|
||
|
"I2": np.array(I2.tolist()),
|
||
|
"T1": np.array(T1.tolist()),
|
||
|
"T2": np.array(T2.tolist())
|
||
|
}
|
||
|
|
||
|
return data
|