# Copyright (c) 2026 JSOL CORPORATION # # This script is released under the MIT License. # See the full license text at: # https://www.jmag-international.com/scriptlibrary/jmag_script_library_mit/ app = designer.GetApplication() def createOrGetThermalModelDefinition(study): """Create thermal model settings, or get the existing settings if already created.""" app.ClearError() thermalModelDefinition = study.CreateThermalModelDefinition(u"motor") if app.HasError(): app.ClearError() thermalModelDefinition = study.GetThermalModelDefinition() return thermalModelDefinition def setThermalModelDefinition(thermalModelDefinition): """Set cooling, housing, and surrounding component parameters for the thermal model settings.""" thermalModelDefinition.SetCoolantPathType(u"Cooling Jacket + Hollow Shaft Spray") parameterSettings = [ (u"ExternalTemperature", 70), (u"Speed", 1000), (u"Inlet-1CoolantVolumeFlowRate", 8e-5), (u"Inlet-1SprayCoolantTemperature", 70), (u"Inlet-1CoolantType", u"Oil"), (u"FromHollowShaftToOutlet", 0.4), (u"FromHollowShaftToFrontShaftSpray", 0.3), (u"FromHollowShaftToRearShaftSpray", 0.3), (u"HousingHeight", 300.0), (u"HousingThickness", 10), (u"MotorMountingType", u"FrontFlange"), (u"FlangeDiameter", 43.7), (u"FlangePlateHeight", 265.0), (u"FlangePlateWidth", 265.0), (u"FlangePlateTemperature", 70), (u"TubeWidth", 10), (u"TubeHeight", 7), (u"TubeNumber", 3), (u"ShaftInnerDiameter", 14.6), (u"CoilEndThermalConductivity", 400), (u"ShaftDiameterFront", 29.1), (u"BearingDiameterFront", 37.8), (u"BearingWidthFront", 10.0), (u"ShaftDiameterRear", 29.1), (u"BearingDiameterRear", 37.8), (u"BearingWidthRear", 10.0), (u"ConvectionType", u"Natural"), ] for propertyName, value in parameterSettings: thermalModelDefinition.SetValue(propertyName, value) def main(): """Create thermal model settings in the current study and set each parameter.""" study = app.GetCurrentStudy() thermalModelDefinition = createOrGetThermalModelDefinition(study) setThermalModelDefinition(thermalModelDefinition) main()