Merge branch 'main' of https://git.spark-ops.com/spark-ops/fluxcontrol
This commit is contained in:
commit
95816badc8
42
genCurvas.py
42
genCurvas.py
@ -54,12 +54,17 @@ def logica_offset(offset, error, errorObjetivo):
|
|||||||
limSup = 1 + errorObjetivo
|
limSup = 1 + errorObjetivo
|
||||||
limInf = 1 - errorObjetivo
|
limInf = 1 - errorObjetivo
|
||||||
|
|
||||||
delta = random.random() * 1e-6
|
|
||||||
|
|
||||||
if error <= limSup and error >= limInf: return True, None
|
if error <= limSup and error >= limInf: return True, None
|
||||||
|
|
||||||
if error > 1: offset = offset - delta
|
tasa_aprendizaje = 0.001
|
||||||
elif error < 1: offset = offset + delta
|
|
||||||
|
desviacion = error - 1
|
||||||
|
delta = abs(tasa_aprendizaje * np.tanh(desviacion))
|
||||||
|
|
||||||
|
print(delta)
|
||||||
|
|
||||||
|
if error >= limSup: offset -= delta
|
||||||
|
if error <= limInf: offset += delta
|
||||||
|
|
||||||
return False, offset
|
return False, offset
|
||||||
|
|
||||||
@ -81,24 +86,29 @@ if __name__ == '__main__':
|
|||||||
ruta = f'{directorio}{nombre}'
|
ruta = f'{directorio}{nombre}'
|
||||||
offset = 0
|
offset = 0
|
||||||
|
|
||||||
generar_curva(offset,ruta)
|
E_original = 70
|
||||||
|
|
||||||
|
B = 4 * np.pi * 1e-7 * 1000 + offset
|
||||||
|
|
||||||
# B = 1e-2
|
cte = E_original/B
|
||||||
# BObjetivo = 2e-2
|
|
||||||
|
|
||||||
# errorObjetivo = 0.01
|
EObjetivo = 175
|
||||||
|
|
||||||
# flag = False
|
errorObjetivo = 0.01
|
||||||
|
|
||||||
# while flag == False:
|
flag = False
|
||||||
# os.system('cls')
|
|
||||||
|
|
||||||
# B = B + offset
|
while flag == False:
|
||||||
|
os.system('cls')
|
||||||
|
|
||||||
# error = B/BObjetivo
|
B_nuevo = 4 * np.pi * 1e-7 * 1000 + offset
|
||||||
|
|
||||||
# print(B)
|
Ecalculado = cte * B_nuevo
|
||||||
# print(error)
|
|
||||||
|
|
||||||
# flag, offset = logica_offset(offset, error, errorObjetivo)
|
error = Ecalculado/EObjetivo
|
||||||
|
|
||||||
|
print(Ecalculado)
|
||||||
|
print(error)
|
||||||
|
print()
|
||||||
|
|
||||||
|
flag, offset = logica_offset(offset, error, errorObjetivo)
|
||||||
|
Loading…
Reference in New Issue
Block a user