How can we use a Design Point (DP) parameter from one DP in a different DP?

M
M Member, Employee Posts: 236
50 Answers 100 Comments 100 Likes First Anniversary
✭✭✭✭
edited June 2023 in Structures

This was a challenge from a customer to bring a DP output parameter from one DP as an input to a following DP.



It is possible with a bit of WB scripting. I couldn't find a native way to do it, but I am lazy.

import time
inputParameter = 'P2' # Parameter IDs from WB 
outputParameter = 'P1'
# Script # 
SetProjectUnitSystem(UnitSystemName="NMM_STANDARD") # Always check units in your model
p_in = Parameters.GetParameter(inputParameter) # grab the parameter identifiers
p_out = Parameters.GetParameter(outputParameter)
designPoints = Parameters.GetAllDesignPoints()
ctr = 0
for designPoint in designPoints:
  if ctr > 0:
    Parameters.SetBaseDesignPoint(DesignPoint=designPoint)
    designPoint.SetParameterExpression(p_in,pNew)
  UpdateAllDesignPoints(DesignPoints=[designPoint])
  tctr = 0
  while designPoint.StateOfParameters != 'UpToDate' and tctr < 10: # max 10 sec to try
    time.sleep(1)
    tctr+=1
  pNew = p_out.Value.ToString().split()[0] # grab the output from solved
  print(pNew)
  ctr+=1

You have to be careful with the input/ouput definition but it should work.