76 lines
1.8 KiB
Python
76 lines
1.8 KiB
Python
import numpy as np
|
|
import pandas as pd
|
|
import json
|
|
|
|
def valores_objetivo():
|
|
pass
|
|
|
|
def generar_curva(offset):
|
|
muVacio = 4 * np.pi * 1e-7
|
|
|
|
hPos = np.arange(1,5001,1)
|
|
hNeg = np.arange(-5000,0,1)
|
|
|
|
bPos = muVacio*hPos + offset
|
|
bNeg = muVacio*hNeg - offset
|
|
|
|
h = np.concatenate((hNeg, hPos))
|
|
b = np.concatenate((bNeg, bPos))
|
|
|
|
|
|
datos = np.column_stack((h,b))
|
|
np.savetxt('curva.csv', datos, delimiter=',')
|
|
|
|
if __name__ == '__main__':
|
|
|
|
archivo = 'Ensayos.xlsx'
|
|
material = 'PLACOND'
|
|
masIter = 10000
|
|
|
|
carga = pd.read_excel(archivo, sheet_name='carga', engine='openpyxl').dropna()
|
|
|
|
Eobjetivo = np.mean(carga.loc[carga['material'] == material, ['V1', 'V2']].values, axis=1)
|
|
Iobjetivo = np.mean(carga.loc[carga['material'] == material, ['I1', 'I2']].values, axis=1)
|
|
fObjetivo = np.array(carga['f'][carga['material'] == material])
|
|
|
|
errorObjetivo = 0.01 # +- cuanto % puede haber de diferencia
|
|
errorCVobjetivo = 1
|
|
|
|
limSup = 1 + errorObjetivo
|
|
limInf = errorObjetivo
|
|
|
|
offset = 0
|
|
|
|
flag = True
|
|
|
|
errorAnterior = 10000
|
|
|
|
while flag:
|
|
generar_curva(offset)
|
|
############################
|
|
'''
|
|
Logica de motorCAD-Pyhton, se sacaran unos vectores con
|
|
corrientes, frecuencias y tensiones de operacion en
|
|
distintos puntos con una curva dada. Esto se hara estableciendo
|
|
como fijo la frecuencia y la corriente, si se puede solo
|
|
con frecuencia mejor. Se compara la tension (y corriente si no se fija)
|
|
con los valores objetivos.
|
|
|
|
'''
|
|
Ecalc = [1, 1, 1, 1, 1]
|
|
|
|
############################
|
|
|
|
error = Ecalc / Eobjetivo
|
|
error = np.mean(Ecalc / Eobjetivo)
|
|
|
|
if error <= limSup and error >= limInf: flag = False
|
|
|
|
flag = False
|
|
|
|
|
|
|
|
|
|
|
|
|