45 lines
1.0 KiB
Python
45 lines
1.0 KiB
Python
import numpy as np
|
|
import genCurvas as gc
|
|
import motorcad as mc
|
|
import os
|
|
|
|
if __name__ == '__main__':
|
|
|
|
archivoEnsayos = "Ensayos.xlsx"
|
|
archivoCurvas = "PLACond.mdb"
|
|
material = "PLACond"
|
|
|
|
E_obj, I_obj, f_obj = gc.valores_objetivo(archivoEnsayos, material)
|
|
|
|
print("La tensión inducida objetivo son ", E_obj, " V")
|
|
|
|
offset = 0
|
|
|
|
errorObjetivo = 0.01
|
|
|
|
flag = False
|
|
iteration = 0
|
|
|
|
while flag == False:
|
|
|
|
gc.generar_curva(offset, archivoCurvas)
|
|
|
|
for i in np.arange(len(E_obj)):
|
|
|
|
error = []
|
|
|
|
corriente = I_obj[i]
|
|
frecuencia = f_obj[i]
|
|
|
|
tension = mc.simularMCAD(corriente, frecuencia, material, iteration)
|
|
|
|
error.append(tension/E_obj)
|
|
|
|
error = np.mean(error)
|
|
|
|
print("El resultado de la tensión inducida de la iteración ", i, " son ", tension, " V")
|
|
print("Y por tanto el error es igual a ", error)
|
|
|
|
flag, offset = gc.logica_offset(offset, error, errorObjetivo)
|
|
|
|
iterarion =+ 1 |