# Sizing design variable

## Recommended Posts

Hey guys!

I have a problem with composite optimization. I would like to ask you to help me modify a script.
I have made a composite skateboard tutorial and after size optimization there were many plies. These plies have initial values like 0.41535 mm, and upper bound value something similar, but bigger. The manufacturable thickness was 0.5 mm, so I had to alter the upper bound value equal to multiple of the manufacturable thickness.

I found a script on the script exchange, which is attached, that can change the upper bound, initial value and lower bound of the design variables for the multiples of the manufacturable plies.

I think it would be useful if this script would be able to modify the upper bound value of the design variables in the following way:

If the initial value (IV) is less than or equal to the manufacturable thickness (TMANUF) then the upper bound value of the design variables (UBV) has to be equal to the manufacturable thickness (TMANUF).
If TMANUF IV <= 2 x TMANUF then UBV = 2 x TMANUF

Generally: If  n x TMANUFIV <= (n+1) x TMANUF then UBV = (n+1) x TMANUF; where n = 0, 1, 2, 3 ...

Could someone modify this script with this changes?

Best regards,

Tüki

Update_sizing_desvars.tcl

##### Share on other sites

Hi lmre,

Try This:

*createmarkpanel designvars 1 "Select DESVARs."
set DesvarIDList [ hm_getmark designvars 1 ]
*clearmark designvars 1
#puts \$DesvarIDList

#set ScaleFactor [hm_getfloat "Enter scaling factor value. Default = 1 if 0." "Entering scaling factor value"]
set PlyThiManu [hm_getfloat "Enter the manufacturable ply thickness." "Entering manufacturable ply thickness"]

foreach DesvarID \$DesvarIDList {

set DesvarName [ hm_getentityvalue designvars \$DesvarID "name" 1 ]
set DesvarIV [ hm_getentityvalue designvars \$DesvarID "initialvalue" 0 ]
set DesvarLB [ hm_getentityvalue designvars \$DesvarID "lowerbound" 0 ]
set DesvarUB [ hm_getentityvalue designvars \$DesvarID "upperbound" 0 ]

puts "Original UB value = \$DesvarUB"
##################  MOdification #####################################

# If the initial value (IV) is less than or equal to the manufacturable ﻿thickness (TMANUF) then the upper bound va﻿lue of the design ﻿variabl﻿es (UBV﻿) has to be equa﻿l to the manufacturable thickness (TMANUF).
if {\$DesvarIV <= \$PlyThiManu } {
set DesvarUB \$PlyThiManu
}

# If TMANUF < IV <= 2 x TMANUF then UBV = 2 x TMANUF
if {\$PlyThiManu < \$DesvarIV & \$DesvarIV <= [expr 2* \$PlyThiManu]} {
set DesvarUB [expr 2 * \$PlyThiManu]

######################################################################
######################################################################

# # Muliply it by one so it'll output in fix notation
# set UBValueoutput [ expr { 1*\$DesvarUB } ]

# #set ScaledUBValue [ expr { \$ScaleFactor*\$DesvarUB } ]
# set ScaledUBValue [ expr { \$PlyThiManu*10 } ]
# set ScaledDesvarIV [ expr { \$PlyThiManu*2 } ]
# set ScaledDesvarLB [ expr { \$PlyThiManu*0 } ]

# *sizedesvarupdatewithddvalfield "\$DesvarName" \$ScaledUBValue \$ScaledDesvarIV \$ScaledDesvarLB -1 0
*sizedesvarupdatewithddvalfield "\$DesvarName" \$DesvarUB \$DesvarIV \$DesvarLB -1 0
#*sizedesvarupdatewithddvalfield "autoply" 0.025 0.0113599 0 -1 0

puts "UB Value updated = \$DesvarUB"

}

##### Share on other sites
2 hours ago, Pandurang said:

Hi lmre,

Try This:

*createmarkpanel designvars 1 "Select DESVARs."
set DesvarIDList [ hm_getmark designvars 1 ]
*clearmark designvars 1
#puts \$DesvarIDList

#set ScaleFactor [hm_getfloat "Enter scaling factor value. Default = 1 if 0." "Entering scaling factor value"]
set PlyThiManu [hm_getfloat "Enter the manufacturable ply thickness." "Entering manufacturable ply thickness"]

foreach DesvarID \$DesvarIDList {

set DesvarName [ hm_getentityvalue designvars \$DesvarID "name" 1 ]
set DesvarIV [ hm_getentityvalue designvars \$DesvarID "initialvalue" 0 ]
set DesvarLB [ hm_getentityvalue designvars \$DesvarID "lowerbound" 0 ]
set DesvarUB [ hm_getentityvalue designvars \$DesvarID "upperbound" 0 ]

puts "Original UB value = \$DesvarUB"
##################  MOdification #####################################

# If the initial value (IV) is less than or equal to the manufacturable ﻿thickness (TMANUF) then the upper bound va﻿lue of the design ﻿variabl﻿es (UBV﻿) has to be equa﻿l to the manufacturable thickness (TMANUF).
if {\$DesvarIV <= \$PlyThiManu } {
set DesvarUB \$PlyThiManu
}

# If TMANUF < IV <= 2 x TMANUF then UBV = 2 x TMANUF
if {\$PlyThiManu ﻿< \$DesvarIV & \$DesvarIV <= [expr 2* \$PlyThiManu]} {
set DesvarUB [expr 2 * \$PlyThiManu]

######################################################################
######################################################################

# # Muliply it by one so it'll output in fix notation
# set UBValueoutput [ expr { 1*\$DesvarUB } ]

# #set ScaledUBValue [ expr { \$ScaleFactor*\$DesvarUB } ]
# set ScaledUBValue [ expr { \$PlyThiManu*10 } ]
# set ScaledDesvarIV [ expr { \$PlyThiManu*2 } ]
# set ScaledDesvarLB [ expr { \$PlyThiManu*0 } ]

# *sizedesvarupdatewithddvalfield "\$DesvarName" \$ScaledUBValue \$ScaledDesvarIV \$ScaledDesvarLB -1 0
*sizedesvarupdatewithddvalfield "\$DesvarName" \$DesvarUB \$DesvarIV \$DesvarLB -1 0
#*sizedesvarupdatewithddvalfield "autoply" 0.025 0.0113599 0 -1 0

puts "UB Value updated = \$DesvarUB"

}﻿

Thank you very much, it is working fine.

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.