diff --git a/.gitignore b/.gitignore index b5b8a56..911d8d2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,6 @@ venv/ *.mdb -motores/PLACond/ +motores/PLACond/* __pycache__/ motores/PLACond/ results/* \ No newline at end of file diff --git a/fluxcontrol.py b/fluxcontrol.py index 78850ae..06a0107 100644 --- a/fluxcontrol.py +++ b/fluxcontrol.py @@ -3,15 +3,23 @@ import genCurvas as gc import motorcad as mc import os +def log(msg): + rutaLog = "results/log.txt" + + with open(rutaLog, 'a') as f: + f.write(msg + '\n') + print(msg) + if __name__ == '__main__': archivoEnsayos = "Ensayos.xlsx" archivoCurvas = "PLACond.mdb" material = "PLACond" + 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 @@ -23,6 +31,9 @@ if __name__ == '__main__': while flag == False: gc.generar_curva(offset, archivoCurvas) + + log("-----------------------") + print(f"Iniciando iteración {iteration}") for i in np.arange(len(E_obj)): @@ -32,7 +43,7 @@ if __name__ == '__main__': frecuencia = f_obj[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) @@ -40,9 +51,12 @@ if __name__ == '__main__': error = np.mean(error) - print("El resultado de la tensión inducida de la iteración ", i, " son ", tension, " V") - print("Y por tanto el error es igual a ", error) + log(f"El resultado de la iteración {iteration} es:") + log(f"- E_calculada = {tension}") + log(f"- E_obj = {E_obj}") + log(f"- Error = {error}") + log("-----------------------") flag, offset = gc.logica_offset(offset, error, errorObjetivo) - iteration =+ 1 \ No newline at end of file + iteration = iteration + 1 \ No newline at end of file diff --git a/motorcad.py b/motorcad.py index 2c3d660..4735a4a 100644 --- a/motorcad.py +++ b/motorcad.py @@ -36,9 +36,8 @@ def simularMCAD(corriente, frecuencia, material, iteration): # Material mcad.import_solid_material(materialPath, material) - print("Material importado desde:", materialPath) mcad.set_component_material("Rotor Lam (Back Iron)", material) - print("Material puesto en el rotor.") + print("Material importado desde:", materialPath) # Ejecución y resultados mcad.do_magnetic_calculation() diff --git a/motores/PLACond/FEResultsData/StaticLoad_result_1.mes b/motores/PLACond/FEResultsData/StaticLoad_result_1.mes index 71f17a2..8a4824b 100644 Binary files a/motores/PLACond/FEResultsData/StaticLoad_result_1.mes and b/motores/PLACond/FEResultsData/StaticLoad_result_1.mes differ diff --git a/motores/PLACond/FEResultsData/StaticOC_result_1.mes b/motores/PLACond/FEResultsData/StaticOC_result_1.mes index c6071aa..98df14c 100644 Binary files a/motores/PLACond/FEResultsData/StaticOC_result_1.mes and b/motores/PLACond/FEResultsData/StaticOC_result_1.mes differ diff --git a/motores/PLACond/FEResultsData/Steel_Material_BH_Magnetic_Properties_Autofile.bh b/motores/PLACond/FEResultsData/Steel_Material_BH_Magnetic_Properties_Autofile.bh index 9102123..b9464d2 100644 --- a/motores/PLACond/FEResultsData/Steel_Material_BH_Magnetic_Properties_Autofile.bh +++ b/motores/PLACond/FEResultsData/Steel_Material_BH_Magnetic_Properties_Autofile.bh @@ -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 24 1 0 0