Logging
This commit is contained in:
parent
d3c70c7c0d
commit
b32e2fa9bc
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,6 +1,6 @@
|
|||||||
venv/
|
venv/
|
||||||
*.mdb
|
*.mdb
|
||||||
motores/PLACond/
|
motores/PLACond/*
|
||||||
__pycache__/
|
__pycache__/
|
||||||
motores/PLACond/
|
motores/PLACond/
|
||||||
results/*
|
results/*
|
@ -3,15 +3,23 @@ import genCurvas as gc
|
|||||||
import motorcad as mc
|
import motorcad as mc
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
def log(msg):
|
||||||
|
rutaLog = "results/log.txt"
|
||||||
|
|
||||||
|
with open(rutaLog, 'a') as f:
|
||||||
|
f.write(msg + '\n')
|
||||||
|
print(msg)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
||||||
archivoEnsayos = "Ensayos.xlsx"
|
archivoEnsayos = "Ensayos.xlsx"
|
||||||
archivoCurvas = "PLACond.mdb"
|
archivoCurvas = "PLACond.mdb"
|
||||||
material = "PLACond"
|
material = "PLACond"
|
||||||
|
|
||||||
|
|
||||||
E_obj, I_obj, f_obj = gc.valores_objetivo(archivoEnsayos, material)
|
E_obj, I_obj, f_obj = gc.valores_objetivo(archivoEnsayos, material)
|
||||||
|
|
||||||
print("La tensión inducida objetivo son ", E_obj, " V")
|
log(f"La tension inducida objetivo son {E_obj} V")
|
||||||
|
|
||||||
offset = 0
|
offset = 0
|
||||||
|
|
||||||
@ -24,6 +32,9 @@ if __name__ == '__main__':
|
|||||||
|
|
||||||
gc.generar_curva(offset, archivoCurvas)
|
gc.generar_curva(offset, archivoCurvas)
|
||||||
|
|
||||||
|
log("-----------------------")
|
||||||
|
print(f"Iniciando iteración {iteration}")
|
||||||
|
|
||||||
for i in np.arange(len(E_obj)):
|
for i in np.arange(len(E_obj)):
|
||||||
|
|
||||||
error = []
|
error = []
|
||||||
@ -32,7 +43,7 @@ if __name__ == '__main__':
|
|||||||
frecuencia = f_obj[i]
|
frecuencia = f_obj[i]
|
||||||
|
|
||||||
mcadIteration = f"{iteration}.{i}"
|
mcadIteration = f"{iteration}.{i}"
|
||||||
print("Iniciando iteración: ", mcadIteration)
|
print(f"Calculando punto de operación: {mcadIteration}")
|
||||||
|
|
||||||
tension = mc.simularMCAD(corriente, frecuencia, material, mcadIteration)
|
tension = mc.simularMCAD(corriente, frecuencia, material, mcadIteration)
|
||||||
|
|
||||||
@ -40,9 +51,12 @@ if __name__ == '__main__':
|
|||||||
|
|
||||||
error = np.mean(error)
|
error = np.mean(error)
|
||||||
|
|
||||||
print("El resultado de la tensión inducida de la iteración ", i, " son ", tension, " V")
|
log(f"El resultado de la iteración {iteration} es:")
|
||||||
print("Y por tanto el error es igual a ", error)
|
log(f"- E_calculada = {tension}")
|
||||||
|
log(f"- E_obj = {E_obj}")
|
||||||
|
log(f"- Error = {error}")
|
||||||
|
log("-----------------------")
|
||||||
|
|
||||||
flag, offset = gc.logica_offset(offset, error, errorObjetivo)
|
flag, offset = gc.logica_offset(offset, error, errorObjetivo)
|
||||||
|
|
||||||
iteration =+ 1
|
iteration = iteration + 1
|
@ -36,9 +36,8 @@ def simularMCAD(corriente, frecuencia, material, iteration):
|
|||||||
|
|
||||||
# Material
|
# Material
|
||||||
mcad.import_solid_material(materialPath, material)
|
mcad.import_solid_material(materialPath, material)
|
||||||
print("Material importado desde:", materialPath)
|
|
||||||
mcad.set_component_material("Rotor Lam (Back Iron)", material)
|
mcad.set_component_material("Rotor Lam (Back Iron)", material)
|
||||||
print("Material puesto en el rotor.")
|
print("Material importado desde:", materialPath)
|
||||||
|
|
||||||
# Ejecución y resultados
|
# Ejecución y resultados
|
||||||
mcad.do_magnetic_calculation()
|
mcad.do_magnetic_calculation()
|
||||||
|
Binary file not shown.
Binary file not shown.
@ -1,4 +1,4 @@
|
|||||||
Material BH characteristics 31/03/2025 13:07:03 13:07:03
|
Material BH characteristics 31/03/2025 14:05:25 14:05:25
|
||||||
Code:1 (Stator) Material: M800-50A
|
Code:1 (Stator) Material: M800-50A
|
||||||
24
|
24
|
||||||
1 0 0
|
1 0 0
|
||||||
|
Loading…
Reference in New Issue
Block a user