Logica de ajuste
This commit is contained in:
parent
210e9074f0
commit
f204cdd5bc
51
genCurvas.py
51
genCurvas.py
@ -1,6 +1,6 @@
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
import json
|
import random, os
|
||||||
|
|
||||||
def valores_objetivo(archivo, material):
|
def valores_objetivo(archivo, material):
|
||||||
carga = pd.read_excel(archivo, sheet_name='carga', engine='openpyxl').dropna()
|
carga = pd.read_excel(archivo, sheet_name='carga', engine='openpyxl').dropna()
|
||||||
@ -11,6 +11,7 @@ def valores_objetivo(archivo, material):
|
|||||||
|
|
||||||
return E, I, f
|
return E, I, f
|
||||||
|
|
||||||
|
|
||||||
def generar_curva(offset):
|
def generar_curva(offset):
|
||||||
muVacio = 4 * np.pi * 1e-7
|
muVacio = 4 * np.pi * 1e-7
|
||||||
|
|
||||||
@ -23,51 +24,33 @@ def generar_curva(offset):
|
|||||||
h = np.concatenate((hNeg, hPos))
|
h = np.concatenate((hNeg, hPos))
|
||||||
b = np.concatenate((bNeg, bPos))
|
b = np.concatenate((bNeg, bPos))
|
||||||
|
|
||||||
|
|
||||||
datos = np.column_stack((h,b))
|
datos = np.column_stack((h,b))
|
||||||
np.savetxt('curva.csv', datos, delimiter=',')
|
np.savetxt('curva.csv', datos, delimiter=',')
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
|
|
||||||
archivo = 'Ensayos.xlsx'
|
def logica_offset(offset, error, errorObjetivo):
|
||||||
material = 'PLACOND'
|
'''
|
||||||
|
Coge el offset, error actual y lo analiza.
|
||||||
|
|
||||||
Eobjetivo, Iobjetivo, fObjetivo = valores_objetivo(archivo, material)
|
devuelve flag y offset nuevo
|
||||||
|
|
||||||
errorObjetivo = 0.01 # +- cuanto % puede haber de diferencia
|
si se cumple la condicion devuelve
|
||||||
errorCVobjetivo = 1
|
un True y None para offset
|
||||||
|
|
||||||
|
'''
|
||||||
|
|
||||||
limSup = 1 + errorObjetivo
|
limSup = 1 + errorObjetivo
|
||||||
limInf = errorObjetivo
|
limInf = 1 - errorObjetivo
|
||||||
|
|
||||||
offset = 0
|
delta = random.random()/100
|
||||||
|
|
||||||
flag = True
|
if error <= limSup and error >= limInf: return True, None
|
||||||
|
|
||||||
errorAnterior = 10000
|
if error > 1: offset = offset - delta
|
||||||
|
elif error < 1: offset = offset + delta
|
||||||
|
|
||||||
|
return False, offset
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user