In magnetic field analysis, the winding setting function is one way to assign current conditions to conductor parts on an FEM model via an electric circuit.
Using the winding setting function requires three steps: adding winding component to the circuit, setting the winding area, and setting the winding parameters.
This script setup the series of settings required to use the winding setting function.
Preconditions
- One or more magnetic field analysis study or efficiency map analysis study have been created for a model with rotational periodicity in the coil geometry.
- The number of slots and the number of poles has been defined as equation variables named SLOTS and POLES.
- The part set for coil region has been created, and the set title is known.
- The units of the setting values follow the unit system set for the model.
Script Function
- Create and place a winding three phase coil component in the circuit. Check whether the circuit has already been created, and if not, create it.
Set the connection type to star connection and include ground components to ON. - Add a winding region setting.
Set the number of slots to the variable named SLOTS, the number of poles to the variable named POLES, and the parts of coil region to the part set named “CoilSet”. - Add a three phase winding setting.
Associate the previously created winding region setting. - Winding Setting – Set each coil parameter.
Set the input type to phase resistance, the number of turns to 40.5 turns, the setting type to round wire, the wire diameter to 0.5, the slot fill factor to 71.5%, the phase resistance to 0.407, the leakage inductance input type to automatic, and the leakage inductance correction factor to 1. - Winding Setting – Set each winding parameter.
Associate the previously created winding three phase coil component, set parallel number to 4, the winding scheme to auto(Type 1), the number of layers to 1, the coil pitch to 5, and the phase order to UWV.
# 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 getCircuitInStudy(study):
"""Retrieve the Circuit object from the study.if it does not exist, create a new circuit"""
if study.HasCircuit():
circuit = study.GetCircuit()
else:
circuit = study.CreateCircuit()
return circuit
def createWindingThreePhaseCoil(circuit, circuitCompName):
"""Place the three-phase coil element in the circuit"""
circuitComponent = circuit.CreateComponent(u"WindingThreePhaseCoil", circuitCompName)
circuit.CreateInstance(circuitCompName, 10, 2)
circuitComponent.SetValue(u"ConnectionType", u"Star")
circuitComponent.SetValue(u"IncludeGround", u"On")
def createWindingRegionOfThreePhase(study, windingRegionName, coilRegionPartSet):
"""Create the winding area (shape)"""
windingRegion = study.CreateWindingRegion(windingRegionName, 0)
windingRegion.SetSlots(u"SLOTS")
windingRegion.SetPoles(u"POLES")
windingRegion.AddCoilRegion(u"Coil Region A")
windingRegion.AddSet(0, coilRegionPartSet)
def createWindingSettingOfThreePhase(study, windingRegionName, circuitCompName):
"""Create a winding configuration, associate the winding area with winding elements, and set each parameter"""
windingDefinition = study.CreateWinding(u"ThreePhase", u"Three Phase")
windingDefinition.SetRegion(windingRegionName)
# Coil tab
windingDefinition.SetInputType(u"Resistance")
windingDefinition.SetWireType(u"Round")
windingDefinition.SetTurns(40.5)
windingDefinition.SetWireDiameter(0.5)
windingDefinition.SetSlotFillFactor(71.5)
windingDefinition.SetResistance(0.407)
windingDefinition.SetLeakageInductanceInputType(u"Auto")
windingDefinition.SetLeakageInductanceCorrectionFactor(1)
# Winding tab
windingDefinition.SetComponent(circuitCompName)
windingDefinition.SetParallelCoils(4)
windingDefinition.SetWindingScheme(u"Auto")
windingDefinition.SetLayers(1)
windingDefinition.SetCoilPitch(5)
windingDefinition.SetPhaseOrder(u"UWV")
app = designer.GetApplication()
study = app.GetCurrentStudy()
circuit = getCircuitInStudy(study)
circuitCompName = u"Winding Three Phase Coil"
createWindingThreePhaseCoil(circuit, circuitCompName)
windingRegionName = u"Coil Region"
set = app.GetCurrentModel().GetSetList().GetSet(u"CoilSet")
createWindingRegionOfThreePhase(study, windingRegionName, set)
createWindingSettingOfThreePhase(study, windingRegionName, circuitCompName)


