[S0042] Create an efficiency map that has the drive cycle

The efficiency map can show efficiency for each combination of rotation speed and torque. By specifying a drive cycle, this map can be used to evaluate performance under time-varying driving conditions. Based on the selected or created drive cycle, it is possible to evaluate the efficiency and losses of the drive motor during operation.
This script defines the efficiency map with the drive cycle.

Preconditions

  • One or more efficiency map analysis study has been created.
    This script runs on the active study in the project tree.

Script Function

  • Set the max voltage, max current and voltage limit for the inverter rating.
  • Specify electromagnetic torque as torque.
  • Set motor control to max power / efficiency.
  • Specify the mode as motor + generation.
  • Set vehicle parameters.
  • Set the time dependent vehicle speed by a point array.
  • Set the loss factor of mechanical loss and the evaluation resolution.
# 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 createEfficiencyMap(study, effMapName, pointArray):
    """Driving Mode: Creating an efficiency map definition object for vehicle speed."""
    effMap = study.CreateEfficiencyMapDefinition(effMapName)
    effMap.SetMaxVoltage(600)
    effMap.SetMaxCurrent(250)
    effMap.SetVoltageLimitType(u"fundamental")
    effMap.SetTorqueType(u"electromagnetic")
    effMap.SetMotorMode(u"generation")
    effMap.SetClusterPoints(6)
    effMap.SetDriveCycleUseVehicleParameters(True)
    effMap.SetDriveCycleTireDiameter(700)
    effMap.SetDriveCycleGearRatio(5)
    effMap.SetDriveCycleAirDensity(1.3)
    effMap.SetDriveCycleDragCoefficient(0.5)
    effMap.SetDriveCycleCrossSectionalArea(3.2)
    effMap.SetDriveCycleRollingResistance(0.001)
    effMap.SetDriveCycleTotalWeight(1800)
    effMap.SetDriveCycleGravity(9.9)
    effMap.SetDriveCycleUseVehicleSpeedTable(True)
    effMap.SetDriveCycleVehicleSpeedTable(pointArray)
    effMap.SetMechancialLossFactor(20)
    effMap.SetYAxisDivisions(40)

def getDriveCycleVehicleSpeedTableArray():
    """Acquisition of vehicle speed data (2D array)"""
    pointArray = [[0 for i in range(2)] for j in range(5)]
    pointArray[0][0] = 0
    pointArray[0][1] = 0
    pointArray[1][0] = 10
    pointArray[1][1] = 20
    pointArray[2][0] = 20
    pointArray[2][1] = 50
    pointArray[3][0] = 30
    pointArray[3][1] = 30
    pointArray[4][0] = 40
    pointArray[4][1] = 20
    return pointArray

study = app.GetCurrentStudy()
effMapName = u"EM3-1"
pointArray = getDriveCycleVehicleSpeedTableArray()
createEfficiencyMap(study, effMapName, pointArray)

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