[S8426] Script to create response data by determining duplicates and create response graphs

 

The following is an example of a script that checks for duplicates, creates response data, and creates a response graph.

※It checks whether the response value is registered, so it is used with calculated data.

app = designer.GetApplication()

# Get the study.

app.SetCurrentStudy(0)

# Response data title

tt = u"AverageTorque"

# Variable name of response data

val = u"AT"

# Get a list of candidates for the X and Y axes of the response graph.

paramDataNameList = app.GetCurrentStudy().ParametricDataNames()

# Get the number of candidates for the X and Y axes.

numParamData = len(paramDataNameList)

# Obtain the number of design parameters.

numParameter = app.GetCurrentStudy().GetDesignTable().NumParameters()

# create a list

responseDataNameList = []

# From the list obtained, create a list excluding the first case number and design parameters.

numSkip = 1 + numParameter

for index in range(numSkip, numParamData):

   responseDataNameList.append(paramDataNameList[index])

# If the specified name is not found in the list of response data created, create a response value and response graph. If it is found, do nothing.

if tt in responseDataNameList:

   # Do nothing if there are duplicate response data.

   pass

else:

   # Create response data and response graphs.

   # Title

   parameter = app.CreateResponseDataParameter(tt)

   # calculation

   parameter.SetCalculationType(u"SimpleAverage")

   # Unit

   parameter.SetUnit(u"Step")

   # Start

   parameter.SetStartValue(u"1")

   # End(Get the number of steps in the study)

   parameter.SetEndValue(app.GetCurrentStudy().GetStep().GetValue(u"Step"))

   # Variable

   parameter.SetVariable(val)

   # Acquire the calculation result data set (point sequence) for which the Response Data is to be created.

   TorqueResult = app.GetCurrentStudy().GetDataSet(u"Torque", 1)

   # Response Data creation.

   app.GetDataManager().CreateParametricDataWithParameter(TorqueResult, parameter)

   # Creating a response graph.

   app.GetCurrentStudy().CreateParametricGraphWithName(u"ATGraph", u"Case Index", 0,tt)

How to use script file

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