淘宝官方店     推荐课程     在线工具     联系方式     关于我们  
 
 

微波射频仿真设计   Ansoft Designer 中文培训教程   |   HFSS视频培训教程套装

 

Agilent ADS 视频培训教程   |   CST微波工作室视频教程   |   AWR Microwave Office

          首页 >> Ansoft Designer >> Ansoft Designer在线帮助文档


Ansoft Designer / Ansys Designer 在线帮助文档:


Generating Reports and Postprocessing >
User Defined Outputs: Python Script API >
   UDO Extension IMPLEMENTATION >
       Compute(IUDSInputData inData,            


Compute(IUDSInputData inData,

IUDSOutputData outData,

IPropertyList propList,

IProgressMonitor progressMonitor)

• Purpose: This is the main computation method which generates the data for the quantities that make up the UDO solution.

• Parameters:

• inData – UDSInputData object: Used to get the input probe data.

• outData – UDSOutputData object: Used to set the UDO solution quantity and sweep data.

• propList – IPropertyList object: Used to get the user entered values for each of the properties defined during the GetInputUDSParams call.

• progressMonitor – IProgressMonitor object. This can be used to set progress for long running calculations, check for user initiated abort etc.

• Returns: True on success, False on failure.

The data is received from UI using IUDSInputData API. It is processed and the result data is sent to UI using IUDSOutputData API.

Example:

# IUserDefinedSolutionHandle API implementation.

# Calculates output values and sets them using IUDSInputData/IUDSOutputData API.

def Compute(self, inData, outData, propList, progMon):

 

# Get the sweeps associated with the probe and validate

# use the probe name that we had defined earlier

sweeps = inData.GetSweepNamesForProbe("probe1")

if( sweeps == None or sweeps.Count > 1):

AddErrorMessage(self.GetName() + "Unexpected sweep count 0 or > 1 in Compute")

return False

 

 

# Get the data associated with our probe

probeData = inData.GetDoubleProbeData("probe1")

sweepData = inData.GetSweepsDataForProbe(sweeps[0], "probe1")

 

# Get the user specified properties.

# Note that ideally, these "X Min" etc names should be written as

# constant membets and referred to in both the GetInputUDSParams

# and in Compute to reduce the change of typos.

useXRangeProp = propList.GetMenuProperty("Activate X Limits").SelectedMenuChoice

xRangeStart = propList.GetNumberProperty("X Min").ValueSI

xRangeEnd = propList.GetNumberProperty("X Max").ValueSI

 

# At this stage, one can look at the RequestedQuantities and create

# a dictionary to later check against. However, I am simply computing

# all the quantities.

minVal = 0

maxVal = 0

avgVal = 0

 

# Check if we need to perform range computation

if useXRangeProp == "Yes":

seenAny = False

avgSum = 0

count = 0

 

# zip is used since we also need to pull in sweep data

# an index and the array notation could also have been used

for probeVal, sweepVal in zip(probeData, sweepData):

if sweepVal < xRangeStart or sweepVal > xRangeEnd:

pass

 

# Note that in a better written script, this code would be

# refactored into it's own function to avoid code

# duplication

if not seenAny:

minVal = probeVal

maxVal = probeVal

avgSum = probeVal

seenAny = True

count = 1

else:

if probeVal < minVal:

minVal = probeVal

 

if probeVal > maxVal:

maxVal = probeVal

 

avgSum += probeVal

count += 1

 

if seenAny:

avgVal = avgSum/count

 

else:

seenAny = False

avgSum = 0

for probeVal in probeData:

if not seenAny:

minVal = probeVal

maxVal = probeVal

avgSum = probeVal

seenAny = True

else:

if probeVal < minVal:

minVal = probeVal

 

if probeVal > maxVal:

maxVal = probeVal

 

avgSum += probeVal

 

if seenAny:

avgVal = avgSum/probeData.Count

 

 

# Finally set the output values. Note that these are always set as

# lists even if we have just one item.

outData.SetDoubleQuantityData("min_val", [minVal])

outData.SetDoubleQuantityData("max_val", [maxVal])

outData.SetDoubleQuantityData("avg_val", [avgVal])

 

# And we are done.

return True




HFSS视频教学培训教程 ADS2011视频培训教程 CST微波工作室教程 Ansoft Designer 教程

                HFSS视频教程                                      ADS视频教程                               CST视频教程                           Ansoft Designer 中文教程


 

      Copyright © 2006 - 2013   微波EDA网, All Rights Reserved    业务联系:mweda@163.com