|
@@ -296,11 +296,16 @@ class RobustMotorCADSolver:
|
|
|
def __init__(self, model_path: str, output_dir: Optional[str] = None,
|
|
def __init__(self, model_path: str, output_dir: Optional[str] = None,
|
|
|
point_timeout: int = 300, max_retries: int = 3,
|
|
point_timeout: int = 300, max_retries: int = 3,
|
|
|
headless: bool = False, motorcad_version: Optional[str] = None,
|
|
headless: bool = False, motorcad_version: Optional[str] = None,
|
|
|
- enable_thermal: bool = False):
|
|
|
|
|
|
|
+ enable_thermal: bool = False,
|
|
|
|
|
+ ambient_temperature: Optional[float] = None):
|
|
|
self.model_path = model_path
|
|
self.model_path = model_path
|
|
|
# P5-M6: optional thermal solve (requires model with thermal
|
|
# P5-M6: optional thermal solve (requires model with thermal
|
|
|
# network configured; OFF by default to preserve EM-only behavior)
|
|
# network configured; OFF by default to preserve EM-only behavior)
|
|
|
self.enable_thermal = bool(enable_thermal)
|
|
self.enable_thermal = bool(enable_thermal)
|
|
|
|
|
+ # P5-M6 thermal boundary: when set, Ambient_Temperature is overridden
|
|
|
|
|
+ # before the thermal solve. MARS ships 125 C (abnormal); use 25-40.
|
|
|
|
|
+ # None = leave the model value unchanged.
|
|
|
|
|
+ self.ambient_temperature = ambient_temperature
|
|
|
self.output_dir = output_dir or os.path.join(
|
|
self.output_dir = output_dir or os.path.join(
|
|
|
os.path.dirname(os.path.dirname(os.path.abspath(__file__))),
|
|
os.path.dirname(os.path.dirname(os.path.abspath(__file__))),
|
|
|
"output", f"run_{datetime.now().strftime('%Y%m%d_%H%M%S')}"
|
|
"output", f"run_{datetime.now().strftime('%Y%m%d_%H%M%S')}"
|
|
@@ -619,6 +624,15 @@ class RobustMotorCADSolver:
|
|
|
# do_thermal_calculation() method. The steady-state
|
|
# do_thermal_calculation() method. The steady-state
|
|
|
# thermal solve is do_steady_state_analysis().
|
|
# thermal solve is do_steady_state_analysis().
|
|
|
# Verified against ansys.motorcad.core sources.
|
|
# Verified against ansys.motorcad.core sources.
|
|
|
|
|
+ if self.ambient_temperature is not None:
|
|
|
|
|
+ self._write_and_verify(
|
|
|
|
|
+ "Ambient_Temperature",
|
|
|
|
|
+ float(self.ambient_temperature),
|
|
|
|
|
+ )
|
|
|
|
|
+ self._log(
|
|
|
|
|
+ "Ambient_Temperature overridden to %s"
|
|
|
|
|
+ % self.ambient_temperature
|
|
|
|
|
+ )
|
|
|
self.mc.do_steady_state_analysis()
|
|
self.mc.do_steady_state_analysis()
|
|
|
self._log("Steady-state thermal calculation completed")
|
|
self._log("Steady-state thermal calculation completed")
|
|
|
except Exception as _therr: # noqa: BLE001
|
|
except Exception as _therr: # noqa: BLE001
|