# 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 createResponseDataParameterByInterval(study, referenceData, calculationType, variableName, rangeType, numLastPeriods = 0.0): """Generate the response value using the specified calculation method""" parameter = app.CreateResponseDataParameter(referenceData) parameter.SetCalculationType(calculationType) parameter.SetUnit(u"s") parameter.SetAllLine(False) parameter.SetLine(u"Total") parameter.SetVariable(variableName) # The 1st argumet of SetCaseRangeType # 0:Uses all steps in all cases # 1:Uses same value for all cases # 2:Specifies values for each case # 3:interval specified from the final step for all cases parameter.SetCaseRangeType(rangeType) if rangeType == 3: parameter.SetRangeFromLastStep(numLastPeriods) study.CreateParametricDataFromTable(referenceData, parameter) app = designer.GetApplication() study = app.GetCurrentStudy() referenceData = u"Joule Loss" calculationType = u"SimpleAverage" variableName = u"JLAve" rangeType = 3 createResponseDataParameterByInterval(study, referenceData, calculationType, variableName, rangeType, 0.05)