actualizacion con codigo
This commit is contained in:
parent
cff7d8c356
commit
a537276a78
35
genCurvas.py
35
genCurvas.py
@ -2,6 +2,9 @@ import numpy as np
|
||||
import pandas as pd
|
||||
import json
|
||||
|
||||
def valores_objetivo():
|
||||
pass
|
||||
|
||||
def generar_curva(offset):
|
||||
muVacio = 4 * np.pi * 1e-7
|
||||
|
||||
@ -14,17 +17,25 @@ def generar_curva(offset):
|
||||
h = np.concatenate((hNeg, hPos))
|
||||
b = np.concatenate((bNeg, bPos))
|
||||
|
||||
return h, b
|
||||
|
||||
datos = np.column_stack((h,b))
|
||||
np.savetxt('curva.csv', datos, delimiter=',')
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
with open('resultados_ensayos.json', 'r') as f: datos = json.load(f)
|
||||
archivo = 'Ensayos.xlsx'
|
||||
material = 'PLACOND'
|
||||
masIter = 10000
|
||||
|
||||
Eobjetivo = np.array(datos['E'])
|
||||
Iobjetivo = np.array(datos['I'])
|
||||
fObjetivo = np.array(datos['f'])
|
||||
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
|
||||
|
||||
@ -32,13 +43,10 @@ if __name__ == '__main__':
|
||||
|
||||
flag = True
|
||||
|
||||
errorAnterior = 10000
|
||||
|
||||
while flag:
|
||||
h,b = generar_curva(offset)
|
||||
|
||||
datos = np.column_stack((h,b))
|
||||
|
||||
np.savetxt('curva.csv', datos, delimiter=',')
|
||||
|
||||
generar_curva(offset)
|
||||
############################
|
||||
'''
|
||||
Logica de motorCAD-Pyhton, se sacaran unos vectores con
|
||||
@ -54,6 +62,11 @@ if __name__ == '__main__':
|
||||
############################
|
||||
|
||||
error = Ecalc / Eobjetivo
|
||||
error = np.mean(Ecalc / Eobjetivo)
|
||||
|
||||
if error <= limSup and error >= limInf: flag = False
|
||||
|
||||
flag = False
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user