# 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)