Main fix and MCAD fix
This commit is contained in:
parent
7c14e88a2a
commit
0ac0e5c84d
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,3 +1,4 @@
|
|||||||
venv/
|
venv/
|
||||||
*.mdb
|
*.mdb
|
||||||
motores/PLACond/
|
motores/PLACond/
|
||||||
|
__pycache__/
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -13,7 +13,7 @@ if __name__ == '__main__':
|
|||||||
|
|
||||||
E_obj, I_obj, f_obj = gc.valores_objetivo(archivoEnsayos, material)
|
E_obj, I_obj, f_obj = gc.valores_objetivo(archivoEnsayos, material)
|
||||||
|
|
||||||
print(E_obj)
|
print("La tensión inducida objetivo son ", E_obj, " V")
|
||||||
|
|
||||||
offset = 0
|
offset = 0
|
||||||
|
|
||||||
@ -41,8 +41,8 @@ if __name__ == '__main__':
|
|||||||
|
|
||||||
error = np.mean(error)
|
error = np.mean(error)
|
||||||
|
|
||||||
print(tension)
|
print("El resultado de la tensión inducida de la iteración ", i, " son ", tension, " V")
|
||||||
print(error)
|
print("Y por tanto el error es igual a ", error)
|
||||||
|
|
||||||
flag, offset = gc.logica_offset(offset, error, errorObjetivo)
|
flag, offset = gc.logica_offset(offset, error, errorObjetivo)
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ def generar_curva(offset, ruta):
|
|||||||
|
|
||||||
muVacio = 4 * np.pi * 1e-7
|
muVacio = 4 * np.pi * 1e-7
|
||||||
|
|
||||||
with open("h_values.json", "r") as f : h = np.array(json.load(f))
|
with open("h_values/h_values.json", "r") as f : h = np.array(json.load(f))
|
||||||
b = muVacio * h + offset
|
b = muVacio * h + offset
|
||||||
|
|
||||||
with open(ruta, "w") as f:
|
with open(ruta, "w") as f:
|
||||||
|
@ -2,7 +2,6 @@ import json
|
|||||||
|
|
||||||
h = []
|
h = []
|
||||||
|
|
||||||
|
|
||||||
with open("curva.txt", "r") as f:
|
with open("curva.txt", "r") as f:
|
||||||
for linea in f:
|
for linea in f:
|
||||||
if "HValue" in linea:
|
if "HValue" in linea:
|
21
motorcad.py
21
motorcad.py
@ -1,15 +1,16 @@
|
|||||||
import ansys.motorcad.core as MCAD
|
import ansys.motorcad.core as MCAD
|
||||||
import os
|
import os
|
||||||
def simularMCAD(mdbName, iteration):
|
def simularMCAD(corriente, frecuencia, material, iteration):
|
||||||
working_folder = os.getcwd()
|
working_folder = os.getcwd()
|
||||||
|
motPath = os.path.join(working_folder, "motores", f"{material}.mot")
|
||||||
|
materialPath = os.path.join(working_folder, f"{material}.mdb")
|
||||||
|
|
||||||
mcad = MCAD.MotorCAD()
|
mcad = MCAD.MotorCAD()
|
||||||
|
|
||||||
motPath = os.path.join(working_folder, "motores", f"{mdbName}.mot")
|
|
||||||
mcad.set_variable("MessageDisplayState", 2)
|
mcad.set_variable("MessageDisplayState", 2)
|
||||||
mcad.set_visible(True)
|
mcad.set_visible(True)
|
||||||
mcad.load_from_file(motPath)
|
mcad.load_from_file(motPath)
|
||||||
print("Motor file loaded:", motPath)
|
print("Archivo de motor cargado desde:", motPath)
|
||||||
|
|
||||||
# Simulation config
|
# Simulation config
|
||||||
mcad.set_variable("MagneticThermalCoupling", 0)
|
mcad.set_variable("MagneticThermalCoupling", 0)
|
||||||
@ -25,14 +26,18 @@ def simularMCAD(mdbName, iteration):
|
|||||||
mcad.set_variable("TorqueCalculation", True)
|
mcad.set_variable("TorqueCalculation", True)
|
||||||
|
|
||||||
# Operation point
|
# Operation point
|
||||||
mcad.set_variable("ShaftSpeed", 1000)
|
polos = mcad.get_variable("PoleNumber")
|
||||||
mcad.set_variable("RMSCurrent", 0.95)
|
n = frecuencia * 60 / (polos/2)
|
||||||
mcad.set_variable("DCBusVoltage", 400)
|
mcad.set_variable("ShaftSpeed", n)
|
||||||
|
mcad.set_variable("RMSCurrent", corriente)
|
||||||
|
mcad.set_variable("DCBusVoltage", 230)
|
||||||
mcad.set_variable("PhaseAdvance", 0)
|
mcad.set_variable("PhaseAdvance", 0)
|
||||||
|
|
||||||
# Material
|
# Material
|
||||||
mcad.import_solid_material("C:\\Users\\promerogomb\\Desktop\\fluxcontrol\\PLACond.mdb", "PLACond")
|
mcad.import_solid_material(materialPath, material)
|
||||||
mcad.set_component_material("Rotor Lam (Back Iron)", "PLACond")
|
print("Material importado desde:", materialPath)
|
||||||
|
mcad.set_component_material("Rotor Lam (Back Iron)", material)
|
||||||
|
print("Material puesto en el rotor.")
|
||||||
|
|
||||||
# Ejecución y resultados
|
# Ejecución y resultados
|
||||||
mcad.do_magnetic_calculation()
|
mcad.do_magnetic_calculation()
|
||||||
|
Loading…
Reference in New Issue
Block a user