hi, im simulating e-Motor with varias RPM. my goal is automation of Query of Stress Data at each RPM in csv File. and now i try to do it with 3 different RPMs.
i made a for-loop function to make Automation. the variable $subcase is for maximum stress of each simulation. and i just a other variable $i for query. and i got only lastest Stress data of rpm. which means i did simulation for 0, 10000, and 20000 RPMs . i got stress data only of 20000RPM. do you have some idea or should i fix some sentence in For Loop?
hwi GetSessionHandle session
session GetProjectHandle project
project GetPageHandle page [project GetActivePage]
page GetWindowHandle window [page GetActiveWindow]
window GetClientHandle client
client GetModelHandle model [client GetActiveModel]
model GetResultCtrlHandle result
result GetContourCtrlHandle contour
contour SetDataType "Element Stresses (2D & 3D)"
contour SetDataComponent component vonMises
contour SetAverageMode advanced
contour SetLayer Max
contour SetEnableState True
contour SetResultSystem 0
contour SetDimensionEnabled solid True
contour SetDimensionEnabled shell True
contour SetEnableState True
client GetMeasureHandle measure 1
model GetQueryCtrlHandle myQueryName
model GetSelectionSetHandle mySetName [model AddSelectionSet node]
mySetName Add all
lappend max_stress
set subcases [result GetSubcaseList "Base"]
foreach subcase $subcases {
result SetCurrentSubcase $subcase ;# nächsten Subcase auswählen
client Draw ;# refresh View
for {set i 1} {$i < $subcases} {incr i} {
result SetCurrentSimulation $subcase
myQueryName SetDataSourceProperty result datatype Stress
myQueryName SetDataSourceProperty result shelllayer Upper
myQueryName SetQuery "node.id, node.coords, contour.value"
myQueryName SetSelectionSet [mySetName GetID];
myQueryName WriteData {D:/junhyeong/Spannungsdaten/$i.csv}
}
lappend max_stress [measure GetMaximum scalar] ;# Maximum an Liste anhängen
}
# Export der maximalen Spannungen
set responses_file [open "struct_responses.json" "w"]
set line "\["
append line [join $max_stress ", "]
append line "\]"
puts -nonewline $responses_file $line
close $responses_file
Thanks in Advanced