[S0028] Retrieve the values ​​of winding parameters calculated based on the input parameters.

 

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.
JMAG's winding setting function is linked to the model and offers multiple input types for setting coil parameters, in addition to directly specifying resistance.
Some items must be specified for each input type, while others are calculated from the input value and the slot area on the model.
It may be necessary to refer to these calculated values to verify the validity of the settings or as constraints during optimization.
This script obtains and displays the values ​​of the calculated items using two input types as examples.
When using these as constraints for optimization, the retrieved values ​​are needed to be registered as user-defined response values ​​and referenced.

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.
    This script runs on the active magnetic field analysis study in the project tree.
  • The winding setting has been created, and its title is known.
  • The units of the setting values ​​follow the unit system set for the model.

Script Function

  • Set the input type of the winding setting created under the title "Coil" to "Turns/Wire Size" and set the necessary input parameters.
  • Obtain and display the values ​​of the slot fill factor and phase resistance calculated from other input values ​​and slot area.
  • Set the input type of the winding setting to "Wire Size/Slot Fill Factor" and set the necessary input parameters.
  • Obtain and display the values ​​of the turns and phase resistance calculated from other input values ​​and slot area.
# 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 setupWindingByTurnAndWireSize(targetWinding):
    """Set the coil item in the winding setting specified by turns and wire size"""
    # Set the Input Type to Turns/Wire Size
    targetWinding.SetInputType(u"TurnAndWireSize")
    # Set the Setting Type to Round Wire
    targetWinding.SetWireType(u"Round")
    targetWinding.SetTurns(40)
    targetWinding.SetWireDiameter(1)
    targetWinding.SetFilmThickness(0.1)
    targetWinding.SetStrands(1)
    targetWinding.SetInsulationThickness(0.2)
    targetWinding.SetCorrectionFactor(1.0)


def setupWindingByFillFactorAndWireSize(targetWinding):
    """Set the coil item in the winding setting specified by wire size and slot fill factor"""
    # Set the Input Type to Wire Size/Slot Fill Factor
    targetWinding.SetInputType(u"WireSizeAndFillFactor")
    # Set the Setting Type to Rectangle Wire
    targetWinding.SetWireType(u"Rectangle")
    targetWinding.SetWireHeight(1.5)
    targetWinding.SetWireWidth(1)
    targetWinding.SetFilmThickness(0.1)
    targetWinding.SetStrands(1)
    targetWinding.SetInsulationThickness(0.2)
    targetWinding.SetSlotFillFactor(80)
    targetWinding.SetCorrectionFactor(1.0)


app = designer.GetApplication()
study = app.GetCurrentStudy()
windingDef = study.GetWinding(u"Coil")

setupWindingByTurnAndWireSize(windingDef)
# Calculated slot fill factor
fillFactor = windingDef.ActualSlotFillFactor()
# Calculated phase resistance
phaseResistance = windingDef.ActualResistance()
print(u"---Specified by turns and wire size---")
print(u"FillFactor:", fillFactor)
print(u"Resistance:", phaseResistance)

setupWindingByFillFactorAndWireSize(windingDef)
# Calculated turns
turns = windingDef.ActualTurn()
# Calculated phase resistance
phaseResistance = windingDef.ActualResistance()
print(u"")
print(u"---Specified by wire size and fill factor---")
print(u"Turns:", turns)
print(u"Resistance:", phaseResistance)

Download Python source code

How to use script file

Use the JMAG Script Library after reading and agreeing to the following terms of use.

Search Filter

  • All Categories

An engineer's diary
JMAG-Express Online