.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples\internal_scripting\thermal_transient.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_examples_internal_scripting_thermal_transient.py: .. _ref_internal_scripting_thermal_transient: Thermal transient ================= This example demonstrates internal scripting thermal transient functionality .. GENERATED FROM PYTHON SOURCE LINES 32-33 Perform required imports .. GENERATED FROM PYTHON SOURCE LINES 33-35 .. code-block:: Python import ansys.motorcad.core as pymotorcad .. GENERATED FROM PYTHON SOURCE LINES 36-37 Launch Motor-CAD .. GENERATED FROM PYTHON SOURCE LINES 37-70 .. code-block:: Python mc = pymotorcad.MotorCAD() # This function is called when "Run" is pressed def main(): pass class thermal_transient: def initial(self): # %% # Disable pop-up messages mc.set_variable("MessageDisplayState", 2) mc.display_screen("Scripting") # initialise water jacket and rotor cooling flow rate mc.set_variable("Wet_Rotor_Fluid_Volume_Flow_Rate", 0.1) mc.set_variable("WJ_Fluid_Volume_Flow_Rate", 0.1) def main(self): current_time = mc.get_variable("CurrentTime") if 1000 <= current_time < 1500: # if between 1000 and 1500 s, stop water jacket coolant flow mc.set_variable("WJ_Fluid_Volume_Flow_Rate", 0) else: # if between 1000 and 1500 s, rotor coolant flow mc.set_variable("Wet_Rotor_Fluid_Volume_Flow_Rate", 0) def final(self): # Called after calculation print("Thermal Transient - Final") mc.set_variable("MessageDisplayState", 0) .. GENERATED FROM PYTHON SOURCE LINES 71-76 Note ---- For more information about transient thermal analysis, see the Scripting Control In Duty Cycle tutorial, installed under C:\ANSYS_Motor-CAD\VersionNumber\Tutorials\Scripting_Control_In_Duty_Cycle. .. GENERATED FROM PYTHON SOURCE LINES 78-81 PyMotorCAD Documentation Example -------------------------------------- (Used for the PyMotorCAD Documentation Examples only) .. GENERATED FROM PYTHON SOURCE LINES 81-89 .. code-block:: Python try: from setup_scripts.setup_script import run_thermal_transient_demo except ImportError: pass else: run_thermal_transient_demo(mc) mc.set_variable("MessageDisplayState", 0) .. image-sg:: /examples/internal_scripting/images/sphx_glr_thermal_transient_001.png :alt: thermal transient :srcset: /examples/internal_scripting/images/sphx_glr_thermal_transient_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (3 minutes 41.660 seconds) .. _sphx_glr_download_examples_internal_scripting_thermal_transient.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: thermal_transient.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: thermal_transient.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: thermal_transient.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_