The number of analysis steps for a magnetic field transient analysis allows to specify the number of steps and terminate the analysis after determining the steady state. This script creates steady conditions that specify tolerances for the frequency components of electromagnetic force and for the average current value of a circuit component.
Preconditions
- One or more magnetic field transient analysis studies or efficiency map studies have been created.
This script is run for the active study in the project tree. - An electromagnetic force condition with the title “Force” has been set.
- Electrical circuit components have been placed in the circuit.
Script Function
- Create a steady condition whose target type is the frequency component of electromagnetic force.
The target is an electromagnetic force condition with the title Force, the base frequency is 100, the component is the second, the harmonic order is 2, and the amplitude tolerance is 0.5. - Create a steady condition whose target type is the average circuit current value.
The periodic is set to 1/50 and the tolerance is set to 3.
# 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/
def createSteadyConditionsByFrequencyComponent(studyPropStep):
"""Add steady conditions for frequency components"""
condition = studyPropStep.CreateSubCondition(u"SteadyState", u"FrequencyComponent")
condition.SetValue(u"SteadyStateStopCheckMethod", "Frequency")
condition.SetValue(u"SteadyStateFrequency", 100)
condition.SetValue(u"HarmonicOrder", 2)
condition.SetValue(u"SteadyStateThreshold", 0.5)
condition.SetValue(u"SteadyStateReferenceResultSource", "Force")
condition.SetValue(u"SteadyStateResultComponent", "Second")
condition.SetLinkWithType(u"SteadyStateLinkedForce", u"Force")
def createSteadyConditionsByAverageValue(studyPropStep):
"""Add steady conditions for Average"""
condition = studyPropStep.CreateSubCondition(u"SteadyState", u"AverageValue")
condition.SetValue(u"SteadyStateStopCheckMethod", "Average")
condition.SetValue(u"SteadyStatePeriodic", u"1/50")
condition.SetValue(u"SteadyStateThreshold", 3)
condition.SetValue(u"SteadyStateReferenceResultSource", "Current")
app = designer.GetApplication()
studyPropStep = app.GetCurrentStudy().GetStep()
studyPropStep.SetValue(u"StopOnSteadyState", "On") # "StopOnSteadyState":Stop the analysis when steady state is reached
createSteadyConditionsByFrequencyComponent(studyPropStep)
createSteadyConditionsByAverageValue(studyPropStep)


